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

void bufchain_fetch(bufchain *ch,void *data,int len)

{
  bufchain_granule *pbVar1;
  size_t __n;
  
  pbVar1 = ch->head;
  if (ch->buffersize < len) {
                    /* WARNING: Subroutine does not return */
    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");
  }
  while( true ) {
    if (len < 1) {
      return;
    }
    if (pbVar1 == (bufchain_granule *)0x0) break;
    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;
    if (len < (int)__n) {
      __n = len;
    }
    len = len - __n;
    memcpy(data,pbVar1->bufpos,__n);
    pbVar1 = pbVar1->next;
    data = (void *)((int)data + __n);
  }
                    /* WARNING: Subroutine does not return */
  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");
}



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

void FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)

{
  undefined4 *puVar1;
  size_t __n;
  
  puVar1 = (undefined4 *)*param_1;
  if ((int)param_1[2] < (int)param_3) {
                    /* WARNING: Subroutine does not return */
    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");
  }
  while( true ) {
    if ((int)param_3 < 1) {
      return;
    }
    if (puVar1 == (undefined4 *)0x0) break;
    __n = puVar1[2] - (int)puVar1[1];
    if ((int)param_3 < (int)__n) {
      __n = param_3;
    }
    param_3 = param_3 - __n;
    memcpy(param_2,(void *)puVar1[1],__n);
    puVar1 = (undefined4 *)*puVar1;
    param_2 = (void *)((int)param_2 + __n);
  }
                    /* WARNING: Subroutine does not return */
  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x0001b410
ADD EBX,0x9446b
SUB ESP,0xc
MOV EAX,dword ptr [ESP + 0x20]
MOV EDX,dword ptr [ESP + 0x24]
MOV EDI,dword ptr [ESP + 0x28]
MOV EBP,dword ptr [EAX]
CMP dword ptr [EAX + 0x8],EDI
JGE 0x0003138e
JMP 0x000313b9
TEST EBP,EBP
JZ 0x0003139a
MOV EAX,dword ptr [EBP + 0x4]
MOV ESI,dword ptr [EBP + 0x8]
SUB ESI,EAX
CMP ESI,EDI
CMOVG ESI,EDI
SUB ESP,0x4
PUSH ESI
SUB EDI,ESI
PUSH EAX
PUSH EDX
MOV dword ptr [ESP + 0x34],EDX
CALL 0x000197d0
MOV EDX,dword ptr [ESP + 0x34]
MOV EBP,dword ptr [EBP]
ADD ESP,0x10
ADD EDX,ESI
TEST EDI,EDI
JG 0x00031360
ADD ESP,0xc
POP EBX
POP ESI
POP EDI
POP EBP
RET
LEA EAX,[EBX + 0xfffcb018]
PUSH EAX
LEA EAX,[EBX + 0xfffb28ad]
PUSH 0x2e7
PUSH EAX
LEA EAX,[EBX + 0xfffcaef5]
PUSH EAX
CALL 0x0001af20
LEA EAX,[EBX + 0xfffcb018]
PUSH EAX
LEA EAX,[EBX + 0xfffb28ad]
PUSH 0x2e3
PUSH EAX
LEA EAX,[EBX + 0xfffcaedf]
PUSH EAX
CALL 0x0001af20
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nvoid FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)\n\n{\n  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}\n\n" comment (function_definition "void FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)\n\n{\n  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" primitive_type (function_declarator "FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)" identifier (parameter_list "(undefined4 *param_1,void *param_2,size_t param_3)" ( (parameter_declaration "undefined4 *param_1" type_identifier (pointer_declarator "*param_1" * 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  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" { (declaration "undefined4 *puVar1;" type_identifier (pointer_declarator "*puVar1" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "puVar1 = (undefined4 *)*param_1;" (assignment_expression "puVar1 = (undefined4 *)*param_1" identifier = (cast_expression "(undefined4 *)*param_1" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_1" * identifier))) ;) (if_statement "if ((int)param_1[2] < (int)param_3) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" if (parenthesized_expression "((int)param_1[2] < (int)param_3)" ( (binary_expression "(int)param_1[2] < (int)param_3" (cast_expression "(int)param_1[2]" ( (type_descriptor "int" primitive_type) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) < (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" { comment (expression_statement "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");" (call_expression "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" identifier (argument_list "("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" ( (string_literal ""ch->buffersize >= len"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })) (while_statement "while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" { (if_statement "if ((int)param_3 < 1) {\n      return;\n    }" if (parenthesized_expression "((int)param_3 < 1)" ( (binary_expression "(int)param_3 < 1" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n      return;\n    }" { (return_statement "return;" return ;) })) (if_statement "if (puVar1 == (undefined4 *)0x0) break;" if (parenthesized_expression "(puVar1 == (undefined4 *)0x0)" ( (binary_expression "puVar1 == (undefined4 *)0x0" identifier == (cast_expression "(undefined4 *)0x0" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (break_statement "break;" break ;)) (expression_statement "__n = puVar1[2] - (int)puVar1[1];" (assignment_expression "__n = puVar1[2] - (int)puVar1[1]" identifier = (binary_expression "puVar1[2] - (int)puVar1[1]" (subscript_expression "puVar1[2]" identifier [ number_literal ]) - (cast_expression "(int)puVar1[1]" ( (type_descriptor "int" primitive_type) ) (subscript_expression "puVar1[1]" identifier [ number_literal ])))) ;) (if_statement "if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }" if (parenthesized_expression "((int)param_3 < (int)__n)" ( (binary_expression "(int)param_3 < (int)__n" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) < (cast_expression "(int)__n" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n      __n = param_3;\n    }" { (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) })) (expression_statement "param_3 = param_3 - __n;" (assignment_expression "param_3 = param_3 - __n" identifier = (binary_expression "param_3 - __n" identifier - identifier)) ;) (expression_statement "memcpy(param_2,(void *)puVar1[1],__n);" (call_expression "memcpy(param_2,(void *)puVar1[1],__n)" identifier (argument_list "(param_2,(void *)puVar1[1],__n)" ( identifier , (cast_expression "(void *)puVar1[1]" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (subscript_expression "puVar1[1]" identifier [ number_literal ])) , identifier ))) ;) (expression_statement "puVar1 = (undefined4 *)*puVar1;" (assignment_expression "puVar1 = (undefined4 *)*puVar1" identifier = (cast_expression "(undefined4 *)*puVar1" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "*puVar1" * identifier))) ;) (expression_statement "param_2 = (void *)((int)param_2 + __n);" (assignment_expression "param_2 = (void *)((int)param_2 + __n)" identifier = (cast_expression "(void *)((int)param_2 + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)param_2 + __n)" ( (binary_expression "(int)param_2 + __n" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) })) comment (expression_statement "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");" (call_expression "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" identifier (argument_list "("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" ( (string_literal ""tmp != NULL"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nvoid bufchain_fetch(bufchain *ch,void *data,int len)\n\n{\n  bufchain_granule *pbVar1;\n  size_t __n;\n  \n  pbVar1 = ch->head;\n  if (ch->buffersize < len) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if (len < 1) {\n      return;\n    }\n    if (pbVar1 == (bufchain_granule *)0x0) break;\n    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;\n    if (len < (int)__n) {\n      __n = len;\n    }\n    len = len - __n;\n    memcpy(data,pbVar1->bufpos,__n);\n    pbVar1 = pbVar1->next;\n    data = (void *)((int)data + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}\n\n" comment (function_definition "void bufchain_fetch(bufchain *ch,void *data,int len)\n\n{\n  bufchain_granule *pbVar1;\n  size_t __n;\n  \n  pbVar1 = ch->head;\n  if (ch->buffersize < len) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if (len < 1) {\n      return;\n    }\n    if (pbVar1 == (bufchain_granule *)0x0) break;\n    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;\n    if (len < (int)__n) {\n      __n = len;\n    }\n    len = len - __n;\n    memcpy(data,pbVar1->bufpos,__n);\n    pbVar1 = pbVar1->next;\n    data = (void *)((int)data + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" primitive_type (function_declarator "bufchain_fetch(bufchain *ch,void *data,int len)" identifier (parameter_list "(bufchain *ch,void *data,int len)" ( (parameter_declaration "bufchain *ch" type_identifier (pointer_declarator "*ch" * identifier)) , (parameter_declaration "void *data" primitive_type (pointer_declarator "*data" * identifier)) , (parameter_declaration "int len" primitive_type identifier) ))) (compound_statement "{\n  bufchain_granule *pbVar1;\n  size_t __n;\n  \n  pbVar1 = ch->head;\n  if (ch->buffersize < len) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if (len < 1) {\n      return;\n    }\n    if (pbVar1 == (bufchain_granule *)0x0) break;\n    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;\n    if (len < (int)__n) {\n      __n = len;\n    }\n    len = len - __n;\n    memcpy(data,pbVar1->bufpos,__n);\n    pbVar1 = pbVar1->next;\n    data = (void *)((int)data + __n);\n  }\n                    /* WARNING: Subroutine does not return */\n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" { (declaration "bufchain_granule *pbVar1;" type_identifier (pointer_declarator "*pbVar1" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "pbVar1 = ch->head;" (assignment_expression "pbVar1 = ch->head" identifier = (field_expression "ch->head" identifier -> field_identifier)) ;) (if_statement "if (ch->buffersize < len) {\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" if (parenthesized_expression "(ch->buffersize < len)" ( (binary_expression "ch->buffersize < len" (field_expression "ch->buffersize" identifier -> field_identifier) < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" { comment (expression_statement "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");" (call_expression "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" identifier (argument_list "("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" ( (string_literal ""ch->buffersize >= len"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })) (while_statement "while( true ) {\n    if (len < 1) {\n      return;\n    }\n    if (pbVar1 == (bufchain_granule *)0x0) break;\n    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;\n    if (len < (int)__n) {\n      __n = len;\n    }\n    len = len - __n;\n    memcpy(data,pbVar1->bufpos,__n);\n    pbVar1 = pbVar1->next;\n    data = (void *)((int)data + __n);\n  }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n    if (len < 1) {\n      return;\n    }\n    if (pbVar1 == (bufchain_granule *)0x0) break;\n    __n = (int)pbVar1->bufend - (int)pbVar1->bufpos;\n    if (len < (int)__n) {\n      __n = len;\n    }\n    len = len - __n;\n    memcpy(data,pbVar1->bufpos,__n);\n    pbVar1 = pbVar1->next;\n    data = (void *)((int)data + __n);\n  }" { (if_statement "if (len < 1) {\n      return;\n    }" if (parenthesized_expression "(len < 1)" ( (binary_expression "len < 1" identifier < number_literal) )) (compound_statement "{\n      return;\n    }" { (return_statement "return;" return ;) })) (if_statement "if (pbVar1 == (bufchain_granule *)0x0) break;" if (parenthesized_expression "(pbVar1 == (bufchain_granule *)0x0)" ( (binary_expression "pbVar1 == (bufchain_granule *)0x0" identifier == (cast_expression "(bufchain_granule *)0x0" ( (type_descriptor "bufchain_granule *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (break_statement "break;" break ;)) (expression_statement "__n = (int)pbVar1->bufend - (int)pbVar1->bufpos;" (assignment_expression "__n = (int)pbVar1->bufend - (int)pbVar1->bufpos" identifier = (binary_expression "(int)pbVar1->bufend - (int)pbVar1->bufpos" (cast_expression "(int)pbVar1->bufend" ( (type_descriptor "int" primitive_type) ) (field_expression "pbVar1->bufend" identifier -> field_identifier)) - (cast_expression "(int)pbVar1->bufpos" ( (type_descriptor "int" primitive_type) ) (field_expression "pbVar1->bufpos" identifier -> field_identifier)))) ;) (if_statement "if (len < (int)__n) {\n      __n = len;\n    }" if (parenthesized_expression "(len < (int)__n)" ( (binary_expression "len < (int)__n" identifier < (cast_expression "(int)__n" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n      __n = len;\n    }" { (expression_statement "__n = len;" (assignment_expression "__n = len" identifier = identifier) ;) })) (expression_statement "len = len - __n;" (assignment_expression "len = len - __n" identifier = (binary_expression "len - __n" identifier - identifier)) ;) (expression_statement "memcpy(data,pbVar1->bufpos,__n);" (call_expression "memcpy(data,pbVar1->bufpos,__n)" identifier (argument_list "(data,pbVar1->bufpos,__n)" ( identifier , (field_expression "pbVar1->bufpos" identifier -> field_identifier) , identifier ))) ;) (expression_statement "pbVar1 = pbVar1->next;" (assignment_expression "pbVar1 = pbVar1->next" identifier = (field_expression "pbVar1->next" identifier -> field_identifier)) ;) (expression_statement "data = (void *)((int)data + __n);" (assignment_expression "data = (void *)((int)data + __n)" identifier = (cast_expression "(void *)((int)data + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)data + __n)" ( (binary_expression "(int)data + __n" (cast_expression "(int)data" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) })) comment (expression_statement "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");" (call_expression "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" identifier (argument_list "("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" ( (string_literal ""tmp != NULL"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })))
(translation_unit "void FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)\n\n{\n  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    \n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}\n\n" (function_definition "void FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)\n\n{\n  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    \n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" primitive_type (function_declarator "FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)" identifier (parameter_list "(undefined4 *param_1,void *param_2,size_t param_3)" ( (parameter_declaration "undefined4 *param_1" type_identifier (pointer_declarator "*param_1" * 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  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    \n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" { (declaration "undefined4 *puVar1;" type_identifier (pointer_declarator "*puVar1" * identifier) ;) (declaration "size_t __n;" primitive_type identifier ;) (expression_statement "puVar1 = (undefined4 *)*param_1;" (assignment_expression "puVar1 = (undefined4 *)*param_1" identifier = (cast_expression "(undefined4 *)*param_1" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_1" * identifier))) ;) (if_statement "if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" if (parenthesized_expression "((int)param_1[2] < (int)param_3)" ( (binary_expression "(int)param_1[2] < (int)param_3" (cast_expression "(int)param_1[2]" ( (type_descriptor "int" primitive_type) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) < (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" { (expression_statement "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");" (call_expression "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" identifier (argument_list "("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" ( (string_literal ""ch->buffersize >= len"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })) (while_statement "while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" { (if_statement "if ((int)param_3 < 1) {\n      return;\n    }" if (parenthesized_expression "((int)param_3 < 1)" ( (binary_expression "(int)param_3 < 1" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n      return;\n    }" { (return_statement "return;" return ;) })) (if_statement "if (puVar1 == (undefined4 *)0x0) break;" if (parenthesized_expression "(puVar1 == (undefined4 *)0x0)" ( (binary_expression "puVar1 == (undefined4 *)0x0" identifier == (cast_expression "(undefined4 *)0x0" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (break_statement "break;" break ;)) (expression_statement "__n = puVar1[2] - (int)puVar1[1];" (assignment_expression "__n = puVar1[2] - (int)puVar1[1]" identifier = (binary_expression "puVar1[2] - (int)puVar1[1]" (subscript_expression "puVar1[2]" identifier [ number_literal ]) - (cast_expression "(int)puVar1[1]" ( (type_descriptor "int" primitive_type) ) (subscript_expression "puVar1[1]" identifier [ number_literal ])))) ;) (if_statement "if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }" if (parenthesized_expression "((int)param_3 < (int)__n)" ( (binary_expression "(int)param_3 < (int)__n" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) < (cast_expression "(int)__n" ( (type_descriptor "int" primitive_type) ) identifier)) )) (compound_statement "{\n      __n = param_3;\n    }" { (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" identifier = identifier) ;) })) (expression_statement "param_3 = param_3 - __n;" (assignment_expression "param_3 = param_3 - __n" identifier = (binary_expression "param_3 - __n" identifier - identifier)) ;) (expression_statement "memcpy(param_2,(void *)puVar1[1],__n);" (call_expression "memcpy(param_2,(void *)puVar1[1],__n)" identifier (argument_list "(param_2,(void *)puVar1[1],__n)" ( identifier , (cast_expression "(void *)puVar1[1]" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (subscript_expression "puVar1[1]" identifier [ number_literal ])) , identifier ))) ;) (expression_statement "puVar1 = (undefined4 *)*puVar1;" (assignment_expression "puVar1 = (undefined4 *)*puVar1" identifier = (cast_expression "(undefined4 *)*puVar1" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "*puVar1" * identifier))) ;) (expression_statement "param_2 = (void *)((int)param_2 + __n);" (assignment_expression "param_2 = (void *)((int)param_2 + __n)" identifier = (cast_expression "(void *)((int)param_2 + __n)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)param_2 + __n)" ( (binary_expression "(int)param_2 + __n" (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier) + identifier) )))) ;) })) (expression_statement "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");" (call_expression "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" identifier (argument_list "("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" ( (string_literal ""tmp != NULL"" " string_content ") , (string_literal ""misc.c"" " string_content ") , number_literal , (string_literal ""bufchain_fetch"" " string_content ") ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) (subscript_expression IDENT [ LIT ])) < (cast_expression ( (type_descriptor TYPE) ) IDENT)) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (string_literal " string_content ") , (string_literal " string_content ") , LIT , (string_literal " string_content ") ))) ;) })) (while_statement while (parenthesized_expression ( BOOL )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) < LIT) )) (compound_statement { (return_statement return ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression (subscript_expression IDENT [ LIT ]) - (cast_expression ( (type_descriptor TYPE) ) (subscript_expression IDENT [ LIT ])))) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) < (cast_expression ( (type_descriptor TYPE) ) IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ])) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * 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 (call_expression IDENT (argument_list ( (string_literal " string_content ") , (string_literal " string_content ") , LIT , (string_literal " string_content ") ))) ;) })))
(function_definition "void FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)\n\n{\n  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    \n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" (primitive_type "void") (function_declarator "FUN_00031330(undefined4 *param_1,void *param_2,size_t param_3)" (identifier "FUN_00031330") (parameter_list "(undefined4 *param_1,void *param_2,size_t param_3)" (( "(") (parameter_declaration "undefined4 *param_1" (type_identifier "undefined4") (pointer_declarator "*param_1" (* "*") (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  undefined4 *puVar1;\n  size_t __n;\n  \n  puVar1 = (undefined4 *)*param_1;\n  if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }\n  while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }\n                    \n  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");\n}" ({ "{") (declaration "undefined4 *puVar1;" (type_identifier "undefined4") (pointer_declarator "*puVar1" (* "*") (identifier "puVar1")) (; ";")) (declaration "size_t __n;" (primitive_type "size_t") (identifier "__n") (; ";")) (expression_statement "puVar1 = (undefined4 *)*param_1;" (assignment_expression "puVar1 = (undefined4 *)*param_1" (identifier "puVar1") (= "=") (cast_expression "(undefined4 *)*param_1" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*param_1" (* "*") (identifier "param_1")))) (; ";")) (if_statement "if ((int)param_1[2] < (int)param_3) {\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" (if "if") (parenthesized_expression "((int)param_1[2] < (int)param_3)" (( "(") (binary_expression "(int)param_1[2] < (int)param_3" (cast_expression "(int)param_1[2]" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]"))) (< "<") (cast_expression "(int)param_3" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_3"))) () ")")) (compound_statement "{\n                    \n    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");\n  }" ({ "{") (expression_statement "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");" (call_expression "__assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" (identifier "__assert_fail") (argument_list "("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch")" (( "(") (string_literal ""ch->buffersize >= len"" (" """) (string_content "ch->buffersize >= len") (" """)) (, ",") (string_literal ""misc.c"" (" """) (string_content "misc.c") (" """)) (, ",") (number_literal "0x2e3") (, ",") (string_literal ""bufchain_fetch"" (" """) (string_content "bufchain_fetch") (" """)) () ")"))) (; ";")) (} "}"))) (while_statement "while( true ) {\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (compound_statement "{\n    if ((int)param_3 < 1) {\n      return;\n    }\n    if (puVar1 == (undefined4 *)0x0) break;\n    __n = puVar1[2] - (int)puVar1[1];\n    if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }\n    param_3 = param_3 - __n;\n    memcpy(param_2,(void *)puVar1[1],__n);\n    puVar1 = (undefined4 *)*puVar1;\n    param_2 = (void *)((int)param_2 + __n);\n  }" ({ "{") (if_statement "if ((int)param_3 < 1) {\n      return;\n    }" (if "if") (parenthesized_expression "((int)param_3 < 1)" (( "(") (binary_expression "(int)param_3 < 1" (cast_expression "(int)param_3" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_3")) (< "<") (number_literal "1")) () ")")) (compound_statement "{\n      return;\n    }" ({ "{") (return_statement "return;" (return "return") (; ";")) (} "}"))) (if_statement "if (puVar1 == (undefined4 *)0x0) break;" (if "if") (parenthesized_expression "(puVar1 == (undefined4 *)0x0)" (( "(") (binary_expression "puVar1 == (undefined4 *)0x0" (identifier "puVar1") (== "==") (cast_expression "(undefined4 *)0x0" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "__n = puVar1[2] - (int)puVar1[1];" (assignment_expression "__n = puVar1[2] - (int)puVar1[1]" (identifier "__n") (= "=") (binary_expression "puVar1[2] - (int)puVar1[1]" (subscript_expression "puVar1[2]" (identifier "puVar1") ([ "[") (number_literal "2") (] "]")) (- "-") (cast_expression "(int)puVar1[1]" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (subscript_expression "puVar1[1]" (identifier "puVar1") ([ "[") (number_literal "1") (] "]"))))) (; ";")) (if_statement "if ((int)param_3 < (int)__n) {\n      __n = param_3;\n    }" (if "if") (parenthesized_expression "((int)param_3 < (int)__n)" (( "(") (binary_expression "(int)param_3 < (int)__n" (cast_expression "(int)param_3" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_3")) (< "<") (cast_expression "(int)__n" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__n"))) () ")")) (compound_statement "{\n      __n = param_3;\n    }" ({ "{") (expression_statement "__n = param_3;" (assignment_expression "__n = param_3" (identifier "__n") (= "=") (identifier "param_3")) (; ";")) (} "}"))) (expression_statement "param_3 = param_3 - __n;" (assignment_expression "param_3 = param_3 - __n" (identifier "param_3") (= "=") (binary_expression "param_3 - __n" (identifier "param_3") (- "-") (identifier "__n"))) (; ";")) (expression_statement "memcpy(param_2,(void *)puVar1[1],__n);" (call_expression "memcpy(param_2,(void *)puVar1[1],__n)" (identifier "memcpy") (argument_list "(param_2,(void *)puVar1[1],__n)" (( "(") (identifier "param_2") (, ",") (cast_expression "(void *)puVar1[1]" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "puVar1[1]" (identifier "puVar1") ([ "[") (number_literal "1") (] "]"))) (, ",") (identifier "__n") () ")"))) (; ";")) (expression_statement "puVar1 = (undefined4 *)*puVar1;" (assignment_expression "puVar1 = (undefined4 *)*puVar1" (identifier "puVar1") (= "=") (cast_expression "(undefined4 *)*puVar1" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*puVar1" (* "*") (identifier "puVar1")))) (; ";")) (expression_statement "param_2 = (void *)((int)param_2 + __n);" (assignment_expression "param_2 = (void *)((int)param_2 + __n)" (identifier "param_2") (= "=") (cast_expression "(void *)((int)param_2 + __n)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)param_2 + __n)" (( "(") (binary_expression "(int)param_2 + __n" (cast_expression "(int)param_2" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_2")) (+ "+") (identifier "__n")) () ")")))) (; ";")) (} "}"))) (expression_statement "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");" (call_expression "__assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" (identifier "__assert_fail") (argument_list "("tmp != NULL","misc.c",0x2e7,"bufchain_fetch")" (( "(") (string_literal ""tmp != NULL"" (" """) (string_content "tmp != NULL") (" """)) (, ",") (string_literal ""misc.c"" (" """) (string_content "misc.c") (" """)) (, ",") (number_literal "0x2e7") (, ",") (string_literal ""bufchain_fetch"" (" """) (string_content "bufchain_fetch") (" """)) () ")"))) (; ";")) (} "}")))

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

void function_1(type_1 *ch,void *data,int var_1)

{
  type_2 *var_3;
  size_t var_4;
  
  var_3 = ch->head;
  if (ch->buffersize < var_1) {
                    /* WARNING: Subroutine does not return */
    var_2("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");
  }
  while( true ) {
    if (var_1 < 1) {
      return;
    }
    if (var_3 == (type_2 *)0x0) break;
    var_4 = (int)var_3->bufend - (int)var_3->bufpos;
    if (var_1 < (int)var_4) {
      var_4 = var_1;
    }
    var_1 = var_1 - var_4;
    var_5(data,var_3->bufpos,var_4);
    var_3 = var_3->next;
    data = (void *)((int)data + var_4);
  }
                    /* WARNING: Subroutine does not return */
  var_2("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");
}


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

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

void MASKED(undefined4 *param_1,void *param_2,size_t param_3)

{
  undefined4 *puVar1;
  size_t __n;
  
  puVar1 = (undefined4 *)*param_1;
  if ((int)param_1[2] < (int)param_3) {
                    /* WARNING: Subroutine does not return */
    __assert_fail("ch->buffersize >= len","misc.c",0x2e3,"bufchain_fetch");
  }
  while( true ) {
    if ((int)param_3 < 1) {
      return;
    }
    if (puVar1 == (undefined4 *)0x0) break;
    __n = puVar1[2] - (int)puVar1[1];
    if ((int)param_3 < (int)__n) {
      __n = param_3;
    }
    param_3 = param_3 - __n;
    memcpy(param_2,(void *)puVar1[1],__n);
    puVar1 = (undefined4 *)*puVar1;
    param_2 = (void *)((int)param_2 + __n);
  }
                    /* WARNING: Subroutine does not return */
  __assert_fail("tmp != NULL","misc.c",0x2e7,"bufchain_fetch");
}

