
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* (anonymous namespace)::xwrite(int, char const*, int) */

int __regparm3 (anonymous_namespace)::xwrite(int param_1,char *param_2,int param_3)

{
  ssize_t sVar1;
  int *piVar2;
  size_t __n;
  
  __n = param_3;
  do {
    while( true ) {
      sVar1 = ::write(param_1,param_2,__n);
      if (sVar1 == -1) break;
      __n = __n - sVar1;
      if (__n == 0) {
        return param_3;
      }
      param_2 = param_2 + sVar1;
    }
    piVar2 = __errno_location();
  } while (*piVar2 == 4);
  return param_3 - __n;
}



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

size_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)

{
  ssize_t sVar1;
  int *piVar2;
  size_t __n;
  
  __n = param_3;
  do {
    while( true ) {
      sVar1 = write(param_1,param_2,__n);
      if (sVar1 == -1) break;
      __n = __n - sVar1;
      if (__n == 0) {
        return param_3;
      }
      param_2 = (void *)((int)param_2 + sVar1);
    }
    piVar2 = __errno_location();
  } while (*piVar2 == 4);
  return param_3 - __n;
}


PUSH EBP
MOV EBP,ECX
PUSH EDI
MOV EDI,EAX
PUSH ESI
MOV ESI,EDX
PUSH EBX
CALL 0x00035680
ADD EBX,0x1925d1
SUB ESP,0x1c
MOV dword ptr [ESP + 0xc],ECX
JMP 0x001aca46
SUB EBP,EAX
JZ 0x001aca78
ADD ESI,EAX
SUB ESP,0x4
PUSH EBP
PUSH ESI
PUSH EDI
CALL 0x000282a0
ADD ESP,0x10
CMP EAX,-0x1
JNZ 0x001aca40
CALL 0x00028090
CMP dword ptr [EAX],0x4
JZ 0x001aca46
MOV EAX,dword ptr [ESP + 0xc]
ADD ESP,0x1c
POP EBX
POP ESI
SUB EAX,EBP
POP EDI
MOV EBP,EAX
MOV EAX,EBP
POP EBP
RET
MOV EBP,dword ptr [ESP + 0xc]
ADD ESP,0x1c
POP EBX
POP ESI
MOV EAX,EBP
POP EDI
POP EBP
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nsize_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}\n\n" comment (function_definition "size_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_001aca20(int param_1,void *param_2,size_t param_3)" identifier (parameter_list "(int param_1,void *param_2,size_t param_3)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "size_t param_3" primitive_type identifier) ))) (compound_statement "{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" { (declaration "ssize_t sVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) (do_statement "do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);" do (compound_statement "{\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  }" { (while_statement "while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" { (expression_statement "sVar1 = write(param_1,param_2,__n);" (assignment_expression "sVar1 = write(param_1,param_2,__n)" identifier = (call_expression "write(param_1,param_2,__n)" identifier (argument_list "(param_1,param_2,__n)" ( identifier , identifier , identifier )))) ;) (if_statement "if (sVar1 == -1) break;" if (parenthesized_expression "(sVar1 == -1)" ( (binary_expression "sVar1 == -1" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "__n = __n - sVar1;" (assignment_expression "__n = __n - sVar1" identifier = (binary_expression "__n - sVar1" identifier - identifier)) ;) (if_statement "if (__n == 0) {\n        return param_3;\n      }" if (parenthesized_expression "(__n == 0)" ( (binary_expression "__n == 0" identifier == number_literal) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "param_2 = (void *)((int)param_2 + sVar1);" (assignment_expression "param_2 = (void *)((int)param_2 + sVar1)" identifier = (cast_expression "(void *)((int)param_2 + sVar1)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)param_2 + sVar1)" ( (binary_expression "(int)param_2 + sVar1" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) })) (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar2 == 4)" ( (binary_expression "*piVar2 == 4" (pointer_expression "*piVar2" * identifier) == number_literal) )) ;) (return_statement "return param_3 - __n;" return (binary_expression "param_3 - __n" identifier - identifier) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* (anonymous namespace)::xwrite(int, char const*, int) */\n\nint __regparm3 (anonymous_namespace)::xwrite(int param_1,char *param_2,int param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}\n\n" comment comment (function_definition "int __regparm3 (anonymous_namespace)::xwrite(int param_1,char *param_2,int param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" primitive_type (function_declarator "__regparm3 (anonymous_namespace)" identifier (parameter_list "(anonymous_namespace)" ( identifier ))) (ERROR "::xwrite(int param_1,char *param_2,int param_3)" : : (macro_type_specifier "xwrite(int" identifier ( (type_descriptor "int" primitive_type) )) identifier , (ERROR "char" identifier) (pointer_declarator "*param_2" * identifier) , identifier identifier )) (compound_statement "{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" { (declaration "ssize_t sVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) (do_statement "do {\n    while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);" do (compound_statement "{\n    while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }\n    piVar2 = __errno_location();\n  }" { (while_statement "while( true ) {\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar1 = ::write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = param_2 + sVar1;\n    }" { (expression_statement "sVar1 = ::write(param_1,param_2,__n);" (assignment_expression "sVar1 = ::write(param_1,param_2,__n)" identifier = (ERROR "::" : :) (call_expression "write(param_1,param_2,__n)" identifier (argument_list "(param_1,param_2,__n)" ( identifier , identifier , identifier )))) ;) (if_statement "if (sVar1 == -1) break;" if (parenthesized_expression "(sVar1 == -1)" ( (binary_expression "sVar1 == -1" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "__n = __n - sVar1;" (assignment_expression "__n = __n - sVar1" identifier = (binary_expression "__n - sVar1" identifier - identifier)) ;) (if_statement "if (__n == 0) {\n        return param_3;\n      }" if (parenthesized_expression "(__n == 0)" ( (binary_expression "__n == 0" identifier == number_literal) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "param_2 = param_2 + sVar1;" (assignment_expression "param_2 = param_2 + sVar1" identifier = (binary_expression "param_2 + sVar1" identifier + identifier)) ;) })) (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar2 == 4)" ( (binary_expression "*piVar2 == 4" (pointer_expression "*piVar2" * identifier) == number_literal) )) ;) (return_statement "return param_3 - __n;" return (binary_expression "param_3 - __n" identifier - identifier) ;) })))
(translation_unit "size_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}\n\n" (function_definition "size_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_001aca20(int param_1,void *param_2,size_t param_3)" identifier (parameter_list "(int param_1,void *param_2,size_t param_3)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "size_t param_3" primitive_type identifier) ))) (compound_statement "{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" { (declaration "ssize_t sVar1;" primitive_type identifier ;) (declaration "int *piVar2;" primitive_type (pointer_declarator "*piVar2" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) (do_statement "do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);" do (compound_statement "{\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  }" { (while_statement "while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" { (expression_statement "sVar1 = write(param_1,param_2,__n);" (assignment_expression "sVar1 = write(param_1,param_2,__n)" identifier = (call_expression "write(param_1,param_2,__n)" identifier (argument_list "(param_1,param_2,__n)" ( identifier , identifier , identifier )))) ;) (if_statement "if (sVar1 == -1) break;" if (parenthesized_expression "(sVar1 == -1)" ( (binary_expression "sVar1 == -1" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "__n = __n - sVar1;" (assignment_expression "__n = __n - sVar1" identifier = (binary_expression "__n - sVar1" identifier - identifier)) ;) (if_statement "if (__n == 0) {\n        return param_3;\n      }" if (parenthesized_expression "(__n == 0)" ( (binary_expression "__n == 0" identifier == number_literal) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "param_2 = (void *)((int)param_2 + sVar1);" (assignment_expression "param_2 = (void *)((int)param_2 + sVar1)" identifier = (cast_expression "(void *)((int)param_2 + sVar1)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)param_2 + sVar1)" ( (binary_expression "(int)param_2 + sVar1" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) })) (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(*piVar2 == 4)" ( (binary_expression "*piVar2 == 4" (pointer_expression "*piVar2" * identifier) == number_literal) )) ;) (return_statement "return param_3 - __n;" return (binary_expression "param_3 - __n" identifier - identifier) ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (do_statement do (compound_statement { (while_statement while (parenthesized_expression ( BOOL )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + IDENT) )))) ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) }) while (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) == LIT) )) ;) (return_statement return (binary_expression IDENT - IDENT) ;) })))
(function_definition "size_t __regparm3 FUN_001aca20(int param_1,void *param_2,size_t param_3)\n\n{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" (primitive_type "size_t") (ERROR "__regparm3" (identifier "__regparm3")) (function_declarator "FUN_001aca20(int param_1,void *param_2,size_t param_3)" (identifier "FUN_001aca20") (parameter_list "(int param_1,void *param_2,size_t param_3)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) (, ",") (parameter_declaration "void *param_2" (primitive_type "void") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "size_t param_3" (primitive_type "size_t") (identifier "param_3")) () ")"))) (compound_statement "{\n  ssize_t sVar1;\n  int *piVar2;\n  size_t __n;\n  \n  __n = param_3;\n  do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);\n  return param_3 - __n;\n}" ({ "{") (declaration "ssize_t sVar1;" (primitive_type "ssize_t") (identifier "sVar1") (; ";")) (declaration "int *piVar2;" (primitive_type "int") (pointer_declarator "*piVar2" (* "*") (identifier "piVar2")) (; ";")) (declaration "size_t __n;" (primitive_type "size_t") (identifier "__n") (; ";")) (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" (identifier "__n") (= "=") (identifier "param_3")) (; ";")) (do_statement "do {\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  } while (*piVar2 == 4);" (do "do") (compound_statement "{\n    while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }\n    piVar2 = __errno_location();\n  }" ({ "{") (while_statement "while( true ) {\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (compound_statement "{\n      sVar1 = write(param_1,param_2,__n);\n      if (sVar1 == -1) break;\n      __n = __n - sVar1;\n      if (__n == 0) {\n        return param_3;\n      }\n      param_2 = (void *)((int)param_2 + sVar1);\n    }" ({ "{") (expression_statement "sVar1 = write(param_1,param_2,__n);" (assignment_expression "sVar1 = write(param_1,param_2,__n)" (identifier "sVar1") (= "=") (call_expression "write(param_1,param_2,__n)" (identifier "write") (argument_list "(param_1,param_2,__n)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "__n") () ")")))) (; ";")) (if_statement "if (sVar1 == -1) break;" (if "if") (parenthesized_expression "(sVar1 == -1)" (( "(") (binary_expression "sVar1 == -1" (identifier "sVar1") (== "==") (number_literal "-1")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "__n = __n - sVar1;" (assignment_expression "__n = __n - sVar1" (identifier "__n") (= "=") (binary_expression "__n - sVar1" (identifier "__n") (- "-") (identifier "sVar1"))) (; ";")) (if_statement "if (__n == 0) {\n        return param_3;\n      }" (if "if") (parenthesized_expression "(__n == 0)" (( "(") (binary_expression "__n == 0" (identifier "__n") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        return param_3;\n      }" ({ "{") (return_statement "return param_3;" (return "return") (identifier "param_3") (; ";")) (} "}"))) (expression_statement "param_2 = (void *)((int)param_2 + sVar1);" (assignment_expression "param_2 = (void *)((int)param_2 + sVar1)" (identifier "param_2") (= "=") (cast_expression "(void *)((int)param_2 + sVar1)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)param_2 + sVar1)" (( "(") (binary_expression "(int)param_2 + sVar1" (cast_expression "(int)param_2" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_2")) (+ "+") (identifier "sVar1")) () ")")))) (; ";")) (} "}"))) (expression_statement "piVar2 = __errno_location();" (assignment_expression "piVar2 = __errno_location()" (identifier "piVar2") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(*piVar2 == 4)" (( "(") (binary_expression "*piVar2 == 4" (pointer_expression "*piVar2" (* "*") (identifier "piVar2")) (== "==") (number_literal "4")) () ")")) (; ";")) (return_statement "return param_3 - __n;" (return "return") (binary_expression "param_3 - __n" (identifier "param_3") (- "-") (identifier "__n")) (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* (anonymous namespace)::xwrite(int, char const*, int) */

int function_1 (anonymous_namespace)::xwrite(int param_1,char *var_4,int var_6)

{
  ssize_t var_2;
  int *piVar2;
  size_t var_3;
  
  var_3 = var_6;
  do {
    while( true ) {
      var_2 = ::var_1(param_1,var_4,var_3);
      if (var_2 == -1) break;
      var_3 = var_3 - var_2;
      if (var_3 == 0) {
        return var_6;
      }
      var_4 = var_4 + var_2;
    }
    piVar2 = var_5();
  } while (*piVar2 == 4);
  return var_6 - var_3;
}


(translation_unit (function_definition type: (primitive_type) (ERROR (identifier)) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (pointer_declarator 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: (identifier))) (do_statement body: (compound_statement (while_statement condition: (parenthesized_expression (true)) 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: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list))))) condition: (parenthesized_expression (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal)))) (return_statement (binary_expression left: (identifier) right: (identifier))))))

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

size_t __regparm3 MASKED(int param_1,void *param_2,size_t param_3)

{
  ssize_t sVar1;
  int *piVar2;
  size_t __n;
  
  __n = param_3;
  do {
    while( true ) {
      sVar1 = write(param_1,param_2,__n);
      if (sVar1 == -1) break;
      __n = __n - sVar1;
      if (__n == 0) {
        return param_3;
      }
      param_2 = (void *)((int)param_2 + sVar1);
    }
    piVar2 = __errno_location();
  } while (*piVar2 == 4);
  return param_3 - __n;
}

