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

int sg_ll_read_defect10(int sg_fd,_Bool req_plist,_Bool req_glist,int dl_format,void *resp,
                       int mx_resp_len,_Bool noisy,int verbose)

{
  int iVar1;
  sg_pt_base *vp;
  int iVar2;
  uint uVar3;
  char *pcVar4;
  byte *pbVar5;
  int in_GS_OFFSET;
  int no_ascii;
  int sense_cat;
  uint8_t rdef_cdb [10];
  uint8_t sense_b [64];
  
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  rdef_cdb[9] = '\0';
  rdef_cdb[2] = (byte)dl_format & 7;
  if (req_plist) {
    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;
  }
  rdef_cdb[0] = '7';
  rdef_cdb[1] = '\0';
  rdef_cdb[3] = '\0';
  if (req_glist) {
    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;
  }
  rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18;
  rdef_cdb[8] = (uint8_t)mx_resp_len;
  if (mx_resp_len < 0x10000) {
    pcVar4 = "Read defect(10)";
    if (verbose == 0) {
      vp = construct_scsi_pt_obj();
    }
    else {
      pr2ws("    %s cdb: ","Read defect(10)");
      pbVar5 = rdef_cdb;
      do {
        uVar3 = (uint)*pbVar5;
        pbVar5 = pbVar5 + 1;
        pr2ws("%02x ",uVar3);
      } while (sense_b != pbVar5);
      pr2ws("\n",uVar3);
      vp = construct_scsi_pt_obj();
    }
    if (vp == (sg_pt_base *)0x0) {
      pr2ws("%s: out of memory\n","Read defect(10)");
      iVar2 = sg_convert_errno(0xc);
    }
    else {
      set_scsi_pt_cdb(vp,rdef_cdb,10);
      set_scsi_pt_sense(vp,sense_b,0x40);
      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);
      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);
      iVar2 = sg_cmds_process_resp
                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);
      if (iVar2 == -1) {
        iVar2 = get_scsi_pt_os_err();
        iVar2 = sg_convert_errno(iVar2);
      }
      else if (iVar2 == -2) {
        iVar2 = sense_cat;
        if (sense_cat - 0x14U < 2) {
          iVar2 = 0;
        }
      }
      else if ((verbose < 3) || (iVar2 < 1)) {
        iVar2 = 0;
      }
      else {
        pr2ws("    %s: response\n","Read defect(10)");
        if (verbose == 3) {
          pcVar4 = ", first 256 bytes";
          if (iVar2 < 0x101) {
            pcVar4 = "";
          }
          pr2ws("%s:\n",pcVar4);
          no_ascii = -1;
          if (0x100 < iVar2) {
            iVar2 = 0x100;
          }
        }
        else {
          pr2ws(":\n",pcVar4);
          no_ascii = 0;
        }
        hex2stderr((uint8_t *)resp,iVar2,no_ascii);
        iVar2 = 0;
      }
      destruct_scsi_pt_obj(vp);
    }
  }
  else {
    iVar2 = -1;
    pr2ws("mx_resp_len too big\n");
  }
  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail_local();
  }
  return iVar2;
}



int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,
                       undefined1 param_6,int param_7)

{
  uint3 uVar1;
  byte bVar2;
  int iVar3;
  undefined4 uVar4;
  int iVar5;
  uint uVar6;
  undefined *puVar7;
  int unaff_EBX;
  byte *pbVar8;
  int iVar9;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_74;
  undefined4 local_6e;
  int local_6a;
  undefined1 uStack_66;
  undefined1 uStack_65;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uStack_65 = 0;
  uStack_14 = 0x2491b;
  entry();
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  bVar2 = param_3 & 7;
  if (param_1 != '\0') {
    bVar2 = param_3 & 7 | 0x10;
  }
  local_6e._0_3_ = CONCAT12(bVar2,0x37);
  uVar1 = (uint3)local_6e;
  local_6e = (uint)(uint3)local_6e;
  if (param_2 != '\0') {
    local_6e = uVar1 | 0x80000;
  }
  local_6a = (param_5 >> 8) << 0x18;
  uStack_66 = (undefined1)param_5;
  if ((int)param_5 < 0x10000) {
    iVar9 = unaff_EBX + 0x180a9;
    if (param_7 == 0) {
      iVar3 = construct_scsi_pt_obj();
    }
    else {
      pr2ws(unaff_EBX + 0x17944,iVar9);
      pbVar8 = (byte *)&local_6e;
      do {
        uVar6 = (uint)*pbVar8;
        pbVar8 = pbVar8 + 1;
        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);
      } while (local_64 != pbVar8);
      pr2ws(unaff_EBX + 0xbdc5,uVar6);
      iVar3 = construct_scsi_pt_obj();
    }
    if (iVar3 == 0) {
      pr2ws(unaff_EBX + 0x17994,iVar9);
      iVar9 = sg_convert_errno(0xc);
    }
    else {
      set_scsi_pt_cdb(iVar3,&local_6e,10);
      set_scsi_pt_sense(iVar3,local_64,0x40);
      set_scsi_pt_data_in(iVar3,param_4,param_5);
      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);
      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);
      if (iVar5 == -1) {
        uVar4 = get_scsi_pt_os_err(iVar3);
        iVar9 = sg_convert_errno(uVar4);
      }
      else if (iVar5 == -2) {
        iVar9 = local_74;
        if (local_74 - 0x14U < 2) {
          iVar9 = 0;
        }
      }
      else if ((param_7 < 3) || (iVar5 < 1)) {
        iVar9 = 0;
      }
      else {
        pr2ws(unaff_EBX + 0x18063,iVar9);
        if (param_7 == 3) {
          puVar7 = &UNK_00017d68 + unaff_EBX;
          if (iVar5 < 0x101) {
            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);
          }
          pr2ws(unaff_EBX + 0xba5b,puVar7);
          uVar4 = 0xffffffff;
          if (0x100 < iVar5) {
            iVar5 = 0x100;
          }
        }
        else {
          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);
          uVar4 = 0;
        }
        hex2stderr(param_4,iVar5,uVar4);
        iVar9 = 0;
      }
      destruct_scsi_pt_obj(iVar3);
    }
  }
  else {
    iVar9 = -1;
    pr2ws(&UNK_00017d7a + unaff_EBX);
  }
  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_0002f100();
  }
  return iVar9;
}


PUSH EBP
XOR EDX,EDX
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00017820
ADD EBX,0x2446d
SUB ESP,0x7c
MOV EAX,dword ptr [ESP + 0xa0]
MOV dword ptr [ESP + 0x8],EAX
MOV EAX,dword ptr [ESP + 0xa8]
MOV dword ptr [ESP + 0xc],EAX
MOV EAX,GS:[0x14]
MOV dword ptr [ESP + 0x6c],EAX
XOR EAX,EAX
MOVZX EAX,byte ptr [ESP + 0x9c]
MOV word ptr [ESP + 0x2a],DX
MOV dword ptr [ESP + 0x22],0x0
AND EAX,0x7
MOV dword ptr [ESP + 0x26],0x0
MOV EDX,EAX
MOV byte ptr [ESP + 0x22],0x37
OR EDX,0x10
CMP byte ptr [ESP + 0x94],0x0
CMOVNZ EAX,EDX
CMP byte ptr [ESP + 0x98],0x0
MOV byte ptr [ESP + 0x24],AL
JZ 0x0002498e
OR byte ptr [ESP + 0x24],0x8
MOVZX EAX,word ptr [ESP + 0xa4]
ROL AX,0x8
CMP dword ptr [ESP + 0xa4],0xffff
MOV word ptr [ESP + 0x29],AX
JG 0x00024bee
LEA EAX,[EBX + 0xffff3c3c]
MOV dword ptr [ESP + 0x4],EAX
MOV EAX,dword ptr [ESP + 0xac]
TEST EAX,EAX
JNZ 0x00024ab8
CALL 0x00017160
MOV ESI,EAX
TEST EAX,EAX
JZ 0x00024b19
SUB ESP,0x4
PUSH 0xa
LEA EAX,[ESP + 0x2a]
PUSH EAX
PUSH ESI
CALL 0x000177e0
ADD ESP,0xc
PUSH 0x40
LEA EDI,[ESP + 0x34]
PUSH EDI
PUSH ESI
CALL 0x00017620
ADD ESP,0xc
PUSH dword ptr [ESP + 0xa8]
PUSH dword ptr [ESP + 0x10]
PUSH ESI
CALL 0x000170d0
PUSH dword ptr [ESP + 0xbc]
PUSH 0x3c
PUSH dword ptr [ESP + 0xa8]
PUSH ESI
CALL 0x00017430
ADD ESP,0x20
LEA EDX,[ESP + 0x1c]
PUSH EDX
PUSH dword ptr [ESP + 0xb0]
MOVZX EDX,byte ptr [ESP + 0x14]
PUSH EDX
PUSH EDI
PUSH dword ptr [ESP + 0xb4]
PUSH EAX
PUSH dword ptr [ESP + 0x1c]
PUSH ESI
CALL 0x00017690
ADD ESP,0x20
MOV EDI,EAX
CMP EAX,-0x1
JZ 0x00024bb8
CMP EDI,-0x2
JZ 0x00024a78
CMP dword ptr [ESP + 0xac],0x2
JLE 0x00024a6f
TEST EDI,EDI
JG 0x00024b48
XOR EDI,EDI
JMP 0x00024a8a
MOV EDI,dword ptr [ESP + 0x1c]
LEA EAX,[EDI + -0x14]
CMP EAX,0x2
MOV EAX,0x0
CMOVC EDI,EAX
SUB ESP,0xc
PUSH ESI
CALL 0x00017490
ADD ESP,0x10
MOV ECX,dword ptr [ESP + 0x6c]
XOR ECX,dword ptr GS:[0x14]
MOV EAX,EDI
JNZ 0x00024c0a
ADD ESP,0x7c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
LEA EAX,[EBX + 0xffff34d7]
LEA ESI,[EBX + 0xffff479b]
PUSH dword ptr [ESP + 0xc]
PUSH EAX
CALL 0x00017630
LEA EBP,[ESP + 0x32]
LEA EDI,[ESP + 0x3c]
ADD ESP,0x10
LEA ESI,[ESI]
MOVZX EAX,byte ptr [EBP]
SUB ESP,0x8
ADD EBP,0x1
PUSH EAX
PUSH ESI
CALL 0x00017630
ADD ESP,0x10
CMP EDI,EBP
JNZ 0x00024ae0
SUB ESP,0xc
LEA EAX,[EBX + 0xfffe7958]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
CALL 0x00017160
MOV ESI,EAX
TEST EAX,EAX
JNZ 0x000249d8
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3527]
PUSH dword ptr [ESP + 0xc]
PUSH EAX
CALL 0x00017630
MOV dword ptr [ESP],0xc
CALL 0x00017560
ADD ESP,0x10
MOV EDI,EAX
JMP 0x00024a96
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3bf6]
PUSH dword ptr [ESP + 0xc]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
CMP dword ptr [ESP + 0xac],0x3
JNZ 0x00024bd8
CMP EDI,0x100
LEA EDX,[EBX + 0xfffe7c4d]
LEA EAX,[EBX + 0xffff38fb]
CMOVLE EAX,EDX
SUB ESP,0x8
PUSH EAX
LEA EAX,[EBX + 0xfffe75ee]
PUSH EAX
CALL 0x00017630
ADD ESP,0xc
MOV EAX,0x100
CMP EDI,0x100
PUSH -0x1
CMOVG EDI,EAX
PUSH EDI
XOR EDI,EDI
PUSH dword ptr [ESP + 0x14]
CALL 0x00017700
ADD ESP,0x10
JMP 0x00024a8a
SUB ESP,0xc
PUSH ESI
CALL 0x000170a0
MOV dword ptr [ESP],EAX
CALL 0x00017560
ADD ESP,0x10
MOV EDI,EAX
JMP 0x00024a8a
SUB ESP,0xc
LEA EAX,[EBX + 0xffff485d]
PUSH EAX
CALL 0x00017630
ADD ESP,0xc
PUSH 0x0
JMP 0x00024ba0
SUB ESP,0xc
LEA EAX,[EBX + 0xffff390d]
MOV EDI,0xffffffff
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
JMP 0x00024a96
CALL 0x0002f100
(translation_unit "int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)\n\n{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar9;\n}\n\n" (function_definition "int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)\n\n{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar9;\n}" primitive_type (function_declarator "sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" identifier (parameter_list "(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" ( (parameter_declaration "char param_1" primitive_type identifier) , (parameter_declaration "char param_2" primitive_type identifier) , (parameter_declaration "byte param_3" type_identifier identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) , (parameter_declaration "uint param_5" type_identifier identifier) , (parameter_declaration "undefined1 param_6" type_identifier identifier) , (parameter_declaration "int param_7" primitive_type identifier) ))) (compound_statement "{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar9;\n}" { (declaration "uint3 uVar1;" type_identifier identifier ;) (declaration "byte bVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "undefined *puVar7;" type_identifier (pointer_declarator "*puVar7" * identifier) ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar8;" type_identifier (pointer_declarator "*pbVar8" * identifier) ;) (declaration "int iVar9;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_74;" primitive_type identifier ;) (declaration "undefined4 local_6e;" type_identifier identifier ;) (declaration "int local_6a;" primitive_type identifier ;) (declaration "undefined1 uStack_66;" type_identifier identifier ;) (declaration "undefined1 uStack_65;" type_identifier 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_65 = 0;" (assignment_expression "uStack_65 = 0" identifier = number_literal) ;) (expression_statement "uStack_14 = 0x2491b;" (assignment_expression "uStack_14 = 0x2491b" 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 "bVar2 = param_3 & 7;" (assignment_expression "bVar2 = param_3 & 7" identifier = (binary_expression "param_3 & 7" identifier & number_literal)) ;) (if_statement "if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }" if (parenthesized_expression "(param_1 != '\0')" ( (binary_expression "param_1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    bVar2 = param_3 & 7 | 0x10;\n  }" { (expression_statement "bVar2 = param_3 & 7 | 0x10;" (assignment_expression "bVar2 = param_3 & 7 | 0x10" identifier = (binary_expression "param_3 & 7 | 0x10" (binary_expression "param_3 & 7" identifier & number_literal) | number_literal)) ;) })) (expression_statement "local_6e._0_3_ = CONCAT12(bVar2,0x37);" (assignment_expression "local_6e._0_3_ = CONCAT12(bVar2,0x37)" (field_expression "local_6e._0_3_" identifier . field_identifier) = (call_expression "CONCAT12(bVar2,0x37)" identifier (argument_list "(bVar2,0x37)" ( identifier , number_literal )))) ;) (expression_statement "uVar1 = (uint3)local_6e;" (assignment_expression "uVar1 = (uint3)local_6e" identifier = (cast_expression "(uint3)local_6e" ( (type_descriptor "uint3" type_identifier) ) identifier)) ;) (expression_statement "local_6e = (uint)(uint3)local_6e;" (assignment_expression "local_6e = (uint)(uint3)local_6e" identifier = (cast_expression "(uint)(uint3)local_6e" ( (type_descriptor "uint" type_identifier) ) (cast_expression "(uint3)local_6e" ( (type_descriptor "uint3" type_identifier) ) identifier))) ;) (if_statement "if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }" if (parenthesized_expression "(param_2 != '\0')" ( (binary_expression "param_2 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6e = uVar1 | 0x80000;\n  }" { (expression_statement "local_6e = uVar1 | 0x80000;" (assignment_expression "local_6e = uVar1 | 0x80000" identifier = (binary_expression "uVar1 | 0x80000" identifier | number_literal)) ;) })) (expression_statement "local_6a = (param_5 >> 8) << 0x18;" (assignment_expression "local_6a = (param_5 >> 8) << 0x18" identifier = (binary_expression "(param_5 >> 8) << 0x18" (parenthesized_expression "(param_5 >> 8)" ( (binary_expression "param_5 >> 8" identifier >> number_literal) )) << number_literal)) ;) (expression_statement "uStack_66 = (undefined1)param_5;" (assignment_expression "uStack_66 = (undefined1)param_5" identifier = (cast_expression "(undefined1)param_5" ( (type_descriptor "undefined1" type_identifier) ) identifier)) ;) (if_statement "if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" if (parenthesized_expression "((int)param_5 < 0x10000)" ( (binary_expression "(int)param_5 < 0x10000" (cast_expression "(int)param_5" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }" { (expression_statement "iVar9 = unaff_EBX + 0x180a9;" (assignment_expression "iVar9 = unaff_EBX + 0x180a9" identifier = (binary_expression "unaff_EBX + 0x180a9" identifier + number_literal)) ;) (if_statement "if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" if (parenthesized_expression "(param_7 == 0)" ( (binary_expression "param_7 == 0" identifier == number_literal) )) (compound_statement "{\n      iVar3 = construct_scsi_pt_obj();\n    }" { (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }) (else_clause "else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" else (compound_statement "{\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x17944,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17944,iVar9)" identifier (argument_list "(unaff_EBX + 0x17944,iVar9)" ( (binary_expression "unaff_EBX + 0x17944" identifier + number_literal) , identifier ))) ;) (expression_statement "pbVar8 = (byte *)&local_6e;" (assignment_expression "pbVar8 = (byte *)&local_6e" identifier = (cast_expression "(byte *)&local_6e" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&local_6e" & identifier))) ;) (do_statement "do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);" do (compound_statement "{\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      }" { (expression_statement "uVar6 = (uint)*pbVar8;" (assignment_expression "uVar6 = (uint)*pbVar8" identifier = (binary_expression "(uint)*pbVar8" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar8 = pbVar8 + 1;" (assignment_expression "pbVar8 = pbVar8 + 1" identifier = (binary_expression "pbVar8 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);" (call_expression "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6)" identifier (argument_list "(&UNK_00018c08 + unaff_EBX,uVar6)" ( (binary_expression "&UNK_00018c08 + unaff_EBX" (pointer_expression "&UNK_00018c08" & identifier) + identifier) , identifier ))) ;) }) while (parenthesized_expression "(local_64 != pbVar8)" ( (binary_expression "local_64 != pbVar8" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0xbdc5,uVar6);" (call_expression "pr2ws(unaff_EBX + 0xbdc5,uVar6)" identifier (argument_list "(unaff_EBX + 0xbdc5,uVar6)" ( (binary_expression "unaff_EBX + 0xbdc5" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }))) (if_statement "if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x17994,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17994,iVar9)" identifier (argument_list "(unaff_EBX + 0x17994,iVar9)" ( (binary_expression "unaff_EBX + 0x17994" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar9 = sg_convert_errno(0xc);" (assignment_expression "iVar9 = sg_convert_errno(0xc)" identifier = (call_expression "sg_convert_errno(0xc)" identifier (argument_list "(0xc)" ( number_literal )))) ;) }) (else_clause "else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" else (compound_statement "{\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" { (expression_statement "set_scsi_pt_cdb(iVar3,&local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar3,&local_6e,10)" identifier (argument_list "(iVar3,&local_6e,10)" ( identifier , (pointer_expression "&local_6e" & identifier) , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(iVar3,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar3,local_64,0x40)" identifier (argument_list "(iVar3,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_in(iVar3,param_4,param_5);" (call_expression "set_scsi_pt_data_in(iVar3,param_4,param_5)" identifier (argument_list "(iVar3,param_4,param_5)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" identifier = (call_expression "do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" identifier (argument_list "(iVar3,unaff_retaddr,0x3c,param_7)" ( identifier , identifier , number_literal , identifier )))) ;) (expression_statement "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" identifier = (call_expression "sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" identifier (argument_list "(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" ( identifier , identifier , identifier , identifier , identifier , identifier , identifier , (pointer_expression "&local_74" & identifier) )))) ;) (if_statement "if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "(iVar5 == -1)" ( (binary_expression "iVar5 == -1" identifier == number_literal) )) (compound_statement "{\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }" { (expression_statement "uVar4 = get_scsi_pt_os_err(iVar3);" (assignment_expression "uVar4 = get_scsi_pt_os_err(iVar3)" identifier = (call_expression "get_scsi_pt_os_err(iVar3)" identifier (argument_list "(iVar3)" ( identifier )))) ;) (expression_statement "iVar9 = sg_convert_errno(uVar4);" (assignment_expression "iVar9 = sg_convert_errno(uVar4)" identifier = (call_expression "sg_convert_errno(uVar4)" identifier (argument_list "(uVar4)" ( identifier )))) ;) }) (else_clause "else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (if_statement "if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "(iVar5 == -2)" ( (binary_expression "iVar5 == -2" identifier == number_literal) )) (compound_statement "{\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }" { (expression_statement "iVar9 = local_74;" (assignment_expression "iVar9 = local_74" identifier = identifier) ;) (if_statement "if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }" if (parenthesized_expression "(local_74 - 0x14U < 2)" ( (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" identifier - number_literal) < number_literal) )) (compound_statement "{\n          iVar9 = 0;\n        }" { (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) })) }) (else_clause "else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (if_statement "if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "((param_7 < 3) || (iVar5 < 1))" ( (binary_expression "(param_7 < 3) || (iVar5 < 1)" (parenthesized_expression "(param_7 < 3)" ( (binary_expression "param_7 < 3" identifier < number_literal) )) || (parenthesized_expression "(iVar5 < 1)" ( (binary_expression "iVar5 < 1" identifier < number_literal) ))) )) (compound_statement "{\n        iVar9 = 0;\n      }" { (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) }) (else_clause "else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (compound_statement "{\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x18063,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x18063,iVar9)" identifier (argument_list "(unaff_EBX + 0x18063,iVar9)" ( (binary_expression "unaff_EBX + 0x18063" identifier + number_literal) , identifier ))) ;) (if_statement "if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" if (parenthesized_expression "(param_7 == 3)" ( (binary_expression "param_7 == 3" identifier == number_literal) )) (compound_statement "{\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }" { (expression_statement "puVar7 = &UNK_00017d68 + unaff_EBX;" (assignment_expression "puVar7 = &UNK_00017d68 + unaff_EBX" identifier = (binary_expression "&UNK_00017d68 + unaff_EBX" (pointer_expression "&UNK_00017d68" & identifier) + identifier)) ;) (if_statement "if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" if (parenthesized_expression "(iVar5 < 0x101)" ( (binary_expression "iVar5 < 0x101" identifier < number_literal) )) (compound_statement "{\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" { (expression_statement "puVar7 = (undefined *)(unaff_EBX + 0xc0ba);" (assignment_expression "puVar7 = (undefined *)(unaff_EBX + 0xc0ba)" identifier = (cast_expression "(undefined *)(unaff_EBX + 0xc0ba)" ( (type_descriptor "undefined *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EBX + 0xc0ba)" ( (binary_expression "unaff_EBX + 0xc0ba" identifier + number_literal) )))) ;) })) (expression_statement "pr2ws(unaff_EBX + 0xba5b,puVar7);" (call_expression "pr2ws(unaff_EBX + 0xba5b,puVar7)" identifier (argument_list "(unaff_EBX + 0xba5b,puVar7)" ( (binary_expression "unaff_EBX + 0xba5b" identifier + number_literal) , identifier ))) ;) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" identifier = number_literal) ;) (if_statement "if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }" if (parenthesized_expression "(0x100 < iVar5)" ( (binary_expression "0x100 < iVar5" number_literal < identifier) )) (compound_statement "{\n            iVar5 = 0x100;\n          }" { (expression_statement "iVar5 = 0x100;" (assignment_expression "iVar5 = 0x100" identifier = number_literal) ;) })) }) (else_clause "else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" else (compound_statement "{\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" { (expression_statement "pr2ws(&UNK_00018cca + unaff_EBX,iVar9);" (call_expression "pr2ws(&UNK_00018cca + unaff_EBX,iVar9)" identifier (argument_list "(&UNK_00018cca + unaff_EBX,iVar9)" ( (binary_expression "&UNK_00018cca + unaff_EBX" (pointer_expression "&UNK_00018cca" & identifier) + identifier) , identifier ))) ;) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) }))) (expression_statement "hex2stderr(param_4,iVar5,uVar4);" (call_expression "hex2stderr(param_4,iVar5,uVar4)" identifier (argument_list "(param_4,iVar5,uVar4)" ( identifier , identifier , identifier ))) ;) (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) }))))))) (expression_statement "destruct_scsi_pt_obj(iVar3);" (call_expression "destruct_scsi_pt_obj(iVar3)" identifier (argument_list "(iVar3)" ( identifier ))) ;) }))) }) (else_clause "else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" else (compound_statement "{\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" { (expression_statement "iVar9 = -1;" (assignment_expression "iVar9 = -1" identifier = number_literal) ;) (expression_statement "pr2ws(&UNK_00017d7a + unaff_EBX);" (call_expression "pr2ws(&UNK_00017d7a + unaff_EBX)" identifier (argument_list "(&UNK_00017d7a + unaff_EBX)" ( (binary_expression "&UNK_00017d7a + unaff_EBX" (pointer_expression "&UNK_00017d7a" & identifier) + identifier) ))) ;) }))) (if_statement "if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\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                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }" { comment (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" identifier (argument_list "()" ( ))) ;) })) (return_statement "return iVar9;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n\nint sg_ll_read_defect10(int sg_fd,_Bool req_plist,_Bool req_glist,int dl_format,void *resp,\n                       int mx_resp_len,_Bool noisy,int verbose)\n\n{\n  int iVar1;\n  sg_pt_base *vp;\n  int iVar2;\n  uint uVar3;\n  char *pcVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  int no_ascii;\n  int sense_cat;\n  uint8_t rdef_cdb [10];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  rdef_cdb[9] = '\0';\n  rdef_cdb[2] = (byte)dl_format & 7;\n  if (req_plist) {\n    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;\n  }\n  rdef_cdb[0] = '7';\n  rdef_cdb[1] = '\0';\n  rdef_cdb[3] = '\0';\n  if (req_glist) {\n    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;\n  }\n  rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18;\n  rdef_cdb[8] = (uint8_t)mx_resp_len;\n  if (mx_resp_len < 0x10000) {\n    pcVar4 = "Read defect(10)";\n    if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }\n    if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }\n  }\n  else {\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar2;\n}\n\n" comment comment (function_definition "int sg_ll_read_defect10(int sg_fd,_Bool req_plist,_Bool req_glist,int dl_format,void *resp,\n                       int mx_resp_len,_Bool noisy,int verbose)\n\n{\n  int iVar1;\n  sg_pt_base *vp;\n  int iVar2;\n  uint uVar3;\n  char *pcVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  int no_ascii;\n  int sense_cat;\n  uint8_t rdef_cdb [10];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  rdef_cdb[9] = '\0';\n  rdef_cdb[2] = (byte)dl_format & 7;\n  if (req_plist) {\n    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;\n  }\n  rdef_cdb[0] = '7';\n  rdef_cdb[1] = '\0';\n  rdef_cdb[3] = '\0';\n  if (req_glist) {\n    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;\n  }\n  rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18;\n  rdef_cdb[8] = (uint8_t)mx_resp_len;\n  if (mx_resp_len < 0x10000) {\n    pcVar4 = "Read defect(10)";\n    if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }\n    if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }\n  }\n  else {\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar2;\n}" primitive_type (function_declarator "sg_ll_read_defect10(int sg_fd,_Bool req_plist,_Bool req_glist,int dl_format,void *resp,\n                       int mx_resp_len,_Bool noisy,int verbose)" identifier (parameter_list "(int sg_fd,_Bool req_plist,_Bool req_glist,int dl_format,void *resp,\n                       int mx_resp_len,_Bool noisy,int verbose)" ( (parameter_declaration "int sg_fd" primitive_type identifier) , (parameter_declaration "_Bool req_plist" type_identifier identifier) , (parameter_declaration "_Bool req_glist" type_identifier identifier) , (parameter_declaration "int dl_format" primitive_type identifier) , (parameter_declaration "void *resp" primitive_type (pointer_declarator "*resp" * identifier)) , (parameter_declaration "int mx_resp_len" primitive_type identifier) , (parameter_declaration "_Bool noisy" type_identifier identifier) , (parameter_declaration "int verbose" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  sg_pt_base *vp;\n  int iVar2;\n  uint uVar3;\n  char *pcVar4;\n  byte *pbVar5;\n  int in_GS_OFFSET;\n  int no_ascii;\n  int sense_cat;\n  uint8_t rdef_cdb [10];\n  uint8_t sense_b [64];\n  \n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  rdef_cdb[9] = '\0';\n  rdef_cdb[2] = (byte)dl_format & 7;\n  if (req_plist) {\n    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;\n  }\n  rdef_cdb[0] = '7';\n  rdef_cdb[1] = '\0';\n  rdef_cdb[3] = '\0';\n  if (req_glist) {\n    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;\n  }\n  rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18;\n  rdef_cdb[8] = (uint8_t)mx_resp_len;\n  if (mx_resp_len < 0x10000) {\n    pcVar4 = "Read defect(10)";\n    if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }\n    if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }\n  }\n  else {\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "sg_pt_base *vp;" type_identifier (pointer_declarator "*vp" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "char *pcVar4;" primitive_type (pointer_declarator "*pcVar4" * identifier) ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "int no_ascii;" primitive_type identifier ;) (declaration "int sense_cat;" primitive_type identifier ;) (declaration "uint8_t rdef_cdb [10];" primitive_type (array_declarator "rdef_cdb [10]" 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 "rdef_cdb[9] = '\0';" (assignment_expression "rdef_cdb[9] = '\0'" (subscript_expression "rdef_cdb[9]" identifier [ number_literal ]) = (char_literal "'\0'" ' escape_sequence ')) ;) (expression_statement "rdef_cdb[2] = (byte)dl_format & 7;" (assignment_expression "rdef_cdb[2] = (byte)dl_format & 7" (subscript_expression "rdef_cdb[2]" identifier [ number_literal ]) = (binary_expression "(byte)dl_format & 7" (cast_expression "(byte)dl_format" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal)) ;) (if_statement "if (req_plist) {\n    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;\n  }" if (parenthesized_expression "(req_plist)" ( identifier )) (compound_statement "{\n    rdef_cdb[2] = (byte)dl_format & 7 | 0x10;\n  }" { (expression_statement "rdef_cdb[2] = (byte)dl_format & 7 | 0x10;" (assignment_expression "rdef_cdb[2] = (byte)dl_format & 7 | 0x10" (subscript_expression "rdef_cdb[2]" identifier [ number_literal ]) = (binary_expression "(byte)dl_format & 7 | 0x10" (binary_expression "(byte)dl_format & 7" (cast_expression "(byte)dl_format" ( (type_descriptor "byte" type_identifier) ) identifier) & number_literal) | number_literal)) ;) })) (expression_statement "rdef_cdb[0] = '7';" (assignment_expression "rdef_cdb[0] = '7'" (subscript_expression "rdef_cdb[0]" identifier [ number_literal ]) = (char_literal "'7'" ' character ')) ;) (expression_statement "rdef_cdb[1] = '\0';" (assignment_expression "rdef_cdb[1] = '\0'" (subscript_expression "rdef_cdb[1]" identifier [ number_literal ]) = (char_literal "'\0'" ' escape_sequence ')) ;) (expression_statement "rdef_cdb[3] = '\0';" (assignment_expression "rdef_cdb[3] = '\0'" (subscript_expression "rdef_cdb[3]" identifier [ number_literal ]) = (char_literal "'\0'" ' escape_sequence ')) ;) (if_statement "if (req_glist) {\n    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;\n  }" if (parenthesized_expression "(req_glist)" ( identifier )) (compound_statement "{\n    rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;\n  }" { (expression_statement "rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000;" (assignment_expression "rdef_cdb._0_4_ = (uint3)rdef_cdb._0_3_ | 0x80000" (field_expression "rdef_cdb._0_4_" identifier . field_identifier) = (binary_expression "(uint3)rdef_cdb._0_3_ | 0x80000" (cast_expression "(uint3)rdef_cdb._0_3_" ( (type_descriptor "uint3" type_identifier) ) (field_expression "rdef_cdb._0_3_" identifier . field_identifier)) | number_literal)) ;) })) (expression_statement "rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18;" (assignment_expression "rdef_cdb._4_4_ = ((uint)mx_resp_len >> 8) << 0x18" (field_expression "rdef_cdb._4_4_" identifier . field_identifier) = (binary_expression "((uint)mx_resp_len >> 8) << 0x18" (parenthesized_expression "((uint)mx_resp_len >> 8)" ( (binary_expression "(uint)mx_resp_len >> 8" (cast_expression "(uint)mx_resp_len" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )) << number_literal)) ;) (expression_statement "rdef_cdb[8] = (uint8_t)mx_resp_len;" (assignment_expression "rdef_cdb[8] = (uint8_t)mx_resp_len" (subscript_expression "rdef_cdb[8]" identifier [ number_literal ]) = (cast_expression "(uint8_t)mx_resp_len" ( (type_descriptor "uint8_t" primitive_type) ) identifier)) ;) (if_statement "if (mx_resp_len < 0x10000) {\n    pcVar4 = "Read defect(10)";\n    if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }\n    if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }\n  }\n  else {\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }" if (parenthesized_expression "(mx_resp_len < 0x10000)" ( (binary_expression "mx_resp_len < 0x10000" identifier < number_literal) )) (compound_statement "{\n    pcVar4 = "Read defect(10)";\n    if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }\n    if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }\n  }" { (expression_statement "pcVar4 = "Read defect(10)";" (assignment_expression "pcVar4 = "Read defect(10)"" identifier = (string_literal ""Read defect(10)"" " string_content ")) ;) (if_statement "if (verbose == 0) {\n      vp = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }" if (parenthesized_expression "(verbose == 0)" ( (binary_expression "verbose == 0" identifier == number_literal) )) (compound_statement "{\n      vp = construct_scsi_pt_obj();\n    }" { (expression_statement "vp = construct_scsi_pt_obj();" (assignment_expression "vp = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }) (else_clause "else {\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }" else (compound_statement "{\n      pr2ws("    %s cdb: ","Read defect(10)");\n      pbVar5 = rdef_cdb;\n      do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);\n      pr2ws("\n",uVar3);\n      vp = construct_scsi_pt_obj();\n    }" { (expression_statement "pr2ws("    %s cdb: ","Read defect(10)");" (call_expression "pr2ws("    %s cdb: ","Read defect(10)")" identifier (argument_list "("    %s cdb: ","Read defect(10)")" ( (string_literal ""    %s cdb: "" " string_content ") , (string_literal ""Read defect(10)"" " string_content ") ))) ;) (expression_statement "pbVar5 = rdef_cdb;" (assignment_expression "pbVar5 = rdef_cdb" identifier = identifier) ;) (do_statement "do {\n        uVar3 = (uint)*pbVar5;\n        pbVar5 = pbVar5 + 1;\n        pr2ws("%02x ",uVar3);\n      } while (sense_b != pbVar5);" 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 "(sense_b != pbVar5)" ( (binary_expression "sense_b != pbVar5" identifier != identifier) )) ;) (expression_statement "pr2ws("\n",uVar3);" (call_expression "pr2ws("\n",uVar3)" identifier (argument_list "("\n",uVar3)" ( (string_literal ""\n"" " escape_sequence ") , identifier ))) ;) (expression_statement "vp = construct_scsi_pt_obj();" (assignment_expression "vp = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }))) (if_statement "if (vp == (sg_pt_base *)0x0) {\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }" if (parenthesized_expression "(vp == (sg_pt_base *)0x0)" ( (binary_expression "vp == (sg_pt_base *)0x0" identifier == (cast_expression "(sg_pt_base *)0x0" ( (type_descriptor "sg_pt_base *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      pr2ws("%s: out of memory\n","Read defect(10)");\n      iVar2 = sg_convert_errno(0xc);\n    }" { (expression_statement "pr2ws("%s: out of memory\n","Read defect(10)");" (call_expression "pr2ws("%s: out of memory\n","Read defect(10)")" identifier (argument_list "("%s: out of memory\n","Read defect(10)")" ( (string_literal ""%s: out of memory\n"" " string_content escape_sequence ") , (string_literal ""Read defect(10)"" " string_content ") ))) ;) (expression_statement "iVar2 = sg_convert_errno(0xc);" (assignment_expression "iVar2 = sg_convert_errno(0xc)" identifier = (call_expression "sg_convert_errno(0xc)" identifier (argument_list "(0xc)" ( number_literal )))) ;) }) (else_clause "else {\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }" else (compound_statement "{\n      set_scsi_pt_cdb(vp,rdef_cdb,10);\n      set_scsi_pt_sense(vp,sense_b,0x40);\n      set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);\n      iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n      iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);\n      if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }\n      destruct_scsi_pt_obj(vp);\n    }" { (expression_statement "set_scsi_pt_cdb(vp,rdef_cdb,10);" (call_expression "set_scsi_pt_cdb(vp,rdef_cdb,10)" identifier (argument_list "(vp,rdef_cdb,10)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(vp,sense_b,0x40);" (call_expression "set_scsi_pt_sense(vp,sense_b,0x40)" identifier (argument_list "(vp,sense_b,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len);" (call_expression "set_scsi_pt_data_in(vp,(uint8_t *)resp,mx_resp_len)" identifier (argument_list "(vp,(uint8_t *)resp,mx_resp_len)" ( identifier , (cast_expression "(uint8_t *)resp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier ))) ;) (expression_statement "iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose);" (assignment_expression "iVar2 = do_scsi_pt(vp,sg_fd,0x3c,verbose)" identifier = (call_expression "do_scsi_pt(vp,sg_fd,0x3c,verbose)" identifier (argument_list "(vp,sg_fd,0x3c,verbose)" ( identifier , identifier , number_literal , identifier )))) ;) (expression_statement "iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat);" (assignment_expression "iVar2 = sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat)" identifier = (call_expression "sg_cmds_process_resp\n                        (vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat)" identifier (argument_list "(vp,"Read defect(10)",iVar2,mx_resp_len,sense_b,noisy,verbose,&sense_cat)" ( identifier , (string_literal ""Read defect(10)"" " string_content ") , identifier , identifier , identifier , identifier , identifier , (pointer_expression "&sense_cat" & identifier) )))) ;) (if_statement "if (iVar2 == -1) {\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = sg_convert_errno(iVar2);\n      }\n      else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n        iVar2 = get_scsi_pt_os_err();\n        iVar2 = 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 "iVar2 = sg_convert_errno(iVar2);" (assignment_expression "iVar2 = sg_convert_errno(iVar2)" identifier = (call_expression "sg_convert_errno(iVar2)" identifier (argument_list "(iVar2)" ( identifier )))) ;) }) (else_clause "else if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" else (if_statement "if (iVar2 == -2) {\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }\n      else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" if (parenthesized_expression "(iVar2 == -2)" ( (binary_expression "iVar2 == -2" identifier == number_literal) )) (compound_statement "{\n        iVar2 = sense_cat;\n        if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }\n      }" { (expression_statement "iVar2 = sense_cat;" (assignment_expression "iVar2 = sense_cat" identifier = identifier) ;) (if_statement "if (sense_cat - 0x14U < 2) {\n          iVar2 = 0;\n        }" if (parenthesized_expression "(sense_cat - 0x14U < 2)" ( (binary_expression "sense_cat - 0x14U < 2" (binary_expression "sense_cat - 0x14U" identifier - number_literal) < number_literal) )) (compound_statement "{\n          iVar2 = 0;\n        }" { (expression_statement "iVar2 = 0;" (assignment_expression "iVar2 = 0" identifier = number_literal) ;) })) }) (else_clause "else if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" else (if_statement "if ((verbose < 3) || (iVar2 < 1)) {\n        iVar2 = 0;\n      }\n      else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" if (parenthesized_expression "((verbose < 3) || (iVar2 < 1))" ( (binary_expression "(verbose < 3) || (iVar2 < 1)" (parenthesized_expression "(verbose < 3)" ( (binary_expression "verbose < 3" identifier < number_literal) )) || (parenthesized_expression "(iVar2 < 1)" ( (binary_expression "iVar2 < 1" identifier < number_literal) ))) )) (compound_statement "{\n        iVar2 = 0;\n      }" { (expression_statement "iVar2 = 0;" (assignment_expression "iVar2 = 0" identifier = number_literal) ;) }) (else_clause "else {\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" else (compound_statement "{\n        pr2ws("    %s: response\n","Read defect(10)");\n        if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }\n        hex2stderr((uint8_t *)resp,iVar2,no_ascii);\n        iVar2 = 0;\n      }" { (expression_statement "pr2ws("    %s: response\n","Read defect(10)");" (call_expression "pr2ws("    %s: response\n","Read defect(10)")" identifier (argument_list "("    %s: response\n","Read defect(10)")" ( (string_literal ""    %s: response\n"" " string_content escape_sequence ") , (string_literal ""Read defect(10)"" " string_content ") ))) ;) (if_statement "if (verbose == 3) {\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }\n        else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }" if (parenthesized_expression "(verbose == 3)" ( (binary_expression "verbose == 3" identifier == number_literal) )) (compound_statement "{\n          pcVar4 = ", first 256 bytes";\n          if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }\n          pr2ws("%s:\n",pcVar4);\n          no_ascii = -1;\n          if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }\n        }" { (expression_statement "pcVar4 = ", first 256 bytes";" (assignment_expression "pcVar4 = ", first 256 bytes"" identifier = (string_literal "", first 256 bytes"" " string_content ")) ;) (if_statement "if (iVar2 < 0x101) {\n            pcVar4 = "";\n          }" if (parenthesized_expression "(iVar2 < 0x101)" ( (binary_expression "iVar2 < 0x101" identifier < number_literal) )) (compound_statement "{\n            pcVar4 = "";\n          }" { (expression_statement "pcVar4 = "";" (assignment_expression "pcVar4 = """ identifier = (string_literal """" " ")) ;) })) (expression_statement "pr2ws("%s:\n",pcVar4);" (call_expression "pr2ws("%s:\n",pcVar4)" identifier (argument_list "("%s:\n",pcVar4)" ( (string_literal ""%s:\n"" " string_content escape_sequence ") , identifier ))) ;) (expression_statement "no_ascii = -1;" (assignment_expression "no_ascii = -1" identifier = number_literal) ;) (if_statement "if (0x100 < iVar2) {\n            iVar2 = 0x100;\n          }" if (parenthesized_expression "(0x100 < iVar2)" ( (binary_expression "0x100 < iVar2" number_literal < identifier) )) (compound_statement "{\n            iVar2 = 0x100;\n          }" { (expression_statement "iVar2 = 0x100;" (assignment_expression "iVar2 = 0x100" identifier = number_literal) ;) })) }) (else_clause "else {\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }" else (compound_statement "{\n          pr2ws(":\n",pcVar4);\n          no_ascii = 0;\n        }" { (expression_statement "pr2ws(":\n",pcVar4);" (call_expression "pr2ws(":\n",pcVar4)" identifier (argument_list "(":\n",pcVar4)" ( (string_literal "":\n"" " string_content escape_sequence ") , identifier ))) ;) (expression_statement "no_ascii = 0;" (assignment_expression "no_ascii = 0" identifier = number_literal) ;) }))) (expression_statement "hex2stderr((uint8_t *)resp,iVar2,no_ascii);" (call_expression "hex2stderr((uint8_t *)resp,iVar2,no_ascii)" identifier (argument_list "((uint8_t *)resp,iVar2,no_ascii)" ( (cast_expression "(uint8_t *)resp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier , identifier ))) ;) (expression_statement "iVar2 = 0;" (assignment_expression "iVar2 = 0" identifier = number_literal) ;) }))))))) (expression_statement "destruct_scsi_pt_obj(vp);" (call_expression "destruct_scsi_pt_obj(vp)" identifier (argument_list "(vp)" ( identifier ))) ;) }))) }) (else_clause "else {\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }" else (compound_statement "{\n    iVar2 = -1;\n    pr2ws("mx_resp_len too big\n");\n  }" { (expression_statement "iVar2 = -1;" (assignment_expression "iVar2 = -1" identifier = number_literal) ;) (expression_statement "pr2ws("mx_resp_len too big\n");" (call_expression "pr2ws("mx_resp_len too big\n")" identifier (argument_list "("mx_resp_len too big\n")" ( (string_literal ""mx_resp_len too big\n"" " string_content escape_sequence ") ))) ;) }))) (if_statement "if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\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                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }" { comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) })) (return_statement "return iVar2;" return identifier ;) })))
(translation_unit "int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)\n\n{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar9;\n}\n\n" (function_definition "int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)\n\n{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar9;\n}" primitive_type (function_declarator "sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" identifier (parameter_list "(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" ( (parameter_declaration "char param_1" primitive_type identifier) , (parameter_declaration "char param_2" primitive_type identifier) , (parameter_declaration "byte param_3" type_identifier identifier) , (parameter_declaration "undefined4 param_4" type_identifier identifier) , (parameter_declaration "uint param_5" type_identifier identifier) , (parameter_declaration "undefined1 param_6" type_identifier identifier) , (parameter_declaration "int param_7" primitive_type identifier) ))) (compound_statement "{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar9;\n}" { (declaration "uint3 uVar1;" type_identifier identifier ;) (declaration "byte bVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "undefined4 uVar4;" type_identifier identifier ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "uint uVar6;" type_identifier identifier ;) (declaration "undefined *puVar7;" type_identifier (pointer_declarator "*puVar7" * identifier) ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar8;" type_identifier (pointer_declarator "*pbVar8" * identifier) ;) (declaration "int iVar9;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_74;" primitive_type identifier ;) (declaration "undefined4 local_6e;" type_identifier identifier ;) (declaration "int local_6a;" primitive_type identifier ;) (declaration "undefined1 uStack_66;" type_identifier identifier ;) (declaration "undefined1 uStack_65;" type_identifier 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_65 = 0;" (assignment_expression "uStack_65 = 0" identifier = number_literal) ;) (expression_statement "uStack_14 = 0x2491b;" (assignment_expression "uStack_14 = 0x2491b" 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 "bVar2 = param_3 & 7;" (assignment_expression "bVar2 = param_3 & 7" identifier = (binary_expression "param_3 & 7" identifier & number_literal)) ;) (if_statement "if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }" if (parenthesized_expression "(param_1 != '\0')" ( (binary_expression "param_1 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    bVar2 = param_3 & 7 | 0x10;\n  }" { (expression_statement "bVar2 = param_3 & 7 | 0x10;" (assignment_expression "bVar2 = param_3 & 7 | 0x10" identifier = (binary_expression "param_3 & 7 | 0x10" (binary_expression "param_3 & 7" identifier & number_literal) | number_literal)) ;) })) (expression_statement "local_6e._0_3_ = CONCAT12(bVar2,0x37);" (assignment_expression "local_6e._0_3_ = CONCAT12(bVar2,0x37)" (field_expression "local_6e._0_3_" identifier . field_identifier) = (call_expression "CONCAT12(bVar2,0x37)" identifier (argument_list "(bVar2,0x37)" ( identifier , number_literal )))) ;) (expression_statement "uVar1 = (uint3)local_6e;" (assignment_expression "uVar1 = (uint3)local_6e" identifier = (cast_expression "(uint3)local_6e" ( (type_descriptor "uint3" type_identifier) ) identifier)) ;) (expression_statement "local_6e = (uint)(uint3)local_6e;" (assignment_expression "local_6e = (uint)(uint3)local_6e" identifier = (cast_expression "(uint)(uint3)local_6e" ( (type_descriptor "uint" type_identifier) ) (cast_expression "(uint3)local_6e" ( (type_descriptor "uint3" type_identifier) ) identifier))) ;) (if_statement "if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }" if (parenthesized_expression "(param_2 != '\0')" ( (binary_expression "param_2 != '\0'" identifier != (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    local_6e = uVar1 | 0x80000;\n  }" { (expression_statement "local_6e = uVar1 | 0x80000;" (assignment_expression "local_6e = uVar1 | 0x80000" identifier = (binary_expression "uVar1 | 0x80000" identifier | number_literal)) ;) })) (expression_statement "local_6a = (param_5 >> 8) << 0x18;" (assignment_expression "local_6a = (param_5 >> 8) << 0x18" identifier = (binary_expression "(param_5 >> 8) << 0x18" (parenthesized_expression "(param_5 >> 8)" ( (binary_expression "param_5 >> 8" identifier >> number_literal) )) << number_literal)) ;) (expression_statement "uStack_66 = (undefined1)param_5;" (assignment_expression "uStack_66 = (undefined1)param_5" identifier = (cast_expression "(undefined1)param_5" ( (type_descriptor "undefined1" type_identifier) ) identifier)) ;) (if_statement "if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" if (parenthesized_expression "((int)param_5 < 0x10000)" ( (binary_expression "(int)param_5 < 0x10000" (cast_expression "(int)param_5" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }" { (expression_statement "iVar9 = unaff_EBX + 0x180a9;" (assignment_expression "iVar9 = unaff_EBX + 0x180a9" identifier = (binary_expression "unaff_EBX + 0x180a9" identifier + number_literal)) ;) (if_statement "if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" if (parenthesized_expression "(param_7 == 0)" ( (binary_expression "param_7 == 0" identifier == number_literal) )) (compound_statement "{\n      iVar3 = construct_scsi_pt_obj();\n    }" { (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }) (else_clause "else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" else (compound_statement "{\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x17944,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17944,iVar9)" identifier (argument_list "(unaff_EBX + 0x17944,iVar9)" ( (binary_expression "unaff_EBX + 0x17944" identifier + number_literal) , identifier ))) ;) (expression_statement "pbVar8 = (byte *)&local_6e;" (assignment_expression "pbVar8 = (byte *)&local_6e" identifier = (cast_expression "(byte *)&local_6e" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&local_6e" & identifier))) ;) (do_statement "do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);" do (compound_statement "{\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      }" { (expression_statement "uVar6 = (uint)*pbVar8;" (assignment_expression "uVar6 = (uint)*pbVar8" identifier = (binary_expression "(uint)*pbVar8" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar8 = pbVar8 + 1;" (assignment_expression "pbVar8 = pbVar8 + 1" identifier = (binary_expression "pbVar8 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);" (call_expression "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6)" identifier (argument_list "(&UNK_00018c08 + unaff_EBX,uVar6)" ( (binary_expression "&UNK_00018c08 + unaff_EBX" (pointer_expression "&UNK_00018c08" & identifier) + identifier) , identifier ))) ;) }) while (parenthesized_expression "(local_64 != pbVar8)" ( (binary_expression "local_64 != pbVar8" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0xbdc5,uVar6);" (call_expression "pr2ws(unaff_EBX + 0xbdc5,uVar6)" identifier (argument_list "(unaff_EBX + 0xbdc5,uVar6)" ( (binary_expression "unaff_EBX + 0xbdc5" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) }))) (if_statement "if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x17994,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17994,iVar9)" identifier (argument_list "(unaff_EBX + 0x17994,iVar9)" ( (binary_expression "unaff_EBX + 0x17994" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar9 = sg_convert_errno(0xc);" (assignment_expression "iVar9 = sg_convert_errno(0xc)" identifier = (call_expression "sg_convert_errno(0xc)" identifier (argument_list "(0xc)" ( number_literal )))) ;) }) (else_clause "else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" else (compound_statement "{\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" { (expression_statement "set_scsi_pt_cdb(iVar3,&local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar3,&local_6e,10)" identifier (argument_list "(iVar3,&local_6e,10)" ( identifier , (pointer_expression "&local_6e" & identifier) , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(iVar3,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar3,local_64,0x40)" identifier (argument_list "(iVar3,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_in(iVar3,param_4,param_5);" (call_expression "set_scsi_pt_data_in(iVar3,param_4,param_5)" identifier (argument_list "(iVar3,param_4,param_5)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" identifier = (call_expression "do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" identifier (argument_list "(iVar3,unaff_retaddr,0x3c,param_7)" ( identifier , identifier , number_literal , identifier )))) ;) (expression_statement "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" identifier = (call_expression "sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" identifier (argument_list "(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" ( identifier , identifier , identifier , identifier , identifier , identifier , identifier , (pointer_expression "&local_74" & identifier) )))) ;) (if_statement "if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "(iVar5 == -1)" ( (binary_expression "iVar5 == -1" identifier == number_literal) )) (compound_statement "{\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }" { (expression_statement "uVar4 = get_scsi_pt_os_err(iVar3);" (assignment_expression "uVar4 = get_scsi_pt_os_err(iVar3)" identifier = (call_expression "get_scsi_pt_os_err(iVar3)" identifier (argument_list "(iVar3)" ( identifier )))) ;) (expression_statement "iVar9 = sg_convert_errno(uVar4);" (assignment_expression "iVar9 = sg_convert_errno(uVar4)" identifier = (call_expression "sg_convert_errno(uVar4)" identifier (argument_list "(uVar4)" ( identifier )))) ;) }) (else_clause "else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (if_statement "if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "(iVar5 == -2)" ( (binary_expression "iVar5 == -2" identifier == number_literal) )) (compound_statement "{\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }" { (expression_statement "iVar9 = local_74;" (assignment_expression "iVar9 = local_74" identifier = identifier) ;) (if_statement "if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }" if (parenthesized_expression "(local_74 - 0x14U < 2)" ( (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" identifier - number_literal) < number_literal) )) (compound_statement "{\n          iVar9 = 0;\n        }" { (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) })) }) (else_clause "else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (if_statement "if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" if (parenthesized_expression "((param_7 < 3) || (iVar5 < 1))" ( (binary_expression "(param_7 < 3) || (iVar5 < 1)" (parenthesized_expression "(param_7 < 3)" ( (binary_expression "param_7 < 3" identifier < number_literal) )) || (parenthesized_expression "(iVar5 < 1)" ( (binary_expression "iVar5 < 1" identifier < number_literal) ))) )) (compound_statement "{\n        iVar9 = 0;\n      }" { (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) }) (else_clause "else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" else (compound_statement "{\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x18063,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x18063,iVar9)" identifier (argument_list "(unaff_EBX + 0x18063,iVar9)" ( (binary_expression "unaff_EBX + 0x18063" identifier + number_literal) , identifier ))) ;) (if_statement "if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" if (parenthesized_expression "(param_7 == 3)" ( (binary_expression "param_7 == 3" identifier == number_literal) )) (compound_statement "{\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }" { (expression_statement "puVar7 = &UNK_00017d68 + unaff_EBX;" (assignment_expression "puVar7 = &UNK_00017d68 + unaff_EBX" identifier = (binary_expression "&UNK_00017d68 + unaff_EBX" (pointer_expression "&UNK_00017d68" & identifier) + identifier)) ;) (if_statement "if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" if (parenthesized_expression "(iVar5 < 0x101)" ( (binary_expression "iVar5 < 0x101" identifier < number_literal) )) (compound_statement "{\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" { (expression_statement "puVar7 = (undefined *)(unaff_EBX + 0xc0ba);" (assignment_expression "puVar7 = (undefined *)(unaff_EBX + 0xc0ba)" identifier = (cast_expression "(undefined *)(unaff_EBX + 0xc0ba)" ( (type_descriptor "undefined *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EBX + 0xc0ba)" ( (binary_expression "unaff_EBX + 0xc0ba" identifier + number_literal) )))) ;) })) (expression_statement "pr2ws(unaff_EBX + 0xba5b,puVar7);" (call_expression "pr2ws(unaff_EBX + 0xba5b,puVar7)" identifier (argument_list "(unaff_EBX + 0xba5b,puVar7)" ( (binary_expression "unaff_EBX + 0xba5b" identifier + number_literal) , identifier ))) ;) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" identifier = number_literal) ;) (if_statement "if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }" if (parenthesized_expression "(0x100 < iVar5)" ( (binary_expression "0x100 < iVar5" number_literal < identifier) )) (compound_statement "{\n            iVar5 = 0x100;\n          }" { (expression_statement "iVar5 = 0x100;" (assignment_expression "iVar5 = 0x100" identifier = number_literal) ;) })) }) (else_clause "else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" else (compound_statement "{\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" { (expression_statement "pr2ws(&UNK_00018cca + unaff_EBX,iVar9);" (call_expression "pr2ws(&UNK_00018cca + unaff_EBX,iVar9)" identifier (argument_list "(&UNK_00018cca + unaff_EBX,iVar9)" ( (binary_expression "&UNK_00018cca + unaff_EBX" (pointer_expression "&UNK_00018cca" & identifier) + identifier) , identifier ))) ;) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" identifier = number_literal) ;) }))) (expression_statement "hex2stderr(param_4,iVar5,uVar4);" (call_expression "hex2stderr(param_4,iVar5,uVar4)" identifier (argument_list "(param_4,iVar5,uVar4)" ( identifier , identifier , identifier ))) ;) (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" identifier = number_literal) ;) }))))))) (expression_statement "destruct_scsi_pt_obj(iVar3);" (call_expression "destruct_scsi_pt_obj(iVar3)" identifier (argument_list "(iVar3)" ( identifier ))) ;) }))) }) (else_clause "else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" else (compound_statement "{\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" { (expression_statement "iVar9 = -1;" (assignment_expression "iVar9 = -1" identifier = number_literal) ;) (expression_statement "pr2ws(&UNK_00017d7a + unaff_EBX);" (call_expression "pr2ws(&UNK_00017d7a + unaff_EBX)" identifier (argument_list "(&UNK_00017d7a + unaff_EBX)" ( (binary_expression "&UNK_00017d7a + unaff_EBX" (pointer_expression "&UNK_00017d7a" & identifier) + identifier) ))) ;) }))) (if_statement "if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\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                    \n    FUN_0002f100();\n  }" { (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" identifier (argument_list "()" ( ))) ;) })) (return_statement "return iVar9;" return identifier ;) })))
(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) ))) (compound_statement { (declaration TYPE IDENT ;) (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 (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (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 IDENT = (binary_expression IDENT & LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT & LIT) | LIT)) ;) })) (expression_statement (assignment_expression (field_expression IDENT . field_identifier) = (call_expression IDENT (argument_list ( IDENT , LIT )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE) ) (cast_expression ( (type_descriptor TYPE) ) IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (char_literal ' escape_sequence ')) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT | LIT)) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( (binary_expression IDENT >> LIT) )) << LIT)) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression & IDENT))) ;) (do_statement do (compound_statement { (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 ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT )))) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , (pointer_expression & 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 , IDENT , LIT , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , IDENT , 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 (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT - LIT) < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT < LIT) )) || (parenthesized_expression ( (binary_expression IDENT < LIT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (pointer_expression & IDENT) + IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) ;) })) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression (pointer_expression & IDENT) + IDENT) , IDENT ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }))) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }))))))) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }))) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression (pointer_expression & IDENT) + IDENT) ))) ;) }))) (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 { (expression_statement (call_expression IDENT (argument_list ( ))) ;) })) (return_statement return IDENT ;) })))
(function_definition "int sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)\n\n{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar9;\n}" (primitive_type "int") (function_declarator "sg_ll_read_defect10(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" (identifier "sg_ll_read_defect10") (parameter_list "(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,\n                       undefined1 param_6,int param_7)" (( "(") (parameter_declaration "char param_1" (primitive_type "char") (identifier "param_1")) (, ",") (parameter_declaration "char param_2" (primitive_type "char") (identifier "param_2")) (, ",") (parameter_declaration "byte param_3" (type_identifier "byte") (identifier "param_3")) (, ",") (parameter_declaration "undefined4 param_4" (type_identifier "undefined4") (identifier "param_4")) (, ",") (parameter_declaration "uint param_5" (type_identifier "uint") (identifier "param_5")) (, ",") (parameter_declaration "undefined1 param_6" (type_identifier "undefined1") (identifier "param_6")) (, ",") (parameter_declaration "int param_7" (primitive_type "int") (identifier "param_7")) () ")"))) (compound_statement "{\n  uint3 uVar1;\n  byte bVar2;\n  int iVar3;\n  undefined4 uVar4;\n  int iVar5;\n  uint uVar6;\n  undefined *puVar7;\n  int unaff_EBX;\n  byte *pbVar8;\n  int iVar9;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_74;\n  undefined4 local_6e;\n  int local_6a;\n  undefined1 uStack_66;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uStack_65 = 0;\n  uStack_14 = 0x2491b;\n  entry();\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  bVar2 = param_3 & 7;\n  if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }\n  local_6e._0_3_ = CONCAT12(bVar2,0x37);\n  uVar1 = (uint3)local_6e;\n  local_6e = (uint)(uint3)local_6e;\n  if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\n  }\n  local_6a = (param_5 >> 8) << 0x18;\n  uStack_66 = (undefined1)param_5;\n  if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar9;\n}" ({ "{") (declaration "uint3 uVar1;" (type_identifier "uint3") (identifier "uVar1") (; ";")) (declaration "byte bVar2;" (type_identifier "byte") (identifier "bVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "undefined4 uVar4;" (type_identifier "undefined4") (identifier "uVar4") (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "uint uVar6;" (type_identifier "uint") (identifier "uVar6") (; ";")) (declaration "undefined *puVar7;" (type_identifier "undefined") (pointer_declarator "*puVar7" (* "*") (identifier "puVar7")) (; ";")) (declaration "int unaff_EBX;" (primitive_type "int") (identifier "unaff_EBX") (; ";")) (declaration "byte *pbVar8;" (type_identifier "byte") (pointer_declarator "*pbVar8" (* "*") (identifier "pbVar8")) (; ";")) (declaration "int iVar9;" (primitive_type "int") (identifier "iVar9") (; ";")) (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_74;" (primitive_type "int") (identifier "local_74") (; ";")) (declaration "undefined4 local_6e;" (type_identifier "undefined4") (identifier "local_6e") (; ";")) (declaration "int local_6a;" (primitive_type "int") (identifier "local_6a") (; ";")) (declaration "undefined1 uStack_66;" (type_identifier "undefined1") (identifier "uStack_66") (; ";")) (declaration "undefined1 uStack_65;" (type_identifier "undefined1") (identifier "uStack_65") (; ";")) (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_65 = 0;" (assignment_expression "uStack_65 = 0" (identifier "uStack_65") (= "=") (number_literal "0")) (; ";")) (expression_statement "uStack_14 = 0x2491b;" (assignment_expression "uStack_14 = 0x2491b" (identifier "uStack_14") (= "=") (number_literal "0x2491b")) (; ";")) (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 "bVar2 = param_3 & 7;" (assignment_expression "bVar2 = param_3 & 7" (identifier "bVar2") (= "=") (binary_expression "param_3 & 7" (identifier "param_3") (& "&") (number_literal "7"))) (; ";")) (if_statement "if (param_1 != '\0') {\n    bVar2 = param_3 & 7 | 0x10;\n  }" (if "if") (parenthesized_expression "(param_1 != '\0')" (( "(") (binary_expression "param_1 != '\0'" (identifier "param_1") (!= "!=") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    bVar2 = param_3 & 7 | 0x10;\n  }" ({ "{") (expression_statement "bVar2 = param_3 & 7 | 0x10;" (assignment_expression "bVar2 = param_3 & 7 | 0x10" (identifier "bVar2") (= "=") (binary_expression "param_3 & 7 | 0x10" (binary_expression "param_3 & 7" (identifier "param_3") (& "&") (number_literal "7")) (| "|") (number_literal "0x10"))) (; ";")) (} "}"))) (expression_statement "local_6e._0_3_ = CONCAT12(bVar2,0x37);" (assignment_expression "local_6e._0_3_ = CONCAT12(bVar2,0x37)" (field_expression "local_6e._0_3_" (identifier "local_6e") (. ".") (field_identifier "_0_3_")) (= "=") (call_expression "CONCAT12(bVar2,0x37)" (identifier "CONCAT12") (argument_list "(bVar2,0x37)" (( "(") (identifier "bVar2") (, ",") (number_literal "0x37") () ")")))) (; ";")) (expression_statement "uVar1 = (uint3)local_6e;" (assignment_expression "uVar1 = (uint3)local_6e" (identifier "uVar1") (= "=") (cast_expression "(uint3)local_6e" (( "(") (type_descriptor "uint3" (type_identifier "uint3")) () ")") (identifier "local_6e"))) (; ";")) (expression_statement "local_6e = (uint)(uint3)local_6e;" (assignment_expression "local_6e = (uint)(uint3)local_6e" (identifier "local_6e") (= "=") (cast_expression "(uint)(uint3)local_6e" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (cast_expression "(uint3)local_6e" (( "(") (type_descriptor "uint3" (type_identifier "uint3")) () ")") (identifier "local_6e")))) (; ";")) (if_statement "if (param_2 != '\0') {\n    local_6e = uVar1 | 0x80000;\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_6e = uVar1 | 0x80000;\n  }" ({ "{") (expression_statement "local_6e = uVar1 | 0x80000;" (assignment_expression "local_6e = uVar1 | 0x80000" (identifier "local_6e") (= "=") (binary_expression "uVar1 | 0x80000" (identifier "uVar1") (| "|") (number_literal "0x80000"))) (; ";")) (} "}"))) (expression_statement "local_6a = (param_5 >> 8) << 0x18;" (assignment_expression "local_6a = (param_5 >> 8) << 0x18" (identifier "local_6a") (= "=") (binary_expression "(param_5 >> 8) << 0x18" (parenthesized_expression "(param_5 >> 8)" (( "(") (binary_expression "param_5 >> 8" (identifier "param_5") (>> ">>") (number_literal "8")) () ")")) (<< "<<") (number_literal "0x18"))) (; ";")) (expression_statement "uStack_66 = (undefined1)param_5;" (assignment_expression "uStack_66 = (undefined1)param_5" (identifier "uStack_66") (= "=") (cast_expression "(undefined1)param_5" (( "(") (type_descriptor "undefined1" (type_identifier "undefined1")) () ")") (identifier "param_5"))) (; ";")) (if_statement "if ((int)param_5 < 0x10000) {\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }\n  else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" (if "if") (parenthesized_expression "((int)param_5 < 0x10000)" (( "(") (binary_expression "(int)param_5 < 0x10000" (cast_expression "(int)param_5" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "param_5")) (< "<") (number_literal "0x10000")) () ")")) (compound_statement "{\n    iVar9 = unaff_EBX + 0x180a9;\n    if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }\n    if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }\n  }" ({ "{") (expression_statement "iVar9 = unaff_EBX + 0x180a9;" (assignment_expression "iVar9 = unaff_EBX + 0x180a9" (identifier "iVar9") (= "=") (binary_expression "unaff_EBX + 0x180a9" (identifier "unaff_EBX") (+ "+") (number_literal "0x180a9"))) (; ";")) (if_statement "if (param_7 == 0) {\n      iVar3 = construct_scsi_pt_obj();\n    }\n    else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" (if "if") (parenthesized_expression "(param_7 == 0)" (( "(") (binary_expression "param_7 == 0" (identifier "param_7") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n      iVar3 = construct_scsi_pt_obj();\n    }" ({ "{") (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" (identifier "iVar3") (= "=") (call_expression "construct_scsi_pt_obj()" (identifier "construct_scsi_pt_obj") (argument_list "()" (( "(") () ")")))) (; ";")) (} "}")) (else_clause "else {\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" (else "else") (compound_statement "{\n      pr2ws(unaff_EBX + 0x17944,iVar9);\n      pbVar8 = (byte *)&local_6e;\n      do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);\n      pr2ws(unaff_EBX + 0xbdc5,uVar6);\n      iVar3 = construct_scsi_pt_obj();\n    }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x17944,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17944,iVar9)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x17944,iVar9)" (( "(") (binary_expression "unaff_EBX + 0x17944" (identifier "unaff_EBX") (+ "+") (number_literal "0x17944")) (, ",") (identifier "iVar9") () ")"))) (; ";")) (expression_statement "pbVar8 = (byte *)&local_6e;" (assignment_expression "pbVar8 = (byte *)&local_6e" (identifier "pbVar8") (= "=") (cast_expression "(byte *)&local_6e" (( "(") (type_descriptor "byte *" (type_identifier "byte") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "&local_6e" (& "&") (identifier "local_6e")))) (; ";")) (do_statement "do {\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      } while (local_64 != pbVar8);" (do "do") (compound_statement "{\n        uVar6 = (uint)*pbVar8;\n        pbVar8 = pbVar8 + 1;\n        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);\n      }" ({ "{") (expression_statement "uVar6 = (uint)*pbVar8;" (assignment_expression "uVar6 = (uint)*pbVar8" (identifier "uVar6") (= "=") (binary_expression "(uint)*pbVar8" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (* "*") (identifier "pbVar8"))) (; ";")) (expression_statement "pbVar8 = pbVar8 + 1;" (assignment_expression "pbVar8 = pbVar8 + 1" (identifier "pbVar8") (= "=") (binary_expression "pbVar8 + 1" (identifier "pbVar8") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);" (call_expression "pr2ws(&UNK_00018c08 + unaff_EBX,uVar6)" (identifier "pr2ws") (argument_list "(&UNK_00018c08 + unaff_EBX,uVar6)" (( "(") (binary_expression "&UNK_00018c08 + unaff_EBX" (pointer_expression "&UNK_00018c08" (& "&") (identifier "UNK_00018c08")) (+ "+") (identifier "unaff_EBX")) (, ",") (identifier "uVar6") () ")"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(local_64 != pbVar8)" (( "(") (binary_expression "local_64 != pbVar8" (identifier "local_64") (!= "!=") (identifier "pbVar8")) () ")")) (; ";")) (expression_statement "pr2ws(unaff_EBX + 0xbdc5,uVar6);" (call_expression "pr2ws(unaff_EBX + 0xbdc5,uVar6)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0xbdc5,uVar6)" (( "(") (binary_expression "unaff_EBX + 0xbdc5" (identifier "unaff_EBX") (+ "+") (number_literal "0xbdc5")) (, ",") (identifier "uVar6") () ")"))) (; ";")) (expression_statement "iVar3 = construct_scsi_pt_obj();" (assignment_expression "iVar3 = construct_scsi_pt_obj()" (identifier "iVar3") (= "=") (call_expression "construct_scsi_pt_obj()" (identifier "construct_scsi_pt_obj") (argument_list "()" (( "(") () ")")))) (; ";")) (} "}")))) (if_statement "if (iVar3 == 0) {\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }\n    else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" (if "if") (parenthesized_expression "(iVar3 == 0)" (( "(") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n      pr2ws(unaff_EBX + 0x17994,iVar9);\n      iVar9 = sg_convert_errno(0xc);\n    }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x17994,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x17994,iVar9)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x17994,iVar9)" (( "(") (binary_expression "unaff_EBX + 0x17994" (identifier "unaff_EBX") (+ "+") (number_literal "0x17994")) (, ",") (identifier "iVar9") () ")"))) (; ";")) (expression_statement "iVar9 = sg_convert_errno(0xc);" (assignment_expression "iVar9 = sg_convert_errno(0xc)" (identifier "iVar9") (= "=") (call_expression "sg_convert_errno(0xc)" (identifier "sg_convert_errno") (argument_list "(0xc)" (( "(") (number_literal "0xc") () ")")))) (; ";")) (} "}")) (else_clause "else {\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" (else "else") (compound_statement "{\n      set_scsi_pt_cdb(iVar3,&local_6e,10);\n      set_scsi_pt_sense(iVar3,local_64,0x40);\n      set_scsi_pt_data_in(iVar3,param_4,param_5);\n      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);\n      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);\n      if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }\n      destruct_scsi_pt_obj(iVar3);\n    }" ({ "{") (expression_statement "set_scsi_pt_cdb(iVar3,&local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar3,&local_6e,10)" (identifier "set_scsi_pt_cdb") (argument_list "(iVar3,&local_6e,10)" (( "(") (identifier "iVar3") (, ",") (pointer_expression "&local_6e" (& "&") (identifier "local_6e")) (, ",") (number_literal "10") () ")"))) (; ";")) (expression_statement "set_scsi_pt_sense(iVar3,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar3,local_64,0x40)" (identifier "set_scsi_pt_sense") (argument_list "(iVar3,local_64,0x40)" (( "(") (identifier "iVar3") (, ",") (identifier "local_64") (, ",") (number_literal "0x40") () ")"))) (; ";")) (expression_statement "set_scsi_pt_data_in(iVar3,param_4,param_5);" (call_expression "set_scsi_pt_data_in(iVar3,param_4,param_5)" (identifier "set_scsi_pt_data_in") (argument_list "(iVar3,param_4,param_5)" (( "(") (identifier "iVar3") (, ",") (identifier "param_4") (, ",") (identifier "param_5") () ")"))) (; ";")) (expression_statement "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" (identifier "uVar4") (= "=") (call_expression "do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7)" (identifier "do_scsi_pt") (argument_list "(iVar3,unaff_retaddr,0x3c,param_7)" (( "(") (identifier "iVar3") (, ",") (identifier "unaff_retaddr") (, ",") (number_literal "0x3c") (, ",") (identifier "param_7") () ")")))) (; ";")) (expression_statement "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" (identifier "iVar5") (= "=") (call_expression "sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" (identifier "sg_cmds_process_resp") (argument_list "(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74)" (( "(") (identifier "iVar3") (, ",") (identifier "iVar9") (, ",") (identifier "uVar4") (, ",") (identifier "param_5") (, ",") (identifier "local_64") (, ",") (identifier "param_6") (, ",") (identifier "param_7") (, ",") (pointer_expression "&local_74" (& "&") (identifier "local_74")) () ")")))) (; ";")) (if_statement "if (iVar5 == -1) {\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }\n      else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (if "if") (parenthesized_expression "(iVar5 == -1)" (( "(") (binary_expression "iVar5 == -1" (identifier "iVar5") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n        uVar4 = get_scsi_pt_os_err(iVar3);\n        iVar9 = sg_convert_errno(uVar4);\n      }" ({ "{") (expression_statement "uVar4 = get_scsi_pt_os_err(iVar3);" (assignment_expression "uVar4 = get_scsi_pt_os_err(iVar3)" (identifier "uVar4") (= "=") (call_expression "get_scsi_pt_os_err(iVar3)" (identifier "get_scsi_pt_os_err") (argument_list "(iVar3)" (( "(") (identifier "iVar3") () ")")))) (; ";")) (expression_statement "iVar9 = sg_convert_errno(uVar4);" (assignment_expression "iVar9 = sg_convert_errno(uVar4)" (identifier "iVar9") (= "=") (call_expression "sg_convert_errno(uVar4)" (identifier "sg_convert_errno") (argument_list "(uVar4)" (( "(") (identifier "uVar4") () ")")))) (; ";")) (} "}")) (else_clause "else if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (else "else") (if_statement "if (iVar5 == -2) {\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }\n      else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (if "if") (parenthesized_expression "(iVar5 == -2)" (( "(") (binary_expression "iVar5 == -2" (identifier "iVar5") (== "==") (number_literal "-2")) () ")")) (compound_statement "{\n        iVar9 = local_74;\n        if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }\n      }" ({ "{") (expression_statement "iVar9 = local_74;" (assignment_expression "iVar9 = local_74" (identifier "iVar9") (= "=") (identifier "local_74")) (; ";")) (if_statement "if (local_74 - 0x14U < 2) {\n          iVar9 = 0;\n        }" (if "if") (parenthesized_expression "(local_74 - 0x14U < 2)" (( "(") (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" (identifier "local_74") (- "-") (number_literal "0x14U")) (< "<") (number_literal "2")) () ")")) (compound_statement "{\n          iVar9 = 0;\n        }" ({ "{") (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" (identifier "iVar9") (= "=") (number_literal "0")) (; ";")) (} "}"))) (} "}")) (else_clause "else if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (else "else") (if_statement "if ((param_7 < 3) || (iVar5 < 1)) {\n        iVar9 = 0;\n      }\n      else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (if "if") (parenthesized_expression "((param_7 < 3) || (iVar5 < 1))" (( "(") (binary_expression "(param_7 < 3) || (iVar5 < 1)" (parenthesized_expression "(param_7 < 3)" (( "(") (binary_expression "param_7 < 3" (identifier "param_7") (< "<") (number_literal "3")) () ")")) (|| "||") (parenthesized_expression "(iVar5 < 1)" (( "(") (binary_expression "iVar5 < 1" (identifier "iVar5") (< "<") (number_literal "1")) () ")"))) () ")")) (compound_statement "{\n        iVar9 = 0;\n      }" ({ "{") (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" (identifier "iVar9") (= "=") (number_literal "0")) (; ";")) (} "}")) (else_clause "else {\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" (else "else") (compound_statement "{\n        pr2ws(unaff_EBX + 0x18063,iVar9);\n        if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }\n        hex2stderr(param_4,iVar5,uVar4);\n        iVar9 = 0;\n      }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x18063,iVar9);" (call_expression "pr2ws(unaff_EBX + 0x18063,iVar9)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x18063,iVar9)" (( "(") (binary_expression "unaff_EBX + 0x18063" (identifier "unaff_EBX") (+ "+") (number_literal "0x18063")) (, ",") (identifier "iVar9") () ")"))) (; ";")) (if_statement "if (param_7 == 3) {\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }\n        else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" (if "if") (parenthesized_expression "(param_7 == 3)" (( "(") (binary_expression "param_7 == 3" (identifier "param_7") (== "==") (number_literal "3")) () ")")) (compound_statement "{\n          puVar7 = &UNK_00017d68 + unaff_EBX;\n          if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }\n          pr2ws(unaff_EBX + 0xba5b,puVar7);\n          uVar4 = 0xffffffff;\n          if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }\n        }" ({ "{") (expression_statement "puVar7 = &UNK_00017d68 + unaff_EBX;" (assignment_expression "puVar7 = &UNK_00017d68 + unaff_EBX" (identifier "puVar7") (= "=") (binary_expression "&UNK_00017d68 + unaff_EBX" (pointer_expression "&UNK_00017d68" (& "&") (identifier "UNK_00017d68")) (+ "+") (identifier "unaff_EBX"))) (; ";")) (if_statement "if (iVar5 < 0x101) {\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" (if "if") (parenthesized_expression "(iVar5 < 0x101)" (( "(") (binary_expression "iVar5 < 0x101" (identifier "iVar5") (< "<") (number_literal "0x101")) () ")")) (compound_statement "{\n            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);\n          }" ({ "{") (expression_statement "puVar7 = (undefined *)(unaff_EBX + 0xc0ba);" (assignment_expression "puVar7 = (undefined *)(unaff_EBX + 0xc0ba)" (identifier "puVar7") (= "=") (cast_expression "(undefined *)(unaff_EBX + 0xc0ba)" (( "(") (type_descriptor "undefined *" (type_identifier "undefined") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EBX + 0xc0ba)" (( "(") (binary_expression "unaff_EBX + 0xc0ba" (identifier "unaff_EBX") (+ "+") (number_literal "0xc0ba")) () ")")))) (; ";")) (} "}"))) (expression_statement "pr2ws(unaff_EBX + 0xba5b,puVar7);" (call_expression "pr2ws(unaff_EBX + 0xba5b,puVar7)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0xba5b,puVar7)" (( "(") (binary_expression "unaff_EBX + 0xba5b" (identifier "unaff_EBX") (+ "+") (number_literal "0xba5b")) (, ",") (identifier "puVar7") () ")"))) (; ";")) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" (identifier "uVar4") (= "=") (number_literal "0xffffffff")) (; ";")) (if_statement "if (0x100 < iVar5) {\n            iVar5 = 0x100;\n          }" (if "if") (parenthesized_expression "(0x100 < iVar5)" (( "(") (binary_expression "0x100 < iVar5" (number_literal "0x100") (< "<") (identifier "iVar5")) () ")")) (compound_statement "{\n            iVar5 = 0x100;\n          }" ({ "{") (expression_statement "iVar5 = 0x100;" (assignment_expression "iVar5 = 0x100" (identifier "iVar5") (= "=") (number_literal "0x100")) (; ";")) (} "}"))) (} "}")) (else_clause "else {\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" (else "else") (compound_statement "{\n          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);\n          uVar4 = 0;\n        }" ({ "{") (expression_statement "pr2ws(&UNK_00018cca + unaff_EBX,iVar9);" (call_expression "pr2ws(&UNK_00018cca + unaff_EBX,iVar9)" (identifier "pr2ws") (argument_list "(&UNK_00018cca + unaff_EBX,iVar9)" (( "(") (binary_expression "&UNK_00018cca + unaff_EBX" (pointer_expression "&UNK_00018cca" (& "&") (identifier "UNK_00018cca")) (+ "+") (identifier "unaff_EBX")) (, ",") (identifier "iVar9") () ")"))) (; ";")) (expression_statement "uVar4 = 0;" (assignment_expression "uVar4 = 0" (identifier "uVar4") (= "=") (number_literal "0")) (; ";")) (} "}")))) (expression_statement "hex2stderr(param_4,iVar5,uVar4);" (call_expression "hex2stderr(param_4,iVar5,uVar4)" (identifier "hex2stderr") (argument_list "(param_4,iVar5,uVar4)" (( "(") (identifier "param_4") (, ",") (identifier "iVar5") (, ",") (identifier "uVar4") () ")"))) (; ";")) (expression_statement "iVar9 = 0;" (assignment_expression "iVar9 = 0" (identifier "iVar9") (= "=") (number_literal "0")) (; ";")) (} "}")))))))) (expression_statement "destruct_scsi_pt_obj(iVar3);" (call_expression "destruct_scsi_pt_obj(iVar3)" (identifier "destruct_scsi_pt_obj") (argument_list "(iVar3)" (( "(") (identifier "iVar3") () ")"))) (; ";")) (} "}")))) (} "}")) (else_clause "else {\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" (else "else") (compound_statement "{\n    iVar9 = -1;\n    pr2ws(&UNK_00017d7a + unaff_EBX);\n  }" ({ "{") (expression_statement "iVar9 = -1;" (assignment_expression "iVar9 = -1" (identifier "iVar9") (= "=") (number_literal "-1")) (; ";")) (expression_statement "pr2ws(&UNK_00017d7a + unaff_EBX);" (call_expression "pr2ws(&UNK_00017d7a + unaff_EBX)" (identifier "pr2ws") (argument_list "(&UNK_00017d7a + unaff_EBX)" (( "(") (binary_expression "&UNK_00017d7a + unaff_EBX" (pointer_expression "&UNK_00017d7a" (& "&") (identifier "UNK_00017d7a")) (+ "+") (identifier "unaff_EBX")) () ")"))) (; ";")) (} "}")))) (if_statement "if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\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                    \n    FUN_0002f100();\n  }" ({ "{") (expression_statement "FUN_0002f100();" (call_expression "FUN_0002f100()" (identifier "FUN_0002f100") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}"))) (return_statement "return iVar9;" (return "return") (identifier "iVar9") (; ";")) (} "}")))

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

int function_1(int sg_fd,type_1 req_plist,type_1 req_glist,int dl_format,void *resp,
                       int var_2,type_1 noisy,int var_3)

{
  int var_20;
  type_2 *var_8;
  int var_15;
  type_3 uVar3;
  char *pcVar4;
  type_4 *var_6;
  int var_1;
  int no_ascii;
  int var_17;
  uint8_t rdef_cdb [10];
  uint8_t var_7 [64];
  
  var_20 = *(int *)(var_1 + 0x14);
  rdef_cdb[9] = '\0';
  rdef_cdb[2] = (type_4)dl_format & 7;
  if (req_plist) {
    rdef_cdb[2] = (type_4)dl_format & 7 | 0x10;
  }
  rdef_cdb[0] = '7';
  rdef_cdb[1] = '\0';
  rdef_cdb[3] = '\0';
  if (req_glist) {
    rdef_cdb._0_4_ = (type_5)rdef_cdb._0_3_ | 0x80000;
  }
  rdef_cdb._4_4_ = ((type_3)var_2 >> 8) << 0x18;
  rdef_cdb[8] = (uint8_t)var_2;
  if (var_2 < 0x10000) {
    pcVar4 = "Read defect(10)";
    if (var_3 == 0) {
      var_8 = var_4();
    }
    else {
      var_5("    %s cdb: ","Read defect(10)");
      var_6 = rdef_cdb;
      do {
        uVar3 = (type_3)*var_6;
        var_6 = var_6 + 1;
        var_5("%02x ",uVar3);
      } while (var_7 != var_6);
      var_5("\n",uVar3);
      var_8 = var_4();
    }
    if (var_8 == (type_2 *)0x0) {
      var_5("%s: out of memory\n","Read defect(10)");
      var_15 = var_9(0xc);
    }
    else {
      var_10(var_8,rdef_cdb,10);
      var_11(var_8,var_7,0x40);
      var_12(var_8,(uint8_t *)resp,var_2);
      var_15 = var_13(var_8,sg_fd,0x3c,var_3);
      var_15 = var_14
                        (var_8,"Read defect(10)",var_15,var_2,var_7,noisy,var_3,&var_17);
      if (var_15 == -1) {
        var_15 = var_16();
        var_15 = var_9(var_15);
      }
      else if (var_15 == -2) {
        var_15 = var_17;
        if (var_17 - 0x14U < 2) {
          var_15 = 0;
        }
      }
      else if ((var_3 < 3) || (var_15 < 1)) {
        var_15 = 0;
      }
      else {
        var_5("    %s: response\n","Read defect(10)");
        if (var_3 == 3) {
          pcVar4 = ", first 256 bytes";
          if (var_15 < 0x101) {
            pcVar4 = "";
          }
          var_5("%s:\n",pcVar4);
          no_ascii = -1;
          if (0x100 < var_15) {
            var_15 = 0x100;
          }
        }
        else {
          var_5(":\n",pcVar4);
          no_ascii = 0;
        }
        var_18((uint8_t *)resp,var_15,no_ascii);
        var_15 = 0;
      }
      var_19(var_8);
    }
  }
  else {
    var_15 = -1;
    var_5("mx_resp_len too big\n");
  }
  if (var_20 != *(int *)(var_1 + 0x14)) {
                    /* WARNING: Subroutine does not return */
    var_21();
  }
  return var_15;
}


(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: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) 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: (type_identifier) 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: (identifier)) (declaration type: (type_identifier) declarator: (pointer_declarator 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: (primitive_type) declarator: (identifier)) (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: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) 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 (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: (identifier) 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: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (number_literal)) right: (number_literal)))))) (expression_statement (assignment_expression left: (field_expression argument: (identifier) field: (field_identifier)) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (number_literal))))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (char_literal (escape_sequence)))) consequence: (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 (binary_expression left: (identifier) right: (number_literal))) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list))))) alternative: (else_clause (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier))))) (do_statement body: (compound_statement (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)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list))))))) (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)) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (number_literal)))))) alternative: (else_clause (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (pointer_expression argument: (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) (identifier) (number_literal) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (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)))))) alternative: (else_clause (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 (assignment_expression left: (identifier) right: (number_literal)))) alternative: (else_clause (compound_statement (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: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (pointer_expression argument: (identifier)) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal)))))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (number_literal) right: (identifier))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal)))))) alternative: (else_clause (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (pointer_expression argument: (identifier)) right: (identifier)) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))))))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier)))))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (pointer_expression argument: (identifier)) right: (identifier)))))))) (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 (expression_statement (call_expression function: (identifier) arguments: (argument_list))))) (return_statement (identifier)))))

int MASKED(char param_1,char param_2,byte param_3,undefined4 param_4,uint param_5,
                       undefined1 param_6,int param_7)

{
  uint3 uVar1;
  byte bVar2;
  int iVar3;
  undefined4 uVar4;
  int iVar5;
  uint uVar6;
  undefined *puVar7;
  int unaff_EBX;
  byte *pbVar8;
  int iVar9;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_74;
  undefined4 local_6e;
  int local_6a;
  undefined1 uStack_66;
  undefined1 uStack_65;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uStack_65 = 0;
  uStack_14 = 0x2491b;
  entry();
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  bVar2 = param_3 & 7;
  if (param_1 != '\0') {
    bVar2 = param_3 & 7 | 0x10;
  }
  local_6e._0_3_ = CONCAT12(bVar2,0x37);
  uVar1 = (uint3)local_6e;
  local_6e = (uint)(uint3)local_6e;
  if (param_2 != '\0') {
    local_6e = uVar1 | 0x80000;
  }
  local_6a = (param_5 >> 8) << 0x18;
  uStack_66 = (undefined1)param_5;
  if ((int)param_5 < 0x10000) {
    iVar9 = unaff_EBX + 0x180a9;
    if (param_7 == 0) {
      iVar3 = construct_scsi_pt_obj();
    }
    else {
      pr2ws(unaff_EBX + 0x17944,iVar9);
      pbVar8 = (byte *)&local_6e;
      do {
        uVar6 = (uint)*pbVar8;
        pbVar8 = pbVar8 + 1;
        pr2ws(&UNK_00018c08 + unaff_EBX,uVar6);
      } while (local_64 != pbVar8);
      pr2ws(unaff_EBX + 0xbdc5,uVar6);
      iVar3 = construct_scsi_pt_obj();
    }
    if (iVar3 == 0) {
      pr2ws(unaff_EBX + 0x17994,iVar9);
      iVar9 = sg_convert_errno(0xc);
    }
    else {
      set_scsi_pt_cdb(iVar3,&local_6e,10);
      set_scsi_pt_sense(iVar3,local_64,0x40);
      set_scsi_pt_data_in(iVar3,param_4,param_5);
      uVar4 = do_scsi_pt(iVar3,unaff_retaddr,0x3c,param_7);
      iVar5 = sg_cmds_process_resp(iVar3,iVar9,uVar4,param_5,local_64,param_6,param_7,&local_74);
      if (iVar5 == -1) {
        uVar4 = get_scsi_pt_os_err(iVar3);
        iVar9 = sg_convert_errno(uVar4);
      }
      else if (iVar5 == -2) {
        iVar9 = local_74;
        if (local_74 - 0x14U < 2) {
          iVar9 = 0;
        }
      }
      else if ((param_7 < 3) || (iVar5 < 1)) {
        iVar9 = 0;
      }
      else {
        pr2ws(unaff_EBX + 0x18063,iVar9);
        if (param_7 == 3) {
          puVar7 = &UNK_00017d68 + unaff_EBX;
          if (iVar5 < 0x101) {
            puVar7 = (undefined *)(unaff_EBX + 0xc0ba);
          }
          pr2ws(unaff_EBX + 0xba5b,puVar7);
          uVar4 = 0xffffffff;
          if (0x100 < iVar5) {
            iVar5 = 0x100;
          }
        }
        else {
          pr2ws(&UNK_00018cca + unaff_EBX,iVar9);
          uVar4 = 0;
        }
        hex2stderr(param_4,iVar5,uVar4);
        iVar9 = 0;
      }
      destruct_scsi_pt_obj(iVar3);
    }
  }
  else {
    iVar9 = -1;
    pr2ws(&UNK_00017d7a + unaff_EBX);
  }
  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_0002f100();
  }
  return iVar9;
}

