
int _hs_history_patsearch(char *string,int direction,int flags)

{
  char cVar1;
  char *pcVar2;
  int iVar3;
  uint uVar4;
  ulong uVar5;
  ulong uVar6;
  long lVar7;
  
  uVar5 = 0xffffffffffffffff;
  pcVar2 = string;
  do {
    if (uVar5 == 0) break;
    uVar5 = uVar5 - 1;
    cVar1 = *pcVar2;
    pcVar2 = pcVar2 + 1;
  } while (cVar1 != '\0');
  uVar5 = ~uVar5;
  uVar6 = uVar5 - 1;
  iVar3 = (int)uVar6 + -1;
  if (string[iVar3] == '\\') {
    if (iVar3 < 1) {
      return -1;
    }
    uVar4 = (int)uVar6 - 2;
    pcVar2 = string + (int)uVar4;
    if (*pcVar2 != '\\') {
      return -1;
    }
    iVar3 = 1;
    do {
      iVar3 = 1 - iVar3;
      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;
      pcVar2 = pcVar2 + -1;
    } while (*pcVar2 == '\\');
    if (iVar3 != 0) {
      return -1;
    }
  }
  pcVar2 = (char *)xmalloc(uVar5 + 2);
  lVar7 = 0;
  if (((flags & 1U) == 0) && (*string != '*')) {
    *pcVar2 = '*';
    lVar7 = 1;
    uVar6 = uVar5;
  }
  strcpy(pcVar2 + lVar7,string);
  if (pcVar2[uVar6 - 1] != '*') {
    pcVar2[uVar6] = '*';
    pcVar2[uVar6 + 1] = '\0';
  }
  iVar3 = history_search_internal(pcVar2,direction,flags | 2);
  if (string != pcVar2) {
    free(pcVar2);
  }
  return iVar3;
}



undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)

{
  char cVar1;
  undefined4 uVar2;
  char *pcVar3;
  int iVar4;
  uint uVar5;
  ulong uVar6;
  ulong uVar7;
  long lVar8;
  
  uVar6 = 0xffffffffffffffff;
  pcVar3 = param_1;
  do {
    if (uVar6 == 0) break;
    uVar6 = uVar6 - 1;
    cVar1 = *pcVar3;
    pcVar3 = pcVar3 + 1;
  } while (cVar1 != '\0');
  uVar6 = ~uVar6;
  uVar7 = uVar6 - 1;
  iVar4 = (int)uVar7 + -1;
  if (param_1[iVar4] == '\\') {
    if (iVar4 < 1) {
      return 0xffffffff;
    }
    uVar5 = (int)uVar7 - 2;
    pcVar3 = param_1 + (int)uVar5;
    if (*pcVar3 != '\\') {
      return 0xffffffff;
    }
    iVar4 = 1;
    do {
      iVar4 = 1 - iVar4;
      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;
      pcVar3 = pcVar3 + -1;
    } while (*pcVar3 == '\\');
    if (iVar4 != 0) {
      return 0xffffffff;
    }
  }
  pcVar3 = (char *)xmalloc(uVar6 + 2);
  lVar8 = 0;
  if (((param_3 & 1) == 0) && (*param_1 != '*')) {
    *pcVar3 = '*';
    lVar8 = 1;
    uVar7 = uVar6;
  }
  strcpy(pcVar3 + lVar8,param_1);
  if (pcVar3[uVar7 - 1] != '*') {
    pcVar3[uVar7] = '*';
    pcVar3[uVar7 + 1] = '\0';
  }
  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);
  if (param_1 != pcVar3) {
    free(pcVar3);
  }
  return uVar2;
}


PUSH R15
PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
SUB RSP,0x8
MOV RBP,RDI
MOV RCX,-0x1
MOV EAX,0x0
SCASB.REPNE RDI
MOV RBX,RCX
NOT RBX
LEA RBX,[RBX + -0x1]
LEA ECX,[RBX + -0x1]
MOVSXD RDI,ECX
CMP byte ptr [RBP + RDI*0x1],0x5c
JZ 0x001cf275
MOV R13D,EDX
MOV R14D,ESI
LEA RDI,[RBX + 0x3]
CALL 0x00188151
MOV R12,RAX
MOV EDI,0x0
TEST R13B,0x1
JNZ 0x001cf224
CMP byte ptr [RBP],0x2a
JZ 0x001cf224
MOV byte ptr [RAX],0x2a
ADD RBX,0x1
MOV EDI,0x1
ADD RDI,R12
MOV RSI,RBP
CALL 0x0012d160
CMP byte ptr [R12 + RBX*0x1 + -0x1],0x2a
JZ 0x001cf242
MOV byte ptr [R12 + RBX*0x1],0x2a
MOV byte ptr [R12 + RBX*0x1 + 0x1],0x0
MOV EDX,R13D
OR EDX,0x2
MOV ESI,R14D
MOV RDI,R12
CALL 0x001cee9d
MOV R15D,EAX
CMP RBP,R12
JZ 0x001cf263
MOV RDI,R12
CALL 0x0012d080
MOV EAX,R15D
ADD RSP,0x8
POP RBX
POP RBP
POP R12
POP R13
POP R14
POP R15
RET
MOV R15D,0xffffffff
TEST ECX,ECX
JLE 0x001cf263
LEA ECX,[RBX + -0x2]
MOVSXD RDI,ECX
LEA RAX,[RBP + RDI*0x1]
CMP byte ptr [RAX],0x5c
JNZ 0x001cf263
MOV ECX,ECX
SUB RDI,RCX
ADD RDI,RBP
MOV ECX,0x1
MOV R8D,0x1
MOV R9D,R8D
SUB R9D,ECX
MOV ECX,R9D
CMP RAX,RDI
JZ 0x001cf2b9
SUB RAX,0x1
CMP byte ptr [RAX],0x5c
JZ 0x001cf2a2
TEST ECX,ECX
JZ 0x001cf1f5
MOV R15D,0xffffffff
JMP 0x001cf263
(translation_unit "undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)\n\n{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}\n\n" (function_definition "undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)\n\n{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" type_identifier (function_declarator "_hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)" identifier (parameter_list "(char *param_1,undefined4 param_2,uint param_3)" ( (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) ))) (compound_statement "{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "char *pcVar3;" primitive_type (pointer_declarator "*pcVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "ulong uVar6;" type_identifier identifier ;) (declaration "ulong uVar7;" type_identifier identifier ;) (declaration "long lVar8;" (sized_type_specifier "long" long) identifier ;) (expression_statement "uVar6 = 0xffffffffffffffff;" (assignment_expression "uVar6 = 0xffffffffffffffff" identifier = number_literal) ;) (expression_statement "pcVar3 = param_1;" (assignment_expression "pcVar3 = param_1" identifier = identifier) ;) (do_statement "do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');" do (compound_statement "{\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  }" { (if_statement "if (uVar6 == 0) break;" if (parenthesized_expression "(uVar6 == 0)" ( (binary_expression "uVar6 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "uVar6 = uVar6 - 1;" (assignment_expression "uVar6 = uVar6 - 1" identifier = (binary_expression "uVar6 - 1" identifier - number_literal)) ;) (expression_statement "cVar1 = *pcVar3;" (assignment_expression "cVar1 = *pcVar3" identifier = (pointer_expression "*pcVar3" * identifier)) ;) (expression_statement "pcVar3 = pcVar3 + 1;" (assignment_expression "pcVar3 = pcVar3 + 1" identifier = (binary_expression "pcVar3 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "uVar6 = ~uVar6;" (assignment_expression "uVar6 = ~uVar6" identifier = (unary_expression "~uVar6" ~ identifier)) ;) (expression_statement "uVar7 = uVar6 - 1;" (assignment_expression "uVar7 = uVar6 - 1" identifier = (binary_expression "uVar6 - 1" identifier - number_literal)) ;) (expression_statement "iVar4 = (int)uVar7 + -1;" (assignment_expression "iVar4 = (int)uVar7 + -1" identifier = (binary_expression "(int)uVar7 + -1" (cast_expression "(int)uVar7" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal)) ;) (if_statement "if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" if (parenthesized_expression "(param_1[iVar4] == '\\')" ( (binary_expression "param_1[iVar4] == '\\'" (subscript_expression "param_1[iVar4]" identifier [ identifier ]) == (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" { (if_statement "if (iVar4 < 1) {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(iVar4 < 1)" ( (binary_expression "iVar4 < 1" identifier < number_literal) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) (expression_statement "uVar5 = (int)uVar7 - 2;" (assignment_expression "uVar5 = (int)uVar7 - 2" identifier = (binary_expression "(int)uVar7 - 2" (cast_expression "(int)uVar7" ( (type_descriptor "int" primitive_type) ) identifier) - number_literal)) ;) (expression_statement "pcVar3 = param_1 + (int)uVar5;" (assignment_expression "pcVar3 = param_1 + (int)uVar5" identifier = (binary_expression "param_1 + (int)uVar5" identifier + (cast_expression "(int)uVar5" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(*pcVar3 != '\\')" ( (binary_expression "*pcVar3 != '\\'" (pointer_expression "*pcVar3" * identifier) != (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (do_statement "do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');" do (compound_statement "{\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    }" { (expression_statement "iVar4 = 1 - iVar4;" (assignment_expression "iVar4 = 1 - iVar4" identifier = (binary_expression "1 - iVar4" number_literal - identifier)) ;) (if_statement "if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;" if (parenthesized_expression "(pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5))" ( (binary_expression "pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)" identifier == (binary_expression "param_1 + ((long)(int)uVar5 - (ulong)uVar5)" identifier + (parenthesized_expression "((long)(int)uVar5 - (ulong)uVar5)" ( (binary_expression "(long)(int)uVar5 - (ulong)uVar5" (cast_expression "(long)(int)uVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (cast_expression "(int)uVar5" ( (type_descriptor "int" primitive_type) ) identifier)) - (cast_expression "(ulong)uVar5" ( (type_descriptor "ulong" type_identifier) ) identifier)) )))) )) (break_statement "break;" break ;)) (expression_statement "pcVar3 = pcVar3 + -1;" (assignment_expression "pcVar3 = pcVar3 + -1" identifier = (binary_expression "pcVar3 + -1" identifier + number_literal)) ;) }) while (parenthesized_expression "(*pcVar3 == '\\')" ( (binary_expression "*pcVar3 == '\\'" (pointer_expression "*pcVar3" * identifier) == (char_literal "'\\'" ' escape_sequence ')) )) ;) (if_statement "if (iVar4 != 0) {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) })) (expression_statement "pcVar3 = (char *)xmalloc(uVar6 + 2);" (assignment_expression "pcVar3 = (char *)xmalloc(uVar6 + 2)" identifier = (cast_expression "(char *)xmalloc(uVar6 + 2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(uVar6 + 2)" identifier (argument_list "(uVar6 + 2)" ( (binary_expression "uVar6 + 2" identifier + number_literal) ))))) ;) (expression_statement "lVar8 = 0;" (assignment_expression "lVar8 = 0" identifier = number_literal) ;) (if_statement "if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" if (parenthesized_expression "(((param_3 & 1) == 0) && (*param_1 != '*'))" ( (binary_expression "((param_3 & 1) == 0) && (*param_1 != '*')" (parenthesized_expression "((param_3 & 1) == 0)" ( (binary_expression "(param_3 & 1) == 0" (parenthesized_expression "(param_3 & 1)" ( (binary_expression "param_3 & 1" identifier & number_literal) )) == number_literal) )) && (parenthesized_expression "(*param_1 != '*')" ( (binary_expression "*param_1 != '*'" (pointer_expression "*param_1" * identifier) != (char_literal "'*'" ' character ')) ))) )) (compound_statement "{\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" { (expression_statement "*pcVar3 = '*';" (assignment_expression "*pcVar3 = '*'" (pointer_expression "*pcVar3" * identifier) = (char_literal "'*'" ' character ')) ;) (expression_statement "lVar8 = 1;" (assignment_expression "lVar8 = 1" identifier = number_literal) ;) (expression_statement "uVar7 = uVar6;" (assignment_expression "uVar7 = uVar6" identifier = identifier) ;) })) (expression_statement "strcpy(pcVar3 + lVar8,param_1);" (call_expression "strcpy(pcVar3 + lVar8,param_1)" identifier (argument_list "(pcVar3 + lVar8,param_1)" ( (binary_expression "pcVar3 + lVar8" identifier + identifier) , identifier ))) ;) (if_statement "if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" if (parenthesized_expression "(pcVar3[uVar7 - 1] != '*')" ( (binary_expression "pcVar3[uVar7 - 1] != '*'" (subscript_expression "pcVar3[uVar7 - 1]" identifier [ (binary_expression "uVar7 - 1" identifier - number_literal) ]) != (char_literal "'*'" ' character ')) )) (compound_statement "{\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" { (expression_statement "pcVar3[uVar7] = '*';" (assignment_expression "pcVar3[uVar7] = '*'" (subscript_expression "pcVar3[uVar7]" identifier [ identifier ]) = (char_literal "'*'" ' character ')) ;) (expression_statement "pcVar3[uVar7 + 1] = '\0';" (assignment_expression "pcVar3[uVar7 + 1] = '\0'" (subscript_expression "pcVar3[uVar7 + 1]" identifier [ (binary_expression "uVar7 + 1" identifier + number_literal) ]) = (char_literal "'\0'" ' escape_sequence ')) ;) })) (expression_statement "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);" (assignment_expression "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2)" identifier = (call_expression "FUN_001cee9d(pcVar3,param_2,param_3 | 2)" identifier (argument_list "(pcVar3,param_2,param_3 | 2)" ( identifier , identifier , (binary_expression "param_3 | 2" identifier | number_literal) )))) ;) (if_statement "if (param_1 != pcVar3) {\n    free(pcVar3);\n  }" if (parenthesized_expression "(param_1 != pcVar3)" ( (binary_expression "param_1 != pcVar3" identifier != identifier) )) (compound_statement "{\n    free(pcVar3);\n  }" { (expression_statement "free(pcVar3);" (call_expression "free(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) })) (return_statement "return uVar2;" return identifier ;) })))
(translation_unit "int _hs_history_patsearch(char *string,int direction,int flags)\n\n{\n  char cVar1;\n  char *pcVar2;\n  int iVar3;\n  uint uVar4;\n  ulong uVar5;\n  ulong uVar6;\n  long lVar7;\n  \n  uVar5 = 0xffffffffffffffff;\n  pcVar2 = string;\n  do {\n    if (uVar5 == 0) break;\n    uVar5 = uVar5 - 1;\n    cVar1 = *pcVar2;\n    pcVar2 = pcVar2 + 1;\n  } while (cVar1 != '\0');\n  uVar5 = ~uVar5;\n  uVar6 = uVar5 - 1;\n  iVar3 = (int)uVar6 + -1;\n  if (string[iVar3] == '\\') {\n    if (iVar3 < 1) {\n      return -1;\n    }\n    uVar4 = (int)uVar6 - 2;\n    pcVar2 = string + (int)uVar4;\n    if (*pcVar2 != '\\') {\n      return -1;\n    }\n    iVar3 = 1;\n    do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');\n    if (iVar3 != 0) {\n      return -1;\n    }\n  }\n  pcVar2 = (char *)xmalloc(uVar5 + 2);\n  lVar7 = 0;\n  if (((flags & 1U) == 0) && (*string != '*')) {\n    *pcVar2 = '*';\n    lVar7 = 1;\n    uVar6 = uVar5;\n  }\n  strcpy(pcVar2 + lVar7,string);\n  if (pcVar2[uVar6 - 1] != '*') {\n    pcVar2[uVar6] = '*';\n    pcVar2[uVar6 + 1] = '\0';\n  }\n  iVar3 = history_search_internal(pcVar2,direction,flags | 2);\n  if (string != pcVar2) {\n    free(pcVar2);\n  }\n  return iVar3;\n}\n\n" (function_definition "int _hs_history_patsearch(char *string,int direction,int flags)\n\n{\n  char cVar1;\n  char *pcVar2;\n  int iVar3;\n  uint uVar4;\n  ulong uVar5;\n  ulong uVar6;\n  long lVar7;\n  \n  uVar5 = 0xffffffffffffffff;\n  pcVar2 = string;\n  do {\n    if (uVar5 == 0) break;\n    uVar5 = uVar5 - 1;\n    cVar1 = *pcVar2;\n    pcVar2 = pcVar2 + 1;\n  } while (cVar1 != '\0');\n  uVar5 = ~uVar5;\n  uVar6 = uVar5 - 1;\n  iVar3 = (int)uVar6 + -1;\n  if (string[iVar3] == '\\') {\n    if (iVar3 < 1) {\n      return -1;\n    }\n    uVar4 = (int)uVar6 - 2;\n    pcVar2 = string + (int)uVar4;\n    if (*pcVar2 != '\\') {\n      return -1;\n    }\n    iVar3 = 1;\n    do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');\n    if (iVar3 != 0) {\n      return -1;\n    }\n  }\n  pcVar2 = (char *)xmalloc(uVar5 + 2);\n  lVar7 = 0;\n  if (((flags & 1U) == 0) && (*string != '*')) {\n    *pcVar2 = '*';\n    lVar7 = 1;\n    uVar6 = uVar5;\n  }\n  strcpy(pcVar2 + lVar7,string);\n  if (pcVar2[uVar6 - 1] != '*') {\n    pcVar2[uVar6] = '*';\n    pcVar2[uVar6 + 1] = '\0';\n  }\n  iVar3 = history_search_internal(pcVar2,direction,flags | 2);\n  if (string != pcVar2) {\n    free(pcVar2);\n  }\n  return iVar3;\n}" primitive_type (function_declarator "_hs_history_patsearch(char *string,int direction,int flags)" identifier (parameter_list "(char *string,int direction,int flags)" ( (parameter_declaration "char *string" primitive_type (pointer_declarator "*string" * identifier)) , (parameter_declaration "int direction" primitive_type identifier) , (parameter_declaration "int flags" primitive_type identifier) ))) (compound_statement "{\n  char cVar1;\n  char *pcVar2;\n  int iVar3;\n  uint uVar4;\n  ulong uVar5;\n  ulong uVar6;\n  long lVar7;\n  \n  uVar5 = 0xffffffffffffffff;\n  pcVar2 = string;\n  do {\n    if (uVar5 == 0) break;\n    uVar5 = uVar5 - 1;\n    cVar1 = *pcVar2;\n    pcVar2 = pcVar2 + 1;\n  } while (cVar1 != '\0');\n  uVar5 = ~uVar5;\n  uVar6 = uVar5 - 1;\n  iVar3 = (int)uVar6 + -1;\n  if (string[iVar3] == '\\') {\n    if (iVar3 < 1) {\n      return -1;\n    }\n    uVar4 = (int)uVar6 - 2;\n    pcVar2 = string + (int)uVar4;\n    if (*pcVar2 != '\\') {\n      return -1;\n    }\n    iVar3 = 1;\n    do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');\n    if (iVar3 != 0) {\n      return -1;\n    }\n  }\n  pcVar2 = (char *)xmalloc(uVar5 + 2);\n  lVar7 = 0;\n  if (((flags & 1U) == 0) && (*string != '*')) {\n    *pcVar2 = '*';\n    lVar7 = 1;\n    uVar6 = uVar5;\n  }\n  strcpy(pcVar2 + lVar7,string);\n  if (pcVar2[uVar6 - 1] != '*') {\n    pcVar2[uVar6] = '*';\n    pcVar2[uVar6 + 1] = '\0';\n  }\n  iVar3 = history_search_internal(pcVar2,direction,flags | 2);\n  if (string != pcVar2) {\n    free(pcVar2);\n  }\n  return iVar3;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "char *pcVar2;" primitive_type (pointer_declarator "*pcVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "ulong uVar5;" type_identifier identifier ;) (declaration "ulong uVar6;" type_identifier identifier ;) (declaration "long lVar7;" (sized_type_specifier "long" long) identifier ;) (expression_statement "uVar5 = 0xffffffffffffffff;" (assignment_expression "uVar5 = 0xffffffffffffffff" identifier = number_literal) ;) (expression_statement "pcVar2 = string;" (assignment_expression "pcVar2 = string" identifier = identifier) ;) (do_statement "do {\n    if (uVar5 == 0) break;\n    uVar5 = uVar5 - 1;\n    cVar1 = *pcVar2;\n    pcVar2 = pcVar2 + 1;\n  } while (cVar1 != '\0');" do (compound_statement "{\n    if (uVar5 == 0) break;\n    uVar5 = uVar5 - 1;\n    cVar1 = *pcVar2;\n    pcVar2 = pcVar2 + 1;\n  }" { (if_statement "if (uVar5 == 0) break;" if (parenthesized_expression "(uVar5 == 0)" ( (binary_expression "uVar5 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "uVar5 = uVar5 - 1;" (assignment_expression "uVar5 = uVar5 - 1" identifier = (binary_expression "uVar5 - 1" identifier - number_literal)) ;) (expression_statement "cVar1 = *pcVar2;" (assignment_expression "cVar1 = *pcVar2" identifier = (pointer_expression "*pcVar2" * identifier)) ;) (expression_statement "pcVar2 = pcVar2 + 1;" (assignment_expression "pcVar2 = pcVar2 + 1" identifier = (binary_expression "pcVar2 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "uVar5 = ~uVar5;" (assignment_expression "uVar5 = ~uVar5" identifier = (unary_expression "~uVar5" ~ identifier)) ;) (expression_statement "uVar6 = uVar5 - 1;" (assignment_expression "uVar6 = uVar5 - 1" identifier = (binary_expression "uVar5 - 1" identifier - number_literal)) ;) (expression_statement "iVar3 = (int)uVar6 + -1;" (assignment_expression "iVar3 = (int)uVar6 + -1" identifier = (binary_expression "(int)uVar6 + -1" (cast_expression "(int)uVar6" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal)) ;) (if_statement "if (string[iVar3] == '\\') {\n    if (iVar3 < 1) {\n      return -1;\n    }\n    uVar4 = (int)uVar6 - 2;\n    pcVar2 = string + (int)uVar4;\n    if (*pcVar2 != '\\') {\n      return -1;\n    }\n    iVar3 = 1;\n    do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');\n    if (iVar3 != 0) {\n      return -1;\n    }\n  }" if (parenthesized_expression "(string[iVar3] == '\\')" ( (binary_expression "string[iVar3] == '\\'" (subscript_expression "string[iVar3]" identifier [ identifier ]) == (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n    if (iVar3 < 1) {\n      return -1;\n    }\n    uVar4 = (int)uVar6 - 2;\n    pcVar2 = string + (int)uVar4;\n    if (*pcVar2 != '\\') {\n      return -1;\n    }\n    iVar3 = 1;\n    do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');\n    if (iVar3 != 0) {\n      return -1;\n    }\n  }" { (if_statement "if (iVar3 < 1) {\n      return -1;\n    }" if (parenthesized_expression "(iVar3 < 1)" ( (binary_expression "iVar3 < 1" identifier < number_literal) )) (compound_statement "{\n      return -1;\n    }" { (return_statement "return -1;" return number_literal ;) })) (expression_statement "uVar4 = (int)uVar6 - 2;" (assignment_expression "uVar4 = (int)uVar6 - 2" identifier = (binary_expression "(int)uVar6 - 2" (cast_expression "(int)uVar6" ( (type_descriptor "int" primitive_type) ) identifier) - number_literal)) ;) (expression_statement "pcVar2 = string + (int)uVar4;" (assignment_expression "pcVar2 = string + (int)uVar4" identifier = (binary_expression "string + (int)uVar4" identifier + (cast_expression "(int)uVar4" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (*pcVar2 != '\\') {\n      return -1;\n    }" if (parenthesized_expression "(*pcVar2 != '\\')" ( (binary_expression "*pcVar2 != '\\'" (pointer_expression "*pcVar2" * identifier) != (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n      return -1;\n    }" { (return_statement "return -1;" return number_literal ;) })) (expression_statement "iVar3 = 1;" (assignment_expression "iVar3 = 1" identifier = number_literal) ;) (do_statement "do {\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    } while (*pcVar2 == '\\');" do (compound_statement "{\n      iVar3 = 1 - iVar3;\n      if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;\n      pcVar2 = pcVar2 + -1;\n    }" { (expression_statement "iVar3 = 1 - iVar3;" (assignment_expression "iVar3 = 1 - iVar3" identifier = (binary_expression "1 - iVar3" number_literal - identifier)) ;) (if_statement "if (pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)) break;" if (parenthesized_expression "(pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4))" ( (binary_expression "pcVar2 == string + ((long)(int)uVar4 - (ulong)uVar4)" identifier == (binary_expression "string + ((long)(int)uVar4 - (ulong)uVar4)" identifier + (parenthesized_expression "((long)(int)uVar4 - (ulong)uVar4)" ( (binary_expression "(long)(int)uVar4 - (ulong)uVar4" (cast_expression "(long)(int)uVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (cast_expression "(int)uVar4" ( (type_descriptor "int" primitive_type) ) identifier)) - (cast_expression "(ulong)uVar4" ( (type_descriptor "ulong" type_identifier) ) identifier)) )))) )) (break_statement "break;" break ;)) (expression_statement "pcVar2 = pcVar2 + -1;" (assignment_expression "pcVar2 = pcVar2 + -1" identifier = (binary_expression "pcVar2 + -1" identifier + number_literal)) ;) }) while (parenthesized_expression "(*pcVar2 == '\\')" ( (binary_expression "*pcVar2 == '\\'" (pointer_expression "*pcVar2" * identifier) == (char_literal "'\\'" ' escape_sequence ')) )) ;) (if_statement "if (iVar3 != 0) {\n      return -1;\n    }" if (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      return -1;\n    }" { (return_statement "return -1;" return number_literal ;) })) })) (expression_statement "pcVar2 = (char *)xmalloc(uVar5 + 2);" (assignment_expression "pcVar2 = (char *)xmalloc(uVar5 + 2)" identifier = (cast_expression "(char *)xmalloc(uVar5 + 2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(uVar5 + 2)" identifier (argument_list "(uVar5 + 2)" ( (binary_expression "uVar5 + 2" identifier + number_literal) ))))) ;) (expression_statement "lVar7 = 0;" (assignment_expression "lVar7 = 0" identifier = number_literal) ;) (if_statement "if (((flags & 1U) == 0) && (*string != '*')) {\n    *pcVar2 = '*';\n    lVar7 = 1;\n    uVar6 = uVar5;\n  }" if (parenthesized_expression "(((flags & 1U) == 0) && (*string != '*'))" ( (binary_expression "((flags & 1U) == 0) && (*string != '*')" (parenthesized_expression "((flags & 1U) == 0)" ( (binary_expression "(flags & 1U) == 0" (parenthesized_expression "(flags & 1U)" ( (binary_expression "flags & 1U" identifier & number_literal) )) == number_literal) )) && (parenthesized_expression "(*string != '*')" ( (binary_expression "*string != '*'" (pointer_expression "*string" * identifier) != (char_literal "'*'" ' character ')) ))) )) (compound_statement "{\n    *pcVar2 = '*';\n    lVar7 = 1;\n    uVar6 = uVar5;\n  }" { (expression_statement "*pcVar2 = '*';" (assignment_expression "*pcVar2 = '*'" (pointer_expression "*pcVar2" * identifier) = (char_literal "'*'" ' character ')) ;) (expression_statement "lVar7 = 1;" (assignment_expression "lVar7 = 1" identifier = number_literal) ;) (expression_statement "uVar6 = uVar5;" (assignment_expression "uVar6 = uVar5" identifier = identifier) ;) })) (expression_statement "strcpy(pcVar2 + lVar7,string);" (call_expression "strcpy(pcVar2 + lVar7,string)" identifier (argument_list "(pcVar2 + lVar7,string)" ( (binary_expression "pcVar2 + lVar7" identifier + identifier) , identifier ))) ;) (if_statement "if (pcVar2[uVar6 - 1] != '*') {\n    pcVar2[uVar6] = '*';\n    pcVar2[uVar6 + 1] = '\0';\n  }" if (parenthesized_expression "(pcVar2[uVar6 - 1] != '*')" ( (binary_expression "pcVar2[uVar6 - 1] != '*'" (subscript_expression "pcVar2[uVar6 - 1]" identifier [ (binary_expression "uVar6 - 1" identifier - number_literal) ]) != (char_literal "'*'" ' character ')) )) (compound_statement "{\n    pcVar2[uVar6] = '*';\n    pcVar2[uVar6 + 1] = '\0';\n  }" { (expression_statement "pcVar2[uVar6] = '*';" (assignment_expression "pcVar2[uVar6] = '*'" (subscript_expression "pcVar2[uVar6]" identifier [ identifier ]) = (char_literal "'*'" ' character ')) ;) (expression_statement "pcVar2[uVar6 + 1] = '\0';" (assignment_expression "pcVar2[uVar6 + 1] = '\0'" (subscript_expression "pcVar2[uVar6 + 1]" identifier [ (binary_expression "uVar6 + 1" identifier + number_literal) ]) = (char_literal "'\0'" ' escape_sequence ')) ;) })) (expression_statement "iVar3 = history_search_internal(pcVar2,direction,flags | 2);" (assignment_expression "iVar3 = history_search_internal(pcVar2,direction,flags | 2)" identifier = (call_expression "history_search_internal(pcVar2,direction,flags | 2)" identifier (argument_list "(pcVar2,direction,flags | 2)" ( identifier , identifier , (binary_expression "flags | 2" identifier | number_literal) )))) ;) (if_statement "if (string != pcVar2) {\n    free(pcVar2);\n  }" if (parenthesized_expression "(string != pcVar2)" ( (binary_expression "string != pcVar2" identifier != identifier) )) (compound_statement "{\n    free(pcVar2);\n  }" { (expression_statement "free(pcVar2);" (call_expression "free(pcVar2)" identifier (argument_list "(pcVar2)" ( identifier ))) ;) })) (return_statement "return iVar3;" return identifier ;) })))
(translation_unit "undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)\n\n{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}\n\n" (function_definition "undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)\n\n{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" type_identifier (function_declarator "_hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)" identifier (parameter_list "(char *param_1,undefined4 param_2,uint param_3)" ( (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) ))) (compound_statement "{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" { (declaration "char cVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "char *pcVar3;" primitive_type (pointer_declarator "*pcVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "ulong uVar6;" type_identifier identifier ;) (declaration "ulong uVar7;" type_identifier identifier ;) (declaration "long lVar8;" (sized_type_specifier "long" long) identifier ;) (expression_statement "uVar6 = 0xffffffffffffffff;" (assignment_expression "uVar6 = 0xffffffffffffffff" identifier = number_literal) ;) (expression_statement "pcVar3 = param_1;" (assignment_expression "pcVar3 = param_1" identifier = identifier) ;) (do_statement "do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');" do (compound_statement "{\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  }" { (if_statement "if (uVar6 == 0) break;" if (parenthesized_expression "(uVar6 == 0)" ( (binary_expression "uVar6 == 0" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "uVar6 = uVar6 - 1;" (assignment_expression "uVar6 = uVar6 - 1" identifier = (binary_expression "uVar6 - 1" identifier - number_literal)) ;) (expression_statement "cVar1 = *pcVar3;" (assignment_expression "cVar1 = *pcVar3" identifier = (pointer_expression "*pcVar3" * identifier)) ;) (expression_statement "pcVar3 = pcVar3 + 1;" (assignment_expression "pcVar3 = pcVar3 + 1" identifier = (binary_expression "pcVar3 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(cVar1 != '\0')" ( (binary_expression "cVar1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) ;) (expression_statement "uVar6 = ~uVar6;" (assignment_expression "uVar6 = ~uVar6" identifier = (unary_expression "~uVar6" ~ identifier)) ;) (expression_statement "uVar7 = uVar6 - 1;" (assignment_expression "uVar7 = uVar6 - 1" identifier = (binary_expression "uVar6 - 1" identifier - number_literal)) ;) (expression_statement "iVar4 = (int)uVar7 + -1;" (assignment_expression "iVar4 = (int)uVar7 + -1" identifier = (binary_expression "(int)uVar7 + -1" (cast_expression "(int)uVar7" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal)) ;) (if_statement "if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" if (parenthesized_expression "(param_1[iVar4] == '\\')" ( (binary_expression "param_1[iVar4] == '\\'" (subscript_expression "param_1[iVar4]" identifier [ identifier ]) == (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" { (if_statement "if (iVar4 < 1) {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(iVar4 < 1)" ( (binary_expression "iVar4 < 1" identifier < number_literal) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) (expression_statement "uVar5 = (int)uVar7 - 2;" (assignment_expression "uVar5 = (int)uVar7 - 2" identifier = (binary_expression "(int)uVar7 - 2" (cast_expression "(int)uVar7" ( (type_descriptor "int" primitive_type) ) identifier) - number_literal)) ;) (expression_statement "pcVar3 = param_1 + (int)uVar5;" (assignment_expression "pcVar3 = param_1 + (int)uVar5" identifier = (binary_expression "param_1 + (int)uVar5" identifier + (cast_expression "(int)uVar5" ( (type_descriptor "int" primitive_type) ) identifier))) ;) (if_statement "if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(*pcVar3 != '\\')" ( (binary_expression "*pcVar3 != '\\'" (pointer_expression "*pcVar3" * identifier) != (char_literal "'\\'" ' escape_sequence ')) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (do_statement "do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');" do (compound_statement "{\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    }" { (expression_statement "iVar4 = 1 - iVar4;" (assignment_expression "iVar4 = 1 - iVar4" identifier = (binary_expression "1 - iVar4" number_literal - identifier)) ;) (if_statement "if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;" if (parenthesized_expression "(pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5))" ( (binary_expression "pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)" identifier == (binary_expression "param_1 + ((long)(int)uVar5 - (ulong)uVar5)" identifier + (parenthesized_expression "((long)(int)uVar5 - (ulong)uVar5)" ( (binary_expression "(long)(int)uVar5 - (ulong)uVar5" (cast_expression "(long)(int)uVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (cast_expression "(int)uVar5" ( (type_descriptor "int" primitive_type) ) identifier)) - (cast_expression "(ulong)uVar5" ( (type_descriptor "ulong" type_identifier) ) identifier)) )))) )) (break_statement "break;" break ;)) (expression_statement "pcVar3 = pcVar3 + -1;" (assignment_expression "pcVar3 = pcVar3 + -1" identifier = (binary_expression "pcVar3 + -1" identifier + number_literal)) ;) }) while (parenthesized_expression "(*pcVar3 == '\\')" ( (binary_expression "*pcVar3 == '\\'" (pointer_expression "*pcVar3" * identifier) == (char_literal "'\\'" ' escape_sequence ')) )) ;) (if_statement "if (iVar4 != 0) {\n      return 0xffffffff;\n    }" if (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) )) (compound_statement "{\n      return 0xffffffff;\n    }" { (return_statement "return 0xffffffff;" return number_literal ;) })) })) (expression_statement "pcVar3 = (char *)xmalloc(uVar6 + 2);" (assignment_expression "pcVar3 = (char *)xmalloc(uVar6 + 2)" identifier = (cast_expression "(char *)xmalloc(uVar6 + 2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xmalloc(uVar6 + 2)" identifier (argument_list "(uVar6 + 2)" ( (binary_expression "uVar6 + 2" identifier + number_literal) ))))) ;) (expression_statement "lVar8 = 0;" (assignment_expression "lVar8 = 0" identifier = number_literal) ;) (if_statement "if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" if (parenthesized_expression "(((param_3 & 1) == 0) && (*param_1 != '*'))" ( (binary_expression "((param_3 & 1) == 0) && (*param_1 != '*')" (parenthesized_expression "((param_3 & 1) == 0)" ( (binary_expression "(param_3 & 1) == 0" (parenthesized_expression "(param_3 & 1)" ( (binary_expression "param_3 & 1" identifier & number_literal) )) == number_literal) )) && (parenthesized_expression "(*param_1 != '*')" ( (binary_expression "*param_1 != '*'" (pointer_expression "*param_1" * identifier) != (char_literal "'*'" ' character ')) ))) )) (compound_statement "{\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" { (expression_statement "*pcVar3 = '*';" (assignment_expression "*pcVar3 = '*'" (pointer_expression "*pcVar3" * identifier) = (char_literal "'*'" ' character ')) ;) (expression_statement "lVar8 = 1;" (assignment_expression "lVar8 = 1" identifier = number_literal) ;) (expression_statement "uVar7 = uVar6;" (assignment_expression "uVar7 = uVar6" identifier = identifier) ;) })) (expression_statement "strcpy(pcVar3 + lVar8,param_1);" (call_expression "strcpy(pcVar3 + lVar8,param_1)" identifier (argument_list "(pcVar3 + lVar8,param_1)" ( (binary_expression "pcVar3 + lVar8" identifier + identifier) , identifier ))) ;) (if_statement "if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" if (parenthesized_expression "(pcVar3[uVar7 - 1] != '*')" ( (binary_expression "pcVar3[uVar7 - 1] != '*'" (subscript_expression "pcVar3[uVar7 - 1]" identifier [ (binary_expression "uVar7 - 1" identifier - number_literal) ]) != (char_literal "'*'" ' character ')) )) (compound_statement "{\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" { (expression_statement "pcVar3[uVar7] = '*';" (assignment_expression "pcVar3[uVar7] = '*'" (subscript_expression "pcVar3[uVar7]" identifier [ identifier ]) = (char_literal "'*'" ' character ')) ;) (expression_statement "pcVar3[uVar7 + 1] = '\0';" (assignment_expression "pcVar3[uVar7 + 1] = '\0'" (subscript_expression "pcVar3[uVar7 + 1]" identifier [ (binary_expression "uVar7 + 1" identifier + number_literal) ]) = (char_literal "'\0'" ' escape_sequence ')) ;) })) (expression_statement "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);" (assignment_expression "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2)" identifier = (call_expression "FUN_001cee9d(pcVar3,param_2,param_3 | 2)" identifier (argument_list "(pcVar3,param_2,param_3 | 2)" ( identifier , identifier , (binary_expression "param_3 | 2" identifier | number_literal) )))) ;) (if_statement "if (param_1 != pcVar3) {\n    free(pcVar3);\n  }" if (parenthesized_expression "(param_1 != pcVar3)" ( (binary_expression "param_1 != pcVar3" identifier != identifier) )) (compound_statement "{\n    free(pcVar3);\n  }" { (expression_statement "free(pcVar3);" (call_expression "free(pcVar3)" identifier (argument_list "(pcVar3)" ( identifier ))) ;) })) (return_statement "return uVar2;" return identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) ;) (expression_statement (assignment_expression IDENT = (unary_expression ~ IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (subscript_expression IDENT [ IDENT ]) == (char_literal ' escape_sequence ')) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return LIT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) - LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + (cast_expression ( (type_descriptor TYPE) ) IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) != (char_literal ' escape_sequence ')) )) (compound_statement { (return_statement return LIT ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression LIT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (binary_expression IDENT + (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) (cast_expression ( (type_descriptor TYPE) ) IDENT)) - (cast_expression ( (type_descriptor TYPE) ) IDENT)) )))) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) == (char_literal ' escape_sequence ')) )) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (return_statement return LIT ;) })) })) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) == LIT) )) && (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) != (char_literal ' character ')) ))) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = (char_literal ' character ')) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + IDENT) , IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression (subscript_expression IDENT [ (binary_expression IDENT - LIT) ]) != (char_literal ' character ')) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ IDENT ]) = (char_literal ' character ')) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ (binary_expression IDENT + LIT) ]) = (char_literal ' escape_sequence ')) ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , (binary_expression IDENT | LIT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) (return_statement return IDENT ;) })))
(function_definition "undefined4 _hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)\n\n{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" (type_identifier "undefined4") (function_declarator "_hs_history_patsearch(char *param_1,undefined4 param_2,uint param_3)" (identifier "_hs_history_patsearch") (parameter_list "(char *param_1,undefined4 param_2,uint param_3)" (( "(") (parameter_declaration "char *param_1" (primitive_type "char") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "uint param_3" (type_identifier "uint") (identifier "param_3")) () ")"))) (compound_statement "{\n  char cVar1;\n  undefined4 uVar2;\n  char *pcVar3;\n  int iVar4;\n  uint uVar5;\n  ulong uVar6;\n  ulong uVar7;\n  long lVar8;\n  \n  uVar6 = 0xffffffffffffffff;\n  pcVar3 = param_1;\n  do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');\n  uVar6 = ~uVar6;\n  uVar7 = uVar6 - 1;\n  iVar4 = (int)uVar7 + -1;\n  if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }\n  pcVar3 = (char *)xmalloc(uVar6 + 2);\n  lVar8 = 0;\n  if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }\n  strcpy(pcVar3 + lVar8,param_1);\n  if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }\n  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);\n  if (param_1 != pcVar3) {\n    free(pcVar3);\n  }\n  return uVar2;\n}" ({ "{") (declaration "char cVar1;" (primitive_type "char") (identifier "cVar1") (; ";")) (declaration "undefined4 uVar2;" (type_identifier "undefined4") (identifier "uVar2") (; ";")) (declaration "char *pcVar3;" (primitive_type "char") (pointer_declarator "*pcVar3" (* "*") (identifier "pcVar3")) (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "uint uVar5;" (type_identifier "uint") (identifier "uVar5") (; ";")) (declaration "ulong uVar6;" (type_identifier "ulong") (identifier "uVar6") (; ";")) (declaration "ulong uVar7;" (type_identifier "ulong") (identifier "uVar7") (; ";")) (declaration "long lVar8;" (sized_type_specifier "long" (long "long")) (identifier "lVar8") (; ";")) (expression_statement "uVar6 = 0xffffffffffffffff;" (assignment_expression "uVar6 = 0xffffffffffffffff" (identifier "uVar6") (= "=") (number_literal "0xffffffffffffffff")) (; ";")) (expression_statement "pcVar3 = param_1;" (assignment_expression "pcVar3 = param_1" (identifier "pcVar3") (= "=") (identifier "param_1")) (; ";")) (do_statement "do {\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  } while (cVar1 != '\0');" (do "do") (compound_statement "{\n    if (uVar6 == 0) break;\n    uVar6 = uVar6 - 1;\n    cVar1 = *pcVar3;\n    pcVar3 = pcVar3 + 1;\n  }" ({ "{") (if_statement "if (uVar6 == 0) break;" (if "if") (parenthesized_expression "(uVar6 == 0)" (( "(") (binary_expression "uVar6 == 0" (identifier "uVar6") (== "==") (number_literal "0")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "uVar6 = uVar6 - 1;" (assignment_expression "uVar6 = uVar6 - 1" (identifier "uVar6") (= "=") (binary_expression "uVar6 - 1" (identifier "uVar6") (- "-") (number_literal "1"))) (; ";")) (expression_statement "cVar1 = *pcVar3;" (assignment_expression "cVar1 = *pcVar3" (identifier "cVar1") (= "=") (pointer_expression "*pcVar3" (* "*") (identifier "pcVar3"))) (; ";")) (expression_statement "pcVar3 = pcVar3 + 1;" (assignment_expression "pcVar3 = pcVar3 + 1" (identifier "pcVar3") (= "=") (binary_expression "pcVar3 + 1" (identifier "pcVar3") (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(cVar1 != '\0')" (( "(") (binary_expression "cVar1 != '\0'" (identifier "cVar1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (; ";")) (expression_statement "uVar6 = ~uVar6;" (assignment_expression "uVar6 = ~uVar6" (identifier "uVar6") (= "=") (unary_expression "~uVar6" (~ "~") (identifier "uVar6"))) (; ";")) (expression_statement "uVar7 = uVar6 - 1;" (assignment_expression "uVar7 = uVar6 - 1" (identifier "uVar7") (= "=") (binary_expression "uVar6 - 1" (identifier "uVar6") (- "-") (number_literal "1"))) (; ";")) (expression_statement "iVar4 = (int)uVar7 + -1;" (assignment_expression "iVar4 = (int)uVar7 + -1" (identifier "iVar4") (= "=") (binary_expression "(int)uVar7 + -1" (cast_expression "(int)uVar7" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar7")) (+ "+") (number_literal "-1"))) (; ";")) (if_statement "if (param_1[iVar4] == '\\') {\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" (if "if") (parenthesized_expression "(param_1[iVar4] == '\\')" (( "(") (binary_expression "param_1[iVar4] == '\\'" (subscript_expression "param_1[iVar4]" (identifier "param_1") ([ "[") (identifier "iVar4") (] "]")) (== "==") (char_literal "'\\'" (' "'") (escape_sequence "\\") (' "'"))) () ")")) (compound_statement "{\n    if (iVar4 < 1) {\n      return 0xffffffff;\n    }\n    uVar5 = (int)uVar7 - 2;\n    pcVar3 = param_1 + (int)uVar5;\n    if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }\n    iVar4 = 1;\n    do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');\n    if (iVar4 != 0) {\n      return 0xffffffff;\n    }\n  }" ({ "{") (if_statement "if (iVar4 < 1) {\n      return 0xffffffff;\n    }" (if "if") (parenthesized_expression "(iVar4 < 1)" (( "(") (binary_expression "iVar4 < 1" (identifier "iVar4") (< "<") (number_literal "1")) () ")")) (compound_statement "{\n      return 0xffffffff;\n    }" ({ "{") (return_statement "return 0xffffffff;" (return "return") (number_literal "0xffffffff") (; ";")) (} "}"))) (expression_statement "uVar5 = (int)uVar7 - 2;" (assignment_expression "uVar5 = (int)uVar7 - 2" (identifier "uVar5") (= "=") (binary_expression "(int)uVar7 - 2" (cast_expression "(int)uVar7" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar7")) (- "-") (number_literal "2"))) (; ";")) (expression_statement "pcVar3 = param_1 + (int)uVar5;" (assignment_expression "pcVar3 = param_1 + (int)uVar5" (identifier "pcVar3") (= "=") (binary_expression "param_1 + (int)uVar5" (identifier "param_1") (+ "+") (cast_expression "(int)uVar5" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar5")))) (; ";")) (if_statement "if (*pcVar3 != '\\') {\n      return 0xffffffff;\n    }" (if "if") (parenthesized_expression "(*pcVar3 != '\\')" (( "(") (binary_expression "*pcVar3 != '\\'" (pointer_expression "*pcVar3" (* "*") (identifier "pcVar3")) (!= "!=") (char_literal "'\\'" (' "'") (escape_sequence "\\") (' "'"))) () ")")) (compound_statement "{\n      return 0xffffffff;\n    }" ({ "{") (return_statement "return 0xffffffff;" (return "return") (number_literal "0xffffffff") (; ";")) (} "}"))) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" (identifier "iVar4") (= "=") (number_literal "1")) (; ";")) (do_statement "do {\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    } while (*pcVar3 == '\\');" (do "do") (compound_statement "{\n      iVar4 = 1 - iVar4;\n      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;\n      pcVar3 = pcVar3 + -1;\n    }" ({ "{") (expression_statement "iVar4 = 1 - iVar4;" (assignment_expression "iVar4 = 1 - iVar4" (identifier "iVar4") (= "=") (binary_expression "1 - iVar4" (number_literal "1") (- "-") (identifier "iVar4"))) (; ";")) (if_statement "if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;" (if "if") (parenthesized_expression "(pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5))" (( "(") (binary_expression "pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)" (identifier "pcVar3") (== "==") (binary_expression "param_1 + ((long)(int)uVar5 - (ulong)uVar5)" (identifier "param_1") (+ "+") (parenthesized_expression "((long)(int)uVar5 - (ulong)uVar5)" (( "(") (binary_expression "(long)(int)uVar5 - (ulong)uVar5" (cast_expression "(long)(int)uVar5" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (cast_expression "(int)uVar5" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar5"))) (- "-") (cast_expression "(ulong)uVar5" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "uVar5"))) () ")")))) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "pcVar3 = pcVar3 + -1;" (assignment_expression "pcVar3 = pcVar3 + -1" (identifier "pcVar3") (= "=") (binary_expression "pcVar3 + -1" (identifier "pcVar3") (+ "+") (number_literal "-1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(*pcVar3 == '\\')" (( "(") (binary_expression "*pcVar3 == '\\'" (pointer_expression "*pcVar3" (* "*") (identifier "pcVar3")) (== "==") (char_literal "'\\'" (' "'") (escape_sequence "\\") (' "'"))) () ")")) (; ";")) (if_statement "if (iVar4 != 0) {\n      return 0xffffffff;\n    }" (if "if") (parenthesized_expression "(iVar4 != 0)" (( "(") (binary_expression "iVar4 != 0" (identifier "iVar4") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      return 0xffffffff;\n    }" ({ "{") (return_statement "return 0xffffffff;" (return "return") (number_literal "0xffffffff") (; ";")) (} "}"))) (} "}"))) (expression_statement "pcVar3 = (char *)xmalloc(uVar6 + 2);" (assignment_expression "pcVar3 = (char *)xmalloc(uVar6 + 2)" (identifier "pcVar3") (= "=") (cast_expression "(char *)xmalloc(uVar6 + 2)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "xmalloc(uVar6 + 2)" (identifier "xmalloc") (argument_list "(uVar6 + 2)" (( "(") (binary_expression "uVar6 + 2" (identifier "uVar6") (+ "+") (number_literal "2")) () ")"))))) (; ";")) (expression_statement "lVar8 = 0;" (assignment_expression "lVar8 = 0" (identifier "lVar8") (= "=") (number_literal "0")) (; ";")) (if_statement "if (((param_3 & 1) == 0) && (*param_1 != '*')) {\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" (if "if") (parenthesized_expression "(((param_3 & 1) == 0) && (*param_1 != '*'))" (( "(") (binary_expression "((param_3 & 1) == 0) && (*param_1 != '*')" (parenthesized_expression "((param_3 & 1) == 0)" (( "(") (binary_expression "(param_3 & 1) == 0" (parenthesized_expression "(param_3 & 1)" (( "(") (binary_expression "param_3 & 1" (identifier "param_3") (& "&") (number_literal "1")) () ")")) (== "==") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(*param_1 != '*')" (( "(") (binary_expression "*param_1 != '*'" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (!= "!=") (char_literal "'*'" (' "'") (character "*") (' "'"))) () ")"))) () ")")) (compound_statement "{\n    *pcVar3 = '*';\n    lVar8 = 1;\n    uVar7 = uVar6;\n  }" ({ "{") (expression_statement "*pcVar3 = '*';" (assignment_expression "*pcVar3 = '*'" (pointer_expression "*pcVar3" (* "*") (identifier "pcVar3")) (= "=") (char_literal "'*'" (' "'") (character "*") (' "'"))) (; ";")) (expression_statement "lVar8 = 1;" (assignment_expression "lVar8 = 1" (identifier "lVar8") (= "=") (number_literal "1")) (; ";")) (expression_statement "uVar7 = uVar6;" (assignment_expression "uVar7 = uVar6" (identifier "uVar7") (= "=") (identifier "uVar6")) (; ";")) (} "}"))) (expression_statement "strcpy(pcVar3 + lVar8,param_1);" (call_expression "strcpy(pcVar3 + lVar8,param_1)" (identifier "strcpy") (argument_list "(pcVar3 + lVar8,param_1)" (( "(") (binary_expression "pcVar3 + lVar8" (identifier "pcVar3") (+ "+") (identifier "lVar8")) (, ",") (identifier "param_1") () ")"))) (; ";")) (if_statement "if (pcVar3[uVar7 - 1] != '*') {\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" (if "if") (parenthesized_expression "(pcVar3[uVar7 - 1] != '*')" (( "(") (binary_expression "pcVar3[uVar7 - 1] != '*'" (subscript_expression "pcVar3[uVar7 - 1]" (identifier "pcVar3") ([ "[") (binary_expression "uVar7 - 1" (identifier "uVar7") (- "-") (number_literal "1")) (] "]")) (!= "!=") (char_literal "'*'" (' "'") (character "*") (' "'"))) () ")")) (compound_statement "{\n    pcVar3[uVar7] = '*';\n    pcVar3[uVar7 + 1] = '\0';\n  }" ({ "{") (expression_statement "pcVar3[uVar7] = '*';" (assignment_expression "pcVar3[uVar7] = '*'" (subscript_expression "pcVar3[uVar7]" (identifier "pcVar3") ([ "[") (identifier "uVar7") (] "]")) (= "=") (char_literal "'*'" (' "'") (character "*") (' "'"))) (; ";")) (expression_statement "pcVar3[uVar7 + 1] = '\0';" (assignment_expression "pcVar3[uVar7 + 1] = '\0'" (subscript_expression "pcVar3[uVar7 + 1]" (identifier "pcVar3") ([ "[") (binary_expression "uVar7 + 1" (identifier "uVar7") (+ "+") (number_literal "1")) (] "]")) (= "=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) (; ";")) (} "}"))) (expression_statement "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);" (assignment_expression "uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2)" (identifier "uVar2") (= "=") (call_expression "FUN_001cee9d(pcVar3,param_2,param_3 | 2)" (identifier "FUN_001cee9d") (argument_list "(pcVar3,param_2,param_3 | 2)" (( "(") (identifier "pcVar3") (, ",") (identifier "param_2") (, ",") (binary_expression "param_3 | 2" (identifier "param_3") (| "|") (number_literal "2")) () ")")))) (; ";")) (if_statement "if (param_1 != pcVar3) {\n    free(pcVar3);\n  }" (if "if") (parenthesized_expression "(param_1 != pcVar3)" (( "(") (binary_expression "param_1 != pcVar3" (identifier "param_1") (!= "!=") (identifier "pcVar3")) () ")")) (compound_statement "{\n    free(pcVar3);\n  }" ({ "{") (expression_statement "free(pcVar3);" (call_expression "free(pcVar3)" (identifier "free") (argument_list "(pcVar3)" (( "(") (identifier "pcVar3") () ")"))) (; ";")) (} "}"))) (return_statement "return uVar2;" (return "return") (identifier "uVar2") (; ";")) (} "}")))

int function_1(char *var_5,int direction,int var_7)

{
  char var_3;
  char *var_2;
  int var_4;
  type_1 uVar4;
  type_2 var_1;
  type_2 var_10;
  long var_9;
  
  var_1 = 0xffffffffffffffff;
  var_2 = var_5;
  do {
    if (var_1 == 0) break;
    var_1 = var_1 - 1;
    var_3 = *var_2;
    var_2 = var_2 + 1;
  } while (var_3 != '\0');
  var_1 = ~var_1;
  var_10 = var_1 - 1;
  var_4 = (int)var_10 + -1;
  if (var_5[var_4] == '\\') {
    if (var_4 < 1) {
      return -1;
    }
    uVar4 = (int)var_10 - 2;
    var_2 = var_5 + (int)uVar4;
    if (*var_2 != '\\') {
      return -1;
    }
    var_4 = 1;
    do {
      var_4 = 1 - var_4;
      if (var_2 == var_5 + ((long)(int)uVar4 - (type_2)uVar4)) break;
      var_2 = var_2 + -1;
    } while (*var_2 == '\\');
    if (var_4 != 0) {
      return -1;
    }
  }
  var_2 = (char *)var_6(var_1 + 2);
  var_9 = 0;
  if (((var_7 & 1U) == 0) && (*var_5 != '*')) {
    *var_2 = '*';
    var_9 = 1;
    var_10 = var_1;
  }
  var_8(var_2 + var_9,var_5);
  if (var_2[var_10 - 1] != '*') {
    var_2[var_10] = '*';
    var_2[var_10 + 1] = '\0';
  }
  var_4 = var_11(var_2,direction,var_7 | 2);
  if (var_5 != var_2) {
    var_12(var_2);
  }
  return var_4;
}


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

undefined4 MASKED(char *param_1,undefined4 param_2,uint param_3)

{
  char cVar1;
  undefined4 uVar2;
  char *pcVar3;
  int iVar4;
  uint uVar5;
  ulong uVar6;
  ulong uVar7;
  long lVar8;
  
  uVar6 = 0xffffffffffffffff;
  pcVar3 = param_1;
  do {
    if (uVar6 == 0) break;
    uVar6 = uVar6 - 1;
    cVar1 = *pcVar3;
    pcVar3 = pcVar3 + 1;
  } while (cVar1 != '\0');
  uVar6 = ~uVar6;
  uVar7 = uVar6 - 1;
  iVar4 = (int)uVar7 + -1;
  if (param_1[iVar4] == '\\') {
    if (iVar4 < 1) {
      return 0xffffffff;
    }
    uVar5 = (int)uVar7 - 2;
    pcVar3 = param_1 + (int)uVar5;
    if (*pcVar3 != '\\') {
      return 0xffffffff;
    }
    iVar4 = 1;
    do {
      iVar4 = 1 - iVar4;
      if (pcVar3 == param_1 + ((long)(int)uVar5 - (ulong)uVar5)) break;
      pcVar3 = pcVar3 + -1;
    } while (*pcVar3 == '\\');
    if (iVar4 != 0) {
      return 0xffffffff;
    }
  }
  pcVar3 = (char *)xmalloc(uVar6 + 2);
  lVar8 = 0;
  if (((param_3 & 1) == 0) && (*param_1 != '*')) {
    *pcVar3 = '*';
    lVar8 = 1;
    uVar7 = uVar6;
  }
  strcpy(pcVar3 + lVar8,param_1);
  if (pcVar3[uVar7 - 1] != '*') {
    pcVar3[uVar7] = '*';
    pcVar3[uVar7 + 1] = '\0';
  }
  uVar2 = FUN_001cee9d(pcVar3,param_2,param_3 | 2);
  if (param_1 != pcVar3) {
    free(pcVar3);
  }
  return uVar2;
}

