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

int sg_ll_send_diag_pt(sg_pt_base *ptvp,int st_code,_Bool pf_bit,_Bool st_bit,_Bool devofl_bit,
                      _Bool unitofl_bit,int long_duration,void *paramp,int param_len,_Bool noisy,
                      int verbose)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  byte *pbVar5;
  int in_GS_OFFSET;
  uint8_t *local_74;
  int sense_cat;
  uint8_t senddiag_cdb [6];
  uint8_t sense_b [64];
  
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  senddiag_cdb[0] = '\x1d';
  senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5);
  if (pf_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;
  }
  if (st_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 4;
  }
  if (devofl_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 2;
  }
  if (unitofl_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 1;
  }
  senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8;
  if (long_duration < 0x1c21) {
    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;
  }
  if (verbose != 0) {
    pr2ws("    %s cdb: ","Send diagnostic");
    pbVar5 = senddiag_cdb;
    do {
      uVar3 = (uint)*pbVar5;
      pbVar5 = pbVar5 + 1;
      pr2ws("%02x ",uVar3);
    } while (pbVar5 != sense_b);
    pr2ws("\n",uVar3);
    if (1 < verbose) {
      if ((paramp != (void *)0x0) && (param_len != 0)) {
        pr2ws("    %s parameter list:\n","Send diagnostic");
        hex2stderr((uint8_t *)paramp,param_len,-1);
      }
      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);
    }
  }
  local_74 = senddiag_cdb;
  set_scsi_pt_cdb(ptvp,local_74,6);
  set_scsi_pt_sense(ptvp,sense_b,0x40);
  set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len);
  iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose);
  iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat);
  if (iVar2 == -1) {
    iVar2 = get_scsi_pt_os_err();
    iVar4 = sg_convert_errno(iVar2);
  }
  else {
    iVar4 = 0;
    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {
      iVar4 = 0;
    }
  }
  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar4;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail_local();
}



int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,
                      int param_7,int param_8,undefined1 param_9,int param_10)

{
  undefined4 uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int unaff_EBX;
  byte *pbVar5;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_84;
  byte *local_78;
  int local_70;
  byte local_6a [2];
  int local_68;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uStack_14 = 0x24199;
  entry();
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  local_6a[0] = 0x1d;
  local_6a[1] = param_1 << 5;
  if (param_2 != '\0') {
    local_6a[1] = param_1 << 5 | 0x10;
  }
  if (param_3 != '\0') {
    local_6a[1] = local_6a[1] | 4;
  }
  if (param_4 != '\0') {
    local_6a[1] = local_6a[1] | 2;
  }
  if (param_5 != '\0') {
    local_6a[1] = local_6a[1] | 1;
  }
  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;
  if (param_6 < 0x1c21) {
    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;
  }
  if (param_10 != 0) {
    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);
    pbVar5 = local_6a;
    do {
      local_84 = unaff_EBX + 0x11739;
      uVar3 = (uint)*pbVar5;
      pbVar5 = pbVar5 + 1;
      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);
    } while (pbVar5 != local_64);
    pr2ws(unaff_EBX + 0xc547,uVar3);
    if (1 < param_10) {
      if ((param_7 != 0) && (param_8 != 0)) {
        pr2ws(unaff_EBX + 0x187f7,local_84);
        hex2stderr(param_7,param_8,0xffffffff);
      }
      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);
    }
  }
  local_78 = local_6a;
  local_84 = unaff_EBX + 0x11739;
  set_scsi_pt_cdb(unaff_retaddr,local_78,6);
  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);
  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);
  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);
  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);
  if (iVar2 == -1) {
    uVar1 = get_scsi_pt_os_err(unaff_retaddr);
    iVar4 = sg_convert_errno(uVar1);
  }
  else {
    iVar4 = 0;
    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {
      iVar4 = 0;
    }
  }
  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar4;
  }
                    /* WARNING: Subroutine does not return */
  FUN_0002f100();
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00017820
ADD EBX,0x24bef
SUB ESP,0x7c
MOV EAX,dword ptr [ESP + 0xac]
MOV ESI,dword ptr [ESP + 0x90]
MOV ECX,dword ptr [ESP + 0xa0]
MOV EDX,dword ptr [ESP + 0xa4]
MOV dword ptr [ESP + 0x10],EAX
MOV EAX,dword ptr [ESP + 0xb4]
MOV dword ptr [ESP + 0x14],EAX
MOV EAX,GS:[0x14]
MOV dword ptr [ESP + 0x6c],EAX
XOR EAX,EAX
MOVZX EAX,byte ptr [ESP + 0x94]
MOV byte ptr [ESP + 0x26],0x1d
MOV dword ptr [ESP + 0x28],0x0
SHL EAX,0x5
MOV EDI,EAX
OR EDI,0x10
CMP byte ptr [ESP + 0x98],0x0
CMOVNZ EAX,EDI
CMP byte ptr [ESP + 0x9c],0x0
MOV byte ptr [ESP + 0x27],AL
JZ 0x00024214
OR byte ptr [ESP + 0x27],0x4
TEST CL,CL
JZ 0x0002421d
OR byte ptr [ESP + 0x27],0x2
TEST DL,DL
JZ 0x00024226
OR byte ptr [ESP + 0x27],0x1
MOVZX EAX,word ptr [ESP + 0xb0]
ROL AX,0x8
CMP dword ptr [ESP + 0xa8],0x1c20
MOV word ptr [ESP + 0x29],AX
JLE 0x00024318
MOV EDX,dword ptr [ESP + 0xb8]
TEST EDX,EDX
JNZ 0x00024342
LEA EAX,[EBX + 0xfffecb4a]
LEA EDI,[ESP + 0x2c]
MOV dword ptr [ESP + 0xc],EAX
LEA EAX,[ESP + 0x26]
MOV dword ptr [ESP + 0x18],EAX
SUB ESP,0x4
PUSH 0x6
PUSH dword ptr [ESP + 0x20]
PUSH ESI
CALL 0x000177e0
ADD ESP,0xc
PUSH 0x40
PUSH EDI
PUSH ESI
CALL 0x00017620
ADD ESP,0xc
PUSH dword ptr [ESP + 0xb4]
PUSH dword ptr [ESP + 0x18]
PUSH ESI
CALL 0x000170f0
PUSH dword ptr [ESP + 0xc8]
PUSH dword ptr [ESP + 0xbc]
PUSH -0x1
PUSH ESI
CALL 0x00017430
ADD ESP,0x20
LEA EDX,[ESP + 0x20]
PUSH EDX
PUSH dword ptr [ESP + 0xbc]
MOVZX EDX,byte ptr [ESP + 0x1c]
PUSH EDX
PUSH EDI
PUSH 0x0
PUSH EAX
PUSH dword ptr [ESP + 0x24]
PUSH ESI
CALL 0x00017690
ADD ESP,0x20
CMP EAX,-0x1
JZ 0x00024420
XOR EDX,EDX
CMP EAX,-0x2
JNZ 0x000242fa
MOV EDX,dword ptr [ESP + 0x20]
LEA EAX,[EDX + -0x14]
CMP EAX,0x2
MOV EAX,0x0
CMOVC EDX,EAX
MOV ECX,dword ptr [ESP + 0x6c]
XOR ECX,dword ptr GS:[0x14]
MOV EAX,EDX
JNZ 0x0002443b
ADD ESP,0x7c
POP EBX
POP ESI
POP EDI
POP EBP
RET
CMP dword ptr [ESP + 0xa8],0x1
MOV EDX,dword ptr [ESP + 0xb8]
SBB EAX,EAX
AND EAX,0xffffe41c
ADD EAX,0x1c20
MOV dword ptr [ESP + 0xa8],EAX
TEST EDX,EDX
JZ 0x00024257
SUB ESP,0x8
LEA EAX,[EBX + 0xfffecb4a]
MOV dword ptr [ESP + 0x14],EAX
PUSH EAX
LEA EAX,[EBX + 0xffff34d7]
PUSH EAX
CALL 0x00017630
LEA EAX,[ESP + 0x36]
LEA EDI,[ESP + 0x3c]
MOV dword ptr [ESP + 0x28],EAX
MOV EBP,EAX
ADD ESP,0x10
LEA EAX,[EBX + 0xffff479b]
MOV dword ptr [ESP + 0x1c],ESI
MOV ESI,EBP
MOV EBP,EAX
LEA ESI,[ESI]
NOP
MOVZX EAX,byte ptr [ESI]
SUB ESP,0x8
ADD ESI,0x1
PUSH EAX
PUSH EBP
CALL 0x00017630
ADD ESP,0x10
CMP ESI,EDI
JNZ 0x00024380
MOV ESI,dword ptr [ESP + 0x1c]
LEA EAX,[EBX + 0xfffe7958]
SUB ESP,0xc
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
CMP dword ptr [ESP + 0xb8],0x1
JLE 0x0002426d
MOV EBP,dword ptr [ESP + 0x10]
TEST EBP,EBP
JZ 0x000243f6
MOV EAX,dword ptr [ESP + 0xb0]
TEST EAX,EAX
JZ 0x000243f6
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3c08]
PUSH dword ptr [ESP + 0x14]
PUSH EAX
CALL 0x00017630
ADD ESP,0xc
PUSH -0x1
PUSH dword ptr [ESP + 0xb8]
PUSH EBP
CALL 0x00017700
ADD ESP,0x10
SUB ESP,0x4
LEA EAX,[EBX + 0xffff3c20]
PUSH dword ptr [ESP + 0xac]
PUSH dword ptr [ESP + 0x14]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
JMP 0x0002426d
SUB ESP,0xc
PUSH ESI
CALL 0x000170a0
MOV dword ptr [ESP],EAX
CALL 0x00017560
ADD ESP,0x10
MOV EDX,EAX
JMP 0x000242fa
CALL 0x0002f100
(translation_unit "int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0002f100();\n}\n\n" (function_definition "int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0002f100();\n}" primitive_type (function_declarator "sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" identifier (parameter_list "(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" ( (parameter_declaration "char param_1" primitive_type identifier) , (parameter_declaration "char param_2" primitive_type identifier) , (parameter_declaration "char param_3" primitive_type identifier) , (parameter_declaration "char param_4" primitive_type identifier) , (parameter_declaration "char param_5" primitive_type identifier) , (parameter_declaration "int param_6" primitive_type identifier) , (parameter_declaration "int param_7" primitive_type identifier) , (parameter_declaration "int param_8" primitive_type identifier) , (parameter_declaration "undefined1 param_9" type_identifier identifier) , (parameter_declaration "int param_10" primitive_type identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0002f100();\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_84;" primitive_type identifier ;) (declaration "byte *local_78;" type_identifier (pointer_declarator "*local_78" * identifier) ;) (declaration "int local_70;" primitive_type identifier ;) (declaration "byte local_6a [2];" type_identifier (array_declarator "local_6a [2]" identifier [ number_literal ]) ;) (declaration "int local_68;" primitive_type identifier ;) (declaration "byte local_64 [64];" type_identifier (array_declarator "local_64 [64]" identifier [ number_literal ]) ;) (declaration "int local_24;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x24199;" (assignment_expression "uStack_14 = 0x24199" identifier = number_literal) ;) (expression_statement "entry();" (call_expression "entry()" identifier (argument_list "()" ( ))) ;) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_6a[0] = 0x1d;" (assignment_expression "local_6a[0] = 0x1d" (subscript_expression "local_6a[0]" identifier [ number_literal ]) = number_literal) ;) (expression_statement "local_6a[1] = param_1 << 5;" (assignment_expression "local_6a[1] = param_1 << 5" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "param_1 << 5" identifier << number_literal)) ;) (if_statement "if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" if (parenthesized_expression "(param_2 != '\0')" ( (binary_expression "param_2 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" { (expression_statement "local_6a[1] = param_1 << 5 | 0x10;" (assignment_expression "local_6a[1] = param_1 << 5 | 0x10" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "param_1 << 5 | 0x10" (binary_expression "param_1 << 5" identifier << number_literal) | number_literal)) ;) })) (if_statement "if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }" if (parenthesized_expression "(param_3 != '\0')" ( (binary_expression "param_3 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 4;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 4;" (assignment_expression "local_6a[1] = local_6a[1] | 4" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 4" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }" if (parenthesized_expression "(param_4 != '\0')" ( (binary_expression "param_4 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 2;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 2;" (assignment_expression "local_6a[1] = local_6a[1] | 2" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 2" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }" if (parenthesized_expression "(param_5 != '\0')" ( (binary_expression "param_5 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 1;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 1;" (assignment_expression "local_6a[1] = local_6a[1] | 1" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 1" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (expression_statement "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;" (assignment_expression "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" identifier = (binary_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" (call_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8)" (call_expression "(uint)(ushort)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(ushort)" ( identifier ))) (argument_list "((ushort)param_8 << 8 | (ushort)param_8 >> 8)" ( (binary_expression "(ushort)param_8 << 8 | (ushort)param_8 >> 8" (binary_expression "(ushort)param_8 << 8" (cast_expression "(ushort)param_8" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_8 >> 8" (cast_expression "(ushort)param_8" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal)) ))) << number_literal)) ;) (if_statement "if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" if (parenthesized_expression "(param_6 < 0x1c21)" ( (binary_expression "param_6 < 0x1c21" identifier < number_literal) )) (compound_statement "{\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" { (expression_statement "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;" (assignment_expression "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" identifier = (binary_expression "(-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" (parenthesized_expression "(-(uint)(param_6 == 0) & 0xffffe41c)" ( (binary_expression "-(uint)(param_6 == 0) & 0xffffe41c" (unary_expression "-(uint)(param_6 == 0)" - (call_expression "(uint)(param_6 == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_6 == 0)" ( (binary_expression "param_6 == 0" identifier == number_literal) )))) & number_literal) )) + number_literal)) ;) })) (if_statement "if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" if (parenthesized_expression "(param_10 != 0)" ( (binary_expression "param_10 != 0" identifier != number_literal) )) (compound_statement "{\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" { (expression_statement "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);" (call_expression "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" identifier (argument_list "(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" ( (binary_expression "unaff_EBX + 0x180c6" identifier + number_literal) , (binary_expression "unaff_EBX + 0x11739" identifier + number_literal) ))) ;) (expression_statement "pbVar5 = local_6a;" (assignment_expression "pbVar5 = local_6a" identifier = identifier) ;) (do_statement "do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);" do (compound_statement "{\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    }" { (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" identifier = (binary_expression "unaff_EBX + 0x11739" identifier + number_literal)) ;) (expression_statement "uVar3 = (uint)*pbVar5;" (assignment_expression "uVar3 = (uint)*pbVar5" identifier = (binary_expression "(uint)*pbVar5" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar5 = pbVar5 + 1;" (assignment_expression "pbVar5 = pbVar5 + 1" identifier = (binary_expression "pbVar5 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws(&UNK_0001938a + unaff_EBX,uVar3);" (call_expression "pr2ws(&UNK_0001938a + unaff_EBX,uVar3)" identifier (argument_list "(&UNK_0001938a + unaff_EBX,uVar3)" ( (binary_expression "&UNK_0001938a + unaff_EBX" (pointer_expression "&UNK_0001938a" & identifier) + identifier) , identifier ))) ;) }) while (parenthesized_expression "(pbVar5 != local_64)" ( (binary_expression "pbVar5 != local_64" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0xc547,uVar3);" (call_expression "pr2ws(unaff_EBX + 0xc547,uVar3)" identifier (argument_list "(unaff_EBX + 0xc547,uVar3)" ( (binary_expression "unaff_EBX + 0xc547" identifier + number_literal) , identifier ))) ;) (if_statement "if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" if (parenthesized_expression "(1 < param_10)" ( (binary_expression "1 < param_10" number_literal < identifier) )) (compound_statement "{\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" { (if_statement "if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" if (parenthesized_expression "((param_7 != 0) && (param_8 != 0))" ( (binary_expression "(param_7 != 0) && (param_8 != 0)" (parenthesized_expression "(param_7 != 0)" ( (binary_expression "param_7 != 0" identifier != number_literal) )) && (parenthesized_expression "(param_8 != 0)" ( (binary_expression "param_8 != 0" identifier != number_literal) ))) )) (compound_statement "{\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x187f7,local_84);" (call_expression "pr2ws(unaff_EBX + 0x187f7,local_84)" identifier (argument_list "(unaff_EBX + 0x187f7,local_84)" ( (binary_expression "unaff_EBX + 0x187f7" identifier + number_literal) , identifier ))) ;) (expression_statement "hex2stderr(param_7,param_8,0xffffffff);" (call_expression "hex2stderr(param_7,param_8,0xffffffff)" identifier (argument_list "(param_7,param_8,0xffffffff)" ( identifier , identifier , number_literal ))) ;) })) (expression_statement "pr2ws(unaff_EBX + 0x1880f,local_84,param_6);" (call_expression "pr2ws(unaff_EBX + 0x1880f,local_84,param_6)" identifier (argument_list "(unaff_EBX + 0x1880f,local_84,param_6)" ( (binary_expression "unaff_EBX + 0x1880f" identifier + number_literal) , identifier , identifier ))) ;) })) })) (expression_statement "local_78 = local_6a;" (assignment_expression "local_78 = local_6a" identifier = identifier) ;) (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" identifier = (binary_expression "unaff_EBX + 0x11739" identifier + number_literal)) ;) (expression_statement "set_scsi_pt_cdb(unaff_retaddr,local_78,6);" (call_expression "set_scsi_pt_cdb(unaff_retaddr,local_78,6)" identifier (argument_list "(unaff_retaddr,local_78,6)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(unaff_retaddr,local_64,0x40);" (call_expression "set_scsi_pt_sense(unaff_retaddr,local_64,0x40)" identifier (argument_list "(unaff_retaddr,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);" (call_expression "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8)" identifier (argument_list "(unaff_retaddr,param_7,param_8)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);" (assignment_expression "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" identifier = (call_expression "do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" identifier (argument_list "(unaff_retaddr,0xffffffff,param_6,param_10)" ( identifier , number_literal , identifier , identifier )))) ;) (expression_statement "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);" (assignment_expression "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" identifier = (call_expression "sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" identifier (argument_list "(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" ( identifier , identifier , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&local_70" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }" { (expression_statement "uVar1 = get_scsi_pt_os_err(unaff_retaddr);" (assignment_expression "uVar1 = get_scsi_pt_os_err(unaff_retaddr)" identifier = (call_expression "get_scsi_pt_os_err(unaff_retaddr)" identifier (argument_list "(unaff_retaddr)" ( identifier )))) ;) (expression_statement "iVar4 = sg_convert_errno(uVar1);" (assignment_expression "iVar4 = sg_convert_errno(uVar1)" identifier = (call_expression "sg_convert_errno(uVar1)" identifier (argument_list "(uVar1)" ( identifier )))) ;) }) (else_clause "else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" else (compound_statement "{\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }" if (parenthesized_expression "((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2))" ( (binary_expression "(iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)" (parenthesized_expression "(iVar2 == -2)" ( (binary_expression "iVar2 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar4 = local_70, local_70 - 0x14U < 2)" ( (comma_expression "iVar4 = local_70, local_70 - 0x14U < 2" (assignment_expression "iVar4 = local_70" identifier = identifier) , (binary_expression "local_70 - 0x14U < 2" (binary_expression "local_70 - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n      iVar4 = 0;\n    }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) })) }))) (if_statement "if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }" if (parenthesized_expression "(local_24 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_24 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return iVar4;\n  }" { (return_statement "return iVar4;" return identifier ;) })) comment (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint sg_ll_send_diag_pt(sg_pt_base *ptvp,int st_code,_Bool pf_bit,_Bool st_bit,_Bool devofl_bit,\n                      _Bool unitofl_bit,int long_duration,void *paramp,int param_len,_Bool noisy,\n                      int verbose)\n\n{\n  int iVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  uint8_t *local_74;\n  int sense_cat;\n  uint8_t senddiag_cdb [6];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  senddiag_cdb[0] = '\x1d';\n  senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5);\n  if (pf_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;\n  }\n  if (st_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 4;\n  }\n  if (devofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 2;\n  }\n  if (unitofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 1;\n  }\n  senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8;\n  if (long_duration < 0x1c21) {\n    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (verbose != 0) {\n    pr2ws("    %s cdb: ","Send diagnostic");\n    pbVar5 = senddiag_cdb;\n    do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);\n    pr2ws("\n",uVar3);\n    if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }\n  }\n  local_74 = senddiag_cdb;\n  set_scsi_pt_cdb(ptvp,local_74,6);\n  set_scsi_pt_sense(ptvp,sense_b,0x40);\n  set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len);\n  iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose);\n  iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat);\n  if (iVar2 == -1) {\n    iVar2 = get_scsi_pt_os_err();\n    iVar4 = sg_convert_errno(iVar2);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}\n\n" comment (function_definition "int sg_ll_send_diag_pt(sg_pt_base *ptvp,int st_code,_Bool pf_bit,_Bool st_bit,_Bool devofl_bit,\n                      _Bool unitofl_bit,int long_duration,void *paramp,int param_len,_Bool noisy,\n                      int verbose)\n\n{\n  int iVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  uint8_t *local_74;\n  int sense_cat;\n  uint8_t senddiag_cdb [6];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  senddiag_cdb[0] = '\x1d';\n  senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5);\n  if (pf_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;\n  }\n  if (st_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 4;\n  }\n  if (devofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 2;\n  }\n  if (unitofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 1;\n  }\n  senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8;\n  if (long_duration < 0x1c21) {\n    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (verbose != 0) {\n    pr2ws("    %s cdb: ","Send diagnostic");\n    pbVar5 = senddiag_cdb;\n    do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);\n    pr2ws("\n",uVar3);\n    if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }\n  }\n  local_74 = senddiag_cdb;\n  set_scsi_pt_cdb(ptvp,local_74,6);\n  set_scsi_pt_sense(ptvp,sense_b,0x40);\n  set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len);\n  iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose);\n  iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat);\n  if (iVar2 == -1) {\n    iVar2 = get_scsi_pt_os_err();\n    iVar4 = sg_convert_errno(iVar2);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" primitive_type (function_declarator "sg_ll_send_diag_pt(sg_pt_base *ptvp,int st_code,_Bool pf_bit,_Bool st_bit,_Bool devofl_bit,\n                      _Bool unitofl_bit,int long_duration,void *paramp,int param_len,_Bool noisy,\n                      int verbose)" identifier (parameter_list "(sg_pt_base *ptvp,int st_code,_Bool pf_bit,_Bool st_bit,_Bool devofl_bit,\n                      _Bool unitofl_bit,int long_duration,void *paramp,int param_len,_Bool noisy,\n                      int verbose)" ( (parameter_declaration "sg_pt_base *ptvp" type_identifier (pointer_declarator "*ptvp" * identifier)) , (parameter_declaration "int st_code" primitive_type identifier) , (parameter_declaration "_Bool pf_bit" type_identifier identifier) , (parameter_declaration "_Bool st_bit" type_identifier identifier) , (parameter_declaration "_Bool devofl_bit" type_identifier identifier) , (parameter_declaration "_Bool unitofl_bit" type_identifier identifier) , (parameter_declaration "int long_duration" primitive_type identifier) , (parameter_declaration "void *paramp" primitive_type (pointer_declarator "*paramp" * identifier)) , (parameter_declaration "int param_len" primitive_type identifier) , (parameter_declaration "_Bool noisy" type_identifier identifier) , (parameter_declaration "int verbose" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  uint8_t *local_74;\n  int sense_cat;\n  uint8_t senddiag_cdb [6];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  senddiag_cdb[0] = '\x1d';\n  senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5);\n  if (pf_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;\n  }\n  if (st_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 4;\n  }\n  if (devofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 2;\n  }\n  if (unitofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 1;\n  }\n  senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8;\n  if (long_duration < 0x1c21) {\n    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (verbose != 0) {\n    pr2ws("    %s cdb: ","Send diagnostic");\n    pbVar5 = senddiag_cdb;\n    do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);\n    pr2ws("\n",uVar3);\n    if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }\n  }\n  local_74 = senddiag_cdb;\n  set_scsi_pt_cdb(ptvp,local_74,6);\n  set_scsi_pt_sense(ptvp,sense_b,0x40);\n  set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len);\n  iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose);\n  iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat);\n  if (iVar2 == -1) {\n    iVar2 = get_scsi_pt_os_err();\n    iVar4 = sg_convert_errno(iVar2);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "uint8_t *local_74;" primitive_type (pointer_declarator "*local_74" * identifier) ;) (declaration "int sense_cat;" primitive_type identifier ;) (declaration "uint8_t senddiag_cdb [6];" primitive_type (array_declarator "senddiag_cdb [6]" identifier [ number_literal ]) ;) (declaration "uint8_t sense_b [64];" primitive_type (array_declarator "sense_b [64]" identifier [ number_literal ]) ;) (expression_statement "iVar1 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "iVar1 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "senddiag_cdb[0] = '\x1d';" (assignment_expression "senddiag_cdb[0] = '\x1d'" (subscript_expression "senddiag_cdb[0]" identifier [ number_literal ]) = (char_literal "'\x1d'" ' escape_sequence ')) ;) (expression_statement "senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5);" (assignment_expression "senddiag_cdb[1] = (uint8_t)((st_code & 0xffU) << 5)" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) = (cast_expression "(uint8_t)((st_code & 0xffU) << 5)" ( (type_descriptor "uint8_t" primitive_type) ) (parenthesized_expression "((st_code & 0xffU) << 5)" ( (binary_expression "(st_code & 0xffU) << 5" (parenthesized_expression "(st_code & 0xffU)" ( (binary_expression "st_code & 0xffU" identifier & number_literal) )) << number_literal) )))) ;) (if_statement "if (pf_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;\n  }" if (parenthesized_expression "(pf_bit)" ( identifier )) (compound_statement "{\n    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;\n  }" { (expression_statement "senddiag_cdb[1] = senddiag_cdb[1] | 0x10;" (assignment_expression "senddiag_cdb[1] = senddiag_cdb[1] | 0x10" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) = (binary_expression "senddiag_cdb[1] | 0x10" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (st_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 4;\n  }" if (parenthesized_expression "(st_bit)" ( identifier )) (compound_statement "{\n    senddiag_cdb[1] = senddiag_cdb[1] | 4;\n  }" { (expression_statement "senddiag_cdb[1] = senddiag_cdb[1] | 4;" (assignment_expression "senddiag_cdb[1] = senddiag_cdb[1] | 4" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) = (binary_expression "senddiag_cdb[1] | 4" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (devofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 2;\n  }" if (parenthesized_expression "(devofl_bit)" ( identifier )) (compound_statement "{\n    senddiag_cdb[1] = senddiag_cdb[1] | 2;\n  }" { (expression_statement "senddiag_cdb[1] = senddiag_cdb[1] | 2;" (assignment_expression "senddiag_cdb[1] = senddiag_cdb[1] | 2" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) = (binary_expression "senddiag_cdb[1] | 2" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (unitofl_bit) {\n    senddiag_cdb[1] = senddiag_cdb[1] | 1;\n  }" if (parenthesized_expression "(unitofl_bit)" ( identifier )) (compound_statement "{\n    senddiag_cdb[1] = senddiag_cdb[1] | 1;\n  }" { (expression_statement "senddiag_cdb[1] = senddiag_cdb[1] | 1;" (assignment_expression "senddiag_cdb[1] = senddiag_cdb[1] | 1" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) = (binary_expression "senddiag_cdb[1] | 1" (subscript_expression "senddiag_cdb[1]" identifier [ number_literal ]) | number_literal)) ;) })) (expression_statement "senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8;" (assignment_expression "senddiag_cdb._2_4_ = (uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8" (field_expression "senddiag_cdb._2_4_" identifier . field_identifier) = (binary_expression "(uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8) << 8" (call_expression "(uint)(ushort)((ushort)param_len << 8 | (ushort)param_len >> 8)" (call_expression "(uint)(ushort)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(ushort)" ( identifier ))) (argument_list "((ushort)param_len << 8 | (ushort)param_len >> 8)" ( (binary_expression "(ushort)param_len << 8 | (ushort)param_len >> 8" (binary_expression "(ushort)param_len << 8" (cast_expression "(ushort)param_len" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_len >> 8" (cast_expression "(ushort)param_len" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal)) ))) << number_literal)) ;) (if_statement "if (long_duration < 0x1c21) {\n    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;\n  }" if (parenthesized_expression "(long_duration < 0x1c21)" ( (binary_expression "long_duration < 0x1c21" identifier < number_literal) )) (compound_statement "{\n    long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;\n  }" { (expression_statement "long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20;" (assignment_expression "long_duration = (-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20" identifier = (binary_expression "(-(uint)(long_duration == 0) & 0xffffe41c) + 0x1c20" (parenthesized_expression "(-(uint)(long_duration == 0) & 0xffffe41c)" ( (binary_expression "-(uint)(long_duration == 0) & 0xffffe41c" (unary_expression "-(uint)(long_duration == 0)" - (call_expression "(uint)(long_duration == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(long_duration == 0)" ( (binary_expression "long_duration == 0" identifier == number_literal) )))) & number_literal) )) + number_literal)) ;) })) (if_statement "if (verbose != 0) {\n    pr2ws("    %s cdb: ","Send diagnostic");\n    pbVar5 = senddiag_cdb;\n    do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);\n    pr2ws("\n",uVar3);\n    if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }\n  }" if (parenthesized_expression "(verbose != 0)" ( (binary_expression "verbose != 0" identifier != number_literal) )) (compound_statement "{\n    pr2ws("    %s cdb: ","Send diagnostic");\n    pbVar5 = senddiag_cdb;\n    do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);\n    pr2ws("\n",uVar3);\n    if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }\n  }" { (expression_statement "pr2ws("    %s cdb: ","Send diagnostic");" (call_expression "pr2ws("    %s cdb: ","Send diagnostic")" identifier (argument_list "("    %s cdb: ","Send diagnostic")" ( (string_literal ""    %s cdb: "" " string_content ") , (string_literal ""Send diagnostic"" " string_content ") ))) ;) (expression_statement "pbVar5 = senddiag_cdb;" (assignment_expression "pbVar5 = senddiag_cdb" identifier = identifier) ;) (do_statement "do {\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    } while (pbVar5 != sense_b);" do (compound_statement "{\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws("%02x ",uVar3);\n    }" { (expression_statement "uVar3 = (uint)*pbVar5;" (assignment_expression "uVar3 = (uint)*pbVar5" identifier = (binary_expression "(uint)*pbVar5" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar5 = pbVar5 + 1;" (assignment_expression "pbVar5 = pbVar5 + 1" identifier = (binary_expression "pbVar5 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws("%02x ",uVar3);" (call_expression "pr2ws("%02x ",uVar3)" identifier (argument_list "("%02x ",uVar3)" ( (string_literal ""%02x "" " string_content ") , identifier ))) ;) }) while (parenthesized_expression "(pbVar5 != sense_b)" ( (binary_expression "pbVar5 != sense_b" identifier != identifier) )) ;) (expression_statement "pr2ws("\n",uVar3);" (call_expression "pr2ws("\n",uVar3)" identifier (argument_list "("\n",uVar3)" ( (string_literal ""\n"" " escape_sequence ") , identifier ))) ;) (if_statement "if (1 < verbose) {\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }" if (parenthesized_expression "(1 < verbose)" ( (binary_expression "1 < verbose" number_literal < identifier) )) (compound_statement "{\n      if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }\n      pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);\n    }" { (if_statement "if ((paramp != (void *)0x0) && (param_len != 0)) {\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }" if (parenthesized_expression "((paramp != (void *)0x0) && (param_len != 0))" ( (binary_expression "(paramp != (void *)0x0) && (param_len != 0)" (parenthesized_expression "(paramp != (void *)0x0)" ( (binary_expression "paramp != (void *)0x0" identifier != (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(param_len != 0)" ( (binary_expression "param_len != 0" identifier != number_literal) ))) )) (compound_statement "{\n        pr2ws("    %s parameter list:\n","Send diagnostic");\n        hex2stderr((uint8_t *)paramp,param_len,-1);\n      }" { (expression_statement "pr2ws("    %s parameter list:\n","Send diagnostic");" (call_expression "pr2ws("    %s parameter list:\n","Send diagnostic")" identifier (argument_list "("    %s parameter list:\n","Send diagnostic")" ( (string_literal ""    %s parameter list:\n"" " string_content escape_sequence ") , (string_literal ""Send diagnostic"" " string_content ") ))) ;) (expression_statement "hex2stderr((uint8_t *)paramp,param_len,-1);" (call_expression "hex2stderr((uint8_t *)paramp,param_len,-1)" identifier (argument_list "((uint8_t *)paramp,param_len,-1)" ( (cast_expression "(uint8_t *)paramp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier , number_literal ))) ;) })) (expression_statement "pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration);" (call_expression "pr2ws("    %s timeout: %d seconds\n","Send diagnostic",long_duration)" identifier (argument_list "("    %s timeout: %d seconds\n","Send diagnostic",long_duration)" ( (string_literal ""    %s timeout: %d seconds\n"" " string_content escape_sequence ") , (string_literal ""Send diagnostic"" " string_content ") , identifier ))) ;) })) })) (expression_statement "local_74 = senddiag_cdb;" (assignment_expression "local_74 = senddiag_cdb" identifier = identifier) ;) (expression_statement "set_scsi_pt_cdb(ptvp,local_74,6);" (call_expression "set_scsi_pt_cdb(ptvp,local_74,6)" identifier (argument_list "(ptvp,local_74,6)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(ptvp,sense_b,0x40);" (call_expression "set_scsi_pt_sense(ptvp,sense_b,0x40)" identifier (argument_list "(ptvp,sense_b,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len);" (call_expression "set_scsi_pt_data_out(ptvp,(uint8_t *)paramp,param_len)" identifier (argument_list "(ptvp,(uint8_t *)paramp,param_len)" ( identifier , (cast_expression "(uint8_t *)paramp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier ))) ;) (expression_statement "iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose);" (assignment_expression "iVar2 = do_scsi_pt(ptvp,-1,long_duration,verbose)" identifier = (call_expression "do_scsi_pt(ptvp,-1,long_duration,verbose)" identifier (argument_list "(ptvp,-1,long_duration,verbose)" ( identifier , number_literal , identifier , identifier )))) ;) (expression_statement "iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat);" (assignment_expression "iVar2 = sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat)" identifier = (call_expression "sg_cmds_process_resp(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat)" identifier (argument_list "(ptvp,"Send diagnostic",iVar2,0,sense_b,noisy,verbose,&sense_cat)" ( identifier , (string_literal ""Send diagnostic"" " string_content ") , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&sense_cat" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n    iVar2 = get_scsi_pt_os_err();\n    iVar4 = sg_convert_errno(iVar2);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n    iVar2 = get_scsi_pt_os_err();\n    iVar4 = sg_convert_errno(iVar2);\n  }" { (expression_statement "iVar2 = get_scsi_pt_os_err();" (assignment_expression "iVar2 = get_scsi_pt_os_err()" identifier = (call_expression "get_scsi_pt_os_err()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar4 = sg_convert_errno(iVar2);" (assignment_expression "iVar4 = sg_convert_errno(iVar2)" identifier = (call_expression "sg_convert_errno(iVar2)" identifier (argument_list "(iVar2)" ( identifier )))) ;) }) (else_clause "else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" else (compound_statement "{\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if ((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)) {\n      iVar4 = 0;\n    }" if (parenthesized_expression "((iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2))" ( (binary_expression "(iVar2 == -2) && (iVar4 = sense_cat, sense_cat - 0x14U < 2)" (parenthesized_expression "(iVar2 == -2)" ( (binary_expression "iVar2 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar4 = sense_cat, sense_cat - 0x14U < 2)" ( (comma_expression "iVar4 = sense_cat, sense_cat - 0x14U < 2" (assignment_expression "iVar4 = sense_cat" identifier = identifier) , (binary_expression "sense_cat - 0x14U < 2" (binary_expression "sense_cat - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n      iVar4 = 0;\n    }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) })) }))) (if_statement "if (iVar1 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }" if (parenthesized_expression "(iVar1 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "iVar1 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return iVar4;\n  }" { (return_statement "return iVar4;" return identifier ;) })) comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    \n  FUN_0002f100();\n}\n\n" (function_definition "int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    \n  FUN_0002f100();\n}" primitive_type (function_declarator "sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" identifier (parameter_list "(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" ( (parameter_declaration "char param_1" primitive_type identifier) , (parameter_declaration "char param_2" primitive_type identifier) , (parameter_declaration "char param_3" primitive_type identifier) , (parameter_declaration "char param_4" primitive_type identifier) , (parameter_declaration "char param_5" primitive_type identifier) , (parameter_declaration "int param_6" primitive_type identifier) , (parameter_declaration "int param_7" primitive_type identifier) , (parameter_declaration "int param_8" primitive_type identifier) , (parameter_declaration "undefined1 param_9" type_identifier identifier) , (parameter_declaration "int param_10" primitive_type identifier) ))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    \n  FUN_0002f100();\n}" { (declaration "undefined4 uVar1;" type_identifier identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_84;" primitive_type identifier ;) (declaration "byte *local_78;" type_identifier (pointer_declarator "*local_78" * identifier) ;) (declaration "int local_70;" primitive_type identifier ;) (declaration "byte local_6a [2];" type_identifier (array_declarator "local_6a [2]" identifier [ number_literal ]) ;) (declaration "int local_68;" primitive_type identifier ;) (declaration "byte local_64 [64];" type_identifier (array_declarator "local_64 [64]" identifier [ number_literal ]) ;) (declaration "int local_24;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x24199;" (assignment_expression "uStack_14 = 0x24199" identifier = number_literal) ;) (expression_statement "entry();" (call_expression "entry()" identifier (argument_list "()" ( ))) ;) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_6a[0] = 0x1d;" (assignment_expression "local_6a[0] = 0x1d" (subscript_expression "local_6a[0]" identifier [ number_literal ]) = number_literal) ;) (expression_statement "local_6a[1] = param_1 << 5;" (assignment_expression "local_6a[1] = param_1 << 5" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "param_1 << 5" identifier << number_literal)) ;) (if_statement "if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" if (parenthesized_expression "(param_2 != '\0')" ( (binary_expression "param_2 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" { (expression_statement "local_6a[1] = param_1 << 5 | 0x10;" (assignment_expression "local_6a[1] = param_1 << 5 | 0x10" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "param_1 << 5 | 0x10" (binary_expression "param_1 << 5" identifier << number_literal) | number_literal)) ;) })) (if_statement "if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }" if (parenthesized_expression "(param_3 != '\0')" ( (binary_expression "param_3 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 4;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 4;" (assignment_expression "local_6a[1] = local_6a[1] | 4" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 4" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }" if (parenthesized_expression "(param_4 != '\0')" ( (binary_expression "param_4 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 2;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 2;" (assignment_expression "local_6a[1] = local_6a[1] | 2" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 2" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (if_statement "if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }" if (parenthesized_expression "(param_5 != '\0')" ( (binary_expression "param_5 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6a[1] = local_6a[1] | 1;\n  }" { (expression_statement "local_6a[1] = local_6a[1] | 1;" (assignment_expression "local_6a[1] = local_6a[1] | 1" (subscript_expression "local_6a[1]" identifier [ number_literal ]) = (binary_expression "local_6a[1] | 1" (subscript_expression "local_6a[1]" identifier [ number_literal ]) | number_literal)) ;) })) (expression_statement "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;" (assignment_expression "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" identifier = (binary_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" (call_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8)" (call_expression "(uint)(ushort)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(ushort)" ( identifier ))) (argument_list "((ushort)param_8 << 8 | (ushort)param_8 >> 8)" ( (binary_expression "(ushort)param_8 << 8 | (ushort)param_8 >> 8" (binary_expression "(ushort)param_8 << 8" (cast_expression "(ushort)param_8" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_8 >> 8" (cast_expression "(ushort)param_8" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal)) ))) << number_literal)) ;) (if_statement "if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" if (parenthesized_expression "(param_6 < 0x1c21)" ( (binary_expression "param_6 < 0x1c21" identifier < number_literal) )) (compound_statement "{\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" { (expression_statement "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;" (assignment_expression "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" identifier = (binary_expression "(-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" (parenthesized_expression "(-(uint)(param_6 == 0) & 0xffffe41c)" ( (binary_expression "-(uint)(param_6 == 0) & 0xffffe41c" (unary_expression "-(uint)(param_6 == 0)" - (call_expression "(uint)(param_6 == 0)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_6 == 0)" ( (binary_expression "param_6 == 0" identifier == number_literal) )))) & number_literal) )) + number_literal)) ;) })) (if_statement "if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" if (parenthesized_expression "(param_10 != 0)" ( (binary_expression "param_10 != 0" identifier != number_literal) )) (compound_statement "{\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" { (expression_statement "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);" (call_expression "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" identifier (argument_list "(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" ( (binary_expression "unaff_EBX + 0x180c6" identifier + number_literal) , (binary_expression "unaff_EBX + 0x11739" identifier + number_literal) ))) ;) (expression_statement "pbVar5 = local_6a;" (assignment_expression "pbVar5 = local_6a" identifier = identifier) ;) (do_statement "do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);" do (compound_statement "{\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    }" { (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" identifier = (binary_expression "unaff_EBX + 0x11739" identifier + number_literal)) ;) (expression_statement "uVar3 = (uint)*pbVar5;" (assignment_expression "uVar3 = (uint)*pbVar5" identifier = (binary_expression "(uint)*pbVar5" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar5 = pbVar5 + 1;" (assignment_expression "pbVar5 = pbVar5 + 1" identifier = (binary_expression "pbVar5 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws(&UNK_0001938a + unaff_EBX,uVar3);" (call_expression "pr2ws(&UNK_0001938a + unaff_EBX,uVar3)" identifier (argument_list "(&UNK_0001938a + unaff_EBX,uVar3)" ( (binary_expression "&UNK_0001938a + unaff_EBX" (pointer_expression "&UNK_0001938a" & identifier) + identifier) , identifier ))) ;) }) while (parenthesized_expression "(pbVar5 != local_64)" ( (binary_expression "pbVar5 != local_64" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0xc547,uVar3);" (call_expression "pr2ws(unaff_EBX + 0xc547,uVar3)" identifier (argument_list "(unaff_EBX + 0xc547,uVar3)" ( (binary_expression "unaff_EBX + 0xc547" identifier + number_literal) , identifier ))) ;) (if_statement "if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" if (parenthesized_expression "(1 < param_10)" ( (binary_expression "1 < param_10" number_literal < identifier) )) (compound_statement "{\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" { (if_statement "if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" if (parenthesized_expression "((param_7 != 0) && (param_8 != 0))" ( (binary_expression "(param_7 != 0) && (param_8 != 0)" (parenthesized_expression "(param_7 != 0)" ( (binary_expression "param_7 != 0" identifier != number_literal) )) && (parenthesized_expression "(param_8 != 0)" ( (binary_expression "param_8 != 0" identifier != number_literal) ))) )) (compound_statement "{\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x187f7,local_84);" (call_expression "pr2ws(unaff_EBX + 0x187f7,local_84)" identifier (argument_list "(unaff_EBX + 0x187f7,local_84)" ( (binary_expression "unaff_EBX + 0x187f7" identifier + number_literal) , identifier ))) ;) (expression_statement "hex2stderr(param_7,param_8,0xffffffff);" (call_expression "hex2stderr(param_7,param_8,0xffffffff)" identifier (argument_list "(param_7,param_8,0xffffffff)" ( identifier , identifier , number_literal ))) ;) })) (expression_statement "pr2ws(unaff_EBX + 0x1880f,local_84,param_6);" (call_expression "pr2ws(unaff_EBX + 0x1880f,local_84,param_6)" identifier (argument_list "(unaff_EBX + 0x1880f,local_84,param_6)" ( (binary_expression "unaff_EBX + 0x1880f" identifier + number_literal) , identifier , identifier ))) ;) })) })) (expression_statement "local_78 = local_6a;" (assignment_expression "local_78 = local_6a" identifier = identifier) ;) (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" identifier = (binary_expression "unaff_EBX + 0x11739" identifier + number_literal)) ;) (expression_statement "set_scsi_pt_cdb(unaff_retaddr,local_78,6);" (call_expression "set_scsi_pt_cdb(unaff_retaddr,local_78,6)" identifier (argument_list "(unaff_retaddr,local_78,6)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(unaff_retaddr,local_64,0x40);" (call_expression "set_scsi_pt_sense(unaff_retaddr,local_64,0x40)" identifier (argument_list "(unaff_retaddr,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);" (call_expression "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8)" identifier (argument_list "(unaff_retaddr,param_7,param_8)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);" (assignment_expression "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" identifier = (call_expression "do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" identifier (argument_list "(unaff_retaddr,0xffffffff,param_6,param_10)" ( identifier , number_literal , identifier , identifier )))) ;) (expression_statement "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);" (assignment_expression "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" identifier = (call_expression "sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" identifier (argument_list "(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" ( identifier , identifier , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&local_70" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }" { (expression_statement "uVar1 = get_scsi_pt_os_err(unaff_retaddr);" (assignment_expression "uVar1 = get_scsi_pt_os_err(unaff_retaddr)" identifier = (call_expression "get_scsi_pt_os_err(unaff_retaddr)" identifier (argument_list "(unaff_retaddr)" ( identifier )))) ;) (expression_statement "iVar4 = sg_convert_errno(uVar1);" (assignment_expression "iVar4 = sg_convert_errno(uVar1)" identifier = (call_expression "sg_convert_errno(uVar1)" identifier (argument_list "(uVar1)" ( identifier )))) ;) }) (else_clause "else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" else (compound_statement "{\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (if_statement "if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }" if (parenthesized_expression "((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2))" ( (binary_expression "(iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)" (parenthesized_expression "(iVar2 == -2)" ( (binary_expression "iVar2 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar4 = local_70, local_70 - 0x14U < 2)" ( (comma_expression "iVar4 = local_70, local_70 - 0x14U < 2" (assignment_expression "iVar4 = local_70" identifier = identifier) , (binary_expression "local_70 - 0x14U < 2" (binary_expression "local_70 - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n      iVar4 = 0;\n    }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) })) }))) (if_statement "if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }" if (parenthesized_expression "(local_24 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_24 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return iVar4;\n  }" { (return_statement "return iVar4;" return identifier ;) })) (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit (function_definition TYPE (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) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( ))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = LIT) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression IDENT << LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (binary_expression IDENT << LIT) | LIT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (subscript_expression IDENT [ LIT ]) | LIT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (subscript_expression IDENT [ LIT ]) | LIT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (subscript_expression IDENT [ LIT ]) | LIT)) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (call_expression (call_expression (parenthesized_expression ( IDENT )) (argument_list ( IDENT ))) (argument_list ( (binary_expression (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) << LIT) | (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT)) ))) << LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( (binary_expression (unary_expression - (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT == LIT) )))) & LIT) )) + LIT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , (binary_expression IDENT + LIT) ))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( IDENT )) * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression (pointer_expression & IDENT) + IDENT) , IDENT ))) ;) }) while (parenthesized_expression ( (binary_expression IDENT != IDENT) )) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != LIT) )) && (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) })) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT , IDENT ))) ;) })) })) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , LIT , IDENT , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , LIT , IDENT , IDENT , IDENT , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT == LIT) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = IDENT) , (binary_expression (binary_expression IDENT - LIT) < LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( ))) ;) })))
(function_definition "int sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)\n\n{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    \n  FUN_0002f100();\n}" (primitive_type "int") (function_declarator "sg_ll_send_diag_pt(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" (identifier "sg_ll_send_diag_pt") (parameter_list "(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,\n                      int param_7,int param_8,undefined1 param_9,int param_10)" (( "(") (parameter_declaration "char param_1" (primitive_type "char") (identifier "param_1")) (, ",") (parameter_declaration "char param_2" (primitive_type "char") (identifier "param_2")) (, ",") (parameter_declaration "char param_3" (primitive_type "char") (identifier "param_3")) (, ",") (parameter_declaration "char param_4" (primitive_type "char") (identifier "param_4")) (, ",") (parameter_declaration "char param_5" (primitive_type "char") (identifier "param_5")) (, ",") (parameter_declaration "int param_6" (primitive_type "int") (identifier "param_6")) (, ",") (parameter_declaration "int param_7" (primitive_type "int") (identifier "param_7")) (, ",") (parameter_declaration "int param_8" (primitive_type "int") (identifier "param_8")) (, ",") (parameter_declaration "undefined1 param_9" (type_identifier "undefined1") (identifier "param_9")) (, ",") (parameter_declaration "int param_10" (primitive_type "int") (identifier "param_10")) () ")"))) (compound_statement "{\n  undefined4 uVar1;\n  int iVar2;\n  uint uVar3;\n  int iVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_84;\n  byte *local_78;\n  int local_70;\n  byte local_6a [2];\n  int local_68;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x24199;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6a[0] = 0x1d;\n  local_6a[1] = param_1 << 5;\n  if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }\n  if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }\n  if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }\n  if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }\n  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;\n  if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }\n  if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }\n  local_78 = local_6a;\n  local_84 = unaff_EBX + 0x11739;\n  set_scsi_pt_cdb(unaff_retaddr,local_78,6);\n  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);\n  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);\n  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);\n  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);\n  if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }\n  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }\n                    \n  FUN_0002f100();\n}" ({ "{") (declaration "undefined4 uVar1;" (type_identifier "undefined4") (identifier "uVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "uint uVar3;" (type_identifier "uint") (identifier "uVar3") (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "int unaff_EBX;" (primitive_type "int") (identifier "unaff_EBX") (; ";")) (declaration "byte *pbVar5;" (type_identifier "byte") (pointer_declarator "*pbVar5" (* "*") (identifier "pbVar5")) (; ";")) (declaration "int in_GS_OFFSET;" (primitive_type "int") (identifier "in_GS_OFFSET") (; ";")) (declaration "undefined4 unaff_retaddr;" (type_identifier "undefined4") (identifier "unaff_retaddr") (; ";")) (declaration "int local_84;" (primitive_type "int") (identifier "local_84") (; ";")) (declaration "byte *local_78;" (type_identifier "byte") (pointer_declarator "*local_78" (* "*") (identifier "local_78")) (; ";")) (declaration "int local_70;" (primitive_type "int") (identifier "local_70") (; ";")) (declaration "byte local_6a [2];" (type_identifier "byte") (array_declarator "local_6a [2]" (identifier "local_6a") ([ "[") (number_literal "2") (] "]")) (; ";")) (declaration "int local_68;" (primitive_type "int") (identifier "local_68") (; ";")) (declaration "byte local_64 [64];" (type_identifier "byte") (array_declarator "local_64 [64]" (identifier "local_64") ([ "[") (number_literal "64") (] "]")) (; ";")) (declaration "int local_24;" (primitive_type "int") (identifier "local_24") (; ";")) (declaration "undefined4 uStack_14;" (type_identifier "undefined4") (identifier "uStack_14") (; ";")) (expression_statement "uStack_14 = 0x24199;" (assignment_expression "uStack_14 = 0x24199" (identifier "uStack_14") (= "=") (number_literal "0x24199")) (; ";")) (expression_statement "entry();" (call_expression "entry()" (identifier "entry") (argument_list "()" (( "(") () ")"))) (; ";")) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_24") (= "=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) (; ";")) (expression_statement "local_6a[0] = 0x1d;" (assignment_expression "local_6a[0] = 0x1d" (subscript_expression "local_6a[0]" (identifier "local_6a") ([ "[") (number_literal "0") (] "]")) (= "=") (number_literal "0x1d")) (; ";")) (expression_statement "local_6a[1] = param_1 << 5;" (assignment_expression "local_6a[1] = param_1 << 5" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "param_1 << 5" (identifier "param_1") (<< "<<") (number_literal "5"))) (; ";")) (if_statement "if (param_2 != '\0') {\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" (if "if") (parenthesized_expression "(param_2 != '\0')" (( "(") (binary_expression "param_2 != '\0'" (identifier "param_2") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    local_6a[1] = param_1 << 5 | 0x10;\n  }" ({ "{") (expression_statement "local_6a[1] = param_1 << 5 | 0x10;" (assignment_expression "local_6a[1] = param_1 << 5 | 0x10" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "param_1 << 5 | 0x10" (binary_expression "param_1 << 5" (identifier "param_1") (<< "<<") (number_literal "5")) (| "|") (number_literal "0x10"))) (; ";")) (} "}"))) (if_statement "if (param_3 != '\0') {\n    local_6a[1] = local_6a[1] | 4;\n  }" (if "if") (parenthesized_expression "(param_3 != '\0')" (( "(") (binary_expression "param_3 != '\0'" (identifier "param_3") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    local_6a[1] = local_6a[1] | 4;\n  }" ({ "{") (expression_statement "local_6a[1] = local_6a[1] | 4;" (assignment_expression "local_6a[1] = local_6a[1] | 4" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "local_6a[1] | 4" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (| "|") (number_literal "4"))) (; ";")) (} "}"))) (if_statement "if (param_4 != '\0') {\n    local_6a[1] = local_6a[1] | 2;\n  }" (if "if") (parenthesized_expression "(param_4 != '\0')" (( "(") (binary_expression "param_4 != '\0'" (identifier "param_4") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    local_6a[1] = local_6a[1] | 2;\n  }" ({ "{") (expression_statement "local_6a[1] = local_6a[1] | 2;" (assignment_expression "local_6a[1] = local_6a[1] | 2" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "local_6a[1] | 2" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (| "|") (number_literal "2"))) (; ";")) (} "}"))) (if_statement "if (param_5 != '\0') {\n    local_6a[1] = local_6a[1] | 1;\n  }" (if "if") (parenthesized_expression "(param_5 != '\0')" (( "(") (binary_expression "param_5 != '\0'" (identifier "param_5") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    local_6a[1] = local_6a[1] | 1;\n  }" ({ "{") (expression_statement "local_6a[1] = local_6a[1] | 1;" (assignment_expression "local_6a[1] = local_6a[1] | 1" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "local_6a[1] | 1" (subscript_expression "local_6a[1]" (identifier "local_6a") ([ "[") (number_literal "1") (] "]")) (| "|") (number_literal "1"))) (; ";")) (} "}"))) (expression_statement "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;" (assignment_expression "local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" (identifier "local_68") (= "=") (binary_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8" (call_expression "(uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8)" (call_expression "(uint)(ushort)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(ushort)" (( "(") (identifier "ushort") () ")"))) (argument_list "((ushort)param_8 << 8 | (ushort)param_8 >> 8)" (( "(") (binary_expression "(ushort)param_8 << 8 | (ushort)param_8 >> 8" (binary_expression "(ushort)param_8 << 8" (cast_expression "(ushort)param_8" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_8")) (<< "<<") (number_literal "8")) (| "|") (binary_expression "(ushort)param_8 >> 8" (cast_expression "(ushort)param_8" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_8")) (>> ">>") (number_literal "8"))) () ")"))) (<< "<<") (number_literal "8"))) (; ";")) (if_statement "if (param_6 < 0x1c21) {\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" (if "if") (parenthesized_expression "(param_6 < 0x1c21)" (( "(") (binary_expression "param_6 < 0x1c21" (identifier "param_6") (< "<") (number_literal "0x1c21")) () ")")) (compound_statement "{\n    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;\n  }" ({ "{") (expression_statement "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;" (assignment_expression "param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" (identifier "param_6") (= "=") (binary_expression "(-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20" (parenthesized_expression "(-(uint)(param_6 == 0) & 0xffffe41c)" (( "(") (binary_expression "-(uint)(param_6 == 0) & 0xffffe41c" (unary_expression "-(uint)(param_6 == 0)" (- "-") (call_expression "(uint)(param_6 == 0)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(param_6 == 0)" (( "(") (binary_expression "param_6 == 0" (identifier "param_6") (== "==") (number_literal "0")) () ")")))) (& "&") (number_literal "0xffffe41c")) () ")")) (+ "+") (number_literal "0x1c20"))) (; ";")) (} "}"))) (if_statement "if (param_10 != 0) {\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" (if "if") (parenthesized_expression "(param_10 != 0)" (( "(") (binary_expression "param_10 != 0" (identifier "param_10") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);\n    pbVar5 = local_6a;\n    do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0xc547,uVar3);\n    if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }\n  }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);" (call_expression "pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x180c6,unaff_EBX + 0x11739)" (( "(") (binary_expression "unaff_EBX + 0x180c6" (identifier "unaff_EBX") (+ "+") (number_literal "0x180c6")) (, ",") (binary_expression "unaff_EBX + 0x11739" (identifier "unaff_EBX") (+ "+") (number_literal "0x11739")) () ")"))) (; ";")) (expression_statement "pbVar5 = local_6a;" (assignment_expression "pbVar5 = local_6a" (identifier "pbVar5") (= "=") (identifier "local_6a")) (; ";")) (do_statement "do {\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    } while (pbVar5 != local_64);" (do "do") (compound_statement "{\n      local_84 = unaff_EBX + 0x11739;\n      uVar3 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);\n    }" ({ "{") (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" (identifier "local_84") (= "=") (binary_expression "unaff_EBX + 0x11739" (identifier "unaff_EBX") (+ "+") (number_literal "0x11739"))) (; ";")) (expression_statement "uVar3 = (uint)*pbVar5;" (assignment_expression "uVar3 = (uint)*pbVar5" (identifier "uVar3") (= "=") (binary_expression "(uint)*pbVar5" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (* "*") (identifier "pbVar5"))) (; ";")) (expression_statement "pbVar5 = pbVar5 + 1;" (assignment_expression "pbVar5 = pbVar5 + 1" (identifier "pbVar5") (= "=") (binary_expression "pbVar5 + 1" (identifier "pbVar5") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "pr2ws(&UNK_0001938a + unaff_EBX,uVar3);" (call_expression "pr2ws(&UNK_0001938a + unaff_EBX,uVar3)" (identifier "pr2ws") (argument_list "(&UNK_0001938a + unaff_EBX,uVar3)" (( "(") (binary_expression "&UNK_0001938a + unaff_EBX" (pointer_expression "&UNK_0001938a" (& "&") (identifier "UNK_0001938a")) (+ "+") (identifier "unaff_EBX")) (, ",") (identifier "uVar3") () ")"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(pbVar5 != local_64)" (( "(") (binary_expression "pbVar5 != local_64" (identifier "pbVar5") (!= "!=") (identifier "local_64")) () ")")) (; ";")) (expression_statement "pr2ws(unaff_EBX + 0xc547,uVar3);" (call_expression "pr2ws(unaff_EBX + 0xc547,uVar3)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0xc547,uVar3)" (( "(") (binary_expression "unaff_EBX + 0xc547" (identifier "unaff_EBX") (+ "+") (number_literal "0xc547")) (, ",") (identifier "uVar3") () ")"))) (; ";")) (if_statement "if (1 < param_10) {\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" (if "if") (parenthesized_expression "(1 < param_10)" (( "(") (binary_expression "1 < param_10" (number_literal "1") (< "<") (identifier "param_10")) () ")")) (compound_statement "{\n      if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }\n      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);\n    }" ({ "{") (if_statement "if ((param_7 != 0) && (param_8 != 0)) {\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" (if "if") (parenthesized_expression "((param_7 != 0) && (param_8 != 0))" (( "(") (binary_expression "(param_7 != 0) && (param_8 != 0)" (parenthesized_expression "(param_7 != 0)" (( "(") (binary_expression "param_7 != 0" (identifier "param_7") (!= "!=") (number_literal "0")) () ")")) (&& "&&") (parenthesized_expression "(param_8 != 0)" (( "(") (binary_expression "param_8 != 0" (identifier "param_8") (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n        pr2ws(unaff_EBX + 0x187f7,local_84);\n        hex2stderr(param_7,param_8,0xffffffff);\n      }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x187f7,local_84);" (call_expression "pr2ws(unaff_EBX + 0x187f7,local_84)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x187f7,local_84)" (( "(") (binary_expression "unaff_EBX + 0x187f7" (identifier "unaff_EBX") (+ "+") (number_literal "0x187f7")) (, ",") (identifier "local_84") () ")"))) (; ";")) (expression_statement "hex2stderr(param_7,param_8,0xffffffff);" (call_expression "hex2stderr(param_7,param_8,0xffffffff)" (identifier "hex2stderr") (argument_list "(param_7,param_8,0xffffffff)" (( "(") (identifier "param_7") (, ",") (identifier "param_8") (, ",") (number_literal "0xffffffff") () ")"))) (; ";")) (} "}"))) (expression_statement "pr2ws(unaff_EBX + 0x1880f,local_84,param_6);" (call_expression "pr2ws(unaff_EBX + 0x1880f,local_84,param_6)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x1880f,local_84,param_6)" (( "(") (binary_expression "unaff_EBX + 0x1880f" (identifier "unaff_EBX") (+ "+") (number_literal "0x1880f")) (, ",") (identifier "local_84") (, ",") (identifier "param_6") () ")"))) (; ";")) (} "}"))) (} "}"))) (expression_statement "local_78 = local_6a;" (assignment_expression "local_78 = local_6a" (identifier "local_78") (= "=") (identifier "local_6a")) (; ";")) (expression_statement "local_84 = unaff_EBX + 0x11739;" (assignment_expression "local_84 = unaff_EBX + 0x11739" (identifier "local_84") (= "=") (binary_expression "unaff_EBX + 0x11739" (identifier "unaff_EBX") (+ "+") (number_literal "0x11739"))) (; ";")) (expression_statement "set_scsi_pt_cdb(unaff_retaddr,local_78,6);" (call_expression "set_scsi_pt_cdb(unaff_retaddr,local_78,6)" (identifier "set_scsi_pt_cdb") (argument_list "(unaff_retaddr,local_78,6)" (( "(") (identifier "unaff_retaddr") (, ",") (identifier "local_78") (, ",") (number_literal "6") () ")"))) (; ";")) (expression_statement "set_scsi_pt_sense(unaff_retaddr,local_64,0x40);" (call_expression "set_scsi_pt_sense(unaff_retaddr,local_64,0x40)" (identifier "set_scsi_pt_sense") (argument_list "(unaff_retaddr,local_64,0x40)" (( "(") (identifier "unaff_retaddr") (, ",") (identifier "local_64") (, ",") (number_literal "0x40") () ")"))) (; ";")) (expression_statement "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);" (call_expression "set_scsi_pt_data_out(unaff_retaddr,param_7,param_8)" (identifier "set_scsi_pt_data_out") (argument_list "(unaff_retaddr,param_7,param_8)" (( "(") (identifier "unaff_retaddr") (, ",") (identifier "param_7") (, ",") (identifier "param_8") () ")"))) (; ";")) (expression_statement "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);" (assignment_expression "uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" (identifier "uVar1") (= "=") (call_expression "do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10)" (identifier "do_scsi_pt") (argument_list "(unaff_retaddr,0xffffffff,param_6,param_10)" (( "(") (identifier "unaff_retaddr") (, ",") (number_literal "0xffffffff") (, ",") (identifier "param_6") (, ",") (identifier "param_10") () ")")))) (; ";")) (expression_statement "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);" (assignment_expression "iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" (identifier "iVar2") (= "=") (call_expression "sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" (identifier "sg_cmds_process_resp") (argument_list "(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70)" (( "(") (identifier "unaff_retaddr") (, ",") (identifier "local_84") (, ",") (identifier "uVar1") (, ",") (number_literal "0") (, ",") (identifier "local_64") (, ",") (identifier "param_9") (, ",") (identifier "param_10") (, ",") (pointer_expression "&local_70" (& "&") (identifier "local_70")) () ")")))) (; ";")) (if_statement "if (iVar2 == -1) {\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }\n  else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" (if "if") (parenthesized_expression "(iVar2 == -1)" (( "(") (binary_expression "iVar2 == -1" (identifier "iVar2") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n    uVar1 = get_scsi_pt_os_err(unaff_retaddr);\n    iVar4 = sg_convert_errno(uVar1);\n  }" ({ "{") (expression_statement "uVar1 = get_scsi_pt_os_err(unaff_retaddr);" (assignment_expression "uVar1 = get_scsi_pt_os_err(unaff_retaddr)" (identifier "uVar1") (= "=") (call_expression "get_scsi_pt_os_err(unaff_retaddr)" (identifier "get_scsi_pt_os_err") (argument_list "(unaff_retaddr)" (( "(") (identifier "unaff_retaddr") () ")")))) (; ";")) (expression_statement "iVar4 = sg_convert_errno(uVar1);" (assignment_expression "iVar4 = sg_convert_errno(uVar1)" (identifier "iVar4") (= "=") (call_expression "sg_convert_errno(uVar1)" (identifier "sg_convert_errno") (argument_list "(uVar1)" (( "(") (identifier "uVar1") () ")")))) (; ";")) (} "}")) (else_clause "else {\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" (else "else") (compound_statement "{\n    iVar4 = 0;\n    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }\n  }" ({ "{") (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";")) (if_statement "if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {\n      iVar4 = 0;\n    }" (if "if") (parenthesized_expression "((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2))" (( "(") (binary_expression "(iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)" (parenthesized_expression "(iVar2 == -2)" (( "(") (binary_expression "iVar2 == -2" (identifier "iVar2") (== "==") (number_literal "-2")) () ")")) (&& "&&") (parenthesized_expression "(iVar4 = local_70, local_70 - 0x14U < 2)" (( "(") (comma_expression "iVar4 = local_70, local_70 - 0x14U < 2" (assignment_expression "iVar4 = local_70" (identifier "iVar4") (= "=") (identifier "local_70")) (, ",") (binary_expression "local_70 - 0x14U < 2" (binary_expression "local_70 - 0x14U" (identifier "local_70") (- "-") (number_literal "0x14U")) (< "<") (number_literal "2"))) () ")"))) () ")")) (compound_statement "{\n      iVar4 = 0;\n    }" ({ "{") (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";")) (} "}"))) (} "}")))) (if_statement "if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar4;\n  }" (if "if") (parenthesized_expression "(local_24 == *(int *)(in_GS_OFFSET + 0x14))" (( "(") (binary_expression "local_24 == *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_24") (== "==") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) () ")")) (compound_statement "{\n    return iVar4;\n  }" ({ "{") (return_statement "return iVar4;" (return "return") (identifier "iVar4") (; ";")) (} "}"))) (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" (identifier "FUN_0002f100") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))

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

int function_1(type_1 *ptvp,int var_2,type_2 pf_bit,type_2 st_bit,type_2 devofl_bit,
                      type_2 unitofl_bit,int var_3,void *var_8,int var_9,type_2 noisy,
                      int var_4)

{
  int var_20;
  int var_16;
  type_3 uVar3;
  int iVar4;
  type_4 *var_6;
  int var_1;
  uint8_t *local_74;
  int var_19;
  uint8_t senddiag_cdb [6];
  uint8_t var_7 [64];
  
  var_20 = *(int *)(var_1 + 0x14);
  senddiag_cdb[0] = '\x1d';
  senddiag_cdb[1] = (uint8_t)((var_2 & 0xffU) << 5);
  if (pf_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 0x10;
  }
  if (st_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 4;
  }
  if (devofl_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 2;
  }
  if (unitofl_bit) {
    senddiag_cdb[1] = senddiag_cdb[1] | 1;
  }
  senddiag_cdb._2_4_ = (type_3)(type_5)((type_5)var_9 << 8 | (type_5)var_9 >> 8) << 8;
  if (var_3 < 0x1c21) {
    var_3 = (-(type_3)(var_3 == 0) & 0xffffe41c) + 0x1c20;
  }
  if (var_4 != 0) {
    var_5("    %s cdb: ","Send diagnostic");
    var_6 = senddiag_cdb;
    do {
      uVar3 = (type_3)*var_6;
      var_6 = var_6 + 1;
      var_5("%02x ",uVar3);
    } while (var_6 != var_7);
    var_5("\n",uVar3);
    if (1 < var_4) {
      if ((var_8 != (void *)0x0) && (var_9 != 0)) {
        var_5("    %s parameter list:\n","Send diagnostic");
        var_10((uint8_t *)var_8,var_9,-1);
      }
      var_5("    %s timeout: %d seconds\n","Send diagnostic",var_3);
    }
  }
  local_74 = senddiag_cdb;
  var_11(ptvp,local_74,6);
  var_12(ptvp,var_7,0x40);
  var_13(ptvp,(uint8_t *)var_8,var_9);
  var_16 = var_14(ptvp,-1,var_3,var_4);
  var_16 = var_15(ptvp,"Send diagnostic",var_16,0,var_7,noisy,var_4,&var_19);
  if (var_16 == -1) {
    var_16 = var_17();
    iVar4 = var_18(var_16);
  }
  else {
    iVar4 = 0;
    if ((var_16 == -2) && (iVar4 = var_19, var_19 - 0x14U < 2)) {
      iVar4 = 0;
    }
  }
  if (var_20 == *(int *)(var_1 + 0x14)) {
    return iVar4;
  }
                    /* WARNING: Subroutine does not return */
  var_21();
}


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

int MASKED(char param_1,char param_2,char param_3,char param_4,char param_5,int param_6,
                      int param_7,int param_8,undefined1 param_9,int param_10)

{
  undefined4 uVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  int unaff_EBX;
  byte *pbVar5;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_84;
  byte *local_78;
  int local_70;
  byte local_6a [2];
  int local_68;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uStack_14 = 0x24199;
  entry();
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  local_6a[0] = 0x1d;
  local_6a[1] = param_1 << 5;
  if (param_2 != '\0') {
    local_6a[1] = param_1 << 5 | 0x10;
  }
  if (param_3 != '\0') {
    local_6a[1] = local_6a[1] | 4;
  }
  if (param_4 != '\0') {
    local_6a[1] = local_6a[1] | 2;
  }
  if (param_5 != '\0') {
    local_6a[1] = local_6a[1] | 1;
  }
  local_68 = (uint)(ushort)((ushort)param_8 << 8 | (ushort)param_8 >> 8) << 8;
  if (param_6 < 0x1c21) {
    param_6 = (-(uint)(param_6 == 0) & 0xffffe41c) + 0x1c20;
  }
  if (param_10 != 0) {
    pr2ws(unaff_EBX + 0x180c6,unaff_EBX + 0x11739);
    pbVar5 = local_6a;
    do {
      local_84 = unaff_EBX + 0x11739;
      uVar3 = (uint)*pbVar5;
      pbVar5 = pbVar5 + 1;
      pr2ws(&UNK_0001938a + unaff_EBX,uVar3);
    } while (pbVar5 != local_64);
    pr2ws(unaff_EBX + 0xc547,uVar3);
    if (1 < param_10) {
      if ((param_7 != 0) && (param_8 != 0)) {
        pr2ws(unaff_EBX + 0x187f7,local_84);
        hex2stderr(param_7,param_8,0xffffffff);
      }
      pr2ws(unaff_EBX + 0x1880f,local_84,param_6);
    }
  }
  local_78 = local_6a;
  local_84 = unaff_EBX + 0x11739;
  set_scsi_pt_cdb(unaff_retaddr,local_78,6);
  set_scsi_pt_sense(unaff_retaddr,local_64,0x40);
  set_scsi_pt_data_out(unaff_retaddr,param_7,param_8);
  uVar1 = do_scsi_pt(unaff_retaddr,0xffffffff,param_6,param_10);
  iVar2 = sg_cmds_process_resp(unaff_retaddr,local_84,uVar1,0,local_64,param_9,param_10,&local_70);
  if (iVar2 == -1) {
    uVar1 = get_scsi_pt_os_err(unaff_retaddr);
    iVar4 = sg_convert_errno(uVar1);
  }
  else {
    iVar4 = 0;
    if ((iVar2 == -2) && (iVar4 = local_70, local_70 - 0x14U < 2)) {
      iVar4 = 0;
    }
  }
  if (local_24 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar4;
  }
                    /* WARNING: Subroutine does not return */
  FUN_0002f100();
}

