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

void * open_settings_w(char *sessionname,char **errmsg)

{
  char *pcVar1;
  char *pcVar2;
  FILE *pFVar3;
  char *pcVar4;
  int *piVar5;
  
  *errmsg = (char *)0x0;
  pcVar1 = make_filename(0,(char *)0x0);
  pcVar2 = make_dir_path(pcVar1,0x1c0);
  if (pcVar2 != (char *)0x0) {
    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);
    *errmsg = pcVar4;
    safefree(pcVar2);
    safefree(pcVar1);
    return (void *)0x0;
  }
  safefree(pcVar1);
  pcVar1 = getenv("PUTTYSESSIONS");
  if (pcVar1 == (char *)0x0) {
    pcVar2 = make_filename(0,(char *)0x0);
    pcVar1 = dupprintf("%s/sessions",pcVar2);
    safefree(pcVar2);
  }
  else {
    pcVar1 = dupstr(pcVar1);
  }
  pcVar2 = make_dir_path(pcVar1,0x1c0);
  if (pcVar2 == (char *)0x0) {
    safefree(pcVar1);
    pcVar1 = make_filename(5,sessionname);
    pFVar3 = fopen64(pcVar1,"w");
    if (pFVar3 == (FILE *)0x0) {
      piVar5 = __errno_location();
      pcVar2 = strerror(*piVar5);
      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);
      *errmsg = pcVar2;
      safefree(pcVar1);
    }
    else {
      safefree(pcVar1);
    }
    return pFVar3;
  }
  pcVar4 = dupprintf("Unable to save session: %s",pcVar2);
  *errmsg = pcVar4;
  safefree(pcVar2);
  safefree(pcVar1);
  return (void *)0x0;
}



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

FILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  char *pcVar3;
  FILE *pFVar4;
  undefined4 uVar5;
  int *piVar6;
  char *pcVar7;
  
  *param_2 = 0;
  uVar1 = FUN_00084c80();
  iVar2 = FUN_0007d880(uVar1,0x1c0);
  if (iVar2 != 0) {
    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);
    *param_2 = uVar5;
    FUN_00020030(iVar2);
    FUN_00020030(uVar1);
    return (FILE *)0x0;
  }
  FUN_00020030(uVar1);
  pcVar3 = getenv("PUTTYSESSIONS");
  if (pcVar3 == (char *)0x0) {
    uVar5 = FUN_00084c80();
    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);
    FUN_00020030(uVar5);
  }
  else {
    uVar1 = FUN_0001eed0(pcVar3);
  }
  iVar2 = FUN_0007d880(uVar1,0x1c0);
  if (iVar2 == 0) {
    FUN_00020030(uVar1);
    pcVar3 = (char *)FUN_00084c80();
    pFVar4 = fopen64(pcVar3,"w");
    if (pFVar4 == (FILE *)0x0) {
      piVar6 = __errno_location();
      pcVar7 = strerror(*piVar6);
      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);
      *param_2 = uVar1;
      FUN_00020030(pcVar3);
    }
    else {
      FUN_00020030(pcVar3);
    }
    return pFVar4;
  }
  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);
  *param_2 = uVar5;
  FUN_00020030(iVar2);
  FUN_00020030(uVar1);
  return (FILE *)0x0;
}


PUSH EBP
XOR EDX,EDX
XOR EAX,EAX
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00015ff0
ADD EBX,0x41a33
SUB ESP,0x1c
MOV EDI,dword ptr [ESP + 0x34]
MOV dword ptr [EDI],0x0
CALL 0x00084c80
SUB ESP,0x8
PUSH 0x1c0
MOV EBP,EAX
PUSH EAX
CALL 0x0007d880
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JNZ 0x00085440
SUB ESP,0xc
PUSH EBP
CALL 0x00020030
LEA EAX,[EBX + 0xfffd3a83]
MOV dword ptr [ESP],EAX
CALL 0x00014340
ADD ESP,0x10
TEST EAX,EAX
JZ 0x00085408
SUB ESP,0xc
PUSH EAX
CALL 0x0001eed0
ADD ESP,0x10
MOV EBP,EAX
SUB ESP,0x8
PUSH 0x1c0
PUSH EBP
CALL 0x0007d880
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x00085478
SUB ESP,0xc
PUSH EBP
CALL 0x00020030
MOV EDX,dword ptr [ESP + 0x40]
MOV EAX,0x5
CALL 0x00084c80
MOV EBP,EAX
POP EAX
LEA EAX,[EBX + 0xfffc3365]
POP EDX
PUSH EAX
PUSH EBP
CALL 0x00014290
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JZ 0x000854b0
SUB ESP,0xc
PUSH EBP
CALL 0x00020030
ADD ESP,0x10
ADD ESP,0x1c
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
XOR EDX,EDX
XOR EAX,EAX
CALL 0x00084c80
SUB ESP,0x8
PUSH EAX
MOV dword ptr [ESP + 0x18],EAX
LEA EAX,[EBX + 0xfffd3a91]
PUSH EAX
CALL 0x0001f1a0
MOV EDX,dword ptr [ESP + 0x1c]
MOV EBP,EAX
MOV dword ptr [ESP],EDX
CALL 0x00020030
ADD ESP,0x10
JMP 0x0008539e
SUB ESP,0x8
PUSH EAX
LEA EAX,[EBX + 0xfffd3afc]
PUSH EAX
CALL 0x0001f1a0
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],ESI
XOR ESI,ESI
CALL 0x00020030
MOV dword ptr [ESP],EBP
CALL 0x00020030
ADD ESP,0x10
MOV EAX,ESI
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
PUSH EAX
MOV dword ptr [ESP + 0x18],EAX
LEA EAX,[EBX + 0xfffd3afc]
PUSH EAX
CALL 0x0001f1a0
MOV EDX,dword ptr [ESP + 0x1c]
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],EDX
CALL 0x00020030
MOV dword ptr [ESP],EBP
CALL 0x00020030
ADD ESP,0x10
MOV EAX,ESI
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
CALL 0x00014540
SUB ESP,0xc
PUSH dword ptr [EAX]
CALL 0x00014380
ADD ESP,0xc
PUSH EAX
LEA EAX,[EBX + 0xfffd3b74]
PUSH EBP
PUSH EAX
CALL 0x0001f1a0
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],EBP
CALL 0x00020030
ADD ESP,0x10
JMP 0x000853f8
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nFILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}\n\n" comment (function_definition "FILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" type_identifier (pointer_declarator "* FUN_00085330(undefined4 param_1,undefined4 *param_2)" * (function_declarator "FUN_00085330(undefined4 param_1,undefined4 *param_2)" identifier (parameter_list "(undefined4 param_1,undefined4 *param_2)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) )))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "char *pcVar3;" primitive_type (pointer_declarator "*pcVar3" * identifier) ;) (declaration "FILE *pFVar4;" type_identifier (pointer_declarator "*pFVar4" * identifier) ;) (declaration "undefined4 uVar5;" type_identifier identifier ;) (declaration "int *piVar6;" primitive_type (pointer_declarator "*piVar6" * identifier) ;) (declaration "char *pcVar7;" primitive_type (pointer_declarator "*pcVar7" * identifier) ;) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" * identifier) = number_literal) ;) (expression_statement "uVar1 = FUN_00084c80();" (assignment_expression "uVar1 = FUN_00084c80()" identifier = (call_expression "FUN_00084c80()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" identifier = (call_expression "FUN_0007d880(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" { (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier (argument_list "("Unable to save session: %s",iVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (return_statement "return (FILE *)0x0;" return (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "pcVar3 = getenv("PUTTYSESSIONS");" (assignment_expression "pcVar3 = getenv("PUTTYSESSIONS")" identifier = (call_expression "getenv("PUTTYSESSIONS")" identifier (argument_list "("PUTTYSESSIONS")" ( (string_literal ""PUTTYSESSIONS"" " string_content ") )))) ;) (if_statement "if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" if (parenthesized_expression "(pcVar3 == (char *)0x0)" ( (binary_expression "pcVar3 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }" { (expression_statement "uVar5 = FUN_00084c80();" (assignment_expression "uVar5 = FUN_00084c80()" identifier = (call_expression "FUN_00084c80()" identifier (argument_list "()" ( )))) ;) (expression_statement "uVar1 = FUN_0001f1a0("%s/sessions",uVar5);" (assignment_expression "uVar1 = FUN_0001f1a0("%s/sessions",uVar5)" identifier = (call_expression "FUN_0001f1a0("%s/sessions",uVar5)" identifier (argument_list "("%s/sessions",uVar5)" ( (string_literal ""%s/sessions"" " string_content ") , identifier )))) ;) (expression_statement "FUN_00020030(uVar5);" (call_expression "FUN_00020030(uVar5)" identifier (argument_list "(uVar5)" ( identifier ))) ;) }) (else_clause "else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" else (compound_statement "{\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" { (expression_statement "uVar1 = FUN_0001eed0(pcVar3);" (assignment_expression "uVar1 = FUN_0001eed0(pcVar3)" identifier = (call_expression "FUN_0001eed0(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier )))) ;) }))) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" identifier = (call_expression "FUN_0007d880(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" { (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "pcVar3 = (char *)FUN_00084c80();" (assignment_expression "pcVar3 = (char *)FUN_00084c80()" identifier = (cast_expression "(char *)FUN_00084c80()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_00084c80()" identifier (argument_list "()" ( ))))) ;) (expression_statement "pFVar4 = fopen64(pcVar3,"w");" (assignment_expression "pFVar4 = fopen64(pcVar3,"w")" identifier = (call_expression "fopen64(pcVar3,"w")" identifier (argument_list "(pcVar3,"w")" ( identifier , (string_literal ""w"" " string_content ") )))) ;) (if_statement "if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }" if (parenthesized_expression "(pFVar4 == (FILE *)0x0)" ( (binary_expression "pFVar4 == (FILE *)0x0" identifier == (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }" { (expression_statement "piVar6 = __errno_location();" (assignment_expression "piVar6 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "pcVar7 = strerror(*piVar6);" (assignment_expression "pcVar7 = strerror(*piVar6)" identifier = (call_expression "strerror(*piVar6)" identifier (argument_list "(*piVar6)" ( (pointer_expression "*piVar6" * identifier) )))) ;) (expression_statement "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);" (assignment_expression "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" identifier (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" ( (string_literal ""Unable to save session: open(\"%s\") returned \'%s\'"" " string_content escape_sequence string_content escape_sequence string_content escape_sequence string_content escape_sequence ") , identifier , identifier )))) ;) (expression_statement "*param_2 = uVar1;" (assignment_expression "*param_2 = uVar1" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) }) (else_clause "else {\n      FUN_00020030(pcVar3);\n    }" else (compound_statement "{\n      FUN_00020030(pcVar3);\n    }" { (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) }))) (return_statement "return pFVar4;" return identifier ;) })) (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier (argument_list "("Unable to save session: %s",iVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (return_statement "return (FILE *)0x0;" return (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nvoid * open_settings_w(char *sessionname,char **errmsg)\n\n{\n  char *pcVar1;\n  char *pcVar2;\n  FILE *pFVar3;\n  char *pcVar4;\n  int *piVar5;\n  \n  *errmsg = (char *)0x0;\n  pcVar1 = make_filename(0,(char *)0x0);\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 != (char *)0x0) {\n    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n    *errmsg = pcVar4;\n    safefree(pcVar2);\n    safefree(pcVar1);\n    return (void *)0x0;\n  }\n  safefree(pcVar1);\n  pcVar1 = getenv("PUTTYSESSIONS");\n  if (pcVar1 == (char *)0x0) {\n    pcVar2 = make_filename(0,(char *)0x0);\n    pcVar1 = dupprintf("%s/sessions",pcVar2);\n    safefree(pcVar2);\n  }\n  else {\n    pcVar1 = dupstr(pcVar1);\n  }\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 == (char *)0x0) {\n    safefree(pcVar1);\n    pcVar1 = make_filename(5,sessionname);\n    pFVar3 = fopen64(pcVar1,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }\n    return pFVar3;\n  }\n  pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n  *errmsg = pcVar4;\n  safefree(pcVar2);\n  safefree(pcVar1);\n  return (void *)0x0;\n}\n\n" comment comment (function_definition "void * open_settings_w(char *sessionname,char **errmsg)\n\n{\n  char *pcVar1;\n  char *pcVar2;\n  FILE *pFVar3;\n  char *pcVar4;\n  int *piVar5;\n  \n  *errmsg = (char *)0x0;\n  pcVar1 = make_filename(0,(char *)0x0);\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 != (char *)0x0) {\n    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n    *errmsg = pcVar4;\n    safefree(pcVar2);\n    safefree(pcVar1);\n    return (void *)0x0;\n  }\n  safefree(pcVar1);\n  pcVar1 = getenv("PUTTYSESSIONS");\n  if (pcVar1 == (char *)0x0) {\n    pcVar2 = make_filename(0,(char *)0x0);\n    pcVar1 = dupprintf("%s/sessions",pcVar2);\n    safefree(pcVar2);\n  }\n  else {\n    pcVar1 = dupstr(pcVar1);\n  }\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 == (char *)0x0) {\n    safefree(pcVar1);\n    pcVar1 = make_filename(5,sessionname);\n    pFVar3 = fopen64(pcVar1,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }\n    return pFVar3;\n  }\n  pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n  *errmsg = pcVar4;\n  safefree(pcVar2);\n  safefree(pcVar1);\n  return (void *)0x0;\n}" primitive_type (pointer_declarator "* open_settings_w(char *sessionname,char **errmsg)" * (function_declarator "open_settings_w(char *sessionname,char **errmsg)" identifier (parameter_list "(char *sessionname,char **errmsg)" ( (parameter_declaration "char *sessionname" primitive_type (pointer_declarator "*sessionname" * identifier)) , (parameter_declaration "char **errmsg" primitive_type (pointer_declarator "**errmsg" * (pointer_declarator "*errmsg" * identifier))) )))) (compound_statement "{\n  char *pcVar1;\n  char *pcVar2;\n  FILE *pFVar3;\n  char *pcVar4;\n  int *piVar5;\n  \n  *errmsg = (char *)0x0;\n  pcVar1 = make_filename(0,(char *)0x0);\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 != (char *)0x0) {\n    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n    *errmsg = pcVar4;\n    safefree(pcVar2);\n    safefree(pcVar1);\n    return (void *)0x0;\n  }\n  safefree(pcVar1);\n  pcVar1 = getenv("PUTTYSESSIONS");\n  if (pcVar1 == (char *)0x0) {\n    pcVar2 = make_filename(0,(char *)0x0);\n    pcVar1 = dupprintf("%s/sessions",pcVar2);\n    safefree(pcVar2);\n  }\n  else {\n    pcVar1 = dupstr(pcVar1);\n  }\n  pcVar2 = make_dir_path(pcVar1,0x1c0);\n  if (pcVar2 == (char *)0x0) {\n    safefree(pcVar1);\n    pcVar1 = make_filename(5,sessionname);\n    pFVar3 = fopen64(pcVar1,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }\n    return pFVar3;\n  }\n  pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n  *errmsg = pcVar4;\n  safefree(pcVar2);\n  safefree(pcVar1);\n  return (void *)0x0;\n}" { (declaration "char *pcVar1;" primitive_type (pointer_declarator "*pcVar1" * identifier) ;) (declaration "char *pcVar2;" primitive_type (pointer_declarator "*pcVar2" * identifier) ;) (declaration "FILE *pFVar3;" type_identifier (pointer_declarator "*pFVar3" * identifier) ;) (declaration "char *pcVar4;" primitive_type (pointer_declarator "*pcVar4" * identifier) ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (expression_statement "*errmsg = (char *)0x0;" (assignment_expression "*errmsg = (char *)0x0" (pointer_expression "*errmsg" * identifier) = (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) ;) (expression_statement "pcVar1 = make_filename(0,(char *)0x0);" (assignment_expression "pcVar1 = make_filename(0,(char *)0x0)" identifier = (call_expression "make_filename(0,(char *)0x0)" identifier (argument_list "(0,(char *)0x0)" ( number_literal , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (expression_statement "pcVar2 = make_dir_path(pcVar1,0x1c0);" (assignment_expression "pcVar2 = make_dir_path(pcVar1,0x1c0)" identifier = (call_expression "make_dir_path(pcVar1,0x1c0)" identifier (argument_list "(pcVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (pcVar2 != (char *)0x0) {\n    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n    *errmsg = pcVar4;\n    safefree(pcVar2);\n    safefree(pcVar1);\n    return (void *)0x0;\n  }" if (parenthesized_expression "(pcVar2 != (char *)0x0)" ( (binary_expression "pcVar2 != (char *)0x0" identifier != (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    pcVar4 = dupprintf("Unable to save session: %s",pcVar2);\n    *errmsg = pcVar4;\n    safefree(pcVar2);\n    safefree(pcVar1);\n    return (void *)0x0;\n  }" { (expression_statement "pcVar4 = dupprintf("Unable to save session: %s",pcVar2);" (assignment_expression "pcVar4 = dupprintf("Unable to save session: %s",pcVar2)" identifier = (call_expression "dupprintf("Unable to save session: %s",pcVar2)" identifier (argument_list "("Unable to save session: %s",pcVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*errmsg = pcVar4;" (assignment_expression "*errmsg = pcVar4" (pointer_expression "*errmsg" * identifier) = identifier) ;) (expression_statement "safefree(pcVar2);" (call_expression "safefree(pcVar2)" identifier (argument_list "(pcVar2)" ( identifier ))) ;) (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) (expression_statement "pcVar1 = getenv("PUTTYSESSIONS");" (assignment_expression "pcVar1 = getenv("PUTTYSESSIONS")" identifier = (call_expression "getenv("PUTTYSESSIONS")" identifier (argument_list "("PUTTYSESSIONS")" ( (string_literal ""PUTTYSESSIONS"" " string_content ") )))) ;) (if_statement "if (pcVar1 == (char *)0x0) {\n    pcVar2 = make_filename(0,(char *)0x0);\n    pcVar1 = dupprintf("%s/sessions",pcVar2);\n    safefree(pcVar2);\n  }\n  else {\n    pcVar1 = dupstr(pcVar1);\n  }" if (parenthesized_expression "(pcVar1 == (char *)0x0)" ( (binary_expression "pcVar1 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    pcVar2 = make_filename(0,(char *)0x0);\n    pcVar1 = dupprintf("%s/sessions",pcVar2);\n    safefree(pcVar2);\n  }" { (expression_statement "pcVar2 = make_filename(0,(char *)0x0);" (assignment_expression "pcVar2 = make_filename(0,(char *)0x0)" identifier = (call_expression "make_filename(0,(char *)0x0)" identifier (argument_list "(0,(char *)0x0)" ( number_literal , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (expression_statement "pcVar1 = dupprintf("%s/sessions",pcVar2);" (assignment_expression "pcVar1 = dupprintf("%s/sessions",pcVar2)" identifier = (call_expression "dupprintf("%s/sessions",pcVar2)" identifier (argument_list "("%s/sessions",pcVar2)" ( (string_literal ""%s/sessions"" " string_content ") , identifier )))) ;) (expression_statement "safefree(pcVar2);" (call_expression "safefree(pcVar2)" identifier (argument_list "(pcVar2)" ( identifier ))) ;) }) (else_clause "else {\n    pcVar1 = dupstr(pcVar1);\n  }" else (compound_statement "{\n    pcVar1 = dupstr(pcVar1);\n  }" { (expression_statement "pcVar1 = dupstr(pcVar1);" (assignment_expression "pcVar1 = dupstr(pcVar1)" identifier = (call_expression "dupstr(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier )))) ;) }))) (expression_statement "pcVar2 = make_dir_path(pcVar1,0x1c0);" (assignment_expression "pcVar2 = make_dir_path(pcVar1,0x1c0)" identifier = (call_expression "make_dir_path(pcVar1,0x1c0)" identifier (argument_list "(pcVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (pcVar2 == (char *)0x0) {\n    safefree(pcVar1);\n    pcVar1 = make_filename(5,sessionname);\n    pFVar3 = fopen64(pcVar1,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }\n    return pFVar3;\n  }" if (parenthesized_expression "(pcVar2 == (char *)0x0)" ( (binary_expression "pcVar2 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    safefree(pcVar1);\n    pcVar1 = make_filename(5,sessionname);\n    pFVar3 = fopen64(pcVar1,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }\n    return pFVar3;\n  }" { (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) (expression_statement "pcVar1 = make_filename(5,sessionname);" (assignment_expression "pcVar1 = make_filename(5,sessionname)" identifier = (call_expression "make_filename(5,sessionname)" identifier (argument_list "(5,sessionname)" ( number_literal , identifier )))) ;) (expression_statement "pFVar3 = fopen64(pcVar1,"w");" (assignment_expression "pFVar3 = fopen64(pcVar1,"w")" identifier = (call_expression "fopen64(pcVar1,"w")" identifier (argument_list "(pcVar1,"w")" ( identifier , (string_literal ""w"" " string_content ") )))) ;) (if_statement "if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }\n    else {\n      safefree(pcVar1);\n    }" if (parenthesized_expression "(pFVar3 == (FILE *)0x0)" ( (binary_expression "pFVar3 == (FILE *)0x0" identifier == (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      piVar5 = __errno_location();\n      pcVar2 = strerror(*piVar5);\n      pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);\n      *errmsg = pcVar2;\n      safefree(pcVar1);\n    }" { (expression_statement "piVar5 = __errno_location();" (assignment_expression "piVar5 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "pcVar2 = strerror(*piVar5);" (assignment_expression "pcVar2 = strerror(*piVar5)" identifier = (call_expression "strerror(*piVar5)" identifier (argument_list "(*piVar5)" ( (pointer_expression "*piVar5" * identifier) )))) ;) (expression_statement "pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2);" (assignment_expression "pcVar2 = dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2)" identifier = (call_expression "dupprintf("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2)" identifier (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,pcVar2)" ( (string_literal ""Unable to save session: open(\"%s\") returned \'%s\'"" " string_content escape_sequence string_content escape_sequence string_content escape_sequence string_content escape_sequence ") , identifier , identifier )))) ;) (expression_statement "*errmsg = pcVar2;" (assignment_expression "*errmsg = pcVar2" (pointer_expression "*errmsg" * identifier) = identifier) ;) (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) }) (else_clause "else {\n      safefree(pcVar1);\n    }" else (compound_statement "{\n      safefree(pcVar1);\n    }" { (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) }))) (return_statement "return pFVar3;" return identifier ;) })) (expression_statement "pcVar4 = dupprintf("Unable to save session: %s",pcVar2);" (assignment_expression "pcVar4 = dupprintf("Unable to save session: %s",pcVar2)" identifier = (call_expression "dupprintf("Unable to save session: %s",pcVar2)" identifier (argument_list "("Unable to save session: %s",pcVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*errmsg = pcVar4;" (assignment_expression "*errmsg = pcVar4" (pointer_expression "*errmsg" * identifier) = identifier) ;) (expression_statement "safefree(pcVar2);" (call_expression "safefree(pcVar2)" identifier (argument_list "(pcVar2)" ( identifier ))) ;) (expression_statement "safefree(pcVar1);" (call_expression "safefree(pcVar1)" identifier (argument_list "(pcVar1)" ( identifier ))) ;) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "FILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}\n\n" (function_definition "FILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" type_identifier (pointer_declarator "* FUN_00085330(undefined4 param_1,undefined4 *param_2)" * (function_declarator "FUN_00085330(undefined4 param_1,undefined4 *param_2)" identifier (parameter_list "(undefined4 param_1,undefined4 *param_2)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) )))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "char *pcVar3;" primitive_type (pointer_declarator "*pcVar3" * identifier) ;) (declaration "FILE *pFVar4;" type_identifier (pointer_declarator "*pFVar4" * identifier) ;) (declaration "undefined4 uVar5;" type_identifier identifier ;) (declaration "int *piVar6;" primitive_type (pointer_declarator "*piVar6" * identifier) ;) (declaration "char *pcVar7;" primitive_type (pointer_declarator "*pcVar7" * identifier) ;) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" * identifier) = number_literal) ;) (expression_statement "uVar1 = FUN_00084c80();" (assignment_expression "uVar1 = FUN_00084c80()" identifier = (call_expression "FUN_00084c80()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" identifier = (call_expression "FUN_0007d880(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" { (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier (argument_list "("Unable to save session: %s",iVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (return_statement "return (FILE *)0x0;" return (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "pcVar3 = getenv("PUTTYSESSIONS");" (assignment_expression "pcVar3 = getenv("PUTTYSESSIONS")" identifier = (call_expression "getenv("PUTTYSESSIONS")" identifier (argument_list "("PUTTYSESSIONS")" ( (string_literal ""PUTTYSESSIONS"" " string_content ") )))) ;) (if_statement "if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" if (parenthesized_expression "(pcVar3 == (char *)0x0)" ( (binary_expression "pcVar3 == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }" { (expression_statement "uVar5 = FUN_00084c80();" (assignment_expression "uVar5 = FUN_00084c80()" identifier = (call_expression "FUN_00084c80()" identifier (argument_list "()" ( )))) ;) (expression_statement "uVar1 = FUN_0001f1a0("%s/sessions",uVar5);" (assignment_expression "uVar1 = FUN_0001f1a0("%s/sessions",uVar5)" identifier = (call_expression "FUN_0001f1a0("%s/sessions",uVar5)" identifier (argument_list "("%s/sessions",uVar5)" ( (string_literal ""%s/sessions"" " string_content ") , identifier )))) ;) (expression_statement "FUN_00020030(uVar5);" (call_expression "FUN_00020030(uVar5)" identifier (argument_list "(uVar5)" ( identifier ))) ;) }) (else_clause "else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" else (compound_statement "{\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" { (expression_statement "uVar1 = FUN_0001eed0(pcVar3);" (assignment_expression "uVar1 = FUN_0001eed0(pcVar3)" identifier = (call_expression "FUN_0001eed0(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier )))) ;) }))) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" identifier = (call_expression "FUN_0007d880(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" { (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "pcVar3 = (char *)FUN_00084c80();" (assignment_expression "pcVar3 = (char *)FUN_00084c80()" identifier = (cast_expression "(char *)FUN_00084c80()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_00084c80()" identifier (argument_list "()" ( ))))) ;) (expression_statement "pFVar4 = fopen64(pcVar3,"w");" (assignment_expression "pFVar4 = fopen64(pcVar3,"w")" identifier = (call_expression "fopen64(pcVar3,"w")" identifier (argument_list "(pcVar3,"w")" ( identifier , (string_literal ""w"" " string_content ") )))) ;) (if_statement "if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }" if (parenthesized_expression "(pFVar4 == (FILE *)0x0)" ( (binary_expression "pFVar4 == (FILE *)0x0" identifier == (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }" { (expression_statement "piVar6 = __errno_location();" (assignment_expression "piVar6 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "pcVar7 = strerror(*piVar6);" (assignment_expression "pcVar7 = strerror(*piVar6)" identifier = (call_expression "strerror(*piVar6)" identifier (argument_list "(*piVar6)" ( (pointer_expression "*piVar6" * identifier) )))) ;) (expression_statement "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);" (assignment_expression "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" identifier (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" ( (string_literal ""Unable to save session: open(\"%s\") returned \'%s\'"" " string_content escape_sequence string_content escape_sequence string_content escape_sequence string_content escape_sequence ") , identifier , identifier )))) ;) (expression_statement "*param_2 = uVar1;" (assignment_expression "*param_2 = uVar1" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) }) (else_clause "else {\n      FUN_00020030(pcVar3);\n    }" else (compound_statement "{\n      FUN_00020030(pcVar3);\n    }" { (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) }))) (return_statement "return pFVar4;" return identifier ;) })) (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" identifier (argument_list "("Unable to save session: %s",iVar2)" ( (string_literal ""Unable to save session: %s"" " string_content ") , identifier )))) ;) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (return_statement "return (FILE *)0x0;" return (cast_expression "(FILE *)0x0" ( (type_descriptor "FILE *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit (function_definition TYPE (pointer_declarator * (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) )))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (string_literal " string_content ") , IDENT )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (string_literal " string_content ") )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (string_literal " string_content ") , IDENT )))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) }))) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( ))))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (string_literal " string_content ") )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (pointer_expression * IDENT) )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (string_literal " string_content escape_sequence string_content escape_sequence string_content escape_sequence string_content escape_sequence ") , IDENT , IDENT )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }))) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (string_literal " string_content ") , IDENT )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })))
(function_definition "FILE * FUN_00085330(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" (type_identifier "FILE") (pointer_declarator "* FUN_00085330(undefined4 param_1,undefined4 *param_2)" (* "*") (function_declarator "FUN_00085330(undefined4 param_1,undefined4 *param_2)" (identifier "FUN_00085330") (parameter_list "(undefined4 param_1,undefined4 *param_2)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 *param_2" (type_identifier "undefined4") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) () ")")))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  char *pcVar3;\n  FILE *pFVar4;\n  undefined4 uVar5;\n  int *piVar6;\n  char *pcVar7;\n  \n  *param_2 = 0;\n  uVar1 = FUN_00084c80();\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_00020030(uVar1);\n  pcVar3 = getenv("PUTTYSESSIONS");\n  if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }\n  iVar2 = FUN_0007d880(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }\n  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n  *param_2 = uVar5;\n  FUN_00020030(iVar2);\n  FUN_00020030(uVar1);\n  return (FILE *)0x0;\n}" ({ "{") (declaration "undefined4 uVar1;" (type_identifier "undefined4") (identifier "uVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "char *pcVar3;" (primitive_type "char") (pointer_declarator "*pcVar3" (* "*") (identifier "pcVar3")) (; ";")) (declaration "FILE *pFVar4;" (type_identifier "FILE") (pointer_declarator "*pFVar4" (* "*") (identifier "pFVar4")) (; ";")) (declaration "undefined4 uVar5;" (type_identifier "undefined4") (identifier "uVar5") (; ";")) (declaration "int *piVar6;" (primitive_type "int") (pointer_declarator "*piVar6" (* "*") (identifier "piVar6")) (; ";")) (declaration "char *pcVar7;" (primitive_type "char") (pointer_declarator "*pcVar7" (* "*") (identifier "pcVar7")) (; ";")) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (number_literal "0")) (; ";")) (expression_statement "uVar1 = FUN_00084c80();" (assignment_expression "uVar1 = FUN_00084c80()" (identifier "uVar1") (= "=") (call_expression "FUN_00084c80()" (identifier "FUN_00084c80") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" (identifier "iVar2") (= "=") (call_expression "FUN_0007d880(uVar1,0x1c0)" (identifier "FUN_0007d880") (argument_list "(uVar1,0x1c0)" (( "(") (identifier "uVar1") (, ",") (number_literal "0x1c0") () ")")))) (; ";")) (if_statement "if (iVar2 != 0) {\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" (if "if") (parenthesized_expression "(iVar2 != 0)" (( "(") (binary_expression "iVar2 != 0" (identifier "iVar2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);\n    *param_2 = uVar5;\n    FUN_00020030(iVar2);\n    FUN_00020030(uVar1);\n    return (FILE *)0x0;\n  }" ({ "{") (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" (identifier "uVar5") (= "=") (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" (identifier "FUN_0001f1a0") (argument_list "("Unable to save session: %s",iVar2)" (( "(") (string_literal ""Unable to save session: %s"" (" """) (string_content "Unable to save session: %s") (" """)) (, ",") (identifier "iVar2") () ")")))) (; ";")) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar5")) (; ";")) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" (identifier "FUN_00020030") (argument_list "(iVar2)" (( "(") (identifier "iVar2") () ")"))) (; ";")) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" (identifier "FUN_00020030") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (return_statement "return (FILE *)0x0;" (return "return") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}"))) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" (identifier "FUN_00020030") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (expression_statement "pcVar3 = getenv("PUTTYSESSIONS");" (assignment_expression "pcVar3 = getenv("PUTTYSESSIONS")" (identifier "pcVar3") (= "=") (call_expression "getenv("PUTTYSESSIONS")" (identifier "getenv") (argument_list "("PUTTYSESSIONS")" (( "(") (string_literal ""PUTTYSESSIONS"" (" """) (string_content "PUTTYSESSIONS") (" """)) () ")")))) (; ";")) (if_statement "if (pcVar3 == (char *)0x0) {\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }\n  else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" (if "if") (parenthesized_expression "(pcVar3 == (char *)0x0)" (( "(") (binary_expression "pcVar3 == (char *)0x0" (identifier "pcVar3") (== "==") (cast_expression "(char *)0x0" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    uVar5 = FUN_00084c80();\n    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);\n    FUN_00020030(uVar5);\n  }" ({ "{") (expression_statement "uVar5 = FUN_00084c80();" (assignment_expression "uVar5 = FUN_00084c80()" (identifier "uVar5") (= "=") (call_expression "FUN_00084c80()" (identifier "FUN_00084c80") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "uVar1 = FUN_0001f1a0("%s/sessions",uVar5);" (assignment_expression "uVar1 = FUN_0001f1a0("%s/sessions",uVar5)" (identifier "uVar1") (= "=") (call_expression "FUN_0001f1a0("%s/sessions",uVar5)" (identifier "FUN_0001f1a0") (argument_list "("%s/sessions",uVar5)" (( "(") (string_literal ""%s/sessions"" (" """) (string_content "%s/sessions") (" """)) (, ",") (identifier "uVar5") () ")")))) (; ";")) (expression_statement "FUN_00020030(uVar5);" (call_expression "FUN_00020030(uVar5)" (identifier "FUN_00020030") (argument_list "(uVar5)" (( "(") (identifier "uVar5") () ")"))) (; ";")) (} "}")) (else_clause "else {\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" (else "else") (compound_statement "{\n    uVar1 = FUN_0001eed0(pcVar3);\n  }" ({ "{") (expression_statement "uVar1 = FUN_0001eed0(pcVar3);" (assignment_expression "uVar1 = FUN_0001eed0(pcVar3)" (identifier "uVar1") (= "=") (call_expression "FUN_0001eed0(pcVar3)" (identifier "FUN_0001eed0") (argument_list "(pcVar3)" (( "(") (identifier "pcVar3") () ")")))) (; ";")) (} "}")))) (expression_statement "iVar2 = FUN_0007d880(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_0007d880(uVar1,0x1c0)" (identifier "iVar2") (= "=") (call_expression "FUN_0007d880(uVar1,0x1c0)" (identifier "FUN_0007d880") (argument_list "(uVar1,0x1c0)" (( "(") (identifier "uVar1") (, ",") (number_literal "0x1c0") () ")")))) (; ";")) (if_statement "if (iVar2 == 0) {\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n    FUN_00020030(uVar1);\n    pcVar3 = (char *)FUN_00084c80();\n    pFVar4 = fopen64(pcVar3,"w");\n    if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }\n    return pFVar4;\n  }" ({ "{") (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" (identifier "FUN_00020030") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (expression_statement "pcVar3 = (char *)FUN_00084c80();" (assignment_expression "pcVar3 = (char *)FUN_00084c80()" (identifier "pcVar3") (= "=") (cast_expression "(char *)FUN_00084c80()" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_00084c80()" (identifier "FUN_00084c80") (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "pFVar4 = fopen64(pcVar3,"w");" (assignment_expression "pFVar4 = fopen64(pcVar3,"w")" (identifier "pFVar4") (= "=") (call_expression "fopen64(pcVar3,"w")" (identifier "fopen64") (argument_list "(pcVar3,"w")" (( "(") (identifier "pcVar3") (, ",") (string_literal ""w"" (" """) (string_content "w") (" """)) () ")")))) (; ";")) (if_statement "if (pFVar4 == (FILE *)0x0) {\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }\n    else {\n      FUN_00020030(pcVar3);\n    }" (if "if") (parenthesized_expression "(pFVar4 == (FILE *)0x0)" (( "(") (binary_expression "pFVar4 == (FILE *)0x0" (identifier "pFVar4") (== "==") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n      piVar6 = __errno_location();\n      pcVar7 = strerror(*piVar6);\n      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);\n      *param_2 = uVar1;\n      FUN_00020030(pcVar3);\n    }" ({ "{") (expression_statement "piVar6 = __errno_location();" (assignment_expression "piVar6 = __errno_location()" (identifier "piVar6") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "pcVar7 = strerror(*piVar6);" (assignment_expression "pcVar7 = strerror(*piVar6)" (identifier "pcVar7") (= "=") (call_expression "strerror(*piVar6)" (identifier "strerror") (argument_list "(*piVar6)" (( "(") (pointer_expression "*piVar6" (* "*") (identifier "piVar6")) () ")")))) (; ";")) (expression_statement "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);" (assignment_expression "uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" (identifier "uVar1") (= "=") (call_expression "FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" (identifier "FUN_0001f1a0") (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7)" (( "(") (string_literal ""Unable to save session: open(\"%s\") returned \'%s\'"" (" """) (string_content "Unable to save session: open(") (escape_sequence "\"") (string_content "%s") (escape_sequence "\"") (string_content ") returned ") (escape_sequence "\'") (string_content "%s") (escape_sequence "\'") (" """)) (, ",") (identifier "pcVar3") (, ",") (identifier "pcVar7") () ")")))) (; ";")) (expression_statement "*param_2 = uVar1;" (assignment_expression "*param_2 = uVar1" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar1")) (; ";")) (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" (identifier "FUN_00020030") (argument_list "(pcVar3)" (( "(") (identifier "pcVar3") () ")"))) (; ";")) (} "}")) (else_clause "else {\n      FUN_00020030(pcVar3);\n    }" (else "else") (compound_statement "{\n      FUN_00020030(pcVar3);\n    }" ({ "{") (expression_statement "FUN_00020030(pcVar3);" (call_expression "FUN_00020030(pcVar3)" (identifier "FUN_00020030") (argument_list "(pcVar3)" (( "(") (identifier "pcVar3") () ")"))) (; ";")) (} "}")))) (return_statement "return pFVar4;" (return "return") (identifier "pFVar4") (; ";")) (} "}"))) (expression_statement "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);" (assignment_expression "uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2)" (identifier "uVar5") (= "=") (call_expression "FUN_0001f1a0("Unable to save session: %s",iVar2)" (identifier "FUN_0001f1a0") (argument_list "("Unable to save session: %s",iVar2)" (( "(") (string_literal ""Unable to save session: %s"" (" """) (string_content "Unable to save session: %s") (" """)) (, ",") (identifier "iVar2") () ")")))) (; ";")) (expression_statement "*param_2 = uVar5;" (assignment_expression "*param_2 = uVar5" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar5")) (; ";")) (expression_statement "FUN_00020030(iVar2);" (call_expression "FUN_00020030(iVar2)" (identifier "FUN_00020030") (argument_list "(iVar2)" (( "(") (identifier "iVar2") () ")"))) (; ";")) (expression_statement "FUN_00020030(uVar1);" (call_expression "FUN_00020030(uVar1)" (identifier "FUN_00020030") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (return_statement "return (FILE *)0x0;" (return "return") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}")))

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

void * function_1(char *sessionname,char **errmsg)

{
  char *var_7;
  char *var_3;
  type_1 *var_10;
  char *pcVar4;
  int *piVar5;
  
  *errmsg = (char *)0x0;
  var_7 = var_1(0,(char *)0x0);
  var_3 = var_2(var_7,0x1c0);
  if (var_3 != (char *)0x0) {
    pcVar4 = var_4("Unable to save session: %s",var_3);
    *errmsg = pcVar4;
    var_5(var_3);
    var_5(var_7);
    return (void *)0x0;
  }
  var_5(var_7);
  var_7 = var_6("PUTTYSESSIONS");
  if (var_7 == (char *)0x0) {
    var_3 = var_1(0,(char *)0x0);
    var_7 = var_4("%s/sessions",var_3);
    var_5(var_3);
  }
  else {
    var_7 = var_8(var_7);
  }
  var_3 = var_2(var_7,0x1c0);
  if (var_3 == (char *)0x0) {
    var_5(var_7);
    var_7 = var_1(5,sessionname);
    var_10 = var_9(var_7,"w");
    if (var_10 == (type_1 *)0x0) {
      piVar5 = var_11();
      var_3 = var_12(*piVar5);
      var_3 = var_4("Unable to save session: open(\"%s\") returned \'%s\'",var_7,var_3);
      *errmsg = var_3;
      var_5(var_7);
    }
    else {
      var_5(var_7);
    }
    return var_10;
  }
  pcVar4 = var_4("Unable to save session: %s",var_3);
  *errmsg = pcVar4;
  var_5(var_3);
  var_5(var_7);
  return (void *)0x0;
}


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

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

FILE * MASKED(undefined4 param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  char *pcVar3;
  FILE *pFVar4;
  undefined4 uVar5;
  int *piVar6;
  char *pcVar7;
  
  *param_2 = 0;
  uVar1 = FUN_00084c80();
  iVar2 = FUN_0007d880(uVar1,0x1c0);
  if (iVar2 != 0) {
    uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);
    *param_2 = uVar5;
    FUN_00020030(iVar2);
    FUN_00020030(uVar1);
    return (FILE *)0x0;
  }
  FUN_00020030(uVar1);
  pcVar3 = getenv("PUTTYSESSIONS");
  if (pcVar3 == (char *)0x0) {
    uVar5 = FUN_00084c80();
    uVar1 = FUN_0001f1a0("%s/sessions",uVar5);
    FUN_00020030(uVar5);
  }
  else {
    uVar1 = FUN_0001eed0(pcVar3);
  }
  iVar2 = FUN_0007d880(uVar1,0x1c0);
  if (iVar2 == 0) {
    FUN_00020030(uVar1);
    pcVar3 = (char *)FUN_00084c80();
    pFVar4 = fopen64(pcVar3,"w");
    if (pFVar4 == (FILE *)0x0) {
      piVar6 = __errno_location();
      pcVar7 = strerror(*piVar6);
      uVar1 = FUN_0001f1a0("Unable to save session: open(\"%s\") returned \'%s\'",pcVar3,pcVar7);
      *param_2 = uVar1;
      FUN_00020030(pcVar3);
    }
    else {
      FUN_00020030(pcVar3);
    }
    return pFVar4;
  }
  uVar5 = FUN_0001f1a0("Unable to save session: %s",iVar2);
  *param_2 = uVar5;
  FUN_00020030(iVar2);
  FUN_00020030(uVar1);
  return (FILE *)0x0;
}

