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

```asm
<typelogicalmath>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D23(%rip),%r13
  push   %r12
  lea    D64(%rip),%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x18,%rsp
L65:
  xor    %r15d,%r15d
L329:
  xor    %r14d,%r14d
  mov    %r15d,%eax
  mov    %ebx,%r15d
  mov    %r14d,%ebx
  mov    %eax,%r14d
L376:
  movl   $0x0,0xc(%rsp)
  mov    %r14d,%eax
  mov    %ebx,%r14d
  mov    %eax,%ebx
  nopl   0x0(%rax)
L184:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L168:
  push   %rbp
  mov    0x14(%rsp),%eax
  mov    %r14d,%r9d
  mov    %ebx,%r8d
  lea    D19(%rip),%rcx
  xor    %edx,%edx
  mov    %r15d,%esi
  add    $0x1,%ebp
  push   %rax
  mov    $0x8000,%edi
  call   <dumpx@plt>
  pop    %r9
  pop    %r10
  cmp    $0x8,%ebp
  jne    L168
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    $0x8,%eax
  jne    L184
  mov    %ebx,%eax
  mov    %r14d,%ebx
  add    $0x1,%ebx
  mov    %eax,%r14d
  cmp    $0x3,%ebx
  jne    L376
  mov    %r15d,%ebx
  cmp    $0x1,%eax
  je     L349
  mov    $0x1,%r15d
  jmp    L329
L349:
  xor    %r15d,%r15d
L114:
  xor    %r14d,%r14d
  mov    %r15d,%eax
  mov    %ebx,%r15d
  mov    %r14d,%ebx
  mov    %eax,%r14d
L80:
  movl   $0x0,0xc(%rsp)
  mov    %r14d,%eax
  mov    %ebx,%r14d
  mov    %eax,%ebx
  nopl   0x0(%rax)
L115:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L55:
  push   %rbp
  mov    0x14(%rsp),%eax
  mov    %ebx,%r8d
  mov    $0x9000,%edi
  mov    %r14d,%r9d
  mov    %r13,%rcx
  mov    $0x4,%edx
  mov    %r15d,%esi
  push   %rax
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rdi
  pop    %r8
  cmp    $0x8,%ebp
  jne    L55
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    $0x8,%eax
  jne    L115
  mov    %ebx,%eax
  mov    %r14d,%ebx
  add    $0x1,%ebx
  mov    %eax,%r14d
  cmp    $0x3,%ebx
  jne    L80
  mov    %r15d,%ebx
  cmp    $0x1,%eax
  je     L149
  mov    $0x1,%r15d
  jmp    L114
L149:
  xor    %r15d,%r15d
L200:
  xor    %r14d,%r14d
  nopl   0x0(%rax,%rax,1)
L40:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L203:
  push   %rbp
  mov    %r13,%rcx
  mov    %ebx,%esi
  mov    $0x3,%r9d
  push   %r14
  mov    %r15d,%r8d
  mov    $0x3,%edx
  mov    $0x9000,%edi
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rcx
  pop    %rsi
  cmp    $0x8,%ebp
  jne    L203
  add    $0x1,%r14d
  cmp    $0x8,%r14d
  jne    L40
  cmp    $0x1,%r15d
  je     L189
  mov    $0x1,%r15d
  jmp    L200
L189:
  xor    %r15d,%r15d
L273:
  xor    %r14d,%r14d
  nopl   0x0(%rax,%rax,1)
L323:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L197:
  push   %rbp
  mov    $0x1,%edx
  mov    %r15d,%r9d
  xor    %r8d,%r8d
  push   %r14
  lea    D52(%rip),%rcx
  mov    %ebx,%esi
  mov    $0xb000,%edi
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rax
  pop    %rdx
  cmp    $0x8,%ebp
  jne    L197
  add    $0x1,%r14d
  cmp    $0x8,%r14d
  jne    L323
  add    $0x1,%r15d
  cmp    $0x3,%r15d
  jne    L273
  xor    %r15d,%r15d
L167:
  xor    %r14d,%r14d
  nopl   (%rax)
L288:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L207:
  push   %rbp
  mov    $0x3,%r9d
  mov    %r15d,%r8d
  mov    $0x3,%edx
  push   %r14
  lea    D52(%rip),%rcx
  mov    %ebx,%esi
  mov    $0xb000,%edi
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %r11
  pop    %rax
  cmp    $0x8,%ebp
  jne    L207
  add    $0x1,%r14d
  cmp    $0x8,%r14d
  jne    L288
  cmp    $0x1,%r15d
  je     L299
  mov    $0x1,%r15d
  jmp    L167
L299:
  xor    %r15d,%r15d
L164:
  xor    %r14d,%r14d
  nopl   (%rax)
L235:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L237:
  push   %rbp
  mov    $0x3,%r9d
  mov    %r15d,%r8d
  mov    %r12,%rcx
  push   %r14
  mov    $0x3,%edx
  mov    %ebx,%esi
  mov    $0xd000,%edi
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %r9
  pop    %r10
  cmp    $0x8,%ebp
  jne    L237
  add    $0x1,%r14d
  cmp    $0x8,%r14d
  jne    L235
  cmp    $0x1,%r15d
  je     L183
  mov    $0x1,%r15d
  jmp    L164
L183:
  xor    %r15d,%r15d
L205:
  xor    %r14d,%r14d
  nopw   0x0(%rax,%rax,1)
L3:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L344:
  push   %rbp
  mov    $0x1,%r8d
  mov    $0xb100,%edi
  mov    %r15d,%r9d
  push   %r14
  lea    D0(%rip),%rcx
  mov    $0x2,%edx
  mov    %ebx,%esi
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rdi
  pop    %r8
  cmp    $0x8,%ebp
  jne    L344
  add    $0x1,%r14d
  cmp    $0x8,%r14d
  jne    L3
  add    $0x1,%r15d
  cmp    $0x3,%r15d
  jne    L205
  xor    %r15d,%r15d
L332:
  xor    %r14d,%r14d
  mov    %r15d,%eax
  mov    %ebx,%r15d
  mov    %r14d,%ebx
  mov    %eax,%r14d
L36:
  movl   $0x0,0xc(%rsp)
  mov    %r14d,%eax
  mov    %ebx,%r14d
  mov    %eax,%ebx
  nopl   (%rax)
L99:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L5:
  push   %rbp
  mov    0x14(%rsp),%eax
  lea    D47(%rip),%rcx
  mov    %r15d,%esi
  mov    %r14d,%r9d
  mov    %ebx,%r8d
  xor    %edx,%edx
  mov    $0xc000,%edi
  push   %rax
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rcx
  pop    %rsi
  cmp    $0x8,%ebp
  jne    L5
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    $0x8,%eax
  jne    L99
  mov    %ebx,%eax
  mov    %r14d,%ebx
  add    $0x1,%ebx
  mov    %eax,%r14d
  cmp    $0x3,%ebx
  jne    L36
  mov    %r15d,%ebx
  cmp    $0x1,%eax
  je     L212
  mov    $0x1,%r15d
  jmp    L332
L212:
  xor    %r15d,%r15d
L91:
  xor    %r14d,%r14d
  mov    %r15d,%eax
  mov    %ebx,%r15d
  mov    %r14d,%ebx
  mov    %eax,%r14d
L60:
  movl   $0x0,0xc(%rsp)
  mov    %r14d,%eax
  mov    %ebx,%r14d
  mov    %eax,%ebx
  nopw   0x0(%rax,%rax,1)
L165:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L267:
  push   %rbp
  mov    0x14(%rsp),%eax
  mov    $0x4,%edx
  mov    %r14d,%r9d
  mov    %ebx,%r8d
  mov    %r12,%rcx
  mov    %r15d,%esi
  mov    $0xd000,%edi
  push   %rax
  add    $0x1,%ebp
  call   <dumpx@plt>
  pop    %rax
  pop    %rdx
  cmp    $0x8,%ebp
  jne    L267
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    $0x8,%eax
  jne    L165
  mov    %ebx,%eax
  mov    %r14d,%ebx
  add    $0x1,%ebx
  mov    %eax,%r14d
  cmp    $0x3,%ebx
  jne    L60
  mov    %r15d,%ebx
  cmp    $0x1,%eax
  je     L369
  mov    $0x1,%r15d
  jmp    L91
L369:
  add    $0x1,%ebx
  cmp    $0x8,%ebx
  jne    L65
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: label: D23
type_guessed: string
name: unpack_data
arguments: label: D64
type_guessed: string
name: unpack_data
arguments: label: D19
type_guessed: string
name: unpack_data
arguments: label: D52
type_guessed: string
name: unpack_data
arguments: label: D0
type_guessed: string
name: unpack_data
arguments: label: D47
type_guessed: string

tool: D23: sub

tool: D64: add

tool: D19: or 

tool: D52: cmp

tool: D0: xor

tool: D47: and

assistant: ```c
void typelogicalmath(void) {
  int dir, leng, mode, sreg, reg;
  for (reg = 0; reg < 8; reg++) {
    for (dir = 0; dir < 2; dir++)
      for (leng = 0; leng < 3; leng++)
        for (mode = 0; mode < 8; mode++)
          for (sreg = 0; sreg < 8; sreg++)
            dumpx(0x8000, reg, 0, "or ", dir, leng, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (leng = 0; leng < 3; leng++)
        for (mode = 0; mode < 8; mode++)
          for (sreg = 0; sreg < 8; sreg++)
            dumpx(0x9000, reg, 4, "sub", dir, leng, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dumpx(0x9000, reg, 3, "sub", dir, 3, mode, sreg);
    for (leng = 0; leng < 3; leng++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dumpx(0xb000, reg, 1, "cmp", 0, leng, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dumpx(0xb000, reg, 3, "cmp", dir, 3, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dumpx(0xd000, reg, 3, "add", dir, 3, mode, sreg);
    for (leng = 0; leng < 3; leng++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dumpx(0xb100, reg, 2, "xor", 1, leng, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (leng = 0; leng < 3; leng++)
        for (mode = 0; mode < 8; mode++)
          for (sreg = 0; sreg < 8; sreg++)
            dumpx(0xc000, reg, 0, "and", dir, leng, mode, sreg);
    for (dir = 0; dir < 2; dir++)
      for (leng = 0; leng < 3; leng++)
        for (mode = 0; mode < 8; mode++)
          for (sreg = 0; sreg < 8; sreg++)
            dumpx(0xd000, reg, 4, "add", dir, leng, mode, sreg);
  }
}
```