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

```asm
<main>:
  endbr64
  push   %r15
  lea    D31(%rip),%rdi
  lea    D58(%rip),%r15
  push   %r14
  lea    D40(%rip),%r14
  push   %r13
  lea    D53(%rip),%r13
  push   %r12
  mov    %r13,%rsi
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <fopen@plt>
  mov    %rax,%r12
L10:
  mov    $0x1,%ebx
  jmp    L17
  nopw   0x0(%rax,%rax,1)
L6:
  sub    $0x8,%rsp
  mov    $0x40,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  push   %rbx
  mov    %ebp,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %ebx,%ecx
  mov    %r14,%rsi
  mov    $0x40,%r9d
  mov    %ebp,%r8d
  mov    %ebp,%edx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    %ebx,(%rsp)
  call   <fprintf@plt>
  pop    %rcx
  pop    %rsi
  cmp    $0x40,%ebx
  je     L82
L64:
  add    $0x1,%ebx
L17:
  cmp    $0x10,%ebx
  jbe    L57
  cmp    $0x20,%ebx
  jg     L6
  sub    $0x8,%rsp
  mov    $0x20,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  push   %rbx
  mov    %ebp,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %ebx,(%rsp)
  mov    $0x20,%r9d
L73:
  mov    %ebp,%edx
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  mov    %r14,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  pop    %rax
  pop    %rdx
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L57:
  sub    $0x8,%rsp
  mov    $0x10,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  push   %rbx
  mov    %ebp,%edx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %ebx,(%rsp)
  mov    $0x10,%r9d
  jmp    L73
L82:
  add    $0x1,%ebp
  cmp    $0x8,%ebp
  jne    L10
  mov    %r12,%rdi
  lea    D47(%rip),%r15
  mov    $0x1,%r12d
  call   <fclose@plt>
  mov    %r13,%rsi
  lea    D7(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  nopl   (%rax)
L33:
  mov    %r12d,%ebp
  xor    %ebx,%ebx
  shl    $0x4,%ebp
  nopl   0x0(%rax,%rax,1)
L91:
  mov    %ebx,%ecx
  mov    %ebp,%edx
  mov    %r12d,%r9d
  mov    $0x75,%r8d
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  lea    0x1(%rbp),%edx
  mov    %ebx,%ecx
  mov    %r12d,%r9d
  mov    $0x69,%r8d
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  add    $0x1,%ebx
  add    $0x2,%ebp
  cmp    $0x8,%ebx
  jne    L91
  add    $0x1,%r12d
  cmp    $0x41,%r12d
  jne    L33
  mov    %r13,%rsi
  lea    D22(%rip),%rdi
  mov    $0x1,%ebp
  call   <fopen@plt>
  lea    D64(%rip),%r14
  mov    %rax,%r13
  nopl   0x0(%rax,%rax,1)
L56:
  mov    %ebp,%r12d
  xor    %ebx,%ebx
  shl    $0x4,%r12d
  nopl   0x0(%rax)
L34:
  sub    $0x8,%rsp
  mov    %ebx,%ecx
  mov    %r12d,%edx
  mov    %ebp,%r9d
  push   %rbp
  mov    $0x75,%r8d
  mov    %r14,%rsi
  mov    %r13,%rdi
  push   $0x75
  xor    %eax,%eax
  push   %rbx
  call   <fprintf@plt>
  add    $0x18,%rsp
  lea    0x1(%r12),%edx
  mov    %ebx,%ecx
  push   %rbp
  mov    %ebp,%r9d
  mov    $0x69,%r8d
  mov    %r14,%rsi
  push   $0x69
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x2,%r12d
  push   %rbx
  add    $0x1,%ebx
  call   <fprintf@plt>
  add    $0x20,%rsp
  cmp    $0x8,%ebx
  jne    L34
  add    $0x1,%ebp
  cmp    $0x41,%ebp
  jne    L56
  mov    %r13,%rdi
  call   <fclose@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: tag: D31
type: string
name: unpack_data
arguments: tag: D58
type: string
name: unpack_data
arguments: tag: D40
type: string
name: unpack_data
arguments: tag: D53
type: string
name: unpack_data
arguments: tag: D47
type: string
name: unpack_data
arguments: tag: D7
type: string
name: unpack_data
arguments: tag: D22
type: string
name: unpack_data
arguments: tag: D64
type: string

tool: D31: bitfield.struct.inc

tool: D58: struct off%di%d { long : %d; int%d_t  data : %d; } __attribute__ ((packed));


tool: D40: struct off%du%d { long : %d; uint%d_t data : %d; } __attribute__ ((packed));


tool: D53: w

tool: D47: case %d: return ((struct off%d%c%d *) data)->data;


tool: D7: bitfield.function.get.inc

tool: D22: bitfield.function.set.inc

tool: D64: case %d: { int64_t ov = ((struct off%d%c%d *) data)->data; ((struct off%d%c%d *) data)->data = value; return ov; }


assistant: ```c
int main() {
  int i;
  int off;
  FILE *f;
  f = fopen("bitfield.struct.inc", "w");
  for (off = 0; off < 8; off++) {
    for (i = 1; i <= 64; i++) {
      int nbits;
      if (i <= 16)
        nbits = 16;
      else if (i <= 32)
        nbits = 32;
      else
        nbits = 64;
      fprintf(f, "struct off%di%d { long : %d; int%d_t  data : %d; } __attribute__ ((packed));\n", off, i, off, nbits, i);
      fprintf(f, "struct off%du%d { long : %d; uint%d_t data : %d; } __attribute__ ((packed));\n", off, i, off, nbits, i);
    }
  }
  fclose(f);
  int is_signed;
  f = fopen("bitfield.function.get.inc", "w");
  for (i = 1; i <= 64; i++) {
    for (off = 0; off < 8; off++) {
      for (is_signed = 0; is_signed < 2; is_signed++) {
        fprintf(f, "case %d: return ((struct off%d%c%d *) data)->data;\n", i * 16 + off * 2 + is_signed, off, is_signed ? 'i' : 'u', i);
      }
    }
  }
  f = fopen("bitfield.function.set.inc", "w");
  for (i = 1; i <= 64; i++) {
    for (off = 0; off < 8; off++) {
      for (is_signed = 0; is_signed < 2; is_signed++) {
        fprintf(f, "case %d: { int64_t ov = ((struct off%d%c%d *) data)->data; ((struct off%d%c%d *) data)->data = value; return ov; }\n", i * 16 + off * 2 + is_signed, off, is_signed ? 'i' : 'u', i, off, is_signed ? 'i' : 'u', i);
      }
    }
  }
  fclose(f);
}
```