user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<disk_scsi_inquiry_command>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  mov    $0x10,%ecx
  movq   %rdx,%xmm2
  push   %r14
  mov    %edi,%r14d
  mov    %rsi,%r15
  push   %r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x1f8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1e8(%rsp)
  xor    %eax,%eax
  mov    %rdx,%rax
  movaps %xmm0,0x140(%rsp)
  lea    0x160(%rsp),%rdi
  shr    $0x8,%rax
  lea    0x160(%rsp),%r12
  movq   $0x0,0x150(%rsp)
  lea    0x140(%rsp),%r13
  movl   $0x12,0x140(%rsp)
  movq   %rax,%xmm0
  movzbl %dl,%eax
  mov    D48(%rip),%rdx
  movd   %eax,%xmm1
  mov    %rbp,%rax
  rep stos %rax,%es:(%rdi)
  mov    %rsp,%rdi
  mov    $0x14,%ecx
  punpckldq %xmm1,%xmm0
  rep stos %rax,%es:(%rdi)
  mov    %rsi,0x28(%rsp)
  movabs $0x1800000051,%rax
  mov    %r14d,%edi
  mov    %rax,(%rsp)
  mov    D59(%rip),%rax
  movq   %xmm0,0x14c(%rsp)
  movq   %r12,%xmm0
  mov    (%rax),%eax
  punpcklqdq %xmm2,%xmm0
  mov    %r13,0x8(%rsp)
  movups %xmm0,0x18(%rsp)
  movd   (%rdx),%xmm0
  mov    %rsp,%rdx
  movd   %eax,%xmm3
  mov    D17(%rip),%rax
  movl   $0x80,0x10(%rsp)
  punpckldq %xmm3,%xmm0
  movl   $0x7530,0x30(%rsp)
  movq   %xmm0,0x94(%rsp)
  mov    (%rax),%esi
  call   <ioctl@plt>
  test   %eax,%eax
  je     L33
  mov    D70(%rip),%rdx
  mov    D49(%rip),%rsi
  mov    (%rdx),%rcx
  cmp    %rcx,(%rsi)
  je     L5
L6:
  mov    0x1e8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L39
  add    $0x1f8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L5:
  mov    %rbp,%rax
  lea    0xa0(%rsp),%rdi
  mov    $0x14,%ecx
  rep stos %rax,%es:(%rdi)
  lea    0xa0(%rsp),%rdx
  mov    %r14d,%edi
  movabs $0x5300007530,%rax
  mov    %rax,0xd0(%rsp)
  mov    D104(%rip),%rax
  mov    %r13,0xd8(%rsp)
  mov    (%rax),%eax
  mov    %r15,0xe8(%rsp)
  movl   $0x18,0xe0(%rsp)
  mov    %eax,0x130(%rsp)
  mov    D17(%rip),%rax
  mov    %rbx,0xf0(%rsp)
  mov    (%rax),%esi
  mov    %r12,0xf8(%rsp)
  movl   $0x80,0x100(%rsp)
  call   <ioctl@plt>
  test   %eax,%eax
  jne    L6
  mov    0x108(%rsp),%rax
  or     0x110(%rsp),%rax
  or     0x118(%rsp),%rax
  jne    L72
  cs nopw 0x0(%rax,%rax,1)
L33:
  mov    0x80(%rsp),%rax
  or     0x88(%rsp),%rax
  or     0x78(%rsp),%rax
  jne    L65
  xor    %eax,%eax
  jmp    L6
  xchg   %ax,%ax
L72:
  mov    D37(%rip),%rax
  mov    D49(%rip),%rbx
  mov    (%rax),%rax
  mov    %rax,(%rbx)
  mov    $0xffffffff,%eax
  jmp    L6
L65:
  mov    D37(%rip),%rax
  mov    (%rax),%rdx
  mov    D49(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L6
L39:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int disk_scsi_inquiry_command(const int fd, void *const buf, const size_t buf_len) {
  uint8_t cdb[6] = {
      [0] = 0x12,
      [3] = (buf_len >> 8),
      [4] = (buf_len & 0xff),
  };
  uint8_t sense[32] = {0};
  struct sg_io_v4 io_v4 = {
      .guard = 'Q',
      .protocol = BSG_PROTOCOL_SCSI,
      .subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD,
      .request_len = sizeof(cdb),
      .request = (uintptr_t)cdb,
      .max_response_len = sizeof(sense),
      .response = (uintptr_t)sense,
      .din_xfer_len = buf_len,
      .din_xferp = (uintptr_t)buf,
      .timeout = (30 * 1000),
  };
  int ret;
  ret = ioctl(fd, SG_IO, &io_v4);
  if (ret != 0) {
    if (errno == EINVAL) {
      struct sg_io_hdr io_hdr = {
          .interface_id = 'S',
          .cmdp = (unsigned char *)cdb,
          .cmd_len = sizeof(cdb),
          .dxferp = buf,
          .dxfer_len = buf_len,
          .sbp = sense,
          .mx_sb_len = sizeof(sense),
          .dxfer_direction = SG_DXFER_FROM_DEV,
          .timeout = (30 * 1000),
      };
      ret = ioctl(fd, SG_IO, &io_hdr);
      if (ret != 0) {
        return ret;
      }
      if (!(io_hdr.status == 0 && io_hdr.host_status == 0 && io_hdr.driver_status == 0)) {
        errno = EIO;
        return -1;
      }
    } else {
      return ret;
    }
  }
  if (!(io_v4.device_status == 0 && io_v4.transport_status == 0 && io_v4.driver_status == 0)) {
    errno = EIO;
    return -1;
  }
  return 0;
}
```