
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

size_t full_write(int fd,void *buf,size_t count)

{
  size_t sVar1;
  int *piVar2;
  size_t sVar3;
  
  sVar3 = 0;
  if (count != 0) {
    do {
      sVar1 = safe_write(fd,buf,count);
      if (sVar1 == 0xffffffff) {
        return sVar3;
      }
      if (sVar1 == 0) {
        piVar2 = __errno_location();
        *piVar2 = 0x1c;
        return sVar3;
      }
      sVar3 = sVar3 + sVar1;
      buf = (void *)((int)buf + sVar1);
      count = count - sVar1;
    } while (count != 0);
  }
  return sVar3;
}



/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int FUN_0001d820(undefined4 param_1,int param_2,int param_3)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  iVar3 = 0;
  if (param_3 != 0) {
    do {
      iVar1 = FUN_00021360(param_1,param_2,param_3);
      if (iVar1 == -1) {
        return iVar3;
      }
      if (iVar1 == 0) {
        piVar2 = __errno_location();
        *piVar2 = 0x1c;
        return iVar3;
      }
      iVar3 = iVar3 + iVar1;
      param_2 = param_2 + iVar1;
      param_3 = param_3 - iVar1;
    } while (param_3 != 0);
  }
  return iVar3;
}


PUSH EBP
PUSH EDI
XOR EDI,EDI
PUSH ESI
PUSH EBX
CALL 0x000132d0
ADD EBX,0x1d7d5
SUB ESP,0xc
MOV ESI,dword ptr [ESP + 0x28]
MOV EBP,dword ptr [ESP + 0x24]
TEST ESI,ESI
JNZ 0x0001d854
JMP 0x0001d86a
TEST EAX,EAX
JZ 0x0001d878
ADD EDI,EAX
ADD EBP,EAX
SUB ESI,EAX
JZ 0x0001d86a
SUB ESP,0x4
PUSH ESI
PUSH EBP
PUSH dword ptr [ESP + 0x2c]
CALL 0x00021360
ADD ESP,0x10
CMP EAX,-0x1
JNZ 0x0001d848
ADD ESP,0xc
MOV EAX,EDI
POP EBX
POP ESI
POP EDI
POP EBP
RET
CALL 0x00012590
MOV dword ptr [EAX],0x1c
ADD ESP,0xc
MOV EAX,EDI
POP EBX
POP ESI
POP EDI
POP EBP
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint FUN_0001d820(undefined4 param_1,int param_2,int param_3)\n\n{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}\n\n" comment (function_definition "int FUN_0001d820(undefined4 param_1,int param_2,int param_3)\n\n{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" primitive_type (function_declarator "FUN_0001d820(undefined4 param_1,int param_2,int param_3)" identifier (parameter_list "(undefined4 param_1,int param_2,int param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "int param_3" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (if_statement "if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" if (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" { (do_statement "do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);" do (compound_statement "{\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    }" { (expression_statement "iVar1 = FUN_00021360(param_1,param_2,param_3);" (assignment_expression "iVar1 = FUN_00021360(param_1,param_2,param_3)" identifier = (call_expression "FUN_00021360(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar1 == -1) {\n        return iVar3;\n      }" if (parenthesized_expression "(iVar1 == -1)" ( (binary_expression "iVar1 == -1" identifier == number_literal) )) (compound_statement "{\n        return iVar3;\n      }" { (return_statement "return iVar3;" return identifier ;) })) (if_statement "if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" if (parenthesized_expression "(iVar1 == 0)" ( (binary_expression "iVar1 == 0" identifier == number_literal) )) (compound_statement "{\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" { (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "*piVar2 = 0x1c;" (assignment_expression "*piVar2 = 0x1c" (pointer_expression "*piVar2" * identifier) = number_literal) ;) (return_statement "return iVar3;" return identifier ;) })) (expression_statement "iVar3 = iVar3 + iVar1;" (assignment_expression "iVar3 = iVar3 + iVar1" identifier = (binary_expression "iVar3 + iVar1" identifier + identifier)) ;) (expression_statement "param_2 = param_2 + iVar1;" (assignment_expression "param_2 = param_2 + iVar1" identifier = (binary_expression "param_2 + iVar1" identifier + identifier)) ;) (expression_statement "param_3 = param_3 - iVar1;" (assignment_expression "param_3 = param_3 - iVar1" identifier = (binary_expression "param_3 - iVar1" identifier - identifier)) ;) }) while (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) ;) })) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nsize_t full_write(int fd,void *buf,size_t count)\n\n{\n  size_t sVar1;\n  int *piVar2;\n  size_t sVar3;\n  \n  sVar3 = 0;\n  if (count != 0) {\n    do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);\n  }\n  return sVar3;\n}\n\n" comment (function_definition "size_t full_write(int fd,void *buf,size_t count)\n\n{\n  size_t sVar1;\n  int *piVar2;\n  size_t sVar3;\n  \n  sVar3 = 0;\n  if (count != 0) {\n    do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);\n  }\n  return sVar3;\n}" primitive_type (function_declarator "full_write(int fd,void *buf,size_t count)" identifier (parameter_list "(int fd,void *buf,size_t count)" ( (parameter_declaration "int fd" primitive_type identifier) , (parameter_declaration "void *buf" primitive_type (pointer_declarator "*buf" * identifier)) , (parameter_declaration "size_t count" primitive_type identifier) ))) (compound_statement "{\n  size_t sVar1;\n  int *piVar2;\n  size_t sVar3;\n  \n  sVar3 = 0;\n  if (count != 0) {\n    do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);\n  }\n  return sVar3;\n}" { (declaration "size_t sVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "size_t sVar3;" primitive_type identifier ;) (expression_statement "sVar3 = 0;" (assignment_expression "sVar3 = 0" identifier = number_literal) ;) (if_statement "if (count != 0) {\n    do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);\n  }" if (parenthesized_expression "(count != 0)" ( (binary_expression "count != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);\n  }" { (do_statement "do {\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    } while (count != 0);" do (compound_statement "{\n      sVar1 = safe_write(fd,buf,count);\n      if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }\n      if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }\n      sVar3 = sVar3 + sVar1;\n      buf = (void *)((int)buf + sVar1);\n      count = count - sVar1;\n    }" { (expression_statement "sVar1 = safe_write(fd,buf,count);" (assignment_expression "sVar1 = safe_write(fd,buf,count)" identifier = (call_expression "safe_write(fd,buf,count)" identifier (argument_list "(fd,buf,count)" ( identifier , identifier , identifier )))) ;) (if_statement "if (sVar1 == 0xffffffff) {\n        return sVar3;\n      }" if (parenthesized_expression "(sVar1 == 0xffffffff)" ( (binary_expression "sVar1 == 0xffffffff" identifier == number_literal) )) (compound_statement "{\n        return sVar3;\n      }" { (return_statement "return sVar3;" return identifier ;) })) (if_statement "if (sVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }" if (parenthesized_expression "(sVar1 == 0)" ( (binary_expression "sVar1 == 0" identifier == number_literal) )) (compound_statement "{\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return sVar3;\n      }" { (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "*piVar2 = 0x1c;" (assignment_expression "*piVar2 = 0x1c" (pointer_expression "*piVar2" * identifier) = number_literal) ;) (return_statement "return sVar3;" return identifier ;) })) (expression_statement "sVar3 = sVar3 + sVar1;" (assignment_expression "sVar3 = sVar3 + sVar1" identifier = (binary_expression "sVar3 + sVar1" identifier + identifier)) ;) (expression_statement "buf = (void *)((int)buf + sVar1);" (assignment_expression "buf = (void *)((int)buf + sVar1)" identifier = (cast_expression "(void *)((int)buf + sVar1)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)buf + sVar1)" ( (binary_expression "(int)buf + sVar1" (cast_expression "(int)buf" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) (expression_statement "count = count - sVar1;" (assignment_expression "count = count - sVar1" identifier = (binary_expression "count - sVar1" identifier - identifier)) ;) }) while (parenthesized_expression "(count != 0)" ( (binary_expression "count != 0" identifier != number_literal) )) ;) })) (return_statement "return sVar3;" return identifier ;) })))
(translation_unit "int FUN_0001d820(undefined4 param_1,int param_2,int param_3)\n\n{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}\n\n" (function_definition "int FUN_0001d820(undefined4 param_1,int param_2,int param_3)\n\n{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" primitive_type (function_declarator "FUN_0001d820(undefined4 param_1,int param_2,int param_3)" identifier (parameter_list "(undefined4 param_1,int param_2,int param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "int param_2" primitive_type identifier) , (parameter_declaration "int param_3" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (if_statement "if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" if (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" { (do_statement "do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);" do (compound_statement "{\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    }" { (expression_statement "iVar1 = FUN_00021360(param_1,param_2,param_3);" (assignment_expression "iVar1 = FUN_00021360(param_1,param_2,param_3)" identifier = (call_expression "FUN_00021360(param_1,param_2,param_3)" identifier (argument_list "(param_1,param_2,param_3)" ( identifier , identifier , identifier )))) ;) (if_statement "if (iVar1 == -1) {\n        return iVar3;\n      }" if (parenthesized_expression "(iVar1 == -1)" ( (binary_expression "iVar1 == -1" identifier == number_literal) )) (compound_statement "{\n        return iVar3;\n      }" { (return_statement "return iVar3;" return identifier ;) })) (if_statement "if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" if (parenthesized_expression "(iVar1 == 0)" ( (binary_expression "iVar1 == 0" identifier == number_literal) )) (compound_statement "{\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" { (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "*piVar2 = 0x1c;" (assignment_expression "*piVar2 = 0x1c" (pointer_expression "*piVar2" * identifier) = number_literal) ;) (return_statement "return iVar3;" return identifier ;) })) (expression_statement "iVar3 = iVar3 + iVar1;" (assignment_expression "iVar3 = iVar3 + iVar1" identifier = (binary_expression "iVar3 + iVar1" identifier + identifier)) ;) (expression_statement "param_2 = param_2 + iVar1;" (assignment_expression "param_2 = param_2 + iVar1" identifier = (binary_expression "param_2 + iVar1" identifier + identifier)) ;) (expression_statement "param_3 = param_3 - iVar1;" (assignment_expression "param_3 = param_3 - iVar1" identifier = (binary_expression "param_3 - iVar1" identifier - identifier)) ;) }) while (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) ;) })) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != LIT) )) ;) })) (return_statement return IDENT ;) })))
(function_definition "int FUN_0001d820(undefined4 param_1,int param_2,int param_3)\n\n{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" (primitive_type "int") (function_declarator "FUN_0001d820(undefined4 param_1,int param_2,int param_3)" (identifier "FUN_0001d820") (parameter_list "(undefined4 param_1,int param_2,int param_3)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) () ")"))) (compound_statement "{\n  int iVar1;\n  int *piVar2;\n  int iVar3;\n  \n  iVar3 = 0;\n  if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }\n  return iVar3;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int *piVar2;" (primitive_type "int") (pointer_declarator "*piVar2" (* "*") (identifier "piVar2")) (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (if_statement "if (param_3 != 0) {\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" (if "if") (parenthesized_expression "(param_3 != 0)" (( "(") (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);\n  }" ({ "{") (do_statement "do {\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    } while (param_3 != 0);" (do "do") (compound_statement "{\n      iVar1 = FUN_00021360(param_1,param_2,param_3);\n      if (iVar1 == -1) {\n        return iVar3;\n      }\n      if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }\n      iVar3 = iVar3 + iVar1;\n      param_2 = param_2 + iVar1;\n      param_3 = param_3 - iVar1;\n    }" ({ "{") (expression_statement "iVar1 = FUN_00021360(param_1,param_2,param_3);" (assignment_expression "iVar1 = FUN_00021360(param_1,param_2,param_3)" (identifier "iVar1") (= "=") (call_expression "FUN_00021360(param_1,param_2,param_3)" (identifier "FUN_00021360") (argument_list "(param_1,param_2,param_3)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") () ")")))) (; ";")) (if_statement "if (iVar1 == -1) {\n        return iVar3;\n      }" (if "if") (parenthesized_expression "(iVar1 == -1)" (( "(") (binary_expression "iVar1 == -1" (identifier "iVar1") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n        return iVar3;\n      }" ({ "{") (return_statement "return iVar3;" (return "return") (identifier "iVar3") (; ";")) (} "}"))) (if_statement "if (iVar1 == 0) {\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" (if "if") (parenthesized_expression "(iVar1 == 0)" (( "(") (binary_expression "iVar1 == 0" (identifier "iVar1") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        piVar2 = __errno_location();\n        *piVar2 = 0x1c;\n        return iVar3;\n      }" ({ "{") (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" (identifier "piVar2") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "*piVar2 = 0x1c;" (assignment_expression "*piVar2 = 0x1c" (pointer_expression "*piVar2" (* "*") (identifier "piVar2")) (= "=") (number_literal "0x1c")) (; ";")) (return_statement "return iVar3;" (return "return") (identifier "iVar3") (; ";")) (} "}"))) (expression_statement "iVar3 = iVar3 + iVar1;" (assignment_expression "iVar3 = iVar3 + iVar1" (identifier "iVar3") (= "=") (binary_expression "iVar3 + iVar1" (identifier "iVar3") (+ "+") (identifier "iVar1"))) (; ";")) (expression_statement "param_2 = param_2 + iVar1;" (assignment_expression "param_2 = param_2 + iVar1" (identifier "param_2") (= "=") (binary_expression "param_2 + iVar1" (identifier "param_2") (+ "+") (identifier "iVar1"))) (; ";")) (expression_statement "param_3 = param_3 - iVar1;" (assignment_expression "param_3 = param_3 - iVar1" (identifier "param_3") (= "=") (binary_expression "param_3 - iVar1" (identifier "param_3") (- "-") (identifier "iVar1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(param_3 != 0)" (( "(") (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) () ")")) (; ";")) (} "}"))) (return_statement "return iVar3;" (return "return") (identifier "iVar3") (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

size_t function_1(int fd,void *buf,size_t var_1)

{
  size_t var_3;
  int *piVar2;
  size_t var_5;
  
  var_5 = 0;
  if (var_1 != 0) {
    do {
      var_3 = var_2(fd,buf,var_1);
      if (var_3 == 0xffffffff) {
        return var_5;
      }
      if (var_3 == 0) {
        piVar2 = var_4();
        *piVar2 = 0x1c;
        return var_5;
      }
      var_5 = var_5 + var_3;
      buf = (void *)((int)buf + var_3);
      var_1 = var_1 - var_3;
    } while (var_1 != 0);
  }
  return var_5;
}


(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (number_literal))) (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal)))))) (return_statement (identifier)))))

/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

int MASKED(undefined4 param_1,int param_2,int param_3)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  iVar3 = 0;
  if (param_3 != 0) {
    do {
      iVar1 = FUN_00021360(param_1,param_2,param_3);
      if (iVar1 == -1) {
        return iVar3;
      }
      if (iVar1 == 0) {
        piVar2 = __errno_location();
        *piVar2 = 0x1c;
        return iVar3;
      }
      iVar3 = iVar3 + iVar1;
      param_2 = param_2 + iVar1;
      param_3 = param_3 - iVar1;
    } while (param_3 != 0);
  }
  return iVar3;
}

