// File: /workspace/github_cpp_makefile_star2_O3/trapexit[P]bbf/src/sg.cpp
// Function: sg::exec(int, int, int, sg::ata_tf const*, void*, unsigned int, unsigned int)
int
  exec(const int            fd,
       const int            rw,
       const int            dma,
       const struct ata_tf *tf,
       void                *data,
       const unsigned int   data_bytes,
       const unsigned int   timeout)
  {
    int rv;
    uint8_t cdb[SG_ATA_16_LEN] = {0};
    uint8_t sb[32]             = {0};
    sg_io_hdr_t io_hdr         = {0};

    if(data && data_bytes && !rw)
      memset(data,0,data_bytes);

    cdb[1]         = calculate_cdb1(dma,rw,data);
    cdb[2]         = calculate_cdb2(rw,data);
    io_hdr.cmd_len = populate_cdb_from_tf(cdb,tf);
    populate_io_hdr(&io_hdr,cdb,sb,tf,data,data_bytes,rw,timeout);

    return sg::exec_core(fd,io_hdr);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r9d, %ebp
movq %r8, %r15
movq %rcx, %r14
movl %edx, %r13d
movl %esi, %r12d
movl %edi, 0x2c(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movups %xmm0, 0x90(%rsp)
movups %xmm0, 0x80(%rsp)
movups %xmm0, 0x70(%rsp)
movups %xmm0, 0x60(%rsp)
movups %xmm0, 0x50(%rsp)
testl %esi, %esi
jne 0x14795
testq %r15, %r15
je 0x14795
testl %ebp, %ebp
je 0x14795
movl %ebp, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4280
testl %r13d, %r13d
setne %al
testq %r15, %r15
setne %cl
movb $0xc, %bl
testb %cl, %al
jne 0x147e3
testq %r15, %r15
sete %al
testl %r13d, %r13d
setne %cl
movb $0x6, %bl
testb %al, %cl
jne 0x147e3
testq %r15, %r15
setne %al
testl %r12d, %r12d
setne %cl
movb $0xa, %bl
testb %al, %cl
jne 0x147e3
testq %r15, %r15
setne %al
addb %al, %al
addb $0x6, %al
testl %r12d, %r12d
movzbl %al, %eax
movl $0x6, %ebx
cmovel %eax, %ebx
testq %r15, %r15
movl $0x20, %eax
movl $0xe, %ecx
cmovel %eax, %ecx
leaq 0x18(%rsp), %rdx
testl %r12d, %r12d
cmovnel %eax, %ecx
testq %r15, %r15
movl $0x6, %eax
cmovel %ecx, %eax
leaq 0x19(%rsp), %r9
testl %r12d, %r12d
cmovel %ecx, %eax
movb %bl, -0x8(%r9)
movb %al, -0x7(%r9)
movb 0x4(%r14), %al
movb %al, 0xf(%rsp)
testb %al, %al
je 0x148a1
leaq 0x1a(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x1b(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x1c(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rdx, %r10
leaq 0x1d(%rsp), %rdx
movq %r9, %r11
leaq 0x1e(%rsp), %r9
orb $0x1, %bl
movb %bl, -0xd(%r9)
movb 0xa(%r14), %al
movb %al, -0xb(%r9)
movb 0x5(%r14), %al
movb %al, -0xa(%r9)
movb 0xb(%r14), %al
movb %al, -0x9(%r9)
movb 0x6(%r14), %al
movb %al, -0x8(%r9)
movb 0xc(%r14), %al
movb %al, -0x7(%r9)
movb $0x10, %cl
movl $0xe, %ebx
movl $0x8, %r13d
movl $0xd, %eax
movl $0x7, %esi
movb $-0x7b, %dil
jmp 0x148e3
leaq 0x13(%rsp), %r10
leaq 0x14(%rsp), %r11
leaq 0x15(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x16(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x17(%rsp), %rax
movq %rax, 0x30(%rsp)
movl $0x8, %ebx
movl $0x7, %r13d
movl $0x6, %eax
movb $0xc, %cl
movl $0x5, %esi
movb $-0x5f, %dil
leaq 0x10(%rsp), %r8
movb %dil, (%r8)
movb (%r14,%rsi), %sil
movb %sil, (%r10)
movb (%r14,%rax), %al
movb %al, (%r11)
movb (%r14,%r13), %al
movq 0x40(%rsp), %rsi
movb %al, (%rsi)
movb (%r14,%rbx), %al
movq 0x38(%rsp), %rsi
movb %al, (%rsi)
movb 0x9(%r14), %al
movq 0x30(%rsp), %rsi
movb %al, (%rsi)
movb (%r14), %al
movb %al, (%rdx)
movb 0x1(%r14), %dl
movb %dl, (%r9)
cmpl $0x1, %r12d
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
sbbl $0x0, %edx
xorl %esi, %esi
cmpq $0x1, %r15
movl $0x0, %edi
sbbl %edi, %edi
orl %edx, %edi
testq %r15, %r15
cmovel %esi, %ebp
movb %cl, 0x50(%rsp)
movl $0x53, 0x48(%rsp)
movl %edi, 0x4c(%rsp)
movq %r15, 0x58(%rsp)
movl 0x100(%rsp), %esi
movl %ebp, 0x54(%rsp)
movq %r8, 0x60(%rsp)
leaq 0xa0(%rsp), %rdx
movq %rdx, 0x68(%rsp)
movb $0x20, 0x51(%rsp)
movzwl 0x8(%r14), %edx
movzbl 0x7(%r14), %edi
cmpb $0x0, 0xf(%rsp)
je 0x14995
movb 0xc(%r14), %al
jmp 0x14997
andb $0xf, %al
movzbl %al, %eax
shll $0x8, %edx
orl %edi, %edx
shll $0x18, %eax
orl %edx, %eax
leaq 0x48(%rsp), %rdx
movl %eax, 0x30(%rdx)
testl %esi, %esi
movl $0x3e8, %eax            # imm = 0x3E8
cmovnel %esi, %eax
movl %eax, 0x28(%rdx)
xorl %ebp, %ebp
movl $0x2285, %esi           # imm = 0x2285
movl 0x2c(%rsp), %edi
xorl %eax, %eax
callq 0x45b0
cmpl $-0x1, %eax
je 0x149f2
movzbl 0x88(%rsp), %eax
testb $-0x3, %al
jne 0x149fb
movzwl 0x8c(%rsp), %ebp
testl %ebp, %ebp
je 0x14a14
orl $0x100, %ebp            # imm = 0x100
negl %ebp
jmp 0x14a00
callq 0x4060
subl (%rax), %ebp
jmp 0x14a00
movl $0xffffffcc, %ebp       # imm = 0xFFFFFFCC
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl 0x8e(%rsp), %ebp
testl %ebp, %ebp
je 0x14a2e
orl $0x200, %ebp            # imm = 0x200
cmpl $0x208, %ebp            # imm = 0x208
jne 0x149ee
movq 0x68(%rsp), %rdi
callq 0xfe81
xorl %ebp, %ebp
testb %al, %al
je 0x14a00
movq 0x68(%rsp), %rdi
callq 0xfe81
cmpb $0x1, %al
je 0x14a00
movq 0x68(%rsp), %rdi
callq 0x145f5
movl %eax, %ebp
jmp 0x149ee