user: Converte this assembly snippet into its equivalent C code:

```asm
<checkAllBusesWright>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  movl   $0x0,-0x24(%rbp)
  jmp    L78
L29:
  movl   $0x0,-0x20(%rbp)
  jmp    L120
L35:
  movl   $0x0,-0x1c(%rbp)
  jmp    L2
L37:
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%ecx
  mov    -0x24(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <checkDevice@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0xffffffff,-0x14(%rbp)
  je     L134
  mov    -0x14(%rbp),%eax
  shr    $0x10,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  movzwl %ax,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x8086,-0xc(%rbp)
  jne    L134
  cmpl   $0x1e00,-0x10(%rbp)
  jne    L134
  mov    -0x1c(%rbp),%ecx
  mov    -0x20(%rbp),%edx
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x24(%rbp),%eax
  shl    $0x10,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  shl    $0xb,%eax
  or     %eax,%edx
  mov    -0x1c(%rbp),%eax
  shl    $0x8,%eax
  or     %edx,%eax
  or     $0x80000018,%eax
  mov    $0xcf8,%esi
  mov    %eax,%edi
  call   <outl@plt>
  mov    $0xcfc,%edi
  call   <inl@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x8(%rbp),%eax
  and    $0xfffc,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x4(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%esi
  mov    $0x5a,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edi
  call   <inb@plt>
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x4(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edi
  call   <inb@plt>
  cmp    $0x5a,%eax
  jne    L141
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L141:
  mov    -0x4(%rbp),%eax
  add    $0x6,%eax
  mov    %eax,%esi
  mov    $0xe0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  mov    %eax,%edi
  call   <inb@plt>
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  nop
L86:
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  mov    %eax,%edi
  call   <inb@plt>
  and    $0x80,%eax
  test   %eax,%eax
  jne    L86
  mov    -0x4(%rbp),%eax
  add    $0x6,%eax
  mov    %eax,%esi
  mov    $0xe0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x5,%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x6,%eax
  mov    %eax,%esi
  mov    $0xe0,%edi
  call   <outb@plt>
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  mov    %eax,%esi
  mov    $0x20,%edi
  call   <outb@plt>
  nop
L136:
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  mov    %eax,%edi
  call   <inb@plt>
  and    $0x80,%eax
  test   %eax,%eax
  jne    L136
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  mov    %eax,%edi
  call   <inb@plt>
  and    $0x80,%eax
  test   %eax,%eax
  jne    L134
  movl   $0x0,-0x18(%rbp)
  jmp    L107
L100:
  mov    -0x4(%rbp),%eax
  cltq
  mov    %rax,%rdi
  call   <inw@plt>
  mov    %eax,%esi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x18(%rbp)
L107:
  cmpl   $0xff,-0x18(%rbp)
  jle    L100
L134:
  addl   $0x1,-0x1c(%rbp)
L2:
  cmpl   $0x7,-0x1c(%rbp)
  jle    L37
  addl   $0x1,-0x20(%rbp)
L120:
  cmpl   $0x1f,-0x20(%rbp)
  jle    L35
  addl   $0x1,-0x24(%rbp)
L78:
  cmpl   $0xff,-0x24(%rbp)
  jle    L29
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D23
type_infered: string
name: unpack_data
arguments: tag: D20
type_infered: string
name: unpack_data
arguments: tag: D1
type_infered: string
name: unpack_data
arguments: tag: D38
type_infered: string

tool: D23: @ %d %d %d


tool: D20: %X


tool: D1: register pritomen

tool: D38: 0x%X


assistant: ```c
int checkAllBusesWright() {
  int bus;
  int device;
  int function;
  uint32_t got, bar2, base;
  uint16_t ven, dev;
  for (bus = 0; bus < 256; bus++) {
    for (device = 0; device < 32; device++) {
      for (function = 0; function < 8; function++) {
        got = checkDevice(bus, device, function);
        if (got != 0xFFFFFFFF) {
          dev = (uint16_t)((got >> 16) & 0xffff);
          ven = (uint16_t)((got >> 0) & 0xffff);
          if (ven == 0x8086 && (dev == 0x1e00)) {
            printf("@ %d %d %d\n", bus, device, function);
            outl(0x80000000 | (bus << 16) | (device << 11) | (function << 8) | 0x18 & 0xfc, 0xCF8);
            bar2 = inl(0xCFC);
            printf("%X\n", bar2);
            base = bar2 & 0xFFFC;
            printf("%X\n", base);
            outb(0x5A, base + 2);
            printf("%X\n", inb(base + 2));
            if (inb(base + 2) == 0x5A) {
              printf("register pritomen\n");
            }
            outb(0xE0, base + 6);
            printf("%X\n", inb(base + 7));
            while ((inb(base + 7) & 0x80) != 0)
              ;
            outb(0xE0, base + 6);
            outb(0x01, base + 2);
            outb(0x00, base + 3);
            outb(0x00, base + 4);
            outb(0x00, base + 5);
            outb(0xE0, base + 6);
            outb(0x20, base + 7);
            while ((inb(base + 7) & 0x80) != 0)
              ;
            if ((inb(base + 7) & 0x80) == 0) {
              int i;
              for (i = 0; i < 256; i++) {
                printf("0x%X\n", inw(base + 0));
              }
            }
          }
        }
      }
    }
  }
  return 0;
}
```