
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */
/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

ssize_t sftp_recv(connectdata *conn,int sockindex,char *mem,size_t len,CURLcode *err)

{
  int iVar1;
  CURLcode CVar2;
  
  iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len);
  ssh_block2waitfor(conn,iVar1 == -0x25);
  if (iVar1 == -0x25) {
    iVar1 = -1;
    *err = CURLE_AGAIN;
  }
  else if (iVar1 < 0) {
    CVar2 = CURLE_SSH;
    if (iVar1 + 0x25U < 0x26) {
      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];
    }
    *err = CVar2;
    return iVar1;
  }
  return iVar1;
}



int __regparm2
FUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5
            ,uint *param_6)

{
  int iVar1;
  uint uVar2;
  int unaff_EBX;
  
  entry(param_2,0x4ca3c);
  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);
  FUN_0004c8e0();
  if (iVar1 == -0x25) {
    iVar1 = -1;
    *param_6 = 0x51;
  }
  else if (iVar1 < 0) {
    uVar2 = 0x4f;
    if (iVar1 + 0x25U < 0x26) {
      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);
    }
    *param_6 = uVar2;
    return iVar1;
  }
  return iVar1;
}


PUSH EDI
PUSH ESI
PUSH EBX
MOV EDI,dword ptr [ESP + 0x10]
CALL 0x00019ed0
ADD EBX,0x63da4
SUB ESP,0x4
PUSH dword ptr [ESP + 0x20]
PUSH dword ptr [ESP + 0x20]
PUSH dword ptr [EDI + 0x54c]
CALL 0x00019410
XOR EDX,EDX
CMP EAX,-0x25
MOV ESI,EAX
MOV EAX,EDI
SETZ DL
CALL 0x0004c8e0
ADD ESP,0x10
CMP ESI,-0x25
JZ 0x0004caa8
TEST ESI,ESI
JS 0x0004ca80
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
RET
LEA EDX,[ESI + 0x25]
MOV EAX,0x4f
CMP EDX,0x25
JA 0x0004ca95
MOVZX EAX,byte ptr [EBX + ESI*0x1 + 0xfffd4405]
MOV ECX,dword ptr [ESP + 0x20]
MOV dword ptr [ECX],EAX
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
RET
MOV EAX,dword ptr [ESP + 0x20]
MOV ESI,0xffffffff
MOV dword ptr [EAX],0x51
JMP 0x0004ca75
(translation_unit "int __regparm2\nFUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)\n\n{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}\n\n" (function_definition "int __regparm2\nFUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)\n\n{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" primitive_type (ERROR "__regparm2" identifier) (function_declarator "FUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) , (parameter_declaration "undefined4 param_5" type_identifier identifier) , (parameter_declaration "uint *param_6" type_identifier (pointer_declarator "*param_6" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (expression_statement "entry(param_2,0x4ca3c);" (call_expression "entry(param_2,0x4ca3c)" identifier (argument_list "(param_2,0x4ca3c)" ( identifier , number_literal ))) ;) (expression_statement "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);" (assignment_expression "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" identifier = (call_expression "libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" identifier (argument_list "(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" ( (pointer_expression "*(undefined4 *)(param_3 + 0x54c)" * (cast_expression "(undefined4 *)(param_3 + 0x54c)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_3 + 0x54c)" ( (binary_expression "param_3 + 0x54c" identifier + number_literal) )))) , identifier , identifier )))) ;) (expression_statement "FUN_0004c8e0();" (call_expression "FUN_0004c8e0()" identifier (argument_list "()" ( ))) ;) (if_statement "if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 == -0x25)" ( (binary_expression "iVar1 == -0x25" identifier == number_literal) )) (compound_statement "{\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }" { (expression_statement "iVar1 = -1;" (assignment_expression "iVar1 = -1" identifier = number_literal) ;) (expression_statement "*param_6 = 0x51;" (assignment_expression "*param_6 = 0x51" (pointer_expression "*param_6" * identifier) = number_literal) ;) }) (else_clause "else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" else (if_statement "if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" { (expression_statement "uVar2 = 0x4f;" (assignment_expression "uVar2 = 0x4f" identifier = number_literal) ;) (if_statement "if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" if (parenthesized_expression "(iVar1 + 0x25U < 0x26)" ( (binary_expression "iVar1 + 0x25U < 0x26" (binary_expression "iVar1 + 0x25U" identifier + number_literal) < number_literal) )) (compound_statement "{\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" { (expression_statement "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);" (assignment_expression "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" identifier = (binary_expression "(uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" (parenthesized_expression "(uint)" ( identifier )) * (cast_expression "(byte *)(unaff_EBX + 0x381a9 + iVar1)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EBX + 0x381a9 + iVar1)" ( (binary_expression "unaff_EBX + 0x381a9 + iVar1" (binary_expression "unaff_EBX + 0x381a9" identifier + number_literal) + identifier) ))))) ;) })) (expression_statement "*param_6 = uVar2;" (assignment_expression "*param_6 = uVar2" (pointer_expression "*param_6" * identifier) = identifier) ;) (return_statement "return iVar1;" return identifier ;) })))) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n/* WARNING: Enum "anon_enum_32": Some values do not have unique names */\n\nssize_t sftp_recv(connectdata *conn,int sockindex,char *mem,size_t len,CURLcode *err)\n\n{\n  int iVar1;\n  CURLcode CVar2;\n  \n  iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len);\n  ssh_block2waitfor(conn,iVar1 == -0x25);\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *err = CURLE_AGAIN;\n  }\n  else if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }\n  return iVar1;\n}\n\n" comment comment comment (function_definition "ssize_t sftp_recv(connectdata *conn,int sockindex,char *mem,size_t len,CURLcode *err)\n\n{\n  int iVar1;\n  CURLcode CVar2;\n  \n  iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len);\n  ssh_block2waitfor(conn,iVar1 == -0x25);\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *err = CURLE_AGAIN;\n  }\n  else if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "sftp_recv(connectdata *conn,int sockindex,char *mem,size_t len,CURLcode *err)" identifier (parameter_list "(connectdata *conn,int sockindex,char *mem,size_t len,CURLcode *err)" ( (parameter_declaration "connectdata *conn" type_identifier (pointer_declarator "*conn" * identifier)) , (parameter_declaration "int sockindex" primitive_type identifier) , (parameter_declaration "char *mem" primitive_type (pointer_declarator "*mem" * identifier)) , (parameter_declaration "size_t len" primitive_type identifier) , (parameter_declaration "CURLcode *err" type_identifier (pointer_declarator "*err" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  CURLcode CVar2;\n  \n  iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len);\n  ssh_block2waitfor(conn,iVar1 == -0x25);\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *err = CURLE_AGAIN;\n  }\n  else if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "CURLcode CVar2;" type_identifier identifier ;) (expression_statement "iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len);" (assignment_expression "iVar1 = libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len)" identifier = (call_expression "libssh2_sftp_read((conn->proto).sshc.sftp_handle,mem,len)" identifier (argument_list "((conn->proto).sshc.sftp_handle,mem,len)" ( (field_expression "(conn->proto).sshc.sftp_handle" (field_expression "(conn->proto).sshc" (parenthesized_expression "(conn->proto)" ( (field_expression "conn->proto" identifier -> field_identifier) )) . field_identifier) . field_identifier) , identifier , identifier )))) ;) (expression_statement "ssh_block2waitfor(conn,iVar1 == -0x25);" (call_expression "ssh_block2waitfor(conn,iVar1 == -0x25)" identifier (argument_list "(conn,iVar1 == -0x25)" ( identifier , (binary_expression "iVar1 == -0x25" identifier == number_literal) ))) ;) (if_statement "if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *err = CURLE_AGAIN;\n  }\n  else if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 == -0x25)" ( (binary_expression "iVar1 == -0x25" identifier == number_literal) )) (compound_statement "{\n    iVar1 = -1;\n    *err = CURLE_AGAIN;\n  }" { (expression_statement "iVar1 = -1;" (assignment_expression "iVar1 = -1" identifier = number_literal) ;) (expression_statement "*err = CURLE_AGAIN;" (assignment_expression "*err = CURLE_AGAIN" (pointer_expression "*err" * identifier) = identifier) ;) }) (else_clause "else if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }" else (if_statement "if (iVar1 < 0) {\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n    CVar2 = CURLE_SSH;\n    if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }\n    *err = CVar2;\n    return iVar1;\n  }" { (expression_statement "CVar2 = CURLE_SSH;" (assignment_expression "CVar2 = CURLE_SSH" identifier = identifier) ;) (if_statement "if (iVar1 + 0x25U < 0x26) {\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }" if (parenthesized_expression "(iVar1 + 0x25U < 0x26)" ( (binary_expression "iVar1 + 0x25U < 0x26" (binary_expression "iVar1 + 0x25U" identifier + number_literal) < number_literal) )) (compound_statement "{\n      CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];\n    }" { (expression_statement "CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25];" (assignment_expression "CVar2 = (CURLcode)(byte)CSWTCH_142[iVar1 + 0x25]" identifier = (cast_expression "(CURLcode)(byte)CSWTCH_142[iVar1 + 0x25]" ( (type_descriptor "CURLcode" type_identifier) ) (cast_expression "(byte)CSWTCH_142[iVar1 + 0x25]" ( (type_descriptor "byte" type_identifier) ) (subscript_expression "CSWTCH_142[iVar1 + 0x25]" identifier [ (binary_expression "iVar1 + 0x25" identifier + number_literal) ])))) ;) })) (expression_statement "*err = CVar2;" (assignment_expression "*err = CVar2" (pointer_expression "*err" * identifier) = identifier) ;) (return_statement "return iVar1;" return identifier ;) })))) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "int __regparm2\nFUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)\n\n{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}\n\n" (function_definition "int __regparm2\nFUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)\n\n{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" primitive_type (ERROR "__regparm2" identifier) (function_declarator "FUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) , (parameter_declaration "undefined4 param_5" type_identifier identifier) , (parameter_declaration "uint *param_6" type_identifier (pointer_declarator "*param_6" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (expression_statement "entry(param_2,0x4ca3c);" (call_expression "entry(param_2,0x4ca3c)" identifier (argument_list "(param_2,0x4ca3c)" ( identifier , number_literal ))) ;) (expression_statement "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);" (assignment_expression "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" identifier = (call_expression "libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" identifier (argument_list "(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" ( (pointer_expression "*(undefined4 *)(param_3 + 0x54c)" * (cast_expression "(undefined4 *)(param_3 + 0x54c)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_3 + 0x54c)" ( (binary_expression "param_3 + 0x54c" identifier + number_literal) )))) , identifier , identifier )))) ;) (expression_statement "FUN_0004c8e0();" (call_expression "FUN_0004c8e0()" identifier (argument_list "()" ( ))) ;) (if_statement "if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 == -0x25)" ( (binary_expression "iVar1 == -0x25" identifier == number_literal) )) (compound_statement "{\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }" { (expression_statement "iVar1 = -1;" (assignment_expression "iVar1 = -1" identifier = number_literal) ;) (expression_statement "*param_6 = 0x51;" (assignment_expression "*param_6 = 0x51" (pointer_expression "*param_6" * identifier) = number_literal) ;) }) (else_clause "else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" else (if_statement "if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" if (parenthesized_expression "(iVar1 < 0)" ( (binary_expression "iVar1 < 0" identifier < number_literal) )) (compound_statement "{\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" { (expression_statement "uVar2 = 0x4f;" (assignment_expression "uVar2 = 0x4f" identifier = number_literal) ;) (if_statement "if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" if (parenthesized_expression "(iVar1 + 0x25U < 0x26)" ( (binary_expression "iVar1 + 0x25U < 0x26" (binary_expression "iVar1 + 0x25U" identifier + number_literal) < number_literal) )) (compound_statement "{\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" { (expression_statement "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);" (assignment_expression "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" identifier = (binary_expression "(uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" (parenthesized_expression "(uint)" ( identifier )) * (cast_expression "(byte *)(unaff_EBX + 0x381a9 + iVar1)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EBX + 0x381a9 + iVar1)" ( (binary_expression "unaff_EBX + 0x381a9 + iVar1" (binary_expression "unaff_EBX + 0x381a9" identifier + number_literal) + identifier) ))))) ;) })) (expression_statement "*param_6 = uVar2;" (assignment_expression "*param_6 = uVar2" (pointer_expression "*param_6" * identifier) = identifier) ;) (return_statement "return iVar1;" return identifier ;) })))) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , LIT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) , IDENT , IDENT )))) ;) (expression_statement (call_expression IDENT (argument_list ( ))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT + LIT) < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( IDENT )) * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (binary_expression IDENT + LIT) + IDENT) ))))) ;) })) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (return_statement return IDENT ;) })))) (return_statement return IDENT ;) })))
(function_definition "int __regparm2\nFUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)\n\n{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" (primitive_type "int") (ERROR "__regparm2" (identifier "__regparm2")) (function_declarator "FUN_0004ca30(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" (identifier "FUN_0004ca30") (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5\n            ,uint *param_6)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) (, ",") (parameter_declaration "undefined4 param_4" (type_identifier "undefined4") (identifier "param_4")) (, ",") (parameter_declaration "undefined4 param_5" (type_identifier "undefined4") (identifier "param_5")) (, ",") (parameter_declaration "uint *param_6" (type_identifier "uint") (pointer_declarator "*param_6" (* "*") (identifier "param_6"))) () ")"))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  int unaff_EBX;\n  \n  entry(param_2,0x4ca3c);\n  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);\n  FUN_0004c8e0();\n  if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }\n  return iVar1;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int unaff_EBX;" (primitive_type "int") (identifier "unaff_EBX") (; ";")) (expression_statement "entry(param_2,0x4ca3c);" (call_expression "entry(param_2,0x4ca3c)" (identifier "entry") (argument_list "(param_2,0x4ca3c)" (( "(") (identifier "param_2") (, ",") (number_literal "0x4ca3c") () ")"))) (; ";")) (expression_statement "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);" (assignment_expression "iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" (identifier "iVar1") (= "=") (call_expression "libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" (identifier "libssh2_sftp_read") (argument_list "(*(undefined4 *)(param_3 + 0x54c),param_4,param_5)" (( "(") (pointer_expression "*(undefined4 *)(param_3 + 0x54c)" (* "*") (cast_expression "(undefined4 *)(param_3 + 0x54c)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_3 + 0x54c)" (( "(") (binary_expression "param_3 + 0x54c" (identifier "param_3") (+ "+") (number_literal "0x54c")) () ")")))) (, ",") (identifier "param_4") (, ",") (identifier "param_5") () ")")))) (; ";")) (expression_statement "FUN_0004c8e0();" (call_expression "FUN_0004c8e0()" (identifier "FUN_0004c8e0") (argument_list "()" (( "(") () ")"))) (; ";")) (if_statement "if (iVar1 == -0x25) {\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }\n  else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" (if "if") (parenthesized_expression "(iVar1 == -0x25)" (( "(") (binary_expression "iVar1 == -0x25" (identifier "iVar1") (== "==") (number_literal "-0x25")) () ")")) (compound_statement "{\n    iVar1 = -1;\n    *param_6 = 0x51;\n  }" ({ "{") (expression_statement "iVar1 = -1;" (assignment_expression "iVar1 = -1" (identifier "iVar1") (= "=") (number_literal "-1")) (; ";")) (expression_statement "*param_6 = 0x51;" (assignment_expression "*param_6 = 0x51" (pointer_expression "*param_6" (* "*") (identifier "param_6")) (= "=") (number_literal "0x51")) (; ";")) (} "}")) (else_clause "else if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" (else "else") (if_statement "if (iVar1 < 0) {\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" (if "if") (parenthesized_expression "(iVar1 < 0)" (( "(") (binary_expression "iVar1 < 0" (identifier "iVar1") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n    uVar2 = 0x4f;\n    if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }\n    *param_6 = uVar2;\n    return iVar1;\n  }" ({ "{") (expression_statement "uVar2 = 0x4f;" (assignment_expression "uVar2 = 0x4f" (identifier "uVar2") (= "=") (number_literal "0x4f")) (; ";")) (if_statement "if (iVar1 + 0x25U < 0x26) {\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" (if "if") (parenthesized_expression "(iVar1 + 0x25U < 0x26)" (( "(") (binary_expression "iVar1 + 0x25U < 0x26" (binary_expression "iVar1 + 0x25U" (identifier "iVar1") (+ "+") (number_literal "0x25U")) (< "<") (number_literal "0x26")) () ")")) (compound_statement "{\n      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);\n    }" ({ "{") (expression_statement "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);" (assignment_expression "uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" (identifier "uVar2") (= "=") (binary_expression "(uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (* "*") (cast_expression "(byte *)(unaff_EBX + 0x381a9 + iVar1)" (( "(") (type_descriptor "byte *" (type_identifier "byte") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EBX + 0x381a9 + iVar1)" (( "(") (binary_expression "unaff_EBX + 0x381a9 + iVar1" (binary_expression "unaff_EBX + 0x381a9" (identifier "unaff_EBX") (+ "+") (number_literal "0x381a9")) (+ "+") (identifier "iVar1")) () ")"))))) (; ";")) (} "}"))) (expression_statement "*param_6 = uVar2;" (assignment_expression "*param_6 = uVar2" (pointer_expression "*param_6" (* "*") (identifier "param_6")) (= "=") (identifier "uVar2")) (; ";")) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}"))))) (return_statement "return iVar1;" (return "return") (identifier "iVar1") (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */
/* WARNING: Enum "anon_enum_32": Some values do not have unique names */

ssize_t function_1(type_1 *conn,int sockindex,char *mem,size_t len,type_2 *err)

{
  int var_3;
  type_2 CVar2;
  
  var_3 = var_1((conn->proto).sshc.sftp_handle,mem,len);
  var_2(conn,var_3 == -0x25);
  if (var_3 == -0x25) {
    var_3 = -1;
    *err = CURLE_AGAIN;
  }
  else if (var_3 < 0) {
    CVar2 = CURLE_SSH;
    if (var_3 + 0x25U < 0x26) {
      CVar2 = (type_2)(type_3)CSWTCH_142[var_3 + 0x25];
    }
    *err = CVar2;
    return var_3;
  }
  return var_3;
}


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

int __regparm2
MASKED(undefined4 param_1,undefined4 param_2,int param_3,undefined4 param_4,undefined4 param_5
            ,uint *param_6)

{
  int iVar1;
  uint uVar2;
  int unaff_EBX;
  
  entry(param_2,0x4ca3c);
  iVar1 = libssh2_sftp_read(*(undefined4 *)(param_3 + 0x54c),param_4,param_5);
  FUN_0004c8e0();
  if (iVar1 == -0x25) {
    iVar1 = -1;
    *param_6 = 0x51;
  }
  else if (iVar1 < 0) {
    uVar2 = 0x4f;
    if (iVar1 + 0x25U < 0x26) {
      uVar2 = (uint)*(byte *)(unaff_EBX + 0x381a9 + iVar1);
    }
    *param_6 = uVar2;
    return iVar1;
  }
  return iVar1;
}

