user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x249000(%rsp),%r11
L151:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L151
  sub    $0xf38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x249f28(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x4(%rsp)
  lea    0x1c(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    D19(%rip),%r14
  jmp    L46
L132:
  add    $0x1,%r15
  sub    $0x18,%r12
  add    $0x18,%r13
  add    $0x18,%rbp
  cmp    %r15d,0x1c(%rsp)
  jle    L169
L161:
  lea    -0x18(%rbp),%rbx
L49:
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  lea    (%rbx,%r12,1),%rax
  movl   $0x3b9ac9ff,0x4(%rax,%r13,1)
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L49
  jmp    L132
L169:
  movl   $0x0,0x2c(%rsp)
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L92
  lea    0x28(%rsp),%rbx
  mov    $0x0,%r12d
  jmp    L141
L42:
  add    $0x18,%rbx
L141:
  mov    %rbx,%rbp
  mov    (%rbx),%edi
  add    0x4(%rbx),%edi
  mov    %edi,0x4(%rbx)
  mov    0xc(%rbx),%esi
  call   <min@plt>
  mov    %eax,0xc(%rbx)
  mov    0x1c(%rsp),%eax
  sub    $0x1,%eax
  cmp    %r12d,%eax
  jg     L112
L98:
  mov    0x8(%rbp),%edi
  add    0xc(%rbp),%edi
  mov    %edi,0xc(%rbp)
  mov    0x1c(%rsp),%eax
  sub    $0x1,%eax
  cmp    %r12d,%eax
  jg     L78
L172:
  add    $0x1,%r12d
  mov    0x1c(%rsp),%eax
  cmp    %r12d,%eax
  jle    L92
  test   %r12d,%r12d
  jle    L42
  mov    0x10(%rbp),%edi
  add    0x14(%rbp),%edi
  mov    %edi,0x14(%rbp)
  mov    0x1c(%rbp),%esi
  call   <min@plt>
  mov    %eax,0x1c(%rbp)
  mov    0x1c(%rsp),%eax
  sub    $0x1,%eax
  cmp    %r12d,%eax
  jle    L42
  mov    0x2c(%rbp),%esi
  mov    0x14(%rbp),%edi
  call   <min@plt>
  mov    %eax,0x2c(%rbp)
  mov    0x34(%rbp),%esi
  mov    0x14(%rbp),%edi
  call   <min@plt>
  mov    %eax,0x34(%rbp)
  jmp    L42
L112:
  mov    0x14(%rbx),%esi
  mov    0x4(%rbx),%edi
  call   <min@plt>
  mov    %eax,0x14(%rbx)
  mov    0x1c(%rbx),%esi
  mov    0x4(%rbx),%edi
  call   <min@plt>
  mov    %eax,0x1c(%rbx)
  mov    0x24(%rbx),%esi
  mov    0x4(%rbx),%edi
  call   <min@plt>
  mov    %eax,0x24(%rbx)
  jmp    L98
L78:
  mov    0x1c(%rbp),%esi
  call   <min@plt>
  mov    %eax,0x1c(%rbp)
  mov    0x24(%rbp),%esi
  mov    0xc(%rbp),%edi
  call   <min@plt>
  mov    %eax,0x24(%rbp)
  jmp    L172
L92:
  sub    $0x1,%eax
  cltq
  lea    (%rax,%rax,2),%rax
  mov    0x2c(%rsp,%rax,8),%edx
  mov    0x4(%rsp),%ebx
  mov    %ebx,%esi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    %ebx,%eax
  add    $0x1,%eax
  mov    %eax,0x4(%rsp)
L46:
  mov    0x8(%rsp),%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  je     L51
  jle    L169
  lea    0x38(%rsp),%rbp
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  mov    $0x0,%r15d
  jmp    L161
L51:
  mov    0x249f28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  mov    $0x0,%eax
  add    $0x249f38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D19
datatype: string
name: parse_data
arguments: data_tag: D9
datatype: string

tool: D19: %d

tool: D9: %d. %d


assistant: ```c
int main() {
  int i, j, q, N;
  int A[100000][3][2];
  for (q = 1;; ++q) {
    scanf("%d", &N);
    if (!N) {
      break;
    }
    for (i = 0; i < N; ++i) {
      for (j = 0; j < 3; ++j) {
        scanf("%d", &A[i][j][0]);
        A[i][j][1] = 999999999;
      }
    }
    A[0][1][1] = 0;
    for (i = 0; i < N; ++i) {
      if (i > 0) {
        A[i][0][1] += A[i][0][0];
        A[i][1][1] = min(A[i][0][1], A[i][1][1]);
        if (i < N - 1) {
          A[i + 1][0][1] = min(A[i][0][1], A[i + 1][0][1]);
          A[i + 1][1][1] = min(A[i][0][1], A[i + 1][1][1]);
        }
      }
      A[i][1][1] += A[i][1][0];
      A[i][2][1] = min(A[i][1][1], A[i][2][1]);
      if (i < N - 1) {
        A[i + 1][0][1] = min(A[i][1][1], A[i + 1][0][1]);
        A[i + 1][1][1] = min(A[i][1][1], A[i + 1][1][1]);
        A[i + 1][2][1] = min(A[i][1][1], A[i + 1][2][1]);
      }
      A[i][2][1] += A[i][2][0];
      if (i < N - 1) {
        A[i + 1][1][1] = min(A[i][2][1], A[i + 1][1][1]);
        A[i + 1][2][1] = min(A[i][2][1], A[i + 1][2][1]);
      }
    }
    printf("%d. %d\n", q, A[N - 1][1][1]);
  }
  return 0;
}
```