user: Please show me the C implementation that matches the assembly code listed below:

```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     L4
L59:
  lea    0x30(%rsp),%r12
  xor    %ebx,%ebx
  test   %eax,%eax
  jle    L95
  nopl   0x0(%rax)
L83:
  mov    %r12,%rsi
  lea    D11(%rip),%rdi
  add    $0x1,%ebx
  add    $0x4,%r12
  call   <scanf@plt>
  cmp    %ebx,0x24(%rsp)
  jg     L83
L95:
  mov    0x18(%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  lea    0x1(%rbp),%eax
  mov    %ebp,%esi
  lea    D14(%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    L114
  cs nopw 0x0(%rax,%rax,1)
L93:
  mov    (%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  jle    L97
  mov    %r13,%r12
  mov    $0x1,%r14d
  nopl   0x0(%rax)
L120:
  cmp    %r14d,%eax
  jle    L97
  mov    %r14,%rbx
L126:
  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    L73
  mov    0x0(%r13,%rbx,4),%ebp
  add    (%r12),%ebp
L73:
  mov    0x24(%rsp),%eax
  add    $0x1,%rbx
  cmp    %ebx,%eax
  jg     L126
  add    $0x1,%r14
  add    $0x4,%r12
  lea    -0x1(%r14),%edx
  cmp    %edx,%eax
  jg     L120
  nopl   0x0(%rax)
L97:
  mov    0x2c(%rsp),%esi
  mov    %ebp,%edx
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,0x28(%rsp)
  jge    L93
L114:
  mov    0x10(%rsp),%rsi
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  je     L4
  mov    0xc(%rsp),%ebp
  jmp    L59
L4:
  mov    0xfe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L90
  add    $0xff8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L90:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D34
datatype: string
name: parse_data
arguments: data_label: D11
datatype: string
name: parse_data
arguments: data_label: D14
datatype: string
name: parse_data
arguments: data_label: D6
datatype: string

tool: D34: %d


tool: D11:  %d

tool: D14: Case %d:


tool: D6: 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);
  }
}
```