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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xfc0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xfb8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0xc(%rsp)
  lea    D45(%rip),%rdi
  call   <puts@plt>
  lea    D59(%rip),%rdi
  call   <puts@plt>
  lea    D84(%rip),%rdi
  call   <puts@plt>
  lea    0xc(%rsp),%rsi
  lea    D40(%rip),%rdi
  call   <scanf@plt>
  mov    $0x0,%ebx
  cmpl   $0x1,0xc(%rsp)
  je     L9
L28:
  cmpl   $0x2,0xc(%rsp)
  je     L74
L83:
  lea    0x10(%rsp),%r10
  lea    -0x2(%rbx),%eax
  lea    0x14(%rsp,%rax,4),%rsi
  mov    $0x0,%r9d
  mov    $0x1,%r8d
L27:
  cmp    $0x1,%ebx
  jle    L93
  mov    %r10,%rax
  mov    %r9d,%edi
  jmp    L44
L9:
  lea    0x10(%rsp),%rbp
  lea    D75(%rip),%r13
  lea    D40(%rip),%r12
L117:
  add    $0x1,%ebx
  mov    %ebx,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x4,%rbp
  cmpl   $0x2a,-0x4(%rbp)
  jne    L117
  jmp    L28
L74:
  movl   $0x0,0xc(%rsp)
  lea    D106(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  lea    D40(%rip),%rdi
  call   <scanf@plt>
  lea    0x10(%rsp),%r12
  mov    $0x0,%ebp
  lea    D75(%rip),%r14
  lea    D40(%rip),%r13
L61:
  add    $0x1,%ebp
  mov    %ebp,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%ebx
  add    $0x4,%r12
  cmp    %ebx,%ebp
  jne    L61
  jmp    L83
L53:
  add    $0x4,%rax
  cmp    %rsi,%rax
  je     L71
L44:
  mov    (%rax),%ecx
  mov    0x4(%rax),%edx
  cmp    %edx,%ecx
  jle    L53
  mov    %ecx,0x4(%rax)
  mov    %edx,(%rax)
  mov    %r8d,%edi
  jmp    L53
L71:
  test   %edi,%edi
  jne    L27
L93:
  movl   $0x0,0xc(%rsp)
  lea    D96(%rip),%rbp
L33:
  movslq 0xc(%rsp),%rax
  mov    0x10(%rsp,%rax,4),%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0xc(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    %ebx,%eax
  jne    L33
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0xfb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  mov    $0x0,%eax
  add    $0xfc0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L7:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D45
datatype: string
name: unpack_data
arguments: data_tag: D59
datatype: string
name: unpack_data
arguments: data_tag: D84
datatype: string
name: unpack_data
arguments: data_tag: D40
datatype: string
name: unpack_data
arguments: data_tag: D75
datatype: string
name: unpack_data
arguments: data_tag: D106
datatype: string
name: unpack_data
arguments: data_tag: D96
datatype: string

tool: D45: Choose when to stop(Insert 1 or 2):

tool: D59: 1.When enter number 42!

tool: D84: 2.When you want!

tool: D40: %d

tool: D75: Insert %d number:

tool: D106: Insert number of numbers:

tool: D96: %d 

assistant: ```c
int main() {
  int i = 0, n = 0, p = 0;
  int a[1000];
  printf("Choose when to stop(Insert 1 or 2):\n");
  printf("1.When enter number 42!\n");
  printf("2.When you want!\n");
  scanf("%d", &n);
  if (n == 1) {
    do {
      printf("Insert %d number:", i + 1);
      scanf("%d", &a[i]);
      i++;
    } while (a[i - 1] != 42);
  }
  if (n == 2) {
    i = 0;
    n = 0;
    printf("Insert number of numbers:");
    scanf("%d", &n);
    do {
      printf("Insert %d number:", i + 1);
      scanf("%d", &a[i]);
      i++;
    } while (i != n);
  }
  n = 0;
  while (1) {
    p = 0;
    for (n = 0; n < i - 1; n++) {
      if (a[n] > a[n + 1]) {
        a[n] = a[n] + a[n + 1];
        a[n + 1] = a[n] - a[n + 1];
        a[n] = a[n] - a[n + 1];
        p = 1;
      }
    }
    if (p == 0) {
      break;
    }
  }
  n = 0;
  do {
    printf("%d ", a[n]);
    n++;
  } while (n != i);
  printf("\n");
}
```