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

int sg_err_category_new(int scsi_status,int host_status,int driver_status,uint8_t *sense_buffer,
                       int sb_len)

{
  int iVar1;
  uint uVar2;
  
  uVar2 = driver_status & 0xf;
  if (((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0) {
    return 0;
  }
  if (((scsi_status & 0x5eU) == 2) || (uVar2 == 8)) {
    iVar1 = sg_err_category_sense(sense_buffer,sb_len);
    return iVar1;
  }
  if (host_status != 0) {
    if (host_status - 1U < 3) {
      return 0x21;
    }
    if (host_status == 0x11) {
      return 0x18;
    }
  }
  iVar1 = 0x21;
  if (uVar2 != 6) {
    iVar1 = 99;
  }
  return iVar1;
}



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

{
  undefined4 uVar1;
  uint unaff_retaddr;
  
  entry(param_2,0x2dac7);
  param_4 = param_4 & 0xf;
  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {
    return 0;
  }
  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {
    uVar1 = sg_err_category_sense(param_5,param_6);
    return uVar1;
  }
  if (param_3 != 0) {
    if (param_3 - 1U < 3) {
      return 0x21;
    }
    if (param_3 == 0x11) {
      return 0x18;
    }
  }
  uVar1 = 0x21;
  if (param_4 != 6) {
    uVar1 = 99;
  }
  return uVar1;
}


PUSH ESI
PUSH EBX
CALL 0x00017820
ADD EBX,0x1c2c1
SUB ESP,0x4
MOV ECX,dword ptr [ESP + 0x10]
MOV ESI,dword ptr [ESP + 0x14]
MOV EDX,dword ptr [ESP + 0x18]
MOV EAX,ECX
AND EAX,0x7e
AND EDX,0xf
OR EAX,ESI
OR EAX,EDX
JZ 0x0002db1d
AND ECX,0x5e
CMP ECX,0x2
JZ 0x0002db28
CMP EDX,0x8
JZ 0x0002db28
TEST ESI,ESI
JZ 0x0002db0d
LEA ECX,[ESI + -0x1]
MOV EAX,0x21
CMP ECX,0x2
JBE 0x0002db1d
CMP ESI,0x11
JZ 0x0002db48
CMP EDX,0x6
MOV EAX,0x21
MOV EDX,0x63
CMOVNZ EAX,EDX
ADD ESP,0x4
POP EBX
POP ESI
RET
SUB ESP,0x8
PUSH dword ptr [ESP + 0x28]
PUSH dword ptr [ESP + 0x28]
CALL 0x000176e0
ADD ESP,0x10
ADD ESP,0x4
POP EBX
POP ESI
RET
MOV EAX,0x18
JMP 0x0002db1d
(translation_unit "undefined4 __regparm2\nsg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)\n\n{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}\n\n" (function_definition "undefined4 __regparm2\nsg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)\n\n{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" type_identifier (ERROR "__regparm2" identifier) (function_declarator "sg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "uint param_4" type_identifier identifier) , (parameter_declaration "undefined4 param_5" type_identifier identifier) , (parameter_declaration "undefined4 param_6" type_identifier identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "uint unaff_retaddr;" type_identifier identifier ;) (expression_statement "entry(param_2,0x2dac7);" (call_expression "entry(param_2,0x2dac7)" identifier (argument_list "(param_2,0x2dac7)" ( identifier , number_literal ))) ;) (expression_statement "param_4 = param_4 & 0xf;" (assignment_expression "param_4 = param_4 & 0xf" identifier = (binary_expression "param_4 & 0xf" identifier & number_literal)) ;) (if_statement "if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }" if (parenthesized_expression "(((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0)" ( (binary_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0" (parenthesized_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0)" ( (binary_expression "(unaff_retaddr & 0x7e) == 0 && param_3 == 0" (binary_expression "(unaff_retaddr & 0x7e) == 0" (parenthesized_expression "(unaff_retaddr & 0x7e)" ( (binary_expression "unaff_retaddr & 0x7e" identifier & number_literal) )) == number_literal) && (binary_expression "param_3 == 0" identifier == number_literal)) )) && (binary_expression "param_4 == 0" identifier == number_literal)) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" if (parenthesized_expression "(((unaff_retaddr & 0x5e) == 2) || (param_4 == 8))" ( (binary_expression "((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)" (parenthesized_expression "((unaff_retaddr & 0x5e) == 2)" ( (binary_expression "(unaff_retaddr & 0x5e) == 2" (parenthesized_expression "(unaff_retaddr & 0x5e)" ( (binary_expression "unaff_retaddr & 0x5e" identifier & number_literal) )) == number_literal) )) || (parenthesized_expression "(param_4 == 8)" ( (binary_expression "param_4 == 8" identifier == number_literal) ))) )) (compound_statement "{\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" { (expression_statement "uVar1 = sg_err_category_sense(param_5,param_6);" (assignment_expression "uVar1 = sg_err_category_sense(param_5,param_6)" identifier = (call_expression "sg_err_category_sense(param_5,param_6)" identifier (argument_list "(param_5,param_6)" ( identifier , identifier )))) ;) (return_statement "return uVar1;" return identifier ;) })) (if_statement "if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" if (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) (compound_statement "{\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" { (if_statement "if (param_3 - 1U < 3) {\n      return 0x21;\n    }" if (parenthesized_expression "(param_3 - 1U < 3)" ( (binary_expression "param_3 - 1U < 3" (binary_expression "param_3 - 1U" identifier - number_literal) < number_literal) )) (compound_statement "{\n      return 0x21;\n    }" { (return_statement "return 0x21;" return number_literal ;) })) (if_statement "if (param_3 == 0x11) {\n      return 0x18;\n    }" if (parenthesized_expression "(param_3 == 0x11)" ( (binary_expression "param_3 == 0x11" identifier == number_literal) )) (compound_statement "{\n      return 0x18;\n    }" { (return_statement "return 0x18;" return number_literal ;) })) })) (expression_statement "uVar1 = 0x21;" (assignment_expression "uVar1 = 0x21" identifier = number_literal) ;) (if_statement "if (param_4 != 6) {\n    uVar1 = 99;\n  }" if (parenthesized_expression "(param_4 != 6)" ( (binary_expression "param_4 != 6" identifier != number_literal) )) (compound_statement "{\n    uVar1 = 99;\n  }" { (expression_statement "uVar1 = 99;" (assignment_expression "uVar1 = 99" identifier = number_literal) ;) })) (return_statement "return uVar1;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint sg_err_category_new(int scsi_status,int host_status,int driver_status,uint8_t *sense_buffer,\n                       int sb_len)\n\n{\n  int iVar1;\n  uint uVar2;\n  \n  uVar2 = driver_status & 0xf;\n  if (((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0) {\n    return 0;\n  }\n  if (((scsi_status & 0x5eU) == 2) || (uVar2 == 8)) {\n    iVar1 = sg_err_category_sense(sense_buffer,sb_len);\n    return iVar1;\n  }\n  if (host_status != 0) {\n    if (host_status - 1U < 3) {\n      return 0x21;\n    }\n    if (host_status == 0x11) {\n      return 0x18;\n    }\n  }\n  iVar1 = 0x21;\n  if (uVar2 != 6) {\n    iVar1 = 99;\n  }\n  return iVar1;\n}\n\n" comment (function_definition "int sg_err_category_new(int scsi_status,int host_status,int driver_status,uint8_t *sense_buffer,\n                       int sb_len)\n\n{\n  int iVar1;\n  uint uVar2;\n  \n  uVar2 = driver_status & 0xf;\n  if (((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0) {\n    return 0;\n  }\n  if (((scsi_status & 0x5eU) == 2) || (uVar2 == 8)) {\n    iVar1 = sg_err_category_sense(sense_buffer,sb_len);\n    return iVar1;\n  }\n  if (host_status != 0) {\n    if (host_status - 1U < 3) {\n      return 0x21;\n    }\n    if (host_status == 0x11) {\n      return 0x18;\n    }\n  }\n  iVar1 = 0x21;\n  if (uVar2 != 6) {\n    iVar1 = 99;\n  }\n  return iVar1;\n}" primitive_type (function_declarator "sg_err_category_new(int scsi_status,int host_status,int driver_status,uint8_t *sense_buffer,\n                       int sb_len)" identifier (parameter_list "(int scsi_status,int host_status,int driver_status,uint8_t *sense_buffer,\n                       int sb_len)" ( (parameter_declaration "int scsi_status" primitive_type identifier) , (parameter_declaration "int host_status" primitive_type identifier) , (parameter_declaration "int driver_status" primitive_type identifier) , (parameter_declaration "uint8_t *sense_buffer" primitive_type (pointer_declarator "*sense_buffer" * identifier)) , (parameter_declaration "int sb_len" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  uint uVar2;\n  \n  uVar2 = driver_status & 0xf;\n  if (((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0) {\n    return 0;\n  }\n  if (((scsi_status & 0x5eU) == 2) || (uVar2 == 8)) {\n    iVar1 = sg_err_category_sense(sense_buffer,sb_len);\n    return iVar1;\n  }\n  if (host_status != 0) {\n    if (host_status - 1U < 3) {\n      return 0x21;\n    }\n    if (host_status == 0x11) {\n      return 0x18;\n    }\n  }\n  iVar1 = 0x21;\n  if (uVar2 != 6) {\n    iVar1 = 99;\n  }\n  return iVar1;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (expression_statement "uVar2 = driver_status & 0xf;" (assignment_expression "uVar2 = driver_status & 0xf" identifier = (binary_expression "driver_status & 0xf" identifier & number_literal)) ;) (if_statement "if (((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0) {\n    return 0;\n  }" if (parenthesized_expression "(((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0)" ( (binary_expression "((scsi_status & 0x7eU) == 0 && host_status == 0) && uVar2 == 0" (parenthesized_expression "((scsi_status & 0x7eU) == 0 && host_status == 0)" ( (binary_expression "(scsi_status & 0x7eU) == 0 && host_status == 0" (binary_expression "(scsi_status & 0x7eU) == 0" (parenthesized_expression "(scsi_status & 0x7eU)" ( (binary_expression "scsi_status & 0x7eU" identifier & number_literal) )) == number_literal) && (binary_expression "host_status == 0" identifier == number_literal)) )) && (binary_expression "uVar2 == 0" identifier == number_literal)) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (((scsi_status & 0x5eU) == 2) || (uVar2 == 8)) {\n    iVar1 = sg_err_category_sense(sense_buffer,sb_len);\n    return iVar1;\n  }" if (parenthesized_expression "(((scsi_status & 0x5eU) == 2) || (uVar2 == 8))" ( (binary_expression "((scsi_status & 0x5eU) == 2) || (uVar2 == 8)" (parenthesized_expression "((scsi_status & 0x5eU) == 2)" ( (binary_expression "(scsi_status & 0x5eU) == 2" (parenthesized_expression "(scsi_status & 0x5eU)" ( (binary_expression "scsi_status & 0x5eU" identifier & number_literal) )) == number_literal) )) || (parenthesized_expression "(uVar2 == 8)" ( (binary_expression "uVar2 == 8" identifier == number_literal) ))) )) (compound_statement "{\n    iVar1 = sg_err_category_sense(sense_buffer,sb_len);\n    return iVar1;\n  }" { (expression_statement "iVar1 = sg_err_category_sense(sense_buffer,sb_len);" (assignment_expression "iVar1 = sg_err_category_sense(sense_buffer,sb_len)" identifier = (call_expression "sg_err_category_sense(sense_buffer,sb_len)" identifier (argument_list "(sense_buffer,sb_len)" ( identifier , identifier )))) ;) (return_statement "return iVar1;" return identifier ;) })) (if_statement "if (host_status != 0) {\n    if (host_status - 1U < 3) {\n      return 0x21;\n    }\n    if (host_status == 0x11) {\n      return 0x18;\n    }\n  }" if (parenthesized_expression "(host_status != 0)" ( (binary_expression "host_status != 0" identifier != number_literal) )) (compound_statement "{\n    if (host_status - 1U < 3) {\n      return 0x21;\n    }\n    if (host_status == 0x11) {\n      return 0x18;\n    }\n  }" { (if_statement "if (host_status - 1U < 3) {\n      return 0x21;\n    }" if (parenthesized_expression "(host_status - 1U < 3)" ( (binary_expression "host_status - 1U < 3" (binary_expression "host_status - 1U" identifier - number_literal) < number_literal) )) (compound_statement "{\n      return 0x21;\n    }" { (return_statement "return 0x21;" return number_literal ;) })) (if_statement "if (host_status == 0x11) {\n      return 0x18;\n    }" if (parenthesized_expression "(host_status == 0x11)" ( (binary_expression "host_status == 0x11" identifier == number_literal) )) (compound_statement "{\n      return 0x18;\n    }" { (return_statement "return 0x18;" return number_literal ;) })) })) (expression_statement "iVar1 = 0x21;" (assignment_expression "iVar1 = 0x21" identifier = number_literal) ;) (if_statement "if (uVar2 != 6) {\n    iVar1 = 99;\n  }" if (parenthesized_expression "(uVar2 != 6)" ( (binary_expression "uVar2 != 6" identifier != number_literal) )) (compound_statement "{\n    iVar1 = 99;\n  }" { (expression_statement "iVar1 = 99;" (assignment_expression "iVar1 = 99" identifier = number_literal) ;) })) (return_statement "return iVar1;" return identifier ;) })))
(translation_unit "undefined4 __regparm2\nsg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)\n\n{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}\n\n" (function_definition "undefined4 __regparm2\nsg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)\n\n{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" type_identifier (ERROR "__regparm2" identifier) (function_declarator "sg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "int param_3" primitive_type identifier) , (parameter_declaration "uint param_4" type_identifier identifier) , (parameter_declaration "undefined4 param_5" type_identifier identifier) , (parameter_declaration "undefined4 param_6" type_identifier identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "uint unaff_retaddr;" type_identifier identifier ;) (expression_statement "entry(param_2,0x2dac7);" (call_expression "entry(param_2,0x2dac7)" identifier (argument_list "(param_2,0x2dac7)" ( identifier , number_literal ))) ;) (expression_statement "param_4 = param_4 & 0xf;" (assignment_expression "param_4 = param_4 & 0xf" identifier = (binary_expression "param_4 & 0xf" identifier & number_literal)) ;) (if_statement "if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }" if (parenthesized_expression "(((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0)" ( (binary_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0" (parenthesized_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0)" ( (binary_expression "(unaff_retaddr & 0x7e) == 0 && param_3 == 0" (binary_expression "(unaff_retaddr & 0x7e) == 0" (parenthesized_expression "(unaff_retaddr & 0x7e)" ( (binary_expression "unaff_retaddr & 0x7e" identifier & number_literal) )) == number_literal) && (binary_expression "param_3 == 0" identifier == number_literal)) )) && (binary_expression "param_4 == 0" identifier == number_literal)) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (if_statement "if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" if (parenthesized_expression "(((unaff_retaddr & 0x5e) == 2) || (param_4 == 8))" ( (binary_expression "((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)" (parenthesized_expression "((unaff_retaddr & 0x5e) == 2)" ( (binary_expression "(unaff_retaddr & 0x5e) == 2" (parenthesized_expression "(unaff_retaddr & 0x5e)" ( (binary_expression "unaff_retaddr & 0x5e" identifier & number_literal) )) == number_literal) )) || (parenthesized_expression "(param_4 == 8)" ( (binary_expression "param_4 == 8" identifier == number_literal) ))) )) (compound_statement "{\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" { (expression_statement "uVar1 = sg_err_category_sense(param_5,param_6);" (assignment_expression "uVar1 = sg_err_category_sense(param_5,param_6)" identifier = (call_expression "sg_err_category_sense(param_5,param_6)" identifier (argument_list "(param_5,param_6)" ( identifier , identifier )))) ;) (return_statement "return uVar1;" return identifier ;) })) (if_statement "if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" if (parenthesized_expression "(param_3 != 0)" ( (binary_expression "param_3 != 0" identifier != number_literal) )) (compound_statement "{\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" { (if_statement "if (param_3 - 1U < 3) {\n      return 0x21;\n    }" if (parenthesized_expression "(param_3 - 1U < 3)" ( (binary_expression "param_3 - 1U < 3" (binary_expression "param_3 - 1U" identifier - number_literal) < number_literal) )) (compound_statement "{\n      return 0x21;\n    }" { (return_statement "return 0x21;" return number_literal ;) })) (if_statement "if (param_3 == 0x11) {\n      return 0x18;\n    }" if (parenthesized_expression "(param_3 == 0x11)" ( (binary_expression "param_3 == 0x11" identifier == number_literal) )) (compound_statement "{\n      return 0x18;\n    }" { (return_statement "return 0x18;" return number_literal ;) })) })) (expression_statement "uVar1 = 0x21;" (assignment_expression "uVar1 = 0x21" identifier = number_literal) ;) (if_statement "if (param_4 != 6) {\n    uVar1 = 99;\n  }" if (parenthesized_expression "(param_4 != 6)" ( (binary_expression "param_4 != 6" identifier != number_literal) )) (compound_statement "{\n    uVar1 = 99;\n  }" { (expression_statement "uVar1 = 99;" (assignment_expression "uVar1 = 99" identifier = number_literal) ;) })) (return_statement "return uVar1;" return identifier ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , LIT ))) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT & LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) == LIT) && (binary_expression IDENT == LIT)) )) && (binary_expression IDENT == LIT)) )) (compound_statement { (return_statement return LIT ;) })) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT & LIT) )) == LIT) )) || (parenthesized_expression ( (binary_expression IDENT == LIT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT )))) ;) (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT - LIT) < LIT) )) (compound_statement { (return_statement return LIT ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return LIT ;) })) })) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) (return_statement return IDENT ;) })))
(function_definition "undefined4 __regparm2\nsg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)\n\n{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" (type_identifier "undefined4") (ERROR "__regparm2" (identifier "__regparm2")) (function_declarator "sg_err_category_new(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" (identifier "sg_err_category_new") (parameter_list "(undefined4 param_1,undefined4 param_2,int param_3,uint param_4,\n                   undefined4 param_5,undefined4 param_6)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "int param_3" (primitive_type "int") (identifier "param_3")) (, ",") (parameter_declaration "uint param_4" (type_identifier "uint") (identifier "param_4")) (, ",") (parameter_declaration "undefined4 param_5" (type_identifier "undefined4") (identifier "param_5")) (, ",") (parameter_declaration "undefined4 param_6" (type_identifier "undefined4") (identifier "param_6")) () ")"))) (compound_statement "{\n  undefined4 uVar1;\n  uint unaff_retaddr;\n  \n  entry(param_2,0x2dac7);\n  param_4 = param_4 & 0xf;\n  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }\n  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }\n  if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }\n  uVar1 = 0x21;\n  if (param_4 != 6) {\n    uVar1 = 99;\n  }\n  return uVar1;\n}" ({ "{") (declaration "undefined4 uVar1;" (type_identifier "undefined4") (identifier "uVar1") (; ";")) (declaration "uint unaff_retaddr;" (type_identifier "uint") (identifier "unaff_retaddr") (; ";")) (expression_statement "entry(param_2,0x2dac7);" (call_expression "entry(param_2,0x2dac7)" (identifier "entry") (argument_list "(param_2,0x2dac7)" (( "(") (identifier "param_2") (, ",") (number_literal "0x2dac7") () ")"))) (; ";")) (expression_statement "param_4 = param_4 & 0xf;" (assignment_expression "param_4 = param_4 & 0xf" (identifier "param_4") (= "=") (binary_expression "param_4 & 0xf" (identifier "param_4") (& "&") (number_literal "0xf"))) (; ";")) (if_statement "if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {\n    return 0;\n  }" (if "if") (parenthesized_expression "(((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0)" (( "(") (binary_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0" (parenthesized_expression "((unaff_retaddr & 0x7e) == 0 && param_3 == 0)" (( "(") (binary_expression "(unaff_retaddr & 0x7e) == 0 && param_3 == 0" (binary_expression "(unaff_retaddr & 0x7e) == 0" (parenthesized_expression "(unaff_retaddr & 0x7e)" (( "(") (binary_expression "unaff_retaddr & 0x7e" (identifier "unaff_retaddr") (& "&") (number_literal "0x7e")) () ")")) (== "==") (number_literal "0")) (&& "&&") (binary_expression "param_3 == 0" (identifier "param_3") (== "==") (number_literal "0"))) () ")")) (&& "&&") (binary_expression "param_4 == 0" (identifier "param_4") (== "==") (number_literal "0"))) () ")")) (compound_statement "{\n    return 0;\n  }" ({ "{") (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (if_statement "if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" (if "if") (parenthesized_expression "(((unaff_retaddr & 0x5e) == 2) || (param_4 == 8))" (( "(") (binary_expression "((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)" (parenthesized_expression "((unaff_retaddr & 0x5e) == 2)" (( "(") (binary_expression "(unaff_retaddr & 0x5e) == 2" (parenthesized_expression "(unaff_retaddr & 0x5e)" (( "(") (binary_expression "unaff_retaddr & 0x5e" (identifier "unaff_retaddr") (& "&") (number_literal "0x5e")) () ")")) (== "==") (number_literal "2")) () ")")) (|| "||") (parenthesized_expression "(param_4 == 8)" (( "(") (binary_expression "param_4 == 8" (identifier "param_4") (== "==") (number_literal "8")) () ")"))) () ")")) (compound_statement "{\n    uVar1 = sg_err_category_sense(param_5,param_6);\n    return uVar1;\n  }" ({ "{") (expression_statement "uVar1 = sg_err_category_sense(param_5,param_6);" (assignment_expression "uVar1 = sg_err_category_sense(param_5,param_6)" (identifier "uVar1") (= "=") (call_expression "sg_err_category_sense(param_5,param_6)" (identifier "sg_err_category_sense") (argument_list "(param_5,param_6)" (( "(") (identifier "param_5") (, ",") (identifier "param_6") () ")")))) (; ";")) (return_statement "return uVar1;" (return "return") (identifier "uVar1") (; ";")) (} "}"))) (if_statement "if (param_3 != 0) {\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" (if "if") (parenthesized_expression "(param_3 != 0)" (( "(") (binary_expression "param_3 != 0" (identifier "param_3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    if (param_3 - 1U < 3) {\n      return 0x21;\n    }\n    if (param_3 == 0x11) {\n      return 0x18;\n    }\n  }" ({ "{") (if_statement "if (param_3 - 1U < 3) {\n      return 0x21;\n    }" (if "if") (parenthesized_expression "(param_3 - 1U < 3)" (( "(") (binary_expression "param_3 - 1U < 3" (binary_expression "param_3 - 1U" (identifier "param_3") (- "-") (number_literal "1U")) (< "<") (number_literal "3")) () ")")) (compound_statement "{\n      return 0x21;\n    }" ({ "{") (return_statement "return 0x21;" (return "return") (number_literal "0x21") (; ";")) (} "}"))) (if_statement "if (param_3 == 0x11) {\n      return 0x18;\n    }" (if "if") (parenthesized_expression "(param_3 == 0x11)" (( "(") (binary_expression "param_3 == 0x11" (identifier "param_3") (== "==") (number_literal "0x11")) () ")")) (compound_statement "{\n      return 0x18;\n    }" ({ "{") (return_statement "return 0x18;" (return "return") (number_literal "0x18") (; ";")) (} "}"))) (} "}"))) (expression_statement "uVar1 = 0x21;" (assignment_expression "uVar1 = 0x21" (identifier "uVar1") (= "=") (number_literal "0x21")) (; ";")) (if_statement "if (param_4 != 6) {\n    uVar1 = 99;\n  }" (if "if") (parenthesized_expression "(param_4 != 6)" (( "(") (binary_expression "param_4 != 6" (identifier "param_4") (!= "!=") (number_literal "6")) () ")")) (compound_statement "{\n    uVar1 = 99;\n  }" ({ "{") (expression_statement "uVar1 = 99;" (assignment_expression "uVar1 = 99" (identifier "uVar1") (= "=") (number_literal "99")) (; ";")) (} "}"))) (return_statement "return uVar1;" (return "return") (identifier "uVar1") (; ";")) (} "}")))

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

int function_1(int var_2,int var_3,int var_1,uint8_t *sense_buffer,
                       int sb_len)

{
  int iVar1;
  type_1 var_4;
  
  var_4 = var_1 & 0xf;
  if (((var_2 & 0x7eU) == 0 && var_3 == 0) && var_4 == 0) {
    return 0;
  }
  if (((var_2 & 0x5eU) == 2) || (var_4 == 8)) {
    iVar1 = var_5(sense_buffer,sb_len);
    return iVar1;
  }
  if (var_3 != 0) {
    if (var_3 - 1U < 3) {
      return 0x21;
    }
    if (var_3 == 0x11) {
      return 0x18;
    }
  }
  iVar1 = 0x21;
  if (var_4 != 6) {
    iVar1 = 99;
  }
  return iVar1;
}


(translation_unit (function_definition type: (type_identifier) (ERROR (identifier)) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (number_literal)) right: (binary_expression left: (identifier) right: (number_literal)))) right: (binary_expression left: (identifier) right: (number_literal)))) consequence: (compound_statement (return_statement (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: (identifier) right: (number_literal))))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier))))) (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (number_literal)) right: (number_literal))) consequence: (compound_statement (return_statement (number_literal)))) (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: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))))) (return_statement (identifier)))))

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

{
  undefined4 uVar1;
  uint unaff_retaddr;
  
  entry(param_2,0x2dac7);
  param_4 = param_4 & 0xf;
  if (((unaff_retaddr & 0x7e) == 0 && param_3 == 0) && param_4 == 0) {
    return 0;
  }
  if (((unaff_retaddr & 0x5e) == 2) || (param_4 == 8)) {
    uVar1 = sg_err_category_sense(param_5,param_6);
    return uVar1;
  }
  if (param_3 != 0) {
    if (param_3 - 1U < 3) {
      return 0x21;
    }
    if (param_3 == 0x11) {
      return 0x18;
    }
  }
  uVar1 = 0x21;
  if (param_4 != 6) {
    uVar1 = 99;
  }
  return uVar1;
}

