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

int sg_ll_write_buffer(int sg_fd,int mode,int buffer_id,int buffer_offset,void *paramp,int param_len
                      ,_Bool noisy,int verbose)

{
  int iVar1;
  ushort uVar2;
  sg_pt_base *vp;
  int iVar3;
  int iVar4;
  uint uVar5;
  char *pcVar6;
  byte *pbVar7;
  int in_GS_OFFSET;
  int sense_cat;
  uint8_t wbuf_cdb [10];
  uint8_t sense_b [64];
  
  wbuf_cdb[1] = (byte)mode & 0x1f;
  iVar1 = *(int *)(in_GS_OFFSET + 0x14);
  wbuf_cdb[2] = (uint8_t)buffer_id;
  wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8;
  wbuf_cdb[0] = ';';
  wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10);
  wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10);
  uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8;
  wbuf_cdb[9] = '\0';
  wbuf_cdb[7] = (char)uVar2;
  wbuf_cdb[8] = (char)(uVar2 >> 8);
  if (verbose != 0) {
    pcVar6 = "write buffer";
    pr2ws("    %s cdb: ","write buffer");
    pbVar7 = wbuf_cdb;
    do {
      uVar5 = (uint)*pbVar7;
      pbVar7 = pbVar7 + 1;
      pr2ws("%02x ",uVar5);
    } while (pbVar7 != sense_b);
    pr2ws("\n",uVar5);
    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {
      pr2ws("    %s parameter list","write buffer");
      if (verbose == 2) {
        pcVar6 = ", first 256 bytes";
        if (param_len < 0x101) {
          pcVar6 = "";
        }
        pr2ws("%s:\n",pcVar6);
        iVar3 = 0x100;
        if (param_len < 0x101) {
          iVar3 = param_len;
        }
        hex2stderr((uint8_t *)paramp,iVar3,-1);
      }
      else {
        pr2ws(":\n",pcVar6);
        hex2stderr((uint8_t *)paramp,param_len,0);
      }
    }
  }
  vp = construct_scsi_pt_obj();
  if (vp == (sg_pt_base *)0x0) {
    iVar3 = -1;
    pr2ws("%s: out of memory\n","write buffer");
  }
  else {
    set_scsi_pt_cdb(vp,wbuf_cdb,10);
    set_scsi_pt_sense(vp,sense_b,0x40);
    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);
    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);
    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);
    if (iVar4 == -1) {
      iVar3 = get_scsi_pt_os_err();
      iVar3 = sg_convert_errno(iVar3);
    }
    else {
      iVar3 = 0;
      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {
        iVar3 = 0;
      }
    }
    destruct_scsi_pt_obj(vp);
  }
  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail_local();
  }
  return iVar3;
}



int sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,
                      undefined1 param_6,int param_7)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  uint uVar4;
  int unaff_EBX;
  byte *pbVar5;
  undefined1 uVar6;
  int iVar7;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_88;
  int local_74;
  byte local_6e [4];
  ushort local_6a;
  undefined1 local_68;
  ushort uStack_67;
  undefined1 uStack_65;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uVar6 = 0;
  uStack_14 = 0x27e0b;
  entry();
  local_6e[1] = param_1 & 0x1f;
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  local_6e[2] = param_2;
  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;
  local_6e[0] = 0x3b;
  local_6e[3] = (byte)((uint)param_3 >> 0x10);
  local_68 = (undefined1)((uint)param_5 >> 0x10);
  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);
  if (param_7 != 0) {
    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);
    pbVar5 = local_6e;
    do {
      local_88 = unaff_EBX + 0x14d3b;
      uVar4 = (uint)*pbVar5;
      pbVar5 = pbVar5 + 1;
      pr2ws(unaff_EBX + 0x15718,uVar4);
    } while (pbVar5 != local_64);
    pr2ws(unaff_EBX + 0x88d5,uVar4);
    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {
      pr2ws(unaff_EBX + 0x14d48,local_88);
      if (param_7 == 2) {
        iVar1 = unaff_EBX + 0x14878;
        if (param_5 < 0x101) {
          iVar1 = unaff_EBX + 0x8bca;
        }
        pr2ws(unaff_EBX + 0x856b,iVar1);
        iVar1 = 0x100;
        if (param_5 < 0x101) {
          iVar1 = param_5;
        }
        hex2stderr(param_4,iVar1,0xffffffff);
      }
      else {
        pr2ws(unaff_EBX + 0x157da,local_88);
        hex2stderr(param_4,param_5,0);
      }
    }
  }
  local_88 = unaff_EBX + 0x14d3b;
  iVar1 = construct_scsi_pt_obj();
  if (iVar1 == 0) {
    iVar7 = -1;
    pr2ws(unaff_EBX + 0x144a4,local_88);
  }
  else {
    set_scsi_pt_cdb(iVar1,local_6e,10);
    set_scsi_pt_sense(iVar1,local_64,0x40);
    set_scsi_pt_data_out(iVar1,param_4,param_5);
    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);
    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);
    if (iVar3 == -1) {
      uVar2 = get_scsi_pt_os_err(iVar1);
      iVar7 = sg_convert_errno(uVar2);
    }
    else {
      iVar7 = 0;
      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {
        iVar7 = 0;
      }
    }
    destruct_scsi_pt_obj(iVar1);
  }
  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_0002f100();
  }
  return iVar7;
}


PUSH EBP
PUSH EDI
PUSH ESI
XOR ESI,ESI
PUSH EBX
CALL 0x00017820
ADD EBX,0x20f7d
SUB ESP,0x7c
MOV ECX,dword ptr [ESP + 0xa0]
MOVZX EDX,byte ptr [ESP + 0x94]
MOV EAX,dword ptr [ESP + 0x9c]
MOV EDI,dword ptr [ESP + 0xac]
MOV dword ptr [ESP + 0x4],ECX
MOV ECX,dword ptr [ESP + 0xa8]
AND EDX,0x1f
MOV dword ptr [ESP + 0xc],ECX
MOV ECX,dword ptr GS:[0x14]
MOV dword ptr [ESP + 0x6c],ECX
XOR ECX,ECX
MOV byte ptr [ESP + 0x23],DL
MOV EDX,dword ptr [ESP + 0x98]
MOV word ptr [ESP + 0x2a],SI
MOV byte ptr [ESP + 0x24],DL
MOV EDX,EAX
ROL AX,0x8
MOV word ptr [ESP + 0x26],AX
MOV EAX,dword ptr [ESP + 0xa4]
SHR EDX,0x10
MOV byte ptr [ESP + 0x22],0x3b
SHR EAX,0x10
MOV byte ptr [ESP + 0x25],DL
MOV byte ptr [ESP + 0x28],AL
MOVZX EAX,word ptr [ESP + 0xa4]
ROL AX,0x8
MOV word ptr [ESP + 0x29],AX
TEST EDI,EDI
JNZ 0x00027f78
LEA EAX,[EBX + 0xffff3dbe]
MOV dword ptr [ESP + 0x8],EAX
CALL 0x00017160
MOV ESI,EAX
TEST EAX,EAX
JZ 0x000280a0
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 + 0xc]
PUSH ESI
CALL 0x000170f0
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 0x0
PUSH EAX
PUSH dword ptr [ESP + 0x20]
PUSH ESI
CALL 0x00017690
ADD ESP,0x20
CMP EAX,-0x1
JZ 0x00028080
XOR EDI,EDI
CMP EAX,-0x2
JNZ 0x00027f4d
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 0x000280ec
ADD ESP,0x7c
POP EBX
POP ESI
POP EDI
POP EBP
RET
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3dbe]
LEA ESI,[EBX + 0xffff479b]
MOV dword ptr [ESP + 0x10],EAX
PUSH EAX
LEA EAX,[EBX + 0xffff34d7]
PUSH EAX
CALL 0x00017630
LEA EBP,[ESP + 0x32]
LEA EDI,[ESP + 0x3c]
ADD ESP,0x10
LEA ESI,[ESI]
NOP
MOVZX EAX,byte ptr [EBP]
SUB ESP,0x8
ADD EBP,0x1
PUSH EAX
PUSH ESI
CALL 0x00017630
ADD ESP,0x10
CMP EBP,EDI
JNZ 0x00027fa8
SUB ESP,0xc
LEA EAX,[EBX + 0xfffe7958]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
MOV ECX,dword ptr [ESP + 0x4]
CMP dword ptr [ESP + 0xac],0x1
SETG DL
TEST ECX,ECX
SETNZ AL
TEST DL,AL
JZ 0x00027eac
MOV EAX,dword ptr [ESP + 0xa4]
TEST EAX,EAX
JZ 0x00027eac
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3dcb]
PUSH dword ptr [ESP + 0x10]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
CMP dword ptr [ESP + 0xac],0x2
JNZ 0x000280c0
LEA EDX,[EBX + 0xfffe7c4d]
LEA EAX,[EBX + 0xffff38fb]
CMP dword ptr [ESP + 0xa4],0x100
CMOVLE EAX,EDX
SUB ESP,0x8
PUSH EAX
LEA EAX,[EBX + 0xfffe75ee]
PUSH EAX
CALL 0x00017630
ADD ESP,0xc
MOV EAX,0x100
PUSH -0x1
CMP dword ptr [ESP + 0xac],0x100
CMOVLE EAX,dword ptr [ESP + 0xac]
PUSH EAX
PUSH dword ptr [ESP + 0x10]
CALL 0x00017700
ADD ESP,0x10
JMP 0x00027eac
SUB ESP,0xc
PUSH ESI
CALL 0x000170a0
MOV dword ptr [ESP],EAX
CALL 0x00017560
ADD ESP,0x10
MOV EDI,EAX
JMP 0x00027f4d
SUB ESP,0x8
LEA EAX,[EBX + 0xffff3527]
MOV EDI,0xffffffff
PUSH dword ptr [ESP + 0x10]
PUSH EAX
CALL 0x00017630
ADD ESP,0x10
JMP 0x00027f59
SUB ESP,0xc
LEA EAX,[EBX + 0xffff485d]
PUSH EAX
CALL 0x00017630
ADD ESP,0xc
PUSH 0x0
PUSH dword ptr [ESP + 0xac]
PUSH dword ptr [ESP + 0x10]
CALL 0x00017700
ADD ESP,0x10
JMP 0x00027eac
CALL 0x0002f100
(translation_unit "int sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar7;\n}\n\n" (function_definition "int sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar7;\n}" primitive_type (function_declarator "sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" identifier (parameter_list "(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" ( (parameter_declaration "byte param_1" type_identifier identifier) , (parameter_declaration "undefined1 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) , (parameter_declaration "int param_4" primitive_type identifier) , (parameter_declaration "int param_5" primitive_type identifier) , (parameter_declaration "undefined1 param_6" type_identifier identifier) , (parameter_declaration "int param_7" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    FUN_0002f100();\n  }\n  return iVar7;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "undefined1 uVar6;" type_identifier identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_88;" primitive_type identifier ;) (declaration "int local_74;" primitive_type identifier ;) (declaration "byte local_6e [4];" type_identifier (array_declarator "local_6e [4]" identifier [ number_literal ]) ;) (declaration "ushort local_6a;" type_identifier identifier ;) (declaration "undefined1 local_68;" type_identifier identifier ;) (declaration "ushort uStack_67;" 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 "uVar6 = 0;" (assignment_expression "uVar6 = 0" identifier = number_literal) ;) (expression_statement "uStack_14 = 0x27e0b;" (assignment_expression "uStack_14 = 0x27e0b" identifier = number_literal) ;) (expression_statement "entry();" (call_expression "entry()" identifier (argument_list "()" ( ))) ;) (expression_statement "local_6e[1] = param_1 & 0x1f;" (assignment_expression "local_6e[1] = param_1 & 0x1f" (subscript_expression "local_6e[1]" identifier [ number_literal ]) = (binary_expression "param_1 & 0x1f" identifier & number_literal)) ;) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_6e[2] = param_2;" (assignment_expression "local_6e[2] = param_2" (subscript_expression "local_6e[2]" identifier [ number_literal ]) = identifier) ;) (expression_statement "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;" (assignment_expression "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8" identifier = (binary_expression "(ushort)param_3 << 8 | (ushort)param_3 >> 8" (binary_expression "(ushort)param_3 << 8" (cast_expression "(ushort)param_3" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_3 >> 8" (cast_expression "(ushort)param_3" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal))) ;) (expression_statement "local_6e[0] = 0x3b;" (assignment_expression "local_6e[0] = 0x3b" (subscript_expression "local_6e[0]" identifier [ number_literal ]) = number_literal) ;) (expression_statement "local_6e[3] = (byte)((uint)param_3 >> 0x10);" (assignment_expression "local_6e[3] = (byte)((uint)param_3 >> 0x10)" (subscript_expression "local_6e[3]" identifier [ number_literal ]) = (call_expression "(byte)((uint)param_3 >> 0x10)" (parenthesized_expression "(byte)" ( identifier )) (argument_list "((uint)param_3 >> 0x10)" ( (binary_expression "(uint)param_3 >> 0x10" (cast_expression "(uint)param_3" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "local_68 = (undefined1)((uint)param_5 >> 0x10);" (assignment_expression "local_68 = (undefined1)((uint)param_5 >> 0x10)" identifier = (call_expression "(undefined1)((uint)param_5 >> 0x10)" (parenthesized_expression "(undefined1)" ( identifier )) (argument_list "((uint)param_5 >> 0x10)" ( (binary_expression "(uint)param_5 >> 0x10" (cast_expression "(uint)param_5" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);" (assignment_expression "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" identifier = (call_expression "CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" identifier (argument_list "(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" ( identifier , (binary_expression "(ushort)param_5 << 8 | (ushort)param_5 >> 8" (binary_expression "(ushort)param_5 << 8" (cast_expression "(ushort)param_5" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_5 >> 8" (cast_expression "(ushort)param_5" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal)) )))) ;) (if_statement "if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" if (parenthesized_expression "(param_7 != 0)" ( (binary_expression "param_7 != 0" identifier != number_literal) )) (compound_statement "{\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" { (expression_statement "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);" (call_expression "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" identifier (argument_list "(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" ( (binary_expression "unaff_EBX + 0x14454" identifier + number_literal) , (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal) ))) ;) (expression_statement "pbVar5 = local_6e;" (assignment_expression "pbVar5 = local_6e" identifier = identifier) ;) (do_statement "do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);" do (compound_statement "{\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    }" { (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" identifier = (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal)) ;) (expression_statement "uVar4 = (uint)*pbVar5;" (assignment_expression "uVar4 = (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(unaff_EBX + 0x15718,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x15718,uVar4)" identifier (argument_list "(unaff_EBX + 0x15718,uVar4)" ( (binary_expression "unaff_EBX + 0x15718" identifier + number_literal) , identifier ))) ;) }) while (parenthesized_expression "(pbVar5 != local_64)" ( (binary_expression "pbVar5 != local_64" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0x88d5,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x88d5,uVar4)" identifier (argument_list "(unaff_EBX + 0x88d5,uVar4)" ( (binary_expression "unaff_EBX + 0x88d5" identifier + number_literal) , identifier ))) ;) (if_statement "if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" if (parenthesized_expression "((1 < param_7 && param_4 != 0) && (param_5 != 0))" ( (binary_expression "(1 < param_7 && param_4 != 0) && (param_5 != 0)" (parenthesized_expression "(1 < param_7 && param_4 != 0)" ( (binary_expression "1 < param_7 && param_4 != 0" (binary_expression "1 < param_7" number_literal < identifier) && (binary_expression "param_4 != 0" identifier != number_literal)) )) && (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) ))) )) (compound_statement "{\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x14d48,local_88);" (call_expression "pr2ws(unaff_EBX + 0x14d48,local_88)" identifier (argument_list "(unaff_EBX + 0x14d48,local_88)" ( (binary_expression "unaff_EBX + 0x14d48" identifier + number_literal) , identifier ))) ;) (if_statement "if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" if (parenthesized_expression "(param_7 == 2)" ( (binary_expression "param_7 == 2" identifier == number_literal) )) (compound_statement "{\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }" { (expression_statement "iVar1 = unaff_EBX + 0x14878;" (assignment_expression "iVar1 = unaff_EBX + 0x14878" identifier = (binary_expression "unaff_EBX + 0x14878" identifier + number_literal)) ;) (if_statement "if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }" if (parenthesized_expression "(param_5 < 0x101)" ( (binary_expression "param_5 < 0x101" identifier < number_literal) )) (compound_statement "{\n          iVar1 = unaff_EBX + 0x8bca;\n        }" { (expression_statement "iVar1 = unaff_EBX + 0x8bca;" (assignment_expression "iVar1 = unaff_EBX + 0x8bca" identifier = (binary_expression "unaff_EBX + 0x8bca" identifier + number_literal)) ;) })) (expression_statement "pr2ws(unaff_EBX + 0x856b,iVar1);" (call_expression "pr2ws(unaff_EBX + 0x856b,iVar1)" identifier (argument_list "(unaff_EBX + 0x856b,iVar1)" ( (binary_expression "unaff_EBX + 0x856b" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar1 = 0x100;" (assignment_expression "iVar1 = 0x100" identifier = number_literal) ;) (if_statement "if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }" if (parenthesized_expression "(param_5 < 0x101)" ( (binary_expression "param_5 < 0x101" identifier < number_literal) )) (compound_statement "{\n          iVar1 = param_5;\n        }" { (expression_statement "iVar1 = param_5;" (assignment_expression "iVar1 = param_5" identifier = identifier) ;) })) (expression_statement "hex2stderr(param_4,iVar1,0xffffffff);" (call_expression "hex2stderr(param_4,iVar1,0xffffffff)" identifier (argument_list "(param_4,iVar1,0xffffffff)" ( identifier , identifier , number_literal ))) ;) }) (else_clause "else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" else (compound_statement "{\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x157da,local_88);" (call_expression "pr2ws(unaff_EBX + 0x157da,local_88)" identifier (argument_list "(unaff_EBX + 0x157da,local_88)" ( (binary_expression "unaff_EBX + 0x157da" identifier + number_literal) , identifier ))) ;) (expression_statement "hex2stderr(param_4,param_5,0);" (call_expression "hex2stderr(param_4,param_5,0)" identifier (argument_list "(param_4,param_5,0)" ( identifier , identifier , number_literal ))) ;) }))) })) })) (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" identifier = (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal)) ;) (expression_statement "iVar1 = construct_scsi_pt_obj();" (assignment_expression "iVar1 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) (if_statement "if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" if (parenthesized_expression "(iVar1 == 0)" ( (binary_expression "iVar1 == 0" identifier == number_literal) )) (compound_statement "{\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }" { (expression_statement "iVar7 = -1;" (assignment_expression "iVar7 = -1" identifier = number_literal) ;) (expression_statement "pr2ws(unaff_EBX + 0x144a4,local_88);" (call_expression "pr2ws(unaff_EBX + 0x144a4,local_88)" identifier (argument_list "(unaff_EBX + 0x144a4,local_88)" ( (binary_expression "unaff_EBX + 0x144a4" identifier + number_literal) , identifier ))) ;) }) (else_clause "else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" else (compound_statement "{\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" { (expression_statement "set_scsi_pt_cdb(iVar1,local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar1,local_6e,10)" identifier (argument_list "(iVar1,local_6e,10)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(iVar1,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar1,local_64,0x40)" identifier (argument_list "(iVar1,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_out(iVar1,param_4,param_5);" (call_expression "set_scsi_pt_data_out(iVar1,param_4,param_5)" identifier (argument_list "(iVar1,param_4,param_5)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" identifier = (call_expression "do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" identifier (argument_list "(iVar1,unaff_retaddr,0x3c,param_7)" ( identifier , identifier , number_literal , identifier )))) ;) (expression_statement "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" identifier = (call_expression "sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" identifier (argument_list "(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" ( identifier , identifier , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&local_74" & identifier) )))) ;) (if_statement "if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" if (parenthesized_expression "(iVar3 == -1)" ( (binary_expression "iVar3 == -1" identifier == number_literal) )) (compound_statement "{\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }" { (expression_statement "uVar2 = get_scsi_pt_os_err(iVar1);" (assignment_expression "uVar2 = get_scsi_pt_os_err(iVar1)" identifier = (call_expression "get_scsi_pt_os_err(iVar1)" identifier (argument_list "(iVar1)" ( identifier )))) ;) (expression_statement "iVar7 = sg_convert_errno(uVar2);" (assignment_expression "iVar7 = sg_convert_errno(uVar2)" identifier = (call_expression "sg_convert_errno(uVar2)" identifier (argument_list "(uVar2)" ( identifier )))) ;) }) (else_clause "else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" else (compound_statement "{\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" { (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" identifier = number_literal) ;) (if_statement "if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }" if (parenthesized_expression "((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2))" ( (binary_expression "(iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)" (parenthesized_expression "(iVar3 == -2)" ( (binary_expression "iVar3 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar7 = local_74, local_74 - 0x14U < 2)" ( (comma_expression "iVar7 = local_74, local_74 - 0x14U < 2" (assignment_expression "iVar7 = local_74" identifier = identifier) , (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n        iVar7 = 0;\n      }" { (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" identifier = number_literal) ;) })) }))) (expression_statement "destruct_scsi_pt_obj(iVar1);" (call_expression "destruct_scsi_pt_obj(iVar1)" identifier (argument_list "(iVar1)" ( 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 iVar7;" 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_write_buffer(int sg_fd,int mode,int buffer_id,int buffer_offset,void *paramp,int param_len\n                      ,_Bool noisy,int verbose)\n\n{\n  int iVar1;\n  ushort uVar2;\n  sg_pt_base *vp;\n  int iVar3;\n  int iVar4;\n  uint uVar5;\n  char *pcVar6;\n  byte *pbVar7;\n  int in_GS_OFFSET;\n  int sense_cat;\n  uint8_t wbuf_cdb [10];\n  uint8_t sense_b [64];\n  \n  wbuf_cdb[1] = (byte)mode & 0x1f;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  wbuf_cdb[2] = (uint8_t)buffer_id;\n  wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8;\n  wbuf_cdb[0] = ';';\n  wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10);\n  wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10);\n  uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8;\n  wbuf_cdb[9] = '\0';\n  wbuf_cdb[7] = (char)uVar2;\n  wbuf_cdb[8] = (char)(uVar2 >> 8);\n  if (verbose != 0) {\n    pcVar6 = "write buffer";\n    pr2ws("    %s cdb: ","write buffer");\n    pbVar7 = wbuf_cdb;\n    do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);\n    pr2ws("\n",uVar5);\n    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }\n  }\n  vp = construct_scsi_pt_obj();\n  if (vp == (sg_pt_base *)0x0) {\n    iVar3 = -1;\n    pr2ws("%s: out of memory\n","write buffer");\n  }\n  else {\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(vp);\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar3;\n}\n\n" comment comment (function_definition "int sg_ll_write_buffer(int sg_fd,int mode,int buffer_id,int buffer_offset,void *paramp,int param_len\n                      ,_Bool noisy,int verbose)\n\n{\n  int iVar1;\n  ushort uVar2;\n  sg_pt_base *vp;\n  int iVar3;\n  int iVar4;\n  uint uVar5;\n  char *pcVar6;\n  byte *pbVar7;\n  int in_GS_OFFSET;\n  int sense_cat;\n  uint8_t wbuf_cdb [10];\n  uint8_t sense_b [64];\n  \n  wbuf_cdb[1] = (byte)mode & 0x1f;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  wbuf_cdb[2] = (uint8_t)buffer_id;\n  wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8;\n  wbuf_cdb[0] = ';';\n  wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10);\n  wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10);\n  uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8;\n  wbuf_cdb[9] = '\0';\n  wbuf_cdb[7] = (char)uVar2;\n  wbuf_cdb[8] = (char)(uVar2 >> 8);\n  if (verbose != 0) {\n    pcVar6 = "write buffer";\n    pr2ws("    %s cdb: ","write buffer");\n    pbVar7 = wbuf_cdb;\n    do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);\n    pr2ws("\n",uVar5);\n    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }\n  }\n  vp = construct_scsi_pt_obj();\n  if (vp == (sg_pt_base *)0x0) {\n    iVar3 = -1;\n    pr2ws("%s: out of memory\n","write buffer");\n  }\n  else {\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(vp);\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar3;\n}" primitive_type (function_declarator "sg_ll_write_buffer(int sg_fd,int mode,int buffer_id,int buffer_offset,void *paramp,int param_len\n                      ,_Bool noisy,int verbose)" identifier (parameter_list "(int sg_fd,int mode,int buffer_id,int buffer_offset,void *paramp,int param_len\n                      ,_Bool noisy,int verbose)" ( (parameter_declaration "int sg_fd" primitive_type identifier) , (parameter_declaration "int mode" primitive_type identifier) , (parameter_declaration "int buffer_id" primitive_type identifier) , (parameter_declaration "int buffer_offset" primitive_type identifier) , (parameter_declaration "void *paramp" primitive_type (pointer_declarator "*paramp" * identifier)) , (parameter_declaration "int param_len" primitive_type identifier) , (parameter_declaration "_Bool noisy" type_identifier identifier) , (parameter_declaration "int verbose" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  ushort uVar2;\n  sg_pt_base *vp;\n  int iVar3;\n  int iVar4;\n  uint uVar5;\n  char *pcVar6;\n  byte *pbVar7;\n  int in_GS_OFFSET;\n  int sense_cat;\n  uint8_t wbuf_cdb [10];\n  uint8_t sense_b [64];\n  \n  wbuf_cdb[1] = (byte)mode & 0x1f;\n  iVar1 = *(int *)(in_GS_OFFSET + 0x14);\n  wbuf_cdb[2] = (uint8_t)buffer_id;\n  wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8;\n  wbuf_cdb[0] = ';';\n  wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10);\n  wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10);\n  uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8;\n  wbuf_cdb[9] = '\0';\n  wbuf_cdb[7] = (char)uVar2;\n  wbuf_cdb[8] = (char)(uVar2 >> 8);\n  if (verbose != 0) {\n    pcVar6 = "write buffer";\n    pr2ws("    %s cdb: ","write buffer");\n    pbVar7 = wbuf_cdb;\n    do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);\n    pr2ws("\n",uVar5);\n    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }\n  }\n  vp = construct_scsi_pt_obj();\n  if (vp == (sg_pt_base *)0x0) {\n    iVar3 = -1;\n    pr2ws("%s: out of memory\n","write buffer");\n  }\n  else {\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(vp);\n  }\n  if (iVar1 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    /* WARNING: Subroutine does not return */\n    __stack_chk_fail_local();\n  }\n  return iVar3;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "ushort uVar2;" type_identifier identifier ;) (declaration "sg_pt_base *vp;" type_identifier (pointer_declarator "*vp" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "uint uVar5;" type_identifier identifier ;) (declaration "char *pcVar6;" primitive_type (pointer_declarator "*pcVar6" * identifier) ;) (declaration "byte *pbVar7;" type_identifier (pointer_declarator "*pbVar7" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "int sense_cat;" primitive_type identifier ;) (declaration "uint8_t wbuf_cdb [10];" primitive_type (array_declarator "wbuf_cdb [10]" identifier [ number_literal ]) ;) (declaration "uint8_t sense_b [64];" primitive_type (array_declarator "sense_b [64]" identifier [ number_literal ]) ;) (expression_statement "wbuf_cdb[1] = (byte)mode & 0x1f;" (assignment_expression "wbuf_cdb[1] = (byte)mode & 0x1f" (subscript_expression "wbuf_cdb[1]" identifier [ number_literal ]) = (binary_expression "(byte)mode & 0x1f" (cast_expression "(byte)mode" ( (type_descriptor "byte" type_identifier) ) 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 "wbuf_cdb[2] = (uint8_t)buffer_id;" (assignment_expression "wbuf_cdb[2] = (uint8_t)buffer_id" (subscript_expression "wbuf_cdb[2]" identifier [ number_literal ]) = (cast_expression "(uint8_t)buffer_id" ( (type_descriptor "uint8_t" primitive_type) ) identifier)) ;) (expression_statement "wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8;" (assignment_expression "wbuf_cdb._4_2_ = (ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8" (field_expression "wbuf_cdb._4_2_" identifier . field_identifier) = (binary_expression "(ushort)buffer_offset << 8 | (ushort)buffer_offset >> 8" (binary_expression "(ushort)buffer_offset << 8" (cast_expression "(ushort)buffer_offset" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)buffer_offset >> 8" (cast_expression "(ushort)buffer_offset" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal))) ;) (expression_statement "wbuf_cdb[0] = ';';" (assignment_expression "wbuf_cdb[0] = ';'" (subscript_expression "wbuf_cdb[0]" identifier [ number_literal ]) = (char_literal "';'" ' character ')) ;) (expression_statement "wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10);" (assignment_expression "wbuf_cdb[3] = (uint8_t)((uint)buffer_offset >> 0x10)" (subscript_expression "wbuf_cdb[3]" identifier [ number_literal ]) = (cast_expression "(uint8_t)((uint)buffer_offset >> 0x10)" ( (type_descriptor "uint8_t" primitive_type) ) (parenthesized_expression "((uint)buffer_offset >> 0x10)" ( (binary_expression "(uint)buffer_offset >> 0x10" (cast_expression "(uint)buffer_offset" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10);" (assignment_expression "wbuf_cdb[6] = (uint8_t)((uint)param_len >> 0x10)" (subscript_expression "wbuf_cdb[6]" identifier [ number_literal ]) = (cast_expression "(uint8_t)((uint)param_len >> 0x10)" ( (type_descriptor "uint8_t" primitive_type) ) (parenthesized_expression "((uint)param_len >> 0x10)" ( (binary_expression "(uint)param_len >> 0x10" (cast_expression "(uint)param_len" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8;" (assignment_expression "uVar2 = (ushort)param_len << 8 | (ushort)param_len >> 8" identifier = (binary_expression "(ushort)param_len << 8 | (ushort)param_len >> 8" (binary_expression "(ushort)param_len << 8" (cast_expression "(ushort)param_len" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_len >> 8" (cast_expression "(ushort)param_len" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal))) ;) (expression_statement "wbuf_cdb[9] = '\0';" (assignment_expression "wbuf_cdb[9] = '\0'" (subscript_expression "wbuf_cdb[9]" identifier [ number_literal ]) = (char_literal "'\0'" ' escape_sequence ')) ;) (expression_statement "wbuf_cdb[7] = (char)uVar2;" (assignment_expression "wbuf_cdb[7] = (char)uVar2" (subscript_expression "wbuf_cdb[7]" identifier [ number_literal ]) = (cast_expression "(char)uVar2" ( (type_descriptor "char" primitive_type) ) identifier)) ;) (expression_statement "wbuf_cdb[8] = (char)(uVar2 >> 8);" (assignment_expression "wbuf_cdb[8] = (char)(uVar2 >> 8)" (subscript_expression "wbuf_cdb[8]" identifier [ number_literal ]) = (cast_expression "(char)(uVar2 >> 8)" ( (type_descriptor "char" primitive_type) ) (parenthesized_expression "(uVar2 >> 8)" ( (binary_expression "uVar2 >> 8" identifier >> number_literal) )))) ;) (if_statement "if (verbose != 0) {\n    pcVar6 = "write buffer";\n    pr2ws("    %s cdb: ","write buffer");\n    pbVar7 = wbuf_cdb;\n    do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);\n    pr2ws("\n",uVar5);\n    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }\n  }" if (parenthesized_expression "(verbose != 0)" ( (binary_expression "verbose != 0" identifier != number_literal) )) (compound_statement "{\n    pcVar6 = "write buffer";\n    pr2ws("    %s cdb: ","write buffer");\n    pbVar7 = wbuf_cdb;\n    do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);\n    pr2ws("\n",uVar5);\n    if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }\n  }" { (expression_statement "pcVar6 = "write buffer";" (assignment_expression "pcVar6 = "write buffer"" identifier = (string_literal ""write buffer"" " string_content ")) ;) (expression_statement "pr2ws("    %s cdb: ","write buffer");" (call_expression "pr2ws("    %s cdb: ","write buffer")" identifier (argument_list "("    %s cdb: ","write buffer")" ( (string_literal ""    %s cdb: "" " string_content ") , (string_literal ""write buffer"" " string_content ") ))) ;) (expression_statement "pbVar7 = wbuf_cdb;" (assignment_expression "pbVar7 = wbuf_cdb" identifier = identifier) ;) (do_statement "do {\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    } while (pbVar7 != sense_b);" do (compound_statement "{\n      uVar5 = (uint)*pbVar7;\n      pbVar7 = pbVar7 + 1;\n      pr2ws("%02x ",uVar5);\n    }" { (expression_statement "uVar5 = (uint)*pbVar7;" (assignment_expression "uVar5 = (uint)*pbVar7" identifier = (binary_expression "(uint)*pbVar7" (parenthesized_expression "(uint)" ( identifier )) * identifier)) ;) (expression_statement "pbVar7 = pbVar7 + 1;" (assignment_expression "pbVar7 = pbVar7 + 1" identifier = (binary_expression "pbVar7 + 1" identifier + number_literal)) ;) (expression_statement "pr2ws("%02x ",uVar5);" (call_expression "pr2ws("%02x ",uVar5)" identifier (argument_list "("%02x ",uVar5)" ( (string_literal ""%02x "" " string_content ") , identifier ))) ;) }) while (parenthesized_expression "(pbVar7 != sense_b)" ( (binary_expression "pbVar7 != sense_b" identifier != identifier) )) ;) (expression_statement "pr2ws("\n",uVar5);" (call_expression "pr2ws("\n",uVar5)" identifier (argument_list "("\n",uVar5)" ( (string_literal ""\n"" " escape_sequence ") , identifier ))) ;) (if_statement "if ((1 < verbose && paramp != (void *)0x0) && (param_len != 0)) {\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }" if (parenthesized_expression "((1 < verbose && paramp != (void *)0x0) && (param_len != 0))" ( (binary_expression "(1 < verbose && paramp != (void *)0x0) && (param_len != 0)" (parenthesized_expression "(1 < verbose && paramp != (void *)0x0)" ( (binary_expression "1 < verbose && paramp != (void *)0x0" (binary_expression "1 < verbose" number_literal < identifier) && (binary_expression "paramp != (void *)0x0" identifier != (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal))) )) && (parenthesized_expression "(param_len != 0)" ( (binary_expression "param_len != 0" identifier != number_literal) ))) )) (compound_statement "{\n      pr2ws("    %s parameter list","write buffer");\n      if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }\n    }" { (expression_statement "pr2ws("    %s parameter list","write buffer");" (call_expression "pr2ws("    %s parameter list","write buffer")" identifier (argument_list "("    %s parameter list","write buffer")" ( (string_literal ""    %s parameter list"" " string_content ") , (string_literal ""write buffer"" " string_content ") ))) ;) (if_statement "if (verbose == 2) {\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }\n      else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }" if (parenthesized_expression "(verbose == 2)" ( (binary_expression "verbose == 2" identifier == number_literal) )) (compound_statement "{\n        pcVar6 = ", first 256 bytes";\n        if (param_len < 0x101) {\n          pcVar6 = "";\n        }\n        pr2ws("%s:\n",pcVar6);\n        iVar3 = 0x100;\n        if (param_len < 0x101) {\n          iVar3 = param_len;\n        }\n        hex2stderr((uint8_t *)paramp,iVar3,-1);\n      }" { (expression_statement "pcVar6 = ", first 256 bytes";" (assignment_expression "pcVar6 = ", first 256 bytes"" identifier = (string_literal "", first 256 bytes"" " string_content ")) ;) (if_statement "if (param_len < 0x101) {\n          pcVar6 = "";\n        }" if (parenthesized_expression "(param_len < 0x101)" ( (binary_expression "param_len < 0x101" identifier < number_literal) )) (compound_statement "{\n          pcVar6 = "";\n        }" { (expression_statement "pcVar6 = "";" (assignment_expression "pcVar6 = """ identifier = (string_literal """" " ")) ;) })) (expression_statement "pr2ws("%s:\n",pcVar6);" (call_expression "pr2ws("%s:\n",pcVar6)" identifier (argument_list "("%s:\n",pcVar6)" ( (string_literal ""%s:\n"" " string_content escape_sequence ") , identifier ))) ;) (expression_statement "iVar3 = 0x100;" (assignment_expression "iVar3 = 0x100" identifier = number_literal) ;) (if_statement "if (param_len < 0x101) {\n          iVar3 = param_len;\n        }" if (parenthesized_expression "(param_len < 0x101)" ( (binary_expression "param_len < 0x101" identifier < number_literal) )) (compound_statement "{\n          iVar3 = param_len;\n        }" { (expression_statement "iVar3 = param_len;" (assignment_expression "iVar3 = param_len" identifier = identifier) ;) })) (expression_statement "hex2stderr((uint8_t *)paramp,iVar3,-1);" (call_expression "hex2stderr((uint8_t *)paramp,iVar3,-1)" identifier (argument_list "((uint8_t *)paramp,iVar3,-1)" ( (cast_expression "(uint8_t *)paramp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier , number_literal ))) ;) }) (else_clause "else {\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }" else (compound_statement "{\n        pr2ws(":\n",pcVar6);\n        hex2stderr((uint8_t *)paramp,param_len,0);\n      }" { (expression_statement "pr2ws(":\n",pcVar6);" (call_expression "pr2ws(":\n",pcVar6)" identifier (argument_list "(":\n",pcVar6)" ( (string_literal "":\n"" " string_content escape_sequence ") , identifier ))) ;) (expression_statement "hex2stderr((uint8_t *)paramp,param_len,0);" (call_expression "hex2stderr((uint8_t *)paramp,param_len,0)" identifier (argument_list "((uint8_t *)paramp,param_len,0)" ( (cast_expression "(uint8_t *)paramp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier , number_literal ))) ;) }))) })) })) (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    iVar3 = -1;\n    pr2ws("%s: out of memory\n","write buffer");\n  }\n  else {\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\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    iVar3 = -1;\n    pr2ws("%s: out of memory\n","write buffer");\n  }" { (expression_statement "iVar3 = -1;" (assignment_expression "iVar3 = -1" identifier = number_literal) ;) (expression_statement "pr2ws("%s: out of memory\n","write buffer");" (call_expression "pr2ws("%s: out of memory\n","write buffer")" identifier (argument_list "("%s: out of memory\n","write buffer")" ( (string_literal ""%s: out of memory\n"" " string_content escape_sequence ") , (string_literal ""write buffer"" " string_content ") ))) ;) }) (else_clause "else {\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(vp);\n  }" else (compound_statement "{\n    set_scsi_pt_cdb(vp,wbuf_cdb,10);\n    set_scsi_pt_sense(vp,sense_b,0x40);\n    set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len);\n    iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);\n    iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);\n    if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(vp);\n  }" { (expression_statement "set_scsi_pt_cdb(vp,wbuf_cdb,10);" (call_expression "set_scsi_pt_cdb(vp,wbuf_cdb,10)" identifier (argument_list "(vp,wbuf_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_out(vp,(uint8_t *)paramp,param_len);" (call_expression "set_scsi_pt_data_out(vp,(uint8_t *)paramp,param_len)" identifier (argument_list "(vp,(uint8_t *)paramp,param_len)" ( identifier , (cast_expression "(uint8_t *)paramp" ( (type_descriptor "uint8_t *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , identifier ))) ;) (expression_statement "iVar3 = do_scsi_pt(vp,sg_fd,0x3c,verbose);" (assignment_expression "iVar3 = 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 "iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat);" (assignment_expression "iVar4 = sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat)" identifier = (call_expression "sg_cmds_process_resp(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat)" identifier (argument_list "(vp,"write buffer",iVar3,0,sense_b,noisy,verbose,&sense_cat)" ( identifier , (string_literal ""write buffer"" " string_content ") , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&sense_cat" & identifier) )))) ;) (if_statement "if (iVar4 == -1) {\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }\n    else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }" if (parenthesized_expression "(iVar4 == -1)" ( (binary_expression "iVar4 == -1" identifier == number_literal) )) (compound_statement "{\n      iVar3 = get_scsi_pt_os_err();\n      iVar3 = sg_convert_errno(iVar3);\n    }" { (expression_statement "iVar3 = get_scsi_pt_os_err();" (assignment_expression "iVar3 = get_scsi_pt_os_err()" identifier = (call_expression "get_scsi_pt_os_err()" identifier (argument_list "()" ( )))) ;) (expression_statement "iVar3 = sg_convert_errno(iVar3);" (assignment_expression "iVar3 = sg_convert_errno(iVar3)" identifier = (call_expression "sg_convert_errno(iVar3)" identifier (argument_list "(iVar3)" ( identifier )))) ;) }) (else_clause "else {\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }" else (compound_statement "{\n      iVar3 = 0;\n      if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }\n    }" { (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (if_statement "if ((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)) {\n        iVar3 = 0;\n      }" if (parenthesized_expression "((iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2))" ( (binary_expression "(iVar4 == -2) && (iVar3 = sense_cat, sense_cat - 0x14U < 2)" (parenthesized_expression "(iVar4 == -2)" ( (binary_expression "iVar4 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar3 = sense_cat, sense_cat - 0x14U < 2)" ( (comma_expression "iVar3 = sense_cat, sense_cat - 0x14U < 2" (assignment_expression "iVar3 = sense_cat" identifier = identifier) , (binary_expression "sense_cat - 0x14U < 2" (binary_expression "sense_cat - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n        iVar3 = 0;\n      }" { (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) })) }))) (expression_statement "destruct_scsi_pt_obj(vp);" (call_expression "destruct_scsi_pt_obj(vp)" identifier (argument_list "(vp)" ( identifier ))) ;) }))) (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 iVar3;" return identifier ;) })))
(translation_unit "int sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar7;\n}\n\n" (function_definition "int sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar7;\n}" primitive_type (function_declarator "sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" identifier (parameter_list "(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" ( (parameter_declaration "byte param_1" type_identifier identifier) , (parameter_declaration "undefined1 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) , (parameter_declaration "int param_4" primitive_type identifier) , (parameter_declaration "int param_5" primitive_type identifier) , (parameter_declaration "undefined1 param_6" type_identifier identifier) , (parameter_declaration "int param_7" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar7;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "uint uVar4;" type_identifier identifier ;) (declaration "int unaff_EBX;" primitive_type identifier ;) (declaration "byte *pbVar5;" type_identifier (pointer_declarator "*pbVar5" * identifier) ;) (declaration "undefined1 uVar6;" type_identifier identifier ;) (declaration "int iVar7;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "undefined4 unaff_retaddr;" type_identifier identifier ;) (declaration "int local_88;" primitive_type identifier ;) (declaration "int local_74;" primitive_type identifier ;) (declaration "byte local_6e [4];" type_identifier (array_declarator "local_6e [4]" identifier [ number_literal ]) ;) (declaration "ushort local_6a;" type_identifier identifier ;) (declaration "undefined1 local_68;" type_identifier identifier ;) (declaration "ushort uStack_67;" 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 "uVar6 = 0;" (assignment_expression "uVar6 = 0" identifier = number_literal) ;) (expression_statement "uStack_14 = 0x27e0b;" (assignment_expression "uStack_14 = 0x27e0b" identifier = number_literal) ;) (expression_statement "entry();" (call_expression "entry()" identifier (argument_list "()" ( ))) ;) (expression_statement "local_6e[1] = param_1 & 0x1f;" (assignment_expression "local_6e[1] = param_1 & 0x1f" (subscript_expression "local_6e[1]" identifier [ number_literal ]) = (binary_expression "param_1 & 0x1f" identifier & number_literal)) ;) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "local_6e[2] = param_2;" (assignment_expression "local_6e[2] = param_2" (subscript_expression "local_6e[2]" identifier [ number_literal ]) = identifier) ;) (expression_statement "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;" (assignment_expression "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8" identifier = (binary_expression "(ushort)param_3 << 8 | (ushort)param_3 >> 8" (binary_expression "(ushort)param_3 << 8" (cast_expression "(ushort)param_3" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_3 >> 8" (cast_expression "(ushort)param_3" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal))) ;) (expression_statement "local_6e[0] = 0x3b;" (assignment_expression "local_6e[0] = 0x3b" (subscript_expression "local_6e[0]" identifier [ number_literal ]) = number_literal) ;) (expression_statement "local_6e[3] = (byte)((uint)param_3 >> 0x10);" (assignment_expression "local_6e[3] = (byte)((uint)param_3 >> 0x10)" (subscript_expression "local_6e[3]" identifier [ number_literal ]) = (call_expression "(byte)((uint)param_3 >> 0x10)" (parenthesized_expression "(byte)" ( identifier )) (argument_list "((uint)param_3 >> 0x10)" ( (binary_expression "(uint)param_3 >> 0x10" (cast_expression "(uint)param_3" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "local_68 = (undefined1)((uint)param_5 >> 0x10);" (assignment_expression "local_68 = (undefined1)((uint)param_5 >> 0x10)" identifier = (call_expression "(undefined1)((uint)param_5 >> 0x10)" (parenthesized_expression "(undefined1)" ( identifier )) (argument_list "((uint)param_5 >> 0x10)" ( (binary_expression "(uint)param_5 >> 0x10" (cast_expression "(uint)param_5" ( (type_descriptor "uint" type_identifier) ) identifier) >> number_literal) )))) ;) (expression_statement "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);" (assignment_expression "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" identifier = (call_expression "CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" identifier (argument_list "(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" ( identifier , (binary_expression "(ushort)param_5 << 8 | (ushort)param_5 >> 8" (binary_expression "(ushort)param_5 << 8" (cast_expression "(ushort)param_5" ( (type_descriptor "ushort" type_identifier) ) identifier) << number_literal) | (binary_expression "(ushort)param_5 >> 8" (cast_expression "(ushort)param_5" ( (type_descriptor "ushort" type_identifier) ) identifier) >> number_literal)) )))) ;) (if_statement "if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" if (parenthesized_expression "(param_7 != 0)" ( (binary_expression "param_7 != 0" identifier != number_literal) )) (compound_statement "{\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" { (expression_statement "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);" (call_expression "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" identifier (argument_list "(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" ( (binary_expression "unaff_EBX + 0x14454" identifier + number_literal) , (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal) ))) ;) (expression_statement "pbVar5 = local_6e;" (assignment_expression "pbVar5 = local_6e" identifier = identifier) ;) (do_statement "do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);" do (compound_statement "{\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    }" { (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" identifier = (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal)) ;) (expression_statement "uVar4 = (uint)*pbVar5;" (assignment_expression "uVar4 = (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(unaff_EBX + 0x15718,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x15718,uVar4)" identifier (argument_list "(unaff_EBX + 0x15718,uVar4)" ( (binary_expression "unaff_EBX + 0x15718" identifier + number_literal) , identifier ))) ;) }) while (parenthesized_expression "(pbVar5 != local_64)" ( (binary_expression "pbVar5 != local_64" identifier != identifier) )) ;) (expression_statement "pr2ws(unaff_EBX + 0x88d5,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x88d5,uVar4)" identifier (argument_list "(unaff_EBX + 0x88d5,uVar4)" ( (binary_expression "unaff_EBX + 0x88d5" identifier + number_literal) , identifier ))) ;) (if_statement "if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" if (parenthesized_expression "((1 < param_7 && param_4 != 0) && (param_5 != 0))" ( (binary_expression "(1 < param_7 && param_4 != 0) && (param_5 != 0)" (parenthesized_expression "(1 < param_7 && param_4 != 0)" ( (binary_expression "1 < param_7 && param_4 != 0" (binary_expression "1 < param_7" number_literal < identifier) && (binary_expression "param_4 != 0" identifier != number_literal)) )) && (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) ))) )) (compound_statement "{\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" { (expression_statement "pr2ws(unaff_EBX + 0x14d48,local_88);" (call_expression "pr2ws(unaff_EBX + 0x14d48,local_88)" identifier (argument_list "(unaff_EBX + 0x14d48,local_88)" ( (binary_expression "unaff_EBX + 0x14d48" identifier + number_literal) , identifier ))) ;) (if_statement "if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" if (parenthesized_expression "(param_7 == 2)" ( (binary_expression "param_7 == 2" identifier == number_literal) )) (compound_statement "{\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }" { (expression_statement "iVar1 = unaff_EBX + 0x14878;" (assignment_expression "iVar1 = unaff_EBX + 0x14878" identifier = (binary_expression "unaff_EBX + 0x14878" identifier + number_literal)) ;) (if_statement "if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }" if (parenthesized_expression "(param_5 < 0x101)" ( (binary_expression "param_5 < 0x101" identifier < number_literal) )) (compound_statement "{\n          iVar1 = unaff_EBX + 0x8bca;\n        }" { (expression_statement "iVar1 = unaff_EBX + 0x8bca;" (assignment_expression "iVar1 = unaff_EBX + 0x8bca" identifier = (binary_expression "unaff_EBX + 0x8bca" identifier + number_literal)) ;) })) (expression_statement "pr2ws(unaff_EBX + 0x856b,iVar1);" (call_expression "pr2ws(unaff_EBX + 0x856b,iVar1)" identifier (argument_list "(unaff_EBX + 0x856b,iVar1)" ( (binary_expression "unaff_EBX + 0x856b" identifier + number_literal) , identifier ))) ;) (expression_statement "iVar1 = 0x100;" (assignment_expression "iVar1 = 0x100" identifier = number_literal) ;) (if_statement "if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }" if (parenthesized_expression "(param_5 < 0x101)" ( (binary_expression "param_5 < 0x101" identifier < number_literal) )) (compound_statement "{\n          iVar1 = param_5;\n        }" { (expression_statement "iVar1 = param_5;" (assignment_expression "iVar1 = param_5" identifier = identifier) ;) })) (expression_statement "hex2stderr(param_4,iVar1,0xffffffff);" (call_expression "hex2stderr(param_4,iVar1,0xffffffff)" identifier (argument_list "(param_4,iVar1,0xffffffff)" ( identifier , identifier , number_literal ))) ;) }) (else_clause "else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" else (compound_statement "{\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" { (expression_statement "pr2ws(unaff_EBX + 0x157da,local_88);" (call_expression "pr2ws(unaff_EBX + 0x157da,local_88)" identifier (argument_list "(unaff_EBX + 0x157da,local_88)" ( (binary_expression "unaff_EBX + 0x157da" identifier + number_literal) , identifier ))) ;) (expression_statement "hex2stderr(param_4,param_5,0);" (call_expression "hex2stderr(param_4,param_5,0)" identifier (argument_list "(param_4,param_5,0)" ( identifier , identifier , number_literal ))) ;) }))) })) })) (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" identifier = (binary_expression "unaff_EBX + 0x14d3b" identifier + number_literal)) ;) (expression_statement "iVar1 = construct_scsi_pt_obj();" (assignment_expression "iVar1 = construct_scsi_pt_obj()" identifier = (call_expression "construct_scsi_pt_obj()" identifier (argument_list "()" ( )))) ;) (if_statement "if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" if (parenthesized_expression "(iVar1 == 0)" ( (binary_expression "iVar1 == 0" identifier == number_literal) )) (compound_statement "{\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }" { (expression_statement "iVar7 = -1;" (assignment_expression "iVar7 = -1" identifier = number_literal) ;) (expression_statement "pr2ws(unaff_EBX + 0x144a4,local_88);" (call_expression "pr2ws(unaff_EBX + 0x144a4,local_88)" identifier (argument_list "(unaff_EBX + 0x144a4,local_88)" ( (binary_expression "unaff_EBX + 0x144a4" identifier + number_literal) , identifier ))) ;) }) (else_clause "else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" else (compound_statement "{\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" { (expression_statement "set_scsi_pt_cdb(iVar1,local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar1,local_6e,10)" identifier (argument_list "(iVar1,local_6e,10)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_sense(iVar1,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar1,local_64,0x40)" identifier (argument_list "(iVar1,local_64,0x40)" ( identifier , identifier , number_literal ))) ;) (expression_statement "set_scsi_pt_data_out(iVar1,param_4,param_5);" (call_expression "set_scsi_pt_data_out(iVar1,param_4,param_5)" identifier (argument_list "(iVar1,param_4,param_5)" ( identifier , identifier , identifier ))) ;) (expression_statement "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" identifier = (call_expression "do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" identifier (argument_list "(iVar1,unaff_retaddr,0x3c,param_7)" ( identifier , identifier , number_literal , identifier )))) ;) (expression_statement "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" identifier = (call_expression "sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" identifier (argument_list "(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" ( identifier , identifier , identifier , number_literal , identifier , identifier , identifier , (pointer_expression "&local_74" & identifier) )))) ;) (if_statement "if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" if (parenthesized_expression "(iVar3 == -1)" ( (binary_expression "iVar3 == -1" identifier == number_literal) )) (compound_statement "{\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }" { (expression_statement "uVar2 = get_scsi_pt_os_err(iVar1);" (assignment_expression "uVar2 = get_scsi_pt_os_err(iVar1)" identifier = (call_expression "get_scsi_pt_os_err(iVar1)" identifier (argument_list "(iVar1)" ( identifier )))) ;) (expression_statement "iVar7 = sg_convert_errno(uVar2);" (assignment_expression "iVar7 = sg_convert_errno(uVar2)" identifier = (call_expression "sg_convert_errno(uVar2)" identifier (argument_list "(uVar2)" ( identifier )))) ;) }) (else_clause "else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" else (compound_statement "{\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" { (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" identifier = number_literal) ;) (if_statement "if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }" if (parenthesized_expression "((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2))" ( (binary_expression "(iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)" (parenthesized_expression "(iVar3 == -2)" ( (binary_expression "iVar3 == -2" identifier == number_literal) )) && (parenthesized_expression "(iVar7 = local_74, local_74 - 0x14U < 2)" ( (comma_expression "iVar7 = local_74, local_74 - 0x14U < 2" (assignment_expression "iVar7 = local_74" identifier = identifier) , (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" identifier - number_literal) < number_literal)) ))) )) (compound_statement "{\n        iVar7 = 0;\n      }" { (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" identifier = number_literal) ;) })) }))) (expression_statement "destruct_scsi_pt_obj(iVar1);" (call_expression "destruct_scsi_pt_obj(iVar1)" identifier (argument_list "(iVar1)" ( 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 iVar7;" 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 (pointer_declarator * 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 ;) (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 (subscript_expression IDENT [ LIT ]) = (binary_expression IDENT & LIT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = IDENT) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) << LIT) | (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = LIT) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT) )))) ;) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT) )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (binary_expression (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) << LIT) | (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) >> LIT)) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , (binary_expression IDENT + LIT) ))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( IDENT )) * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) }) while (parenthesized_expression ( (binary_expression IDENT != IDENT) )) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (binary_expression LIT < IDENT) && (binary_expression IDENT != LIT)) )) && (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) (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 IDENT + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (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 IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) }))) })) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , IDENT ))) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , LIT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , LIT , IDENT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , LIT , IDENT , IDENT , IDENT , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT == LIT) )) && (parenthesized_expression ( (comma_expression (assignment_expression IDENT = IDENT) , (binary_expression (binary_expression IDENT - LIT) < LIT)) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) }))) (expression_statement (call_expression IDENT (argument_list ( 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_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar7;\n}" (primitive_type "int") (function_declarator "sg_ll_write_buffer(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" (identifier "sg_ll_write_buffer") (parameter_list "(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,\n                      undefined1 param_6,int param_7)" (( "(") (parameter_declaration "byte param_1" (type_identifier "byte") (identifier "param_1")) (, ",") (parameter_declaration "undefined1 param_2" (type_identifier "undefined1") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) (, ",") (parameter_declaration "int param_4" (primitive_type "int") (identifier "param_4")) (, ",") (parameter_declaration "int param_5" (primitive_type "int") (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  int iVar1;\n  undefined4 uVar2;\n  int iVar3;\n  uint uVar4;\n  int unaff_EBX;\n  byte *pbVar5;\n  undefined1 uVar6;\n  int iVar7;\n  int in_GS_OFFSET;\n  undefined4 unaff_retaddr;\n  int local_88;\n  int local_74;\n  byte local_6e [4];\n  ushort local_6a;\n  undefined1 local_68;\n  ushort uStack_67;\n  undefined1 uStack_65;\n  byte local_64 [64];\n  int local_24;\n  undefined4 uStack_14;\n  \n  uVar6 = 0;\n  uStack_14 = 0x27e0b;\n  entry();\n  local_6e[1] = param_1 & 0x1f;\n  local_24 = *(int *)(in_GS_OFFSET + 0x14);\n  local_6e[2] = param_2;\n  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;\n  local_6e[0] = 0x3b;\n  local_6e[3] = (byte)((uint)param_3 >> 0x10);\n  local_68 = (undefined1)((uint)param_5 >> 0x10);\n  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);\n  if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }\n  local_88 = unaff_EBX + 0x14d3b;\n  iVar1 = construct_scsi_pt_obj();\n  if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }\n  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {\n                    \n    FUN_0002f100();\n  }\n  return iVar7;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "undefined4 uVar2;" (type_identifier "undefined4") (identifier "uVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "uint uVar4;" (type_identifier "uint") (identifier "uVar4") (; ";")) (declaration "int unaff_EBX;" (primitive_type "int") (identifier "unaff_EBX") (; ";")) (declaration "byte *pbVar5;" (type_identifier "byte") (pointer_declarator "*pbVar5" (* "*") (identifier "pbVar5")) (; ";")) (declaration "undefined1 uVar6;" (type_identifier "undefined1") (identifier "uVar6") (; ";")) (declaration "int iVar7;" (primitive_type "int") (identifier "iVar7") (; ";")) (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_88;" (primitive_type "int") (identifier "local_88") (; ";")) (declaration "int local_74;" (primitive_type "int") (identifier "local_74") (; ";")) (declaration "byte local_6e [4];" (type_identifier "byte") (array_declarator "local_6e [4]" (identifier "local_6e") ([ "[") (number_literal "4") (] "]")) (; ";")) (declaration "ushort local_6a;" (type_identifier "ushort") (identifier "local_6a") (; ";")) (declaration "undefined1 local_68;" (type_identifier "undefined1") (identifier "local_68") (; ";")) (declaration "ushort uStack_67;" (type_identifier "ushort") (identifier "uStack_67") (; ";")) (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 "uVar6 = 0;" (assignment_expression "uVar6 = 0" (identifier "uVar6") (= "=") (number_literal "0")) (; ";")) (expression_statement "uStack_14 = 0x27e0b;" (assignment_expression "uStack_14 = 0x27e0b" (identifier "uStack_14") (= "=") (number_literal "0x27e0b")) (; ";")) (expression_statement "entry();" (call_expression "entry()" (identifier "entry") (argument_list "()" (( "(") () ")"))) (; ";")) (expression_statement "local_6e[1] = param_1 & 0x1f;" (assignment_expression "local_6e[1] = param_1 & 0x1f" (subscript_expression "local_6e[1]" (identifier "local_6e") ([ "[") (number_literal "1") (] "]")) (= "=") (binary_expression "param_1 & 0x1f" (identifier "param_1") (& "&") (number_literal "0x1f"))) (; ";")) (expression_statement "local_24 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_24 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_24") (= "=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) (; ";")) (expression_statement "local_6e[2] = param_2;" (assignment_expression "local_6e[2] = param_2" (subscript_expression "local_6e[2]" (identifier "local_6e") ([ "[") (number_literal "2") (] "]")) (= "=") (identifier "param_2")) (; ";")) (expression_statement "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;" (assignment_expression "local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8" (identifier "local_6a") (= "=") (binary_expression "(ushort)param_3 << 8 | (ushort)param_3 >> 8" (binary_expression "(ushort)param_3 << 8" (cast_expression "(ushort)param_3" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_3")) (<< "<<") (number_literal "8")) (| "|") (binary_expression "(ushort)param_3 >> 8" (cast_expression "(ushort)param_3" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_3")) (>> ">>") (number_literal "8")))) (; ";")) (expression_statement "local_6e[0] = 0x3b;" (assignment_expression "local_6e[0] = 0x3b" (subscript_expression "local_6e[0]" (identifier "local_6e") ([ "[") (number_literal "0") (] "]")) (= "=") (number_literal "0x3b")) (; ";")) (expression_statement "local_6e[3] = (byte)((uint)param_3 >> 0x10);" (assignment_expression "local_6e[3] = (byte)((uint)param_3 >> 0x10)" (subscript_expression "local_6e[3]" (identifier "local_6e") ([ "[") (number_literal "3") (] "]")) (= "=") (call_expression "(byte)((uint)param_3 >> 0x10)" (parenthesized_expression "(byte)" (( "(") (identifier "byte") () ")")) (argument_list "((uint)param_3 >> 0x10)" (( "(") (binary_expression "(uint)param_3 >> 0x10" (cast_expression "(uint)param_3" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "param_3")) (>> ">>") (number_literal "0x10")) () ")")))) (; ";")) (expression_statement "local_68 = (undefined1)((uint)param_5 >> 0x10);" (assignment_expression "local_68 = (undefined1)((uint)param_5 >> 0x10)" (identifier "local_68") (= "=") (call_expression "(undefined1)((uint)param_5 >> 0x10)" (parenthesized_expression "(undefined1)" (( "(") (identifier "undefined1") () ")")) (argument_list "((uint)param_5 >> 0x10)" (( "(") (binary_expression "(uint)param_5 >> 0x10" (cast_expression "(uint)param_5" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (identifier "param_5")) (>> ">>") (number_literal "0x10")) () ")")))) (; ";")) (expression_statement "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);" (assignment_expression "_uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" (identifier "_uStack_67") (= "=") (call_expression "CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" (identifier "CONCAT12") (argument_list "(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8)" (( "(") (identifier "uVar6") (, ",") (binary_expression "(ushort)param_5 << 8 | (ushort)param_5 >> 8" (binary_expression "(ushort)param_5 << 8" (cast_expression "(ushort)param_5" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_5")) (<< "<<") (number_literal "8")) (| "|") (binary_expression "(ushort)param_5 >> 8" (cast_expression "(ushort)param_5" (( "(") (type_descriptor "ushort" (type_identifier "ushort")) () ")") (identifier "param_5")) (>> ">>") (number_literal "8"))) () ")")))) (; ";")) (if_statement "if (param_7 != 0) {\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" (if "if") (parenthesized_expression "(param_7 != 0)" (( "(") (binary_expression "param_7 != 0" (identifier "param_7") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);\n    pbVar5 = local_6e;\n    do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);\n    pr2ws(unaff_EBX + 0x88d5,uVar4);\n    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }\n  }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);" (call_expression "pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b)" (( "(") (binary_expression "unaff_EBX + 0x14454" (identifier "unaff_EBX") (+ "+") (number_literal "0x14454")) (, ",") (binary_expression "unaff_EBX + 0x14d3b" (identifier "unaff_EBX") (+ "+") (number_literal "0x14d3b")) () ")"))) (; ";")) (expression_statement "pbVar5 = local_6e;" (assignment_expression "pbVar5 = local_6e" (identifier "pbVar5") (= "=") (identifier "local_6e")) (; ";")) (do_statement "do {\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    } while (pbVar5 != local_64);" (do "do") (compound_statement "{\n      local_88 = unaff_EBX + 0x14d3b;\n      uVar4 = (uint)*pbVar5;\n      pbVar5 = pbVar5 + 1;\n      pr2ws(unaff_EBX + 0x15718,uVar4);\n    }" ({ "{") (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" (identifier "local_88") (= "=") (binary_expression "unaff_EBX + 0x14d3b" (identifier "unaff_EBX") (+ "+") (number_literal "0x14d3b"))) (; ";")) (expression_statement "uVar4 = (uint)*pbVar5;" (assignment_expression "uVar4 = (uint)*pbVar5" (identifier "uVar4") (= "=") (binary_expression "(uint)*pbVar5" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (* "*") (identifier "pbVar5"))) (; ";")) (expression_statement "pbVar5 = pbVar5 + 1;" (assignment_expression "pbVar5 = pbVar5 + 1" (identifier "pbVar5") (= "=") (binary_expression "pbVar5 + 1" (identifier "pbVar5") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "pr2ws(unaff_EBX + 0x15718,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x15718,uVar4)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x15718,uVar4)" (( "(") (binary_expression "unaff_EBX + 0x15718" (identifier "unaff_EBX") (+ "+") (number_literal "0x15718")) (, ",") (identifier "uVar4") () ")"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(pbVar5 != local_64)" (( "(") (binary_expression "pbVar5 != local_64" (identifier "pbVar5") (!= "!=") (identifier "local_64")) () ")")) (; ";")) (expression_statement "pr2ws(unaff_EBX + 0x88d5,uVar4);" (call_expression "pr2ws(unaff_EBX + 0x88d5,uVar4)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x88d5,uVar4)" (( "(") (binary_expression "unaff_EBX + 0x88d5" (identifier "unaff_EBX") (+ "+") (number_literal "0x88d5")) (, ",") (identifier "uVar4") () ")"))) (; ";")) (if_statement "if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" (if "if") (parenthesized_expression "((1 < param_7 && param_4 != 0) && (param_5 != 0))" (( "(") (binary_expression "(1 < param_7 && param_4 != 0) && (param_5 != 0)" (parenthesized_expression "(1 < param_7 && param_4 != 0)" (( "(") (binary_expression "1 < param_7 && param_4 != 0" (binary_expression "1 < param_7" (number_literal "1") (< "<") (identifier "param_7")) (&& "&&") (binary_expression "param_4 != 0" (identifier "param_4") (!= "!=") (number_literal "0"))) () ")")) (&& "&&") (parenthesized_expression "(param_5 != 0)" (( "(") (binary_expression "param_5 != 0" (identifier "param_5") (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\n      pr2ws(unaff_EBX + 0x14d48,local_88);\n      if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }\n    }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x14d48,local_88);" (call_expression "pr2ws(unaff_EBX + 0x14d48,local_88)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x14d48,local_88)" (( "(") (binary_expression "unaff_EBX + 0x14d48" (identifier "unaff_EBX") (+ "+") (number_literal "0x14d48")) (, ",") (identifier "local_88") () ")"))) (; ";")) (if_statement "if (param_7 == 2) {\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }\n      else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" (if "if") (parenthesized_expression "(param_7 == 2)" (( "(") (binary_expression "param_7 == 2" (identifier "param_7") (== "==") (number_literal "2")) () ")")) (compound_statement "{\n        iVar1 = unaff_EBX + 0x14878;\n        if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }\n        pr2ws(unaff_EBX + 0x856b,iVar1);\n        iVar1 = 0x100;\n        if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }\n        hex2stderr(param_4,iVar1,0xffffffff);\n      }" ({ "{") (expression_statement "iVar1 = unaff_EBX + 0x14878;" (assignment_expression "iVar1 = unaff_EBX + 0x14878" (identifier "iVar1") (= "=") (binary_expression "unaff_EBX + 0x14878" (identifier "unaff_EBX") (+ "+") (number_literal "0x14878"))) (; ";")) (if_statement "if (param_5 < 0x101) {\n          iVar1 = unaff_EBX + 0x8bca;\n        }" (if "if") (parenthesized_expression "(param_5 < 0x101)" (( "(") (binary_expression "param_5 < 0x101" (identifier "param_5") (< "<") (number_literal "0x101")) () ")")) (compound_statement "{\n          iVar1 = unaff_EBX + 0x8bca;\n        }" ({ "{") (expression_statement "iVar1 = unaff_EBX + 0x8bca;" (assignment_expression "iVar1 = unaff_EBX + 0x8bca" (identifier "iVar1") (= "=") (binary_expression "unaff_EBX + 0x8bca" (identifier "unaff_EBX") (+ "+") (number_literal "0x8bca"))) (; ";")) (} "}"))) (expression_statement "pr2ws(unaff_EBX + 0x856b,iVar1);" (call_expression "pr2ws(unaff_EBX + 0x856b,iVar1)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x856b,iVar1)" (( "(") (binary_expression "unaff_EBX + 0x856b" (identifier "unaff_EBX") (+ "+") (number_literal "0x856b")) (, ",") (identifier "iVar1") () ")"))) (; ";")) (expression_statement "iVar1 = 0x100;" (assignment_expression "iVar1 = 0x100" (identifier "iVar1") (= "=") (number_literal "0x100")) (; ";")) (if_statement "if (param_5 < 0x101) {\n          iVar1 = param_5;\n        }" (if "if") (parenthesized_expression "(param_5 < 0x101)" (( "(") (binary_expression "param_5 < 0x101" (identifier "param_5") (< "<") (number_literal "0x101")) () ")")) (compound_statement "{\n          iVar1 = param_5;\n        }" ({ "{") (expression_statement "iVar1 = param_5;" (assignment_expression "iVar1 = param_5" (identifier "iVar1") (= "=") (identifier "param_5")) (; ";")) (} "}"))) (expression_statement "hex2stderr(param_4,iVar1,0xffffffff);" (call_expression "hex2stderr(param_4,iVar1,0xffffffff)" (identifier "hex2stderr") (argument_list "(param_4,iVar1,0xffffffff)" (( "(") (identifier "param_4") (, ",") (identifier "iVar1") (, ",") (number_literal "0xffffffff") () ")"))) (; ";")) (} "}")) (else_clause "else {\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" (else "else") (compound_statement "{\n        pr2ws(unaff_EBX + 0x157da,local_88);\n        hex2stderr(param_4,param_5,0);\n      }" ({ "{") (expression_statement "pr2ws(unaff_EBX + 0x157da,local_88);" (call_expression "pr2ws(unaff_EBX + 0x157da,local_88)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x157da,local_88)" (( "(") (binary_expression "unaff_EBX + 0x157da" (identifier "unaff_EBX") (+ "+") (number_literal "0x157da")) (, ",") (identifier "local_88") () ")"))) (; ";")) (expression_statement "hex2stderr(param_4,param_5,0);" (call_expression "hex2stderr(param_4,param_5,0)" (identifier "hex2stderr") (argument_list "(param_4,param_5,0)" (( "(") (identifier "param_4") (, ",") (identifier "param_5") (, ",") (number_literal "0") () ")"))) (; ";")) (} "}")))) (} "}"))) (} "}"))) (expression_statement "local_88 = unaff_EBX + 0x14d3b;" (assignment_expression "local_88 = unaff_EBX + 0x14d3b" (identifier "local_88") (= "=") (binary_expression "unaff_EBX + 0x14d3b" (identifier "unaff_EBX") (+ "+") (number_literal "0x14d3b"))) (; ";")) (expression_statement "iVar1 = construct_scsi_pt_obj();" (assignment_expression "iVar1 = construct_scsi_pt_obj()" (identifier "iVar1") (= "=") (call_expression "construct_scsi_pt_obj()" (identifier "construct_scsi_pt_obj") (argument_list "()" (( "(") () ")")))) (; ";")) (if_statement "if (iVar1 == 0) {\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }\n  else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" (if "if") (parenthesized_expression "(iVar1 == 0)" (( "(") (binary_expression "iVar1 == 0" (identifier "iVar1") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n    iVar7 = -1;\n    pr2ws(unaff_EBX + 0x144a4,local_88);\n  }" ({ "{") (expression_statement "iVar7 = -1;" (assignment_expression "iVar7 = -1" (identifier "iVar7") (= "=") (number_literal "-1")) (; ";")) (expression_statement "pr2ws(unaff_EBX + 0x144a4,local_88);" (call_expression "pr2ws(unaff_EBX + 0x144a4,local_88)" (identifier "pr2ws") (argument_list "(unaff_EBX + 0x144a4,local_88)" (( "(") (binary_expression "unaff_EBX + 0x144a4" (identifier "unaff_EBX") (+ "+") (number_literal "0x144a4")) (, ",") (identifier "local_88") () ")"))) (; ";")) (} "}")) (else_clause "else {\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" (else "else") (compound_statement "{\n    set_scsi_pt_cdb(iVar1,local_6e,10);\n    set_scsi_pt_sense(iVar1,local_64,0x40);\n    set_scsi_pt_data_out(iVar1,param_4,param_5);\n    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);\n    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);\n    if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }\n    destruct_scsi_pt_obj(iVar1);\n  }" ({ "{") (expression_statement "set_scsi_pt_cdb(iVar1,local_6e,10);" (call_expression "set_scsi_pt_cdb(iVar1,local_6e,10)" (identifier "set_scsi_pt_cdb") (argument_list "(iVar1,local_6e,10)" (( "(") (identifier "iVar1") (, ",") (identifier "local_6e") (, ",") (number_literal "10") () ")"))) (; ";")) (expression_statement "set_scsi_pt_sense(iVar1,local_64,0x40);" (call_expression "set_scsi_pt_sense(iVar1,local_64,0x40)" (identifier "set_scsi_pt_sense") (argument_list "(iVar1,local_64,0x40)" (( "(") (identifier "iVar1") (, ",") (identifier "local_64") (, ",") (number_literal "0x40") () ")"))) (; ";")) (expression_statement "set_scsi_pt_data_out(iVar1,param_4,param_5);" (call_expression "set_scsi_pt_data_out(iVar1,param_4,param_5)" (identifier "set_scsi_pt_data_out") (argument_list "(iVar1,param_4,param_5)" (( "(") (identifier "iVar1") (, ",") (identifier "param_4") (, ",") (identifier "param_5") () ")"))) (; ";")) (expression_statement "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);" (assignment_expression "uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" (identifier "uVar2") (= "=") (call_expression "do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7)" (identifier "do_scsi_pt") (argument_list "(iVar1,unaff_retaddr,0x3c,param_7)" (( "(") (identifier "iVar1") (, ",") (identifier "unaff_retaddr") (, ",") (number_literal "0x3c") (, ",") (identifier "param_7") () ")")))) (; ";")) (expression_statement "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);" (assignment_expression "iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" (identifier "iVar3") (= "=") (call_expression "sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" (identifier "sg_cmds_process_resp") (argument_list "(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74)" (( "(") (identifier "iVar1") (, ",") (identifier "local_88") (, ",") (identifier "uVar2") (, ",") (number_literal "0") (, ",") (identifier "local_64") (, ",") (identifier "param_6") (, ",") (identifier "param_7") (, ",") (pointer_expression "&local_74" (& "&") (identifier "local_74")) () ")")))) (; ";")) (if_statement "if (iVar3 == -1) {\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }\n    else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" (if "if") (parenthesized_expression "(iVar3 == -1)" (( "(") (binary_expression "iVar3 == -1" (identifier "iVar3") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n      uVar2 = get_scsi_pt_os_err(iVar1);\n      iVar7 = sg_convert_errno(uVar2);\n    }" ({ "{") (expression_statement "uVar2 = get_scsi_pt_os_err(iVar1);" (assignment_expression "uVar2 = get_scsi_pt_os_err(iVar1)" (identifier "uVar2") (= "=") (call_expression "get_scsi_pt_os_err(iVar1)" (identifier "get_scsi_pt_os_err") (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")")))) (; ";")) (expression_statement "iVar7 = sg_convert_errno(uVar2);" (assignment_expression "iVar7 = sg_convert_errno(uVar2)" (identifier "iVar7") (= "=") (call_expression "sg_convert_errno(uVar2)" (identifier "sg_convert_errno") (argument_list "(uVar2)" (( "(") (identifier "uVar2") () ")")))) (; ";")) (} "}")) (else_clause "else {\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" (else "else") (compound_statement "{\n      iVar7 = 0;\n      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }\n    }" ({ "{") (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" (identifier "iVar7") (= "=") (number_literal "0")) (; ";")) (if_statement "if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {\n        iVar7 = 0;\n      }" (if "if") (parenthesized_expression "((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2))" (( "(") (binary_expression "(iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)" (parenthesized_expression "(iVar3 == -2)" (( "(") (binary_expression "iVar3 == -2" (identifier "iVar3") (== "==") (number_literal "-2")) () ")")) (&& "&&") (parenthesized_expression "(iVar7 = local_74, local_74 - 0x14U < 2)" (( "(") (comma_expression "iVar7 = local_74, local_74 - 0x14U < 2" (assignment_expression "iVar7 = local_74" (identifier "iVar7") (= "=") (identifier "local_74")) (, ",") (binary_expression "local_74 - 0x14U < 2" (binary_expression "local_74 - 0x14U" (identifier "local_74") (- "-") (number_literal "0x14U")) (< "<") (number_literal "2"))) () ")"))) () ")")) (compound_statement "{\n        iVar7 = 0;\n      }" ({ "{") (expression_statement "iVar7 = 0;" (assignment_expression "iVar7 = 0" (identifier "iVar7") (= "=") (number_literal "0")) (; ";")) (} "}"))) (} "}")))) (expression_statement "destruct_scsi_pt_obj(iVar1);" (call_expression "destruct_scsi_pt_obj(iVar1)" (identifier "destruct_scsi_pt_obj") (argument_list "(iVar1)" (( "(") (identifier "iVar1") () ")"))) (; ";")) (} "}")))) (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 iVar7;" (return "return") (identifier "iVar7") (; ";")) (} "}")))

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

int function_1(int sg_fd,int mode,int buffer_id,int buffer_offset,void *var_7,int var_8
                      ,type_1 noisy,int var_3)

{
  int var_22;
  type_2 var_2;
  type_3 *var_11;
  int iVar3;
  int var_17;
  type_4 uVar5;
  char *pcVar6;
  type_5 *var_5;
  int var_1;
  int var_20;
  uint8_t wbuf_cdb [10];
  uint8_t var_6 [64];
  
  wbuf_cdb[1] = (type_5)mode & 0x1f;
  var_22 = *(int *)(var_1 + 0x14);
  wbuf_cdb[2] = (uint8_t)buffer_id;
  wbuf_cdb._4_2_ = (type_2)buffer_offset << 8 | (type_2)buffer_offset >> 8;
  wbuf_cdb[0] = ';';
  wbuf_cdb[3] = (uint8_t)((type_4)buffer_offset >> 0x10);
  wbuf_cdb[6] = (uint8_t)((type_4)var_8 >> 0x10);
  var_2 = (type_2)var_8 << 8 | (type_2)var_8 >> 8;
  wbuf_cdb[9] = '\0';
  wbuf_cdb[7] = (char)var_2;
  wbuf_cdb[8] = (char)(var_2 >> 8);
  if (var_3 != 0) {
    pcVar6 = "write buffer";
    var_4("    %s cdb: ","write buffer");
    var_5 = wbuf_cdb;
    do {
      uVar5 = (type_4)*var_5;
      var_5 = var_5 + 1;
      var_4("%02x ",uVar5);
    } while (var_5 != var_6);
    var_4("\n",uVar5);
    if ((1 < var_3 && var_7 != (void *)0x0) && (var_8 != 0)) {
      var_4("    %s parameter list","write buffer");
      if (var_3 == 2) {
        pcVar6 = ", first 256 bytes";
        if (var_8 < 0x101) {
          pcVar6 = "";
        }
        var_4("%s:\n",pcVar6);
        iVar3 = 0x100;
        if (var_8 < 0x101) {
          iVar3 = var_8;
        }
        var_9((uint8_t *)var_7,iVar3,-1);
      }
      else {
        var_4(":\n",pcVar6);
        var_9((uint8_t *)var_7,var_8,0);
      }
    }
  }
  var_11 = var_10();
  if (var_11 == (type_3 *)0x0) {
    iVar3 = -1;
    var_4("%s: out of memory\n","write buffer");
  }
  else {
    var_12(var_11,wbuf_cdb,10);
    var_13(var_11,var_6,0x40);
    var_14(var_11,(uint8_t *)var_7,var_8);
    iVar3 = var_15(var_11,sg_fd,0x3c,var_3);
    var_17 = var_16(var_11,"write buffer",iVar3,0,var_6,noisy,var_3,&var_20);
    if (var_17 == -1) {
      iVar3 = var_18();
      iVar3 = var_19(iVar3);
    }
    else {
      iVar3 = 0;
      if ((var_17 == -2) && (iVar3 = var_20, var_20 - 0x14U < 2)) {
        iVar3 = 0;
      }
    }
    var_21(var_11);
  }
  if (var_22 != *(int *)(var_1 + 0x14)) {
                    /* WARNING: Subroutine does not return */
    var_23();
  }
  return iVar3;
}


(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (identifier)))) body: (compound_statement (declaration type: (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: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (array_declarator declarator: (identifier) size: (number_literal))) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) 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: (subscript_expression argument: (identifier) index: (number_literal)) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)) right: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal))))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (number_literal))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal)) right: (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (binary_expression left: (identifier) right: (number_literal))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (number_literal) right: (identifier)) right: (binary_expression left: (identifier) right: (number_literal)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) consequence: (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier)))) (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: (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: (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: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (number_literal))))) alternative: (else_clause (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (number_literal))))))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (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 (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (identifier))))) alternative: (else_clause (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (number_literal)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (number_literal)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (number_literal) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (number_literal) (identifier) (identifier) (identifier) (pointer_expression argument: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier)))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (number_literal)) right: (number_literal)))))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal)))))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (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(byte param_1,undefined1 param_2,undefined4 param_3,int param_4,int param_5,
                      undefined1 param_6,int param_7)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  uint uVar4;
  int unaff_EBX;
  byte *pbVar5;
  undefined1 uVar6;
  int iVar7;
  int in_GS_OFFSET;
  undefined4 unaff_retaddr;
  int local_88;
  int local_74;
  byte local_6e [4];
  ushort local_6a;
  undefined1 local_68;
  ushort uStack_67;
  undefined1 uStack_65;
  byte local_64 [64];
  int local_24;
  undefined4 uStack_14;
  
  uVar6 = 0;
  uStack_14 = 0x27e0b;
  entry();
  local_6e[1] = param_1 & 0x1f;
  local_24 = *(int *)(in_GS_OFFSET + 0x14);
  local_6e[2] = param_2;
  local_6a = (ushort)param_3 << 8 | (ushort)param_3 >> 8;
  local_6e[0] = 0x3b;
  local_6e[3] = (byte)((uint)param_3 >> 0x10);
  local_68 = (undefined1)((uint)param_5 >> 0x10);
  _uStack_67 = CONCAT12(uVar6,(ushort)param_5 << 8 | (ushort)param_5 >> 8);
  if (param_7 != 0) {
    pr2ws(unaff_EBX + 0x14454,unaff_EBX + 0x14d3b);
    pbVar5 = local_6e;
    do {
      local_88 = unaff_EBX + 0x14d3b;
      uVar4 = (uint)*pbVar5;
      pbVar5 = pbVar5 + 1;
      pr2ws(unaff_EBX + 0x15718,uVar4);
    } while (pbVar5 != local_64);
    pr2ws(unaff_EBX + 0x88d5,uVar4);
    if ((1 < param_7 && param_4 != 0) && (param_5 != 0)) {
      pr2ws(unaff_EBX + 0x14d48,local_88);
      if (param_7 == 2) {
        iVar1 = unaff_EBX + 0x14878;
        if (param_5 < 0x101) {
          iVar1 = unaff_EBX + 0x8bca;
        }
        pr2ws(unaff_EBX + 0x856b,iVar1);
        iVar1 = 0x100;
        if (param_5 < 0x101) {
          iVar1 = param_5;
        }
        hex2stderr(param_4,iVar1,0xffffffff);
      }
      else {
        pr2ws(unaff_EBX + 0x157da,local_88);
        hex2stderr(param_4,param_5,0);
      }
    }
  }
  local_88 = unaff_EBX + 0x14d3b;
  iVar1 = construct_scsi_pt_obj();
  if (iVar1 == 0) {
    iVar7 = -1;
    pr2ws(unaff_EBX + 0x144a4,local_88);
  }
  else {
    set_scsi_pt_cdb(iVar1,local_6e,10);
    set_scsi_pt_sense(iVar1,local_64,0x40);
    set_scsi_pt_data_out(iVar1,param_4,param_5);
    uVar2 = do_scsi_pt(iVar1,unaff_retaddr,0x3c,param_7);
    iVar3 = sg_cmds_process_resp(iVar1,local_88,uVar2,0,local_64,param_6,param_7,&local_74);
    if (iVar3 == -1) {
      uVar2 = get_scsi_pt_os_err(iVar1);
      iVar7 = sg_convert_errno(uVar2);
    }
    else {
      iVar7 = 0;
      if ((iVar3 == -2) && (iVar7 = local_74, local_74 - 0x14U < 2)) {
        iVar7 = 0;
      }
    }
    destruct_scsi_pt_obj(iVar1);
  }
  if (local_24 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    FUN_0002f100();
  }
  return iVar7;
}

