user: 请将以下的汇编代码转换成C语言代码:

```asm
<threeSumClosest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%r13d
  mov    %edx,%ebp
  call   <bubblesort@plt>
  mov    0x4(%r12),%eax
  add    (%r12),%eax
  mov    %eax,%ebx
  add    0x8(%r12),%ebx
  cmp    %ebp,%ebx
  jge    L16
  movslq %r13d,%rdx
  shl    $0x2,%rdx
  mov    -0x4(%r12,%rdx,1),%esi
  mov    %esi,%r14d
  add    -0x8(%r12,%rdx,1),%r14d
  add    -0xc(%r12,%rdx,1),%r14d
  cmp    %ebp,%r14d
  jle    L11
  add    %esi,%eax
  cmp    %eax,%ebp
  jle    L248
  cmp    $0x2,%r13d
  jle    L179
  lea    0x4(%r12),%rcx
  lea    -0x2(%r13),%edi
  mov    $0x0,%edx
L32:
  mov    %edx,%r15d
  add    $0x1,%edx
  mov    0x4(%rcx),%eax
  add    (%rcx),%eax
  add    %esi,%eax
  cmp    %eax,%ebp
  jle    L56
  add    $0x4,%rcx
  cmp    %edi,%edx
  jne    L32
  test   %edx,%edx
  jg     L168
  mov    %ebx,%edx
  mov    %r14d,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    %ebx,%ecx
  mov    %r14d,%ebx
L165:
  lea    (%rcx,%rbx,1),%eax
  add    %ebp,%ebp
  cmp    %ebp,%eax
  cmovg  %ecx,%ebx
  jmp    L16
L56:
  test   %edx,%edx
  cmovle %edx,%r15d
L168:
  mov    %ebx,%edx
  mov    %r14d,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  lea    -0x2(%r13),%eax
  cmp    %eax,%r15d
  jge    L93
  movslq %r15d,%rsi
  mov    %eax,%r8d
  mov    %ebx,%ecx
  lea    -0x1(%r13),%r9d
L144:
  lea    0x1(%r15),%edi
  cmp    %r9d,%edi
  jge    L84
  add    $0x2,%r15d
  movslq %r15d,%r15
  mov    %r8d,%eax
  sub    %edi,%eax
  lea    0x3(%rsi,%rax,1),%r10
  jmp    L48
L248:
  mov    $0x0,%r15d
  jmp    L168
L239:
  mov    %ebx,%ecx
L107:
  add    $0x1,%rax
  cmp    %eax,%r13d
  jle    L60
L193:
  mov    %edx,%ebx
  add    (%r12,%rax,4),%ebx
  cmp    %ebx,%ebp
  je     L16
  jle    L13
  cmp    %ecx,%ebx
  jg     L239
L13:
  cmp    %ebx,%ebp
  jge    L107
  cmp    %ebx,%r14d
  cmovg  %ebx,%r14d
L60:
  add    $0x1,%r15
  cmp    %r10,%r15
  je     L84
L48:
  cmp    %r15d,%r13d
  jle    L60
  mov    -0x4(%r12,%r15,4),%edx
  add    (%r12,%rsi,4),%edx
  movslq %r15d,%rax
  jmp    L193
L84:
  add    $0x1,%rsi
  cmp    %r8d,%edi
  je     L97
  mov    %edi,%r15d
  jmp    L144
L97:
  mov    %r14d,%ebx
  jmp    L165
L93:
  mov    %ebx,%ecx
  mov    %r14d,%ebx
  jmp    L165
L11:
  mov    %r14d,%ebx
L16:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L179:
  mov    %ebx,%edx
  mov    %r14d,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    %ebx,%ecx
  mov    %r14d,%ebx
  jmp    L165
```

tool_calls: name: unpack_data
arguments: data_tag: D4
type_infered: string

tool: D4: max:%d min:%d 


assistant: ```c
int threeSumClosest(int *A, int n, int target) {
  int i = 0, j = 0, k = 0;
  bubblesort(A, n);
  int min = A[0] + A[1] + A[2];
  int max = A[n - 1] + A[n - 2] + A[n - 3];
  if (min >= target)
    return min;
  if (max <= target)
    return max;
  int sum = A[0] + A[1] + A[n - 1];
  while (sum < target && i < n - 2) {
    i++;
    sum = A[i] + A[i + 1] + A[n - 1];
  }
  if (i > 0)
    i--;
  printf("max:%d min:%d \n", max, min);
  for (; i < n - 2; i++) {
    for (j = i + 1; j < n - 1; j++) {
      for (k = j + 1; k < n; k++) {
        sum = A[i] + A[j] + A[k];
        if (sum == target) {
          return target;
        }
        if (sum < target && sum > min)
          min = sum;
        if (sum > target) {
          if (sum < max)
            max = sum;
          break;
        }
      }
    }
  }
  if (max + min > target * 2)
    return min;
  return max;
}
```