user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r14
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xf28,%rsp
  lea    D22(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x2f18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jle    L156
  lea    0x20(%rsp),%rbx
  mov    $0x1,%ebp
  lea    D25(%rip),%r12
  nopw   0x0(%rax,%rax,1)
L117:
  mov    %ebp,-0x4(%rbx)
  lea    0x4(%rbx),%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%ebp
  add    $0xc,%rbx
  call   <scanf@plt>
  mov    0xc(%rsp),%r9d
  cmp    %ebp,%r9d
  jge    L117
  test   %r9d,%r9d
  jle    L156
  lea    0x1c(%rsp),%r11
  lea    0x1(%r9),%ebx
  mov    $0x1,%ebp
  mov    %r11,%r8
  mov    %r11,%rdx
  nopw   0x0(%rax,%rax,1)
L103:
  mov    %rdx,%rax
  mov    %ebp,%ecx
  nopl   (%rax)
L115:
  mov    0x4(%rdx),%esi
  mov    0x4(%rax),%edi
  cmp    %edi,%esi
  jg     L18
  mov    (%rdx),%r10d
  mov    (%rax),%r12d
  mov    %r12d,(%rdx)
  mov    %r10d,(%rax)
  mov    %edi,0x4(%rdx)
  mov    0x8(%rax),%edi
  mov    %esi,0x4(%rax)
  mov    0x8(%rdx),%esi
  mov    %edi,0x8(%rdx)
  mov    %esi,0x8(%rax)
L18:
  add    $0x1,%ecx
  add    $0xc,%rax
  cmp    %ecx,%r9d
  jge    L115
  add    $0x1,%ebp
  add    $0xc,%rdx
  cmp    %ebx,%ebp
  jne    L103
  mov    $0x1,%ebp
  mov    $0x1,%r10d
  nopw   0x0(%rax,%rax,1)
L17:
  cmp    %r10d,%r9d
  jl     L101
  mov    %r9d,%eax
  sub    %r10d,%eax
  add    %rbp,%rax
  lea    (%rax,%rax,2),%rax
  lea    (%r11,%rax,4),%rcx
  mov    %r8,%rax
  jmp    L51
  nopl   0x0(%rax,%rax,1)
L125:
  add    $0xc,%rax
  cmp    %rcx,%rax
  je     L101
L51:
  mov    0x4(%r8),%edx
  cmp    0x4(%rax),%edx
  jne    L125
  mov    0x8(%r8),%esi
  mov    0x8(%rax),%edi
  cmp    %edi,%esi
  jg     L125
  mov    (%rax),%r14d
  mov    (%r8),%r12d
  add    $0xc,%rax
  mov    %r14d,(%r8)
  mov    %r12d,-0xc(%rax)
  mov    %edx,0x4(%r8)
  mov    %edx,-0x8(%rax)
  mov    %edi,0x8(%r8)
  mov    %esi,-0x4(%rax)
  cmp    %rcx,%rax
  jne    L51
  nopl   0x0(%rax)
L101:
  add    $0x1,%r10d
  add    $0x1,%rbp
  add    $0xc,%r8
  cmp    %ebx,%r10d
  jne    L17
L33:
  mov    %r11,%rbx
  mov    $0x1,%ebp
  lea    D23(%rip),%r12
  nopl   0x0(%rax,%rax,1)
L37:
  mov    0x8(%rbx),%ecx
  mov    0x4(%rbx),%edx
  mov    %r12,%rdi
  add    $0x1,%ebp
  mov    (%rbx),%esi
  add    $0xc,%rbx
  call   <printf@plt>
  cmp    %ebp,0xc(%rsp)
  jge    L37
L40:
  mov    0x2f18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L83
  add    $0x2f28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r14
  ret
L156:
  cmpl   $0x0,0xc(%rsp)
  lea    0x1c(%rsp),%r11
  jle    L40
  jmp    L33
L83:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D22
type: string
name: unpack_data
arguments: data_label: D25
type: string
name: unpack_data
arguments: data_label: D23
type: string

tool: D22: %d

tool: D25: %d %d

tool: D23: %d %d %d


assistant: ```c
int main() {
  int n, i, j, t;
  int score[1003][3];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    score[i][0] = i;
    scanf("%d %d", &score[i][1], &score[i][2]);
  }
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      if (score[i][1] <= score[j][1]) {
        t = score[i][0];
        score[i][0] = score[j][0];
        score[j][0] = t;
        t = score[i][1];
        score[i][1] = score[j][1];
        score[j][1] = t;
        t = score[i][2];
        score[i][2] = score[j][2];
        score[j][2] = t;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      if (score[i][1] == score[j][1] && score[i][2] <= score[j][2]) {
        t = score[i][0];
        score[i][0] = score[j][0];
        score[j][0] = t;
        t = score[i][1];
        score[i][1] = score[j][1];
        score[j][1] = t;
        t = score[i][2];
        score[i][2] = score[j][2];
        score[j][2] = t;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%d %d %d\n", score[i][0], score[i][1], score[i][2]);
  }
}
```