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

int sha1_stream(FILE *stream,void *resblock)

{
  int iVar1;
  size_t sVar2;
  size_t len;
  sha1_ctx ctx;
  char buffer [4168];
  
  sha1_init_ctx(&ctx);
  do {
    len = 0;
    while( true ) {
      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);
      len = len + sVar2;
      if (len == 0x1000) break;
      if (sVar2 == 0) {
        iVar1 = ferror((FILE *)stream);
        if (iVar1 != 0) {
          return 1;
        }
        goto LAB_0003bda7;
      }
      iVar1 = feof((FILE *)stream);
      if (iVar1 != 0) {
LAB_0003bda7:
        if (len != 0) {
          sha1_process_bytes(buffer,len,&ctx);
        }
        sha1_finish_ctx(&ctx,resblock);
        return 0;
      }
    }
    sha1_process_block(buffer,0x1000,&ctx);
  } while( true );
}



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

undefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)

{
  int iVar1;
  size_t sVar2;
  int iVar3;
  undefined1 local_1104 [160];
  undefined1 local_1064 [4176];
  undefined4 uStack_14;
  
  uStack_14 = 0x3bd09;
  FUN_0003a6c0(local_1104);
  do {
    iVar3 = 0;
    while( true ) {
      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);
      iVar3 = iVar3 + sVar2;
      if (iVar3 == 0x1000) break;
      if (sVar2 == 0) {
        iVar1 = ferror(param_1);
        if (iVar1 != 0) {
          return 1;
        }
        goto LAB_0003bda7;
      }
      iVar1 = feof(param_1);
      if (iVar1 != 0) {
LAB_0003bda7:
        if (iVar3 != 0) {
          FUN_0003b970(local_1064,iVar3,local_1104);
        }
        FUN_0003b880(local_1104,param_2);
        return 0;
      }
    }
    FUN_0003a730(local_1064,0x1000,local_1104);
  } while( true );
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00015a80
ADD EBX,0x552f7
SUB ESP,0x1118
LEA EAX,[ESP + 0x24]
MOV ESI,dword ptr [ESP + 0x112c]
MOV dword ptr [ESP + 0x18],EAX
PUSH EAX
CALL 0x0003a6c0
ADD ESP,0x10
LEA EDI,[ESP + 0xb8]
XOR EBP,EBP
JMP 0x0003bd54
TEST EAX,EAX
JZ 0x0003bd90
SUB ESP,0xc
PUSH ESI
CALL 0x000146a0
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x0003bda7
MOV EAX,0x1000
PUSH ESI
SUB EAX,EBP
PUSH EAX
LEA EAX,[EDI + EBP*0x1]
PUSH 0x1
PUSH EAX
CALL 0x000144e0
ADD ESP,0x10
ADD EBP,EAX
CMP EBP,0x1000
JNZ 0x0003bd40
SUB ESP,0x4
PUSH dword ptr [ESP + 0x10]
PUSH 0x1000
PUSH EDI
CALL 0x0003a730
ADD ESP,0x10
JMP 0x0003bd34
SUB ESP,0xc
PUSH ESI
CALL 0x00014250
ADD ESP,0x10
MOV ECX,EAX
MOV EAX,0x1
TEST ECX,ECX
JNZ 0x0003bdc3
TEST EBP,EBP
JNZ 0x0003bdd0
SUB ESP,0x8
PUSH dword ptr [ESP + 0x112c]
PUSH dword ptr [ESP + 0x18]
CALL 0x0003b880
ADD ESP,0x10
XOR EAX,EAX
ADD ESP,0x110c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x4
PUSH dword ptr [ESP + 0x10]
PUSH EBP
PUSH EDI
CALL 0x0003b970
ADD ESP,0x10
JMP 0x0003bdab
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nundefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}\n\n" comment (function_definition "undefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" type_identifier (function_declarator "FUN_0003bd00(FILE *param_1,undefined4 param_2)" identifier (parameter_list "(FILE *param_1,undefined4 param_2)" ( (parameter_declaration "FILE *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "size_t sVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined1 local_1104 [160];" type_identifier (array_declarator "local_1104 [160]" identifier [ number_literal ]) ;) (declaration "undefined1 local_1064 [4176];" type_identifier (array_declarator "local_1064 [4176]" identifier [ number_literal ]) ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x3bd09;" (assignment_expression "uStack_14 = 0x3bd09" identifier = number_literal) ;) (expression_statement "FUN_0003a6c0(local_1104);" (call_expression "FUN_0003a6c0(local_1104)" identifier (argument_list "(local_1104)" ( identifier ))) ;) (do_statement "do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );" do (compound_statement "{\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  }" { (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (while_statement "while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" { (expression_statement "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);" (assignment_expression "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" identifier = (call_expression "fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" identifier (argument_list "(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" ( (binary_expression "local_1064 + iVar3" identifier + identifier) , number_literal , (binary_expression "0x1000 - iVar3" number_literal - identifier) , identifier )))) ;) (expression_statement "iVar3 = iVar3 + sVar2;" (assignment_expression "iVar3 = iVar3 + sVar2" identifier = (binary_expression "iVar3 + sVar2" identifier + identifier)) ;) (if_statement "if (iVar3 == 0x1000) break;" if (parenthesized_expression "(iVar3 == 0x1000)" ( (binary_expression "iVar3 == 0x1000" identifier == number_literal) )) (break_statement "break;" break ;)) (if_statement "if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" if (parenthesized_expression "(sVar2 == 0)" ( (binary_expression "sVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" { (expression_statement "iVar1 = ferror(param_1);" (assignment_expression "iVar1 = ferror(param_1)" identifier = (call_expression "ferror(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar1 != 0) {\n          return 1;\n        }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n          return 1;\n        }" { (return_statement "return 1;" return number_literal ;) })) (goto_statement "goto LAB_0003bda7;" goto statement_identifier ;) })) (expression_statement "iVar1 = feof(param_1);" (assignment_expression "iVar1 = feof(param_1)" identifier = (call_expression "feof(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" { (labeled_statement "LAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" statement_identifier : (if_statement "if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" { (expression_statement "FUN_0003b970(local_1064,iVar3,local_1104);" (call_expression "FUN_0003b970(local_1064,iVar3,local_1104)" identifier (argument_list "(local_1064,iVar3,local_1104)" ( identifier , identifier , identifier ))) ;) }))) (expression_statement "FUN_0003b880(local_1104,param_2);" (call_expression "FUN_0003b880(local_1104,param_2)" identifier (argument_list "(local_1104,param_2)" ( identifier , identifier ))) ;) (return_statement "return 0;" return number_literal ;) })) })) (expression_statement "FUN_0003a730(local_1064,0x1000,local_1104);" (call_expression "FUN_0003a730(local_1064,0x1000,local_1104)" identifier (argument_list "(local_1064,0x1000,local_1104)" ( identifier , number_literal , identifier ))) ;) }) while (parenthesized_expression "( true )" ( true )) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nint sha1_stream(FILE *stream,void *resblock)\n\n{\n  int iVar1;\n  size_t sVar2;\n  size_t len;\n  sha1_ctx ctx;\n  char buffer [4168];\n  \n  sha1_init_ctx(&ctx);\n  do {\n    len = 0;\n    while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }\n    sha1_process_block(buffer,0x1000,&ctx);\n  } while( true );\n}\n\n" comment comment (function_definition "int sha1_stream(FILE *stream,void *resblock)\n\n{\n  int iVar1;\n  size_t sVar2;\n  size_t len;\n  sha1_ctx ctx;\n  char buffer [4168];\n  \n  sha1_init_ctx(&ctx);\n  do {\n    len = 0;\n    while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }\n    sha1_process_block(buffer,0x1000,&ctx);\n  } while( true );\n}" primitive_type (function_declarator "sha1_stream(FILE *stream,void *resblock)" identifier (parameter_list "(FILE *stream,void *resblock)" ( (parameter_declaration "FILE *stream" type_identifier (pointer_declarator "*stream" * identifier)) , (parameter_declaration "void *resblock" primitive_type (pointer_declarator "*resblock" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  size_t sVar2;\n  size_t len;\n  sha1_ctx ctx;\n  char buffer [4168];\n  \n  sha1_init_ctx(&ctx);\n  do {\n    len = 0;\n    while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }\n    sha1_process_block(buffer,0x1000,&ctx);\n  } while( true );\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "size_t sVar2;" primitive_type identifier ;) (declaration "size_t len;" primitive_type identifier ;) (declaration "sha1_ctx ctx;" type_identifier identifier ;) (declaration "char buffer [4168];" primitive_type (array_declarator "buffer [4168]" identifier [ number_literal ]) ;) (expression_statement "sha1_init_ctx(&ctx);" (call_expression "sha1_init_ctx(&ctx)" identifier (argument_list "(&ctx)" ( (pointer_expression "&ctx" & identifier) ))) ;) (do_statement "do {\n    len = 0;\n    while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }\n    sha1_process_block(buffer,0x1000,&ctx);\n  } while( true );" do (compound_statement "{\n    len = 0;\n    while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }\n    sha1_process_block(buffer,0x1000,&ctx);\n  }" { (expression_statement "len = 0;" (assignment_expression "len = 0" identifier = number_literal) ;) (while_statement "while( true ) {\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);\n      len = len + sVar2;\n      if (len == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof((FILE *)stream);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }\n    }" { (expression_statement "sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream);" (assignment_expression "sVar2 = fread(buffer + len,1,0x1000 - len,(FILE *)stream)" identifier = (call_expression "fread(buffer + len,1,0x1000 - len,(FILE *)stream)" identifier (argument_list "(buffer + len,1,0x1000 - len,(FILE *)stream)" ( (binary_expression "buffer + len" identifier + identifier) , number_literal , (binary_expression "0x1000 - len" number_literal - identifier) , (cast_expression "(FILE *)stream" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) )))) ;) (expression_statement "len = len + sVar2;" (assignment_expression "len = len + sVar2" identifier = (binary_expression "len + sVar2" identifier + identifier)) ;) (if_statement "if (len == 0x1000) break;" if (parenthesized_expression "(len == 0x1000)" ( (binary_expression "len == 0x1000" identifier == number_literal) )) (break_statement "break;" break ;)) (if_statement "if (sVar2 == 0) {\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" if (parenthesized_expression "(sVar2 == 0)" ( (binary_expression "sVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        iVar1 = ferror((FILE *)stream);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" { (expression_statement "iVar1 = ferror((FILE *)stream);" (assignment_expression "iVar1 = ferror((FILE *)stream)" identifier = (call_expression "ferror((FILE *)stream)" identifier (argument_list "((FILE *)stream)" ( (cast_expression "(FILE *)stream" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) )))) ;) (if_statement "if (iVar1 != 0) {\n          return 1;\n        }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n          return 1;\n        }" { (return_statement "return 1;" return number_literal ;) })) (goto_statement "goto LAB_0003bda7;" goto statement_identifier ;) })) (expression_statement "iVar1 = feof((FILE *)stream);" (assignment_expression "iVar1 = feof((FILE *)stream)" identifier = (call_expression "feof((FILE *)stream)" identifier (argument_list "((FILE *)stream)" ( (cast_expression "(FILE *)stream" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) )))) ;) (if_statement "if (iVar1 != 0) {\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }\n        sha1_finish_ctx(&ctx,resblock);\n        return 0;\n      }" { (labeled_statement "LAB_0003bda7:\n        if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }" statement_identifier : (if_statement "if (len != 0) {\n          sha1_process_bytes(buffer,len,&ctx);\n        }" if (parenthesized_expression "(len != 0)" ( (binary_expression "len != 0" identifier != number_literal) )) (compound_statement "{\n          sha1_process_bytes(buffer,len,&ctx);\n        }" { (expression_statement "sha1_process_bytes(buffer,len,&ctx);" (call_expression "sha1_process_bytes(buffer,len,&ctx)" identifier (argument_list "(buffer,len,&ctx)" ( identifier , identifier , (pointer_expression "&ctx" & identifier) ))) ;) }))) (expression_statement "sha1_finish_ctx(&ctx,resblock);" (call_expression "sha1_finish_ctx(&ctx,resblock)" identifier (argument_list "(&ctx,resblock)" ( (pointer_expression "&ctx" & identifier) , identifier ))) ;) (return_statement "return 0;" return number_literal ;) })) })) (expression_statement "sha1_process_block(buffer,0x1000,&ctx);" (call_expression "sha1_process_block(buffer,0x1000,&ctx)" identifier (argument_list "(buffer,0x1000,&ctx)" ( identifier , number_literal , (pointer_expression "&ctx" & identifier) ))) ;) }) while (parenthesized_expression "( true )" ( true )) ;) })))
(translation_unit "undefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}\n\n" (function_definition "undefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" type_identifier (function_declarator "FUN_0003bd00(FILE *param_1,undefined4 param_2)" identifier (parameter_list "(FILE *param_1,undefined4 param_2)" ( (parameter_declaration "FILE *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "size_t sVar2;" primitive_type identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined1 local_1104 [160];" type_identifier (array_declarator "local_1104 [160]" identifier [ number_literal ]) ;) (declaration "undefined1 local_1064 [4176];" type_identifier (array_declarator "local_1064 [4176]" identifier [ number_literal ]) ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x3bd09;" (assignment_expression "uStack_14 = 0x3bd09" identifier = number_literal) ;) (expression_statement "FUN_0003a6c0(local_1104);" (call_expression "FUN_0003a6c0(local_1104)" identifier (argument_list "(local_1104)" ( identifier ))) ;) (do_statement "do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );" do (compound_statement "{\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  }" { (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (while_statement "while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" { (expression_statement "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);" (assignment_expression "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" identifier = (call_expression "fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" identifier (argument_list "(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" ( (binary_expression "local_1064 + iVar3" identifier + identifier) , number_literal , (binary_expression "0x1000 - iVar3" number_literal - identifier) , identifier )))) ;) (expression_statement "iVar3 = iVar3 + sVar2;" (assignment_expression "iVar3 = iVar3 + sVar2" identifier = (binary_expression "iVar3 + sVar2" identifier + identifier)) ;) (if_statement "if (iVar3 == 0x1000) break;" if (parenthesized_expression "(iVar3 == 0x1000)" ( (binary_expression "iVar3 == 0x1000" identifier == number_literal) )) (break_statement "break;" break ;)) (if_statement "if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" if (parenthesized_expression "(sVar2 == 0)" ( (binary_expression "sVar2 == 0" identifier == number_literal) )) (compound_statement "{\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" { (expression_statement "iVar1 = ferror(param_1);" (assignment_expression "iVar1 = ferror(param_1)" identifier = (call_expression "ferror(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar1 != 0) {\n          return 1;\n        }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n          return 1;\n        }" { (return_statement "return 1;" return number_literal ;) })) (goto_statement "goto LAB_0003bda7;" goto statement_identifier ;) })) (expression_statement "iVar1 = feof(param_1);" (assignment_expression "iVar1 = feof(param_1)" identifier = (call_expression "feof(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" { (labeled_statement "LAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" statement_identifier : (if_statement "if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" { (expression_statement "FUN_0003b970(local_1064,iVar3,local_1104);" (call_expression "FUN_0003b970(local_1064,iVar3,local_1104)" identifier (argument_list "(local_1064,iVar3,local_1104)" ( identifier , identifier , identifier ))) ;) }))) (expression_statement "FUN_0003b880(local_1104,param_2);" (call_expression "FUN_0003b880(local_1104,param_2)" identifier (argument_list "(local_1104,param_2)" ( identifier , identifier ))) ;) (return_statement "return 0;" return number_literal ;) })) })) (expression_statement "FUN_0003a730(local_1064,0x1000,local_1104);" (call_expression "FUN_0003a730(local_1064,0x1000,local_1104)" identifier (argument_list "(local_1064,0x1000,local_1104)" ( identifier , number_literal , identifier ))) ;) }) while (parenthesized_expression "( true )" ( true )) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (while_statement while (parenthesized_expression ( BOOL )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (binary_expression IDENT + IDENT) , LIT , (binary_expression LIT - IDENT) , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (return_statement return LIT ;) })) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (labeled_statement statement_identifier : (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) }))) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT ))) ;) (return_statement return LIT ;) })) })) (expression_statement (call_expression IDENT (argument_list ( IDENT , LIT , IDENT ))) ;) }) while (parenthesized_expression ( BOOL )) ;) })))
(function_definition "undefined4 FUN_0003bd00(FILE *param_1,undefined4 param_2)\n\n{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" (type_identifier "undefined4") (function_declarator "FUN_0003bd00(FILE *param_1,undefined4 param_2)" (identifier "FUN_0003bd00") (parameter_list "(FILE *param_1,undefined4 param_2)" (( "(") (parameter_declaration "FILE *param_1" (type_identifier "FILE") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  size_t sVar2;\n  int iVar3;\n  undefined1 local_1104 [160];\n  undefined1 local_1064 [4176];\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x3bd09;\n  FUN_0003a6c0(local_1104);\n  do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "size_t sVar2;" (primitive_type "size_t") (identifier "sVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "undefined1 local_1104 [160];" (type_identifier "undefined1") (array_declarator "local_1104 [160]" (identifier "local_1104") ([ "[") (number_literal "160") (] "]")) (; ";")) (declaration "undefined1 local_1064 [4176];" (type_identifier "undefined1") (array_declarator "local_1064 [4176]" (identifier "local_1064") ([ "[") (number_literal "4176") (] "]")) (; ";")) (declaration "undefined4 uStack_14;" (type_identifier "undefined4") (identifier "uStack_14") (; ";")) (expression_statement "uStack_14 = 0x3bd09;" (assignment_expression "uStack_14 = 0x3bd09" (identifier "uStack_14") (= "=") (number_literal "0x3bd09")) (; ";")) (expression_statement "FUN_0003a6c0(local_1104);" (call_expression "FUN_0003a6c0(local_1104)" (identifier "FUN_0003a6c0") (argument_list "(local_1104)" (( "(") (identifier "local_1104") () ")"))) (; ";")) (do_statement "do {\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  } while( true );" (do "do") (compound_statement "{\n    iVar3 = 0;\n    while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }\n    FUN_0003a730(local_1064,0x1000,local_1104);\n  }" ({ "{") (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" (identifier "iVar3") (= "=") (number_literal "0")) (; ";")) (while_statement "while( true ) {\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (compound_statement "{\n      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);\n      iVar3 = iVar3 + sVar2;\n      if (iVar3 == 0x1000) break;\n      if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }\n      iVar1 = feof(param_1);\n      if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }\n    }" ({ "{") (expression_statement "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);" (assignment_expression "sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" (identifier "sVar2") (= "=") (call_expression "fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" (identifier "fread") (argument_list "(local_1064 + iVar3,1,0x1000 - iVar3,param_1)" (( "(") (binary_expression "local_1064 + iVar3" (identifier "local_1064") (+ "+") (identifier "iVar3")) (, ",") (number_literal "1") (, ",") (binary_expression "0x1000 - iVar3" (number_literal "0x1000") (- "-") (identifier "iVar3")) (, ",") (identifier "param_1") () ")")))) (; ";")) (expression_statement "iVar3 = iVar3 + sVar2;" (assignment_expression "iVar3 = iVar3 + sVar2" (identifier "iVar3") (= "=") (binary_expression "iVar3 + sVar2" (identifier "iVar3") (+ "+") (identifier "sVar2"))) (; ";")) (if_statement "if (iVar3 == 0x1000) break;" (if "if") (parenthesized_expression "(iVar3 == 0x1000)" (( "(") (binary_expression "iVar3 == 0x1000" (identifier "iVar3") (== "==") (number_literal "0x1000")) () ")")) (break_statement "break;" (break "break") (; ";"))) (if_statement "if (sVar2 == 0) {\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" (if "if") (parenthesized_expression "(sVar2 == 0)" (( "(") (binary_expression "sVar2 == 0" (identifier "sVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        iVar1 = ferror(param_1);\n        if (iVar1 != 0) {\n          return 1;\n        }\n        goto LAB_0003bda7;\n      }" ({ "{") (expression_statement "iVar1 = ferror(param_1);" (assignment_expression "iVar1 = ferror(param_1)" (identifier "iVar1") (= "=") (call_expression "ferror(param_1)" (identifier "ferror") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\n          return 1;\n        }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n          return 1;\n        }" ({ "{") (return_statement "return 1;" (return "return") (number_literal "1") (; ";")) (} "}"))) (goto_statement "goto LAB_0003bda7;" (goto "goto") (statement_identifier "LAB_0003bda7") (; ";")) (} "}"))) (expression_statement "iVar1 = feof(param_1);" (assignment_expression "iVar1 = feof(param_1)" (identifier "iVar1") (= "=") (call_expression "feof(param_1)" (identifier "feof") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\nLAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }\n        FUN_0003b880(local_1104,param_2);\n        return 0;\n      }" ({ "{") (labeled_statement "LAB_0003bda7:\n        if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" (statement_identifier "LAB_0003bda7") (: ":") (if_statement "if (iVar3 != 0) {\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" (if "if") (parenthesized_expression "(iVar3 != 0)" (( "(") (binary_expression "iVar3 != 0" (identifier "iVar3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n          FUN_0003b970(local_1064,iVar3,local_1104);\n        }" ({ "{") (expression_statement "FUN_0003b970(local_1064,iVar3,local_1104);" (call_expression "FUN_0003b970(local_1064,iVar3,local_1104)" (identifier "FUN_0003b970") (argument_list "(local_1064,iVar3,local_1104)" (( "(") (identifier "local_1064") (, ",") (identifier "iVar3") (, ",") (identifier "local_1104") () ")"))) (; ";")) (} "}")))) (expression_statement "FUN_0003b880(local_1104,param_2);" (call_expression "FUN_0003b880(local_1104,param_2)" (identifier "FUN_0003b880") (argument_list "(local_1104,param_2)" (( "(") (identifier "local_1104") (, ",") (identifier "param_2") () ")"))) (; ";")) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (} "}"))) (expression_statement "FUN_0003a730(local_1064,0x1000,local_1104);" (call_expression "FUN_0003a730(local_1064,0x1000,local_1104)" (identifier "FUN_0003a730") (argument_list "(local_1064,0x1000,local_1104)" (( "(") (identifier "local_1064") (, ",") (number_literal "0x1000") (, ",") (identifier "local_1104") () ")"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (; ";")) (} "}")))

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

int function_1(type_1 *stream,void *resblock)

{
  int var_7;
  size_t var_5;
  size_t var_4;
  type_2 ctx;
  char var_3 [4168];
  
  var_1(&ctx);
  do {
    var_4 = 0;
    while( true ) {
      var_5 = var_2(var_3 + var_4,1,0x1000 - var_4,(type_1 *)stream);
      var_4 = var_4 + var_5;
      if (var_4 == 0x1000) break;
      if (var_5 == 0) {
        var_7 = var_6((type_1 *)stream);
        if (var_7 != 0) {
          return 1;
        }
        goto LAB_0003bda7;
      }
      var_7 = var_8((type_1 *)stream);
      if (var_7 != 0) {
LAB_0003bda7:
        if (var_4 != 0) {
          var_9(var_3,var_4,&ctx);
        }
        var_10(&ctx,resblock);
        return 0;
      }
    }
    var_11(var_3,0x1000,&ctx);
  } while( true );
}


(translation_unit (function_definition type: (type_identifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (array_declarator declarator: (identifier) size: (number_literal))) (declaration type: (type_identifier) declarator: (array_declarator declarator: (identifier) size: (number_literal))) (declaration type: (type_identifier) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier)))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (while_statement condition: (parenthesized_expression (true)) body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (number_literal) (binary_expression left: (number_literal) right: (identifier)) (identifier))))) (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: (break_statement)) (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 (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (number_literal)))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (labeled_statement label: (statement_identifier) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier)))) (return_statement (number_literal)))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (number_literal) (identifier))))) condition: (parenthesized_expression (true))))))

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

undefined4 MASKED(FILE *param_1,undefined4 param_2)

{
  int iVar1;
  size_t sVar2;
  int iVar3;
  undefined1 local_1104 [160];
  undefined1 local_1064 [4176];
  undefined4 uStack_14;
  
  uStack_14 = 0x3bd09;
  FUN_0003a6c0(local_1104);
  do {
    iVar3 = 0;
    while( true ) {
      sVar2 = fread(local_1064 + iVar3,1,0x1000 - iVar3,param_1);
      iVar3 = iVar3 + sVar2;
      if (iVar3 == 0x1000) break;
      if (sVar2 == 0) {
        iVar1 = ferror(param_1);
        if (iVar1 != 0) {
          return 1;
        }
        goto LAB_0003bda7;
      }
      iVar1 = feof(param_1);
      if (iVar1 != 0) {
LAB_0003bda7:
        if (iVar3 != 0) {
          FUN_0003b970(local_1064,iVar3,local_1104);
        }
        FUN_0003b880(local_1104,param_2);
        return 0;
      }
    }
    FUN_0003a730(local_1064,0x1000,local_1104);
  } while( true );
}

