
/* 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 = make_filename(4,(char *)0x0);
  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_0009fa20(undefined4 param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  int iVar2;
  char *__filename;
  FILE *pFVar3;
  undefined4 uVar4;
  int *piVar5;
  char *pcVar6;
  
  *param_2 = 0;
  uVar1 = FUN_0009f370();
  iVar2 = FUN_00099b60(uVar1,0x1c0);
  if (iVar2 != 0) {
    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);
    *param_2 = uVar4;
    FUN_0002f010(iVar2);
    FUN_0002f010(uVar1);
    return (FILE *)0x0;
  }
  FUN_0002f010(uVar1);
  uVar1 = FUN_0009f370();
  iVar2 = FUN_00099b60(uVar1,0x1c0);
  if (iVar2 == 0) {
    FUN_0002f010(uVar1);
    __filename = (char *)FUN_0009f370();
    pFVar3 = fopen64(__filename,"w");
    if (pFVar3 == (FILE *)0x0) {
      piVar5 = __errno_location();
      pcVar6 = strerror(*piVar5);
      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)
      ;
      *param_2 = uVar1;
      FUN_0002f010(__filename);
    }
    else {
      FUN_0002f010(__filename);
    }
    return pFVar3;
  }
  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);
  *param_2 = uVar4;
  FUN_0002f010(iVar2);
  FUN_0002f010(uVar1);
  return (FILE *)0x0;
}


PUSH EBP
XOR EDX,EDX
XOR EAX,EAX
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x0001c4f0
ADD EBX,0x70d23
SUB ESP,0x1c
MOV EDI,dword ptr [ESP + 0x34]
MOV dword ptr [EDI],0x0
CALL 0x0009f370
SUB ESP,0x8
PUSH 0x1c0
MOV EBP,EAX
PUSH EAX
CALL 0x00099b60
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JNZ 0x0009fb20
SUB ESP,0xc
PUSH EBP
CALL 0x0002f010
XOR EDX,EDX
MOV EAX,0x4
CALL 0x0009f370
POP ECX
MOV EBP,EAX
POP EAX
PUSH 0x1c0
PUSH EBP
CALL 0x00099b60
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x0009fae0
SUB ESP,0xc
PUSH EBP
CALL 0x0002f010
MOV EDX,dword ptr [ESP + 0x40]
MOV EAX,0x5
CALL 0x0009f370
MOV EBP,EAX
POP EAX
LEA EAX,[EBX + 0xfffbc5a6]
POP EDX
PUSH EAX
PUSH EBP
CALL 0x0001a910
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JZ 0x0009fb58
SUB ESP,0xc
PUSH EBP
CALL 0x0002f010
ADD ESP,0x10
ADD ESP,0x1c
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
PUSH EAX
MOV dword ptr [ESP + 0x18],EAX
LEA EAX,[EBX + 0xfffbdbac]
PUSH EAX
CALL 0x0002edf0
MOV EDX,dword ptr [ESP + 0x1c]
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],EDX
CALL 0x0002f010
MOV dword ptr [ESP],EBP
CALL 0x0002f010
ADD ESP,0x10
MOV EAX,ESI
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
PUSH EAX
LEA EAX,[EBX + 0xfffbdbac]
PUSH EAX
CALL 0x0002edf0
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],ESI
XOR ESI,ESI
CALL 0x0002f010
MOV dword ptr [ESP],EBP
CALL 0x0002f010
ADD ESP,0x10
MOV EAX,ESI
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
CALL 0x0001ac30
SUB ESP,0xc
PUSH dword ptr [EAX]
CALL 0x0001b7a0
ADD ESP,0xc
PUSH EAX
LEA EAX,[EBX + 0xfffbdc18]
PUSH EBP
PUSH EAX
CALL 0x0002edf0
MOV dword ptr [EDI],EAX
MOV dword ptr [ESP],EBP
CALL 0x0002f010
ADD ESP,0x10
JMP 0x0009face
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nFILE * FUN_0009fa20(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}\n\n" comment (function_definition "FILE * FUN_0009fa20(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" type_identifier (pointer_declarator "* FUN_0009fa20(undefined4 param_1,undefined4 *param_2)" * (function_declarator "FUN_0009fa20(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 *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "char *__filename;" primitive_type (pointer_declarator "*__filename" * identifier) ;) (declaration "FILE *pFVar3;" type_identifier (pointer_declarator "*pFVar3" * identifier) ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (declaration "char *pcVar6;" primitive_type (pointer_declarator "*pcVar6" * identifier) ;) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" * identifier) = number_literal) ;) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" identifier = (call_expression "FUN_0009f370()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" identifier = (call_expression "FUN_00099b60(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" { (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0002edf0("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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(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_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" identifier = (call_expression "FUN_0009f370()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" identifier = (call_expression "FUN_00099b60(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" { (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "__filename = (char *)FUN_0009f370();" (assignment_expression "__filename = (char *)FUN_0009f370()" identifier = (cast_expression "(char *)FUN_0009f370()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0009f370()" identifier (argument_list "()" ( ))))) ;) (expression_statement "pFVar3 = fopen64(__filename,"w");" (assignment_expression "pFVar3 = fopen64(__filename,"w")" identifier = (call_expression "fopen64(__filename,"w")" identifier (argument_list "(__filename,"w")" ( identifier , (string_literal ""w"" " string_content ") )))) ;) (if_statement "if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\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      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }" { (expression_statement "piVar5 = __errno_location();" (assignment_expression "piVar5 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "pcVar6 = strerror(*piVar5);" (assignment_expression "pcVar6 = strerror(*piVar5)" identifier = (call_expression "strerror(*piVar5)" identifier (argument_list "(*piVar5)" ( (pointer_expression "*piVar5" * identifier) )))) ;) (expression_statement "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;" (assignment_expression "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" identifier = (call_expression "FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" identifier (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" ( (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_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }) (else_clause "else {\n      FUN_0002f010(__filename);\n    }" else (compound_statement "{\n      FUN_0002f010(__filename);\n    }" { (expression_statement "FUN_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }))) (return_statement "return pFVar3;" return identifier ;) })) (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0002edf0("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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(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 = make_filename(4,(char *)0x0);\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 = make_filename(4,(char *)0x0);\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 = make_filename(4,(char *)0x0);\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 = make_filename(4,(char *)0x0);" (assignment_expression "pcVar1 = make_filename(4,(char *)0x0)" identifier = (call_expression "make_filename(4,(char *)0x0)" identifier (argument_list "(4,(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    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_0009fa20(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}\n\n" (function_definition "FILE * FUN_0009fa20(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" type_identifier (pointer_declarator "* FUN_0009fa20(undefined4 param_1,undefined4 *param_2)" * (function_declarator "FUN_0009fa20(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 *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "char *__filename;" primitive_type (pointer_declarator "*__filename" * identifier) ;) (declaration "FILE *pFVar3;" type_identifier (pointer_declarator "*pFVar3" * identifier) ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (declaration "int *piVar5;" primitive_type (pointer_declarator "*piVar5" * identifier) ;) (declaration "char *pcVar6;" primitive_type (pointer_declarator "*pcVar6" * identifier) ;) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" * identifier) = number_literal) ;) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" identifier = (call_expression "FUN_0009f370()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" identifier = (call_expression "FUN_00099b60(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" { (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0002edf0("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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(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_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" identifier = (call_expression "FUN_0009f370()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" identifier = (call_expression "FUN_00099b60(uVar1,0x1c0)" identifier (argument_list "(uVar1,0x1c0)" ( identifier , number_literal )))) ;) (if_statement "if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" { (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;) (expression_statement "__filename = (char *)FUN_0009f370();" (assignment_expression "__filename = (char *)FUN_0009f370()" identifier = (cast_expression "(char *)FUN_0009f370()" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0009f370()" identifier (argument_list "()" ( ))))) ;) (expression_statement "pFVar3 = fopen64(__filename,"w");" (assignment_expression "pFVar3 = fopen64(__filename,"w")" identifier = (call_expression "fopen64(__filename,"w")" identifier (argument_list "(__filename,"w")" ( identifier , (string_literal ""w"" " string_content ") )))) ;) (if_statement "if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\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      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }" { (expression_statement "piVar5 = __errno_location();" (assignment_expression "piVar5 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "pcVar6 = strerror(*piVar5);" (assignment_expression "pcVar6 = strerror(*piVar5)" identifier = (call_expression "strerror(*piVar5)" identifier (argument_list "(*piVar5)" ( (pointer_expression "*piVar5" * identifier) )))) ;) (expression_statement "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;" (assignment_expression "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" identifier = (call_expression "FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" identifier (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" ( (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_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }) (else_clause "else {\n      FUN_0002f010(__filename);\n    }" else (compound_statement "{\n      FUN_0002f010(__filename);\n    }" { (expression_statement "FUN_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" identifier (argument_list "(__filename)" ( identifier ))) ;) }))) (return_statement "return pFVar3;" return identifier ;) })) (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" identifier = (call_expression "FUN_0002edf0("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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" identifier (argument_list "(iVar2)" ( identifier ))) ;) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(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 ( )))) ;) (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_0009fa20(undefined4 param_1,undefined4 *param_2)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  char *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" (type_identifier "FILE") (pointer_declarator "* FUN_0009fa20(undefined4 param_1,undefined4 *param_2)" (* "*") (function_declarator "FUN_0009fa20(undefined4 param_1,undefined4 *param_2)" (identifier "FUN_0009fa20") (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 *__filename;\n  FILE *pFVar3;\n  undefined4 uVar4;\n  int *piVar5;\n  char *pcVar6;\n  \n  *param_2 = 0;\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }\n  FUN_0002f010(uVar1);\n  uVar1 = FUN_0009f370();\n  iVar2 = FUN_00099b60(uVar1,0x1c0);\n  if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }\n  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n  *param_2 = uVar4;\n  FUN_0002f010(iVar2);\n  FUN_0002f010(uVar1);\n  return (FILE *)0x0;\n}" ({ "{") (declaration "undefined4 uVar1;" (type_identifier "undefined4") (identifier "uVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "char *__filename;" (primitive_type "char") (pointer_declarator "*__filename" (* "*") (identifier "__filename")) (; ";")) (declaration "FILE *pFVar3;" (type_identifier "FILE") (pointer_declarator "*pFVar3" (* "*") (identifier "pFVar3")) (; ";")) (declaration "undefined4 uVar4;" (type_identifier "undefined4") (identifier "uVar4") (; ";")) (declaration "int *piVar5;" (primitive_type "int") (pointer_declarator "*piVar5" (* "*") (identifier "piVar5")) (; ";")) (declaration "char *pcVar6;" (primitive_type "char") (pointer_declarator "*pcVar6" (* "*") (identifier "pcVar6")) (; ";")) (expression_statement "*param_2 = 0;" (assignment_expression "*param_2 = 0" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (number_literal "0")) (; ";")) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" (identifier "uVar1") (= "=") (call_expression "FUN_0009f370()" (identifier "FUN_0009f370") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" (identifier "iVar2") (= "=") (call_expression "FUN_00099b60(uVar1,0x1c0)" (identifier "FUN_00099b60") (argument_list "(uVar1,0x1c0)" (( "(") (identifier "uVar1") (, ",") (number_literal "0x1c0") () ")")))) (; ";")) (if_statement "if (iVar2 != 0) {\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" (if "if") (parenthesized_expression "(iVar2 != 0)" (( "(") (binary_expression "iVar2 != 0" (identifier "iVar2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);\n    *param_2 = uVar4;\n    FUN_0002f010(iVar2);\n    FUN_0002f010(uVar1);\n    return (FILE *)0x0;\n  }" ({ "{") (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" (identifier "uVar4") (= "=") (call_expression "FUN_0002edf0("Unable to save session: %s",iVar2)" (identifier "FUN_0002edf0") (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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar4")) (; ";")) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" (identifier "FUN_0002f010") (argument_list "(iVar2)" (( "(") (identifier "iVar2") () ")"))) (; ";")) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" (identifier "FUN_0002f010") (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_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" (identifier "FUN_0002f010") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (expression_statement "uVar1 = FUN_0009f370();" (assignment_expression "uVar1 = FUN_0009f370()" (identifier "uVar1") (= "=") (call_expression "FUN_0009f370()" (identifier "FUN_0009f370") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "iVar2 = FUN_00099b60(uVar1,0x1c0);" (assignment_expression "iVar2 = FUN_00099b60(uVar1,0x1c0)" (identifier "iVar2") (= "=") (call_expression "FUN_00099b60(uVar1,0x1c0)" (identifier "FUN_00099b60") (argument_list "(uVar1,0x1c0)" (( "(") (identifier "uVar1") (, ",") (number_literal "0x1c0") () ")")))) (; ";")) (if_statement "if (iVar2 == 0) {\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n    FUN_0002f010(uVar1);\n    __filename = (char *)FUN_0009f370();\n    pFVar3 = fopen64(__filename,"w");\n    if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }\n    return pFVar3;\n  }" ({ "{") (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" (identifier "FUN_0002f010") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")"))) (; ";")) (expression_statement "__filename = (char *)FUN_0009f370();" (assignment_expression "__filename = (char *)FUN_0009f370()" (identifier "__filename") (= "=") (cast_expression "(char *)FUN_0009f370()" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_0009f370()" (identifier "FUN_0009f370") (argument_list "()" (( "(") () ")"))))) (; ";")) (expression_statement "pFVar3 = fopen64(__filename,"w");" (assignment_expression "pFVar3 = fopen64(__filename,"w")" (identifier "pFVar3") (= "=") (call_expression "fopen64(__filename,"w")" (identifier "fopen64") (argument_list "(__filename,"w")" (( "(") (identifier "__filename") (, ",") (string_literal ""w"" (" """) (string_content "w") (" """)) () ")")))) (; ";")) (if_statement "if (pFVar3 == (FILE *)0x0) {\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }\n    else {\n      FUN_0002f010(__filename);\n    }" (if "if") (parenthesized_expression "(pFVar3 == (FILE *)0x0)" (( "(") (binary_expression "pFVar3 == (FILE *)0x0" (identifier "pFVar3") (== "==") (cast_expression "(FILE *)0x0" (( "(") (type_descriptor "FILE *" (type_identifier "FILE") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n      piVar5 = __errno_location();\n      pcVar6 = strerror(*piVar5);\n      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;\n      *param_2 = uVar1;\n      FUN_0002f010(__filename);\n    }" ({ "{") (expression_statement "piVar5 = __errno_location();" (assignment_expression "piVar5 = __errno_location()" (identifier "piVar5") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "pcVar6 = strerror(*piVar5);" (assignment_expression "pcVar6 = strerror(*piVar5)" (identifier "pcVar6") (= "=") (call_expression "strerror(*piVar5)" (identifier "strerror") (argument_list "(*piVar5)" (( "(") (pointer_expression "*piVar5" (* "*") (identifier "piVar5")) () ")")))) (; ";")) (expression_statement "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)\n      ;" (assignment_expression "uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" (identifier "uVar1") (= "=") (call_expression "FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" (identifier "FUN_0002edf0") (argument_list "("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)" (( "(") (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 "__filename") (, ",") (identifier "pcVar6") () ")")))) (; ";")) (expression_statement "*param_2 = uVar1;" (assignment_expression "*param_2 = uVar1" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar1")) (; ";")) (expression_statement "FUN_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" (identifier "FUN_0002f010") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";")) (} "}")) (else_clause "else {\n      FUN_0002f010(__filename);\n    }" (else "else") (compound_statement "{\n      FUN_0002f010(__filename);\n    }" ({ "{") (expression_statement "FUN_0002f010(__filename);" (call_expression "FUN_0002f010(__filename)" (identifier "FUN_0002f010") (argument_list "(__filename)" (( "(") (identifier "__filename") () ")"))) (; ";")) (} "}")))) (return_statement "return pFVar3;" (return "return") (identifier "pFVar3") (; ";")) (} "}"))) (expression_statement "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);" (assignment_expression "uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2)" (identifier "uVar4") (= "=") (call_expression "FUN_0002edf0("Unable to save session: %s",iVar2)" (identifier "FUN_0002edf0") (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 = uVar4;" (assignment_expression "*param_2 = uVar4" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "uVar4")) (; ";")) (expression_statement "FUN_0002f010(iVar2);" (call_expression "FUN_0002f010(iVar2)" (identifier "FUN_0002f010") (argument_list "(iVar2)" (( "(") (identifier "iVar2") () ")"))) (; ";")) (expression_statement "FUN_0002f010(uVar1);" (call_expression "FUN_0002f010(uVar1)" (identifier "FUN_0002f010") (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 *pcVar1;
  char *var_3;
  type_1 *var_7;
  char *pcVar4;
  int *piVar5;
  
  *errmsg = (char *)0x0;
  pcVar1 = var_1(0,(char *)0x0);
  var_3 = var_2(pcVar1,0x1c0);
  if (var_3 != (char *)0x0) {
    pcVar4 = var_4("Unable to save session: %s",var_3);
    *errmsg = pcVar4;
    var_5(var_3);
    var_5(pcVar1);
    return (void *)0x0;
  }
  var_5(pcVar1);
  pcVar1 = var_1(4,(char *)0x0);
  var_3 = var_2(pcVar1,0x1c0);
  if (var_3 == (char *)0x0) {
    var_5(pcVar1);
    pcVar1 = var_1(5,sessionname);
    var_7 = var_6(pcVar1,"w");
    if (var_7 == (type_1 *)0x0) {
      piVar5 = var_8();
      var_3 = var_9(*piVar5);
      var_3 = var_4("Unable to save session: open(\"%s\") returned \'%s\'",pcVar1,var_3);
      *errmsg = var_3;
      var_5(pcVar1);
    }
    else {
      var_5(pcVar1);
    }
    return var_7;
  }
  pcVar4 = var_4("Unable to save session: %s",var_3);
  *errmsg = pcVar4;
  var_5(var_3);
  var_5(pcVar1);
  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)))) (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 *__filename;
  FILE *pFVar3;
  undefined4 uVar4;
  int *piVar5;
  char *pcVar6;
  
  *param_2 = 0;
  uVar1 = FUN_0009f370();
  iVar2 = FUN_00099b60(uVar1,0x1c0);
  if (iVar2 != 0) {
    uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);
    *param_2 = uVar4;
    FUN_0002f010(iVar2);
    FUN_0002f010(uVar1);
    return (FILE *)0x0;
  }
  FUN_0002f010(uVar1);
  uVar1 = FUN_0009f370();
  iVar2 = FUN_00099b60(uVar1,0x1c0);
  if (iVar2 == 0) {
    FUN_0002f010(uVar1);
    __filename = (char *)FUN_0009f370();
    pFVar3 = fopen64(__filename,"w");
    if (pFVar3 == (FILE *)0x0) {
      piVar5 = __errno_location();
      pcVar6 = strerror(*piVar5);
      uVar1 = FUN_0002edf0("Unable to save session: open(\"%s\") returned \'%s\'",__filename,pcVar6)
      ;
      *param_2 = uVar1;
      FUN_0002f010(__filename);
    }
    else {
      FUN_0002f010(__filename);
    }
    return pFVar3;
  }
  uVar4 = FUN_0002edf0("Unable to save session: %s",iVar2);
  *param_2 = uVar4;
  FUN_0002f010(iVar2);
  FUN_0002f010(uVar1);
  return (FILE *)0x0;
}

