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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x9000(%rsp),%r11
L75:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L75
  sub    $0xfb8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x9fa8(%rsp)
  xor    %eax,%eax
  lea    0x38(%rsp),%rsi
  lea    D22(%rip),%rdi
  call   <scanf@plt>
  mov    0x38(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x38(%rsp)
  test   %eax,%eax
  je     L79
  lea    D22(%rip),%r15
  jmp    L133
L7:
  lea    0x360(%rsp,%r13,4),%rbp
  mov    $0x0,%ebx
L87:
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %r12d,%ebx
  jle    L87
L22:
  add    $0x1,%r12d
  add    $0x64,%r13
  cmp    %r12d,0x3c(%rsp)
  jle    L135
L144:
  test   %r12d,%r12d
  jns    L7
  jmp    L22
L102:
  mov    $0x1,%edi
  mov    0xc(%rsp),%esi
  sub    %esi,%edi
  mov    %edi,0x2c(%rsp)
  movslq %edi,%rax
  lea    (%rax,%rax,4),%rax
  lea    (%rax,%rax,4),%rax
  shl    $0x4,%rax
  movslq %esi,%rdx
  lea    (%rdx,%rdx,4),%rdx
  lea    (%rdx,%rdx,4),%rcx
  shl    $0x4,%rcx
  mov    0x20(%rsp),%rbp
  mov    -0x4(%rbp),%edx
  add    0x40(%rsp,%rcx,1),%edx
  mov    %edx,0x40(%rsp,%rax,1)
  cmpl   $0x1,0x28(%rsp)
  jle    L54
  movslq %esi,%r12
  lea    (%r12,%r12,4),%rax
  lea    0x0(,%rax,4),%rcx
  lea    (%rax,%rcx,1),%rdx
  shl    $0x4,%rdx
  lea    0x44(%rsp,%rdx,1),%rbx
  add    %rcx,%rax
  mov    0x10(%rsp),%rcx
  lea    (%rcx,%rax,4),%rax
  lea    0x48(%rsp,%rax,4),%r14
  imul   $0xfffffffffffffe70,%r12,%r12
  movslq %edi,%rax
  lea    (%rax,%rax,4),%rax
  lea    (%rax,%rax,4),%r13
  shl    $0x4,%r13
L39:
  mov    -0x4(%rbx),%esi
  mov    (%rbx),%edi
  call   <max@plt>
  lea    (%rbx,%r12,1),%rdx
  add    0x0(%rbp),%eax
  mov    %eax,(%rdx,%r13,1)
  add    $0x4,%rbp
  add    $0x4,%rbx
  cmp    %r14,%rbx
  jne    L39
L54:
  addq   $0x1,0x10(%rsp)
  addq   $0x194,0x18(%rsp)
  addq   $0x190,0x20(%rsp)
  mov    0xc(%rsp),%eax
  mov    0x2c(%rsp),%ecx
  mov    %ecx,0xc(%rsp)
L58:
  mov    0x28(%rsp),%edi
  movslq %edi,%rcx
  movslq 0xc(%rsp),%rdx
  lea    (%rdx,%rdx,4),%rdx
  lea    (%rdx,%rdx,4),%rdx
  lea    (%rcx,%rdx,4),%rcx
  movslq 0x10(%rsp),%rdx
  cltq
  lea    (%rax,%rax,4),%rax
  lea    (%rax,%rax,4),%rsi
  lea    (%rdx,%rsi,4),%rdx
  mov    0x18(%rsp),%rax
  mov    (%rax),%eax
  add    0x40(%rsp,%rdx,4),%eax
  mov    %eax,0x40(%rsp,%rcx,4)
  add    $0x1,%edi
  mov    %edi,0x28(%rsp)
  mov    0x3c(%rsp),%edx
  cmp    %edi,%edx
  jg     L102
  mov    0xc(%rsp),%ecx
  movslq %ecx,%rax
  lea    (%rax,%rax,4),%rax
  lea    (%rax,%rax,4),%rax
  shl    $0x4,%rax
  mov    0x40(%rsp,%rax,1),%esi
  cmp    $0x1,%edx
  jle    L21
  movslq %ecx,%rax
  lea    (%rax,%rax,4),%rcx
  lea    0x0(,%rcx,4),%rdi
  lea    (%rcx,%rdi,1),%rax
  shl    $0x4,%rax
  lea    0x44(%rsp,%rax,1),%rax
  lea    -0x2(%rdx),%edx
  add    %rdi,%rcx
  lea    (%rdx,%rcx,4),%rdx
  lea    0x48(%rsp,%rdx,4),%rcx
L93:
  mov    (%rax),%edx
  cmp    %edx,%esi
  cmovl  %edx,%esi
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L93
L21:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    0x38(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x38(%rsp)
  test   %eax,%eax
  je     L79
L133:
  lea    0x3c(%rsp),%rsi
  mov    %r15,%rdi
  call   <scanf@plt>
  lea    0x40(%rsp),%rdi
  mov    $0x320,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  cmpl   $0x0,0x3c(%rsp)
  jg     L144
L135:
  mov    0x360(%rsp),%esi
  mov    %esi,0x40(%rsp)
  cmpl   $0x1,0x3c(%rsp)
  jle    L21
  add    0x4f0(%rsp),%esi
  mov    %esi,0x1d0(%rsp)
  lea    0x4f4(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x684(%rsp),%rax
  mov    %rax,0x20(%rsp)
  movq   $0x0,0x10(%rsp)
  movl   $0x1,0x28(%rsp)
  mov    $0x0,%eax
  movl   $0x1,0xc(%rsp)
  jmp    L58
L79:
  mov    0x9fa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  mov    $0x0,%eax
  add    $0x9fb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D22
type_guessed: string
name: retrieve_data
arguments: tag: D2
type_guessed: string

tool: D22: %d

tool: D2: %d


assistant: ```c
int main() {
  int C;
  scanf("%d", &C);
  int n;
  int dp[2][100];
  int num[100][100];
  while (C--) {
    int N;
    scanf("%d", &N);
    int dpi = 0;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= i; j++) {
        scanf("%d", &num[i][j]);
      }
    }
    dpi = 0;
    dp[dpi][0] = num[0][0];
    for (int i = 1; i < N; i++) {
      dp[1 - dpi][0] = dp[dpi][0] + num[i][0];
      for (int j = 1; j < i; j++) {
        dp[1 - dpi][j] = max(dp[dpi][j], dp[dpi][j - 1]) + num[i][j];
      }
      dp[1 - dpi][i] = dp[dpi][i - 1] + num[i][i];
      dpi = 1 - dpi;
    }
    int ans = dp[dpi][0];
    for (int i = 1; i < N; i++) {
      ans = (ans < dp[dpi][i] ? dp[dpi][i] : ans);
    }
    printf("%d\n", ans);
  }
  return 0;
}
```