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

```asm
<main>:
  endbr64
  push   %r15
  lea    D34(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    $0x1,%ebp
  push   %rbx
  sub    $0xff8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xfe8(%rsp)
  xor    %eax,%eax
  lea    0x24(%rsp),%rax
  lea    0x30(%rsp),%r13
  mov    %rax,%rsi
  mov    %rax,0x10(%rsp)
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  lea    0x28(%rsp),%rcx
  mov    %rcx,0x18(%rsp)
  test   %eax,%eax
  je     L5
L22:
  lea    0x30(%rsp),%r12
  xor    %ebx,%ebx
  test   %eax,%eax
  jle    L99
  nopl   0x0(%rax)
L57:
  mov    %r12,%rsi
  lea    D28(%rip),%rdi
  add    $0x1,%ebx
  add    $0x4,%r12
  call   <scanf@plt>
  cmp    %ebx,0x24(%rsp)
  jg     L57
L99:
  mov    0x18(%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  lea    0x1(%rbp),%eax
  mov    %ebp,%esi
  lea    D36(%rip),%rdi
  mov    %eax,0xc(%rsp)
  xor    %eax,%eax
  mov    $0x4000000,%ebp
  call   <printf@plt>
  lea    0x2c(%rsp),%rax
  movl   $0x1,0x8(%rsp)
  mov    %rax,(%rsp)
  mov    0x28(%rsp),%eax
  test   %eax,%eax
  jle    L37
  cs nopw 0x0(%rax,%rax,1)
L0:
  mov    (%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  jle    L73
  mov    %r13,%r12
  mov    $0x1,%r14d
  nopl   0x0(%rax)
L115:
  cmp    %r14d,%eax
  jle    L73
  mov    %r14,%rbx
L97:
  mov    %ebp,%edi
  sub    0x2c(%rsp),%edi
  call   <abs@plt>
  mov    0x2c(%rsp),%edi
  mov    %rax,%r15
  mov    0x0(%r13,%rbx,4),%eax
  add    (%r12),%eax
  sub    %eax,%edi
  call   <abs@plt>
  cmp    %rax,%r15
  jle    L66
  mov    0x0(%r13,%rbx,4),%ebp
  add    (%r12),%ebp
L66:
  mov    0x24(%rsp),%eax
  add    $0x1,%rbx
  cmp    %ebx,%eax
  jg     L97
  add    $0x1,%r14
  add    $0x4,%r12
  lea    -0x1(%r14),%edx
  cmp    %edx,%eax
  jg     L115
  nopl   0x0(%rax)
L73:
  mov    0x2c(%rsp),%esi
  mov    %ebp,%edx
  lea    D46(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,0x28(%rsp)
  jge    L0
L37:
  mov    0x10(%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  je     L5
  mov    0xc(%rsp),%ebp
  jmp    L22
L5:
  mov    0xfe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L120
  add    $0xff8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L120:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D34
type_infered: string
name: read_data
arguments: data_label: D28
type_infered: string
name: read_data
arguments: data_label: D36
type_infered: string
name: read_data
arguments: data_label: D46
type_infered: string

tool: D34: %d


tool: D28:  %d

tool: D36: Case %d:


tool: D46: Closest sum to %d is %d.


assistant: ```c
int main(void) {
  int i, n, m, num[1005], t;
  scanf("%d\n", &n);
  t = 1;
  while (0 != n) {
    for (i = 0; i < n; i++)
      scanf(" %d", &num[i]);
    int q, k, m, dif, s;
    dif = (1 << 26);
    scanf("%d\n", &q);
    printf("Case %d:\n", t++);
    for (i = 1; i <= q; i++) {
      scanf("%d\n", &s);
      for (k = 0; k < n; k++)
        for (m = k + 1; m < n; m++)
          if (abs(dif - s) > abs(s - (num[k] + num[m])))
            dif = (num[k] + num[m]);
      printf("Closest sum to %d is %d.\n", s, dif);
    }
    scanf("%d\n", &n);
  }
}
```