undefined4 FUN_0040c158(undefined4 *param_1,int param_2)

{
  int iVar1;
  int *__s;
  int iVar2;
  undefined4 *puVar3;
  undefined4 uVar4;
  char *pcVar5;
  undefined *puVar6;
  int *piVar7;
  undefined4 uVar8;
  int *piVar9;
  int local_28 [2];
  
  iVar1 = sobj_new();
  if (iVar1 == 0) {
    client_printf(*param_1,"\n!! %s >>>>>>>>>>>>>>>>>>>>>>>>>\n","INTERNAL ERROR");
    client_printf(*param_1,"!! %s: File:[%s]\n","INTERNAL ERROR",param_1[2]);
    client_printf(*param_1,"memory allocation failed !");
    client_printf(*param_1,"\n!! %s <<<<<<<<<<<<<<<<<<<<<<<<<\n","INTERNAL ERROR");
    return 0xffffffff;
  }
  __s = (int *)malloc(0x24)   //possible issue identified - semgrep
  if (__s == (int *)0x0) {
    client_printf(*param_1,"\n!! %s >>>>>>>>>>>>>>>>>>>>>>>>>\n","INTERNAL ERROR");
    client_printf(*param_1,"!! %s: File:[%s]\n","INTERNAL ERROR",param_1[2]);
    client_printf(*param_1,"memory allocation failed !");
    uVar4 = *param_1;
    pcVar5 = "INTERNAL ERROR";
LAB_0040c554:
    uVar8 = 0xffffffff;
    client_printf(uVar4,"\n!! %s <<<<<<<<<<<<<<<<<<<<<<<<<\n",pcVar5);
  }
  else {
    memset(__s,0,0x24)   //possible issue identified - semgrep
    piVar7 = __s + 5;
    piVar9 = __s + 7;
    __s[2] = 1;
    __s[4] = (int)(__s + 3);
    __s[3] = (int)(__s + 3);
    __s[6] = (int)piVar7;
    __s[5] = (int)piVar7;
    __s[8] = (int)piVar9;
    __s[7] = (int)piVar9;
    iVar2 = FUN_00408e6c(param_1);
    if (iVar2 < 0) {
      uVar8 = 0xffffffff;
      goto LAB_0040c720;
    }
    sobj_free(iVar1);
    FUN_00407458(param_1[1],iVar1,local_28);
    if ((local_28[0] == 0) && (iVar2 = sobj_strcmp(iVar1,&DAT_00422834), iVar2 == 0)) {
      puVar6 = &DAT_00422838;
    }
    else {
      if (local_28[0] != 0) {
        xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
      }
      uVar8 = sobj_get_string(iVar1);
      xs_ungets(uVar8,param_1[1])   //possible issue identified - semgrep
      if (local_28[0] != 0) {
        xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
      }
      puVar6 = (undefined *)0x0;
    }
    iVar2 = FUN_00409a00(param_1,piVar7,puVar6);
    uVar8 = 0xffffffff;
    if (iVar2 < 0) goto LAB_0040c720;
    sobj_free(iVar1);
    FUN_00407458(param_1[1],iVar1,local_28);
    if ((local_28[0] == 0) && (iVar2 = sobj_strcmp(iVar1,&DAT_00422910), iVar2 == 0)) {
      sobj_free(iVar1);
      FUN_00407458(param_1[1],iVar1,local_28);
      if ((local_28[0] == 0) && (iVar2 = sobj_strcmp(iVar1,&DAT_00422828), iVar2 == 0)) {
        sobj_free(iVar1);
        FUN_00407458(param_1[1],iVar1,local_28);
        iVar2 = sobj_strcmp(iVar1,&DAT_0042274c);
        if (iVar2 != 0) {
          client_printf(*param_1,"\n!! %s >>>>>>>>>>>>>>>>>>>>>>>>>\n","SYNTAX ERROR");
          client_printf(*param_1,"!! %s: File:[%s]\n","SYNTAX ERROR",param_1[2]);
          uVar4 = *param_1;
          uVar8 = sobj_get_string(iVar1);
          client_printf(uVar4,"got an invalid token [%s]",uVar8);
          uVar4 = *param_1;
          pcVar5 = "SYNTAX ERROR";
          goto LAB_0040c554;
        }
        iVar2 = FUN_0040c158(param_1,piVar9);
      }
      else {
        if ((local_28[0] == 0) && (iVar2 = sobj_strcmp(iVar1,&DAT_00422834), iVar2 == 0)) {
          puVar6 = &DAT_00422838;
        }
        else {
          if (local_28[0] != 0) {
            xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
          }
          uVar8 = sobj_get_string(iVar1);
          xs_ungets(uVar8,param_1[1])   //possible issue identified - semgrep
          if (local_28[0] != 0) {
            xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
          }
          puVar6 = (undefined *)0x0;
        }
        iVar2 = FUN_00409a00(param_1,piVar9,puVar6);
      }
      if (iVar2 < 0) {
        uVar8 = 0xffffffff;
        goto LAB_0040c720;
      }
    }
    else {
      if (local_28[0] != 0) {
        xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
      }
      uVar8 = sobj_get_string(iVar1);
      xs_ungets(uVar8,param_1[1])   //possible issue identified - semgrep
      if (local_28[0] != 0) {
        xs_ungetc(0x22,param_1[1])   //possible issue identified - semgrep
      }
    }
    puVar3 = *(undefined4 **)(param_2 + 4);
    *__s = param_2;
    *(int **)(param_2 + 4) = __s;
    *puVar3 = __s;
    __s[1] = (int)puVar3;
    uVar8 = 0;
    __s = (int *)0x0;
  }
LAB_0040c720:
  sobj_del(iVar1);
  if (__s != (int *)0x0) {
    FUN_00409248(__s);
  }
  return uVar8;
}