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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x88,%rsp
  cmp    $0x1,%edi
  jle    L514
  mov    0x8(%rsi),%r12
  mov    %edi,%ebp
  cmp    $0x2,%edi
  jne    L566
  movq   $0x14,0x60(%rsp)
  movl   $0x1,0x50(%rsp)
  movq   $0x0,0x58(%rsp)
L146:
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L163
  xor    %eax,%eax
  xor    %ecx,%ecx
  xor    %esi,%esi
  jmp    L572
L564:
  cmp    $0x29,%dl
  je     L374
  cmp    $0x5b,%dl
  cmove  %ebx,%eax
L656:
  add    $0x1,%eax
  cmp    %eax,%ebx
  jle    L6
L572:
  movslq %eax,%rdx
  movzbl (%r12,%rdx,1),%edx
  cmp    $0x2c,%dl
  jne    L564
  add    $0x1,%eax
  add    $0x1,%ecx
  cmp    %eax,%ebx
  jg     L572
L6:
  mov    %esi,0x14(%rsp)
L414:
  mov    0x14(%rsp),%eax
  mov    0x60(%rsp),%edi
  lea    0x1(%rax),%r15d
  imul   %r15d,%edi
  mov    %r15d,0x54(%rsp)
  shl    $0x2,%edi
  call   <malloc@plt>
  lea    0x0(,%r15,4),%edi
  mov    %rax,0x20(%rsp)
  mov    %rax,%r14
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %r14,%r14
  je     L112
  test   %rax,%rax
  je     L112
L433:
  mov    0x20(%rsp),%rax
  movl   $0x0,(%rax)
  test   %ebx,%ebx
  jle    L399
  mov    0x54(%rsp),%r13d
  mov    0x20(%rsp),%r14
  xor    %r9d,%r9d
  xor    %esi,%esi
  xor    %edi,%edi
  xor    %r8d,%r8d
  lea    -0x1(%rbx),%r10d
  xor    %r11d,%r11d
  jmp    L600
  nopl   0x0(%rax)
L171:
  sub    $0x30,%eax
  movslq %eax,%rdx
  cmp    $0x9,%rdx
  ja     L524
  mov    %edi,%edx
  imul   %r13d,%edx
  add    %r8d,%edx
  movslq %edx,%rdx
  lea    (%r14,%rdx,4),%rdx
  mov    (%rdx),%ecx
  lea    (%rcx,%rcx,4),%ecx
  lea    (%rax,%rcx,2),%eax
  mov    %eax,(%rdx)
L524:
  add    $0x1,%esi
  cmp    %esi,%ebx
  jle    L13
L600:
  movslq %esi,%rax
  add    %r12,%rax
  movzbl (%rax),%edx
  cmp    $0x2c,%dl
  jne    L117
  mov    %r13d,%edx
  add    $0x1,%r8d
  imul   %edi,%edx
  add    %r8d,%edx
  movslq %edx,%rdx
  movl   $0x0,(%r14,%rdx,4)
  movzbl (%rax),%edx
L117:
  cmp    $0x29,%dl
  jne    L100
  add    $0x1,%edi
  mov    %r13d,%edx
  xor    %r8d,%r8d
  imul   %edi,%edx
  movslq %edx,%rdx
  movl   $0x0,(%r14,%rdx,4)
  movzbl (%rax),%edx
L100:
  lea    0x1(%rsi),%r15d
  movsbl %dl,%eax
  movslq %r15d,%rcx
  cmp    $0x5b,%dl
  jne    L171
  movsbl (%r12,%rcx,1),%eax
  lea    -0x30(%rax),%edx
  movslq %edx,%rdx
  cmp    %ecx,%ebx
  jle    L286
  nopl   0x0(%rax,%rax,1)
L282:
  cmp    $0x9,%rdx
  ja     L426
  lea    (%r9,%r9,4),%rax
  lea    (%rdx,%rax,2),%r9
L426:
  add    $0x1,%rcx
  movsbl (%r12,%rcx,1),%eax
  lea    -0x30(%rax),%edx
  movslq %edx,%rdx
  cmp    %ecx,%ebx
  jg     L282
L286:
  mov    %r10d,%edx
  sub    %esi,%edx
  cmp    %ebx,%esi
  cmovge %r11d,%edx
  lea    (%r15,%rdx,1),%esi
  jmp    L171
L566:
  mov    0x10(%rsi),%rdi
  call   <atol@plt>
  movslq %eax,%rdx
  mov    $0x1,%eax
  test   %rdx,%rdx
  cmovg  %rdx,%rax
  mov    %rax,0x60(%rsp)
  cmp    $0x3,%ebp
  je     L39
  mov    0x18(%rbx),%rdi
  call   <atoi@plt>
  mov    %eax,0x50(%rsp)
  cmp    $0x4,%ebp
  jle    L626
  mov    0x20(%rbx),%rdi
  call   <atoi@plt>
  movslq %eax,%rbx
  xor    %eax,%eax
  test   %rbx,%rbx
  cmovns %rbx,%rax
  mov    %rax,0x58(%rsp)
  jmp    L146
L374:
  cmp    %ecx,%esi
  cmovl  %ecx,%esi
  xor    %ecx,%ecx
  jmp    L656
L13:
  test   %r9,%r9
  mov    $0x2,%eax
  cmovg  %r9,%rax
  mov    %rax,0x30(%rsp)
  test   %edi,%edi
  je     L399
  sub    $0x1,%edi
  mov    0x14(%rsp),%edx
  movq   $0x0,0x78(%rsp)
  lea    D35(%rip),%r12
  movslq %edi,%rax
  mov    %rax,0x8(%rsp)
  movslq 0x54(%rsp),%rax
  mov    %rax,0x28(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x18(%rsp)
  mov    0x20(%rsp),%rax
  lea    0x4(%rax),%rbx
  lea    -0x1(%rdx),%eax
  lea    (%rbx,%rax,4),%rax
  mov    %rbx,0x38(%rsp)
  mov    %rax,0x70(%rsp)
  movslq %edx,%rax
  mov    %rax,0x68(%rsp)
  lea    0x4(,%rax,4),%r13
  nopl   0x0(%rax)
L232:
  mov    %r13,0x48(%rsp)
  xor    %eax,%eax
  mov    0x70(%rsp),%rbx
  mov    0x20(%rsp),%r14
  mov    0x68(%rsp),%r15
  mov    %rbp,0x40(%rsp)
  mov    %rax,%rbp
  cs nopw 0x0(%rax,%rax,1)
L81:
  mov    $0x28,%edi
  mov    %r14,%r13
  call   <putchar@plt>
  mov    0x14(%rsp),%esi
  test   %esi,%esi
  je     L645
  nopl   (%rax)
L102:
  mov    0x0(%r13),%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x4,%r13
  call   <printf@plt>
  cmp    %rbx,%r13
  jne    L102
L645:
  mov    (%r14,%r15,4),%esi
  lea    D24(%rip),%rdi
  xor    %eax,%eax
  add    $0x1,%rbp
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  add    %rax,%r14
  add    %rax,%rbx
  cmp    %rbp,0x8(%rsp)
  jge    L81
  mov    0x30(%rsp),%rsi
  xor    %eax,%eax
  mov    0x40(%rsp),%rbp
  lea    D75(%rip),%rdi
  mov    0x48(%rsp),%r13
  call   <printf@plt>
  mov    0x8(%rsp),%r10
  imul   0x28(%rsp),%r10
  mov    0x20(%rsp),%rax
  cmpl   $0x2,0x50(%rsp)
  lea    (%rax,%r10,4),%rdx
  je     L312
  cmpl   $0x3,0x50(%rsp)
  jne    L436
  mov    0x30(%rsp),%rbx
  mov    0x8(%rsp),%rdi
  mov    %rbx,%rax
  imul   %rbx,%rax
  mov    (%rdx),%ebx
  mov    %rax,0x30(%rsp)
  test   %ebx,%ebx
  jne    L182
L196:
  cmp    0x60(%rsp),%rdi
  jg     L531
L33:
  mov    0x58(%rsp),%rsi
  test   %rsi,%rsi
  je     L121
  mov    0x78(%rsp),%rcx
  lea    0x1(%rcx),%rax
  cmp    %rcx,%rsi
  jle    L111
  mov    %rax,0x78(%rsp)
L121:
  cmp    0x8(%rsp),%rdi
  jle    L44
  mov    0x8(%rsp),%r9
  movslq %ebx,%rcx
  mov    0x20(%rsp),%rbx
  mov    0x18(%rsp),%r8
  mov    %r9,%rax
  sub    %rcx,%rax
  imul   0x28(%rsp),%rax
  lea    (%rbx,%rax,4),%rsi
  nopw   0x0(%rax,%rax,1)
L85:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L335:
  mov    0x0(%rbp,%rax,1),%ecx
  add    (%rsi,%rax,1),%ecx
  mov    %ecx,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%r13
  jne    L335
  lea    0x1(%r9),%rax
  add    %r8,%rsi
  add    %r8,%rdx
  cmp    %rax,%rdi
  je     L142
  mov    %rax,%r9
  jmp    L85
  nop
L142:
  mov    %r9,0x8(%rsp)
  jmp    L232
L312:
  mov    (%rdx),%ebx
  addq   $0x1,0x30(%rsp)
  mov    0x8(%rsp),%rdi
  test   %ebx,%ebx
  je     L196
L182:
  mov    0x54(%rsp),%esi
  xor    %eax,%eax
L430:
  add    $0x1,%eax
  cmp    0x14(%rsp),%eax
  jg     L287
L314:
  mov    0x20(%rsp),%rbx
  movslq %eax,%rcx
  add    %r10,%rcx
  mov    (%rbx,%rcx,4),%ecx
  test   %ecx,%ecx
  jne    L430
  mov    %eax,%esi
  mov    0x54(%rsp),%eax
  add    $0x1,%eax
  cmp    0x14(%rsp),%eax
  jle    L314
L287:
  xor    %ebx,%ebx
  mov    %r13,0x48(%rsp)
  lea    -0x1(%rsi),%r14d
  mov    0x8(%rsp),%r13
  mov    %ebx,0x40(%rsp)
  mov    0x68(%rsp),%r15
  xor    %r9d,%r9d
  mov    %r14,%r11
  mov    0x20(%rsp),%rbx
  nopl   0x0(%rax,%rax,1)
L532:
  mov    %r13,%r8
  mov    0x38(%rsp),%rdi
  mov    %r10,%rsi
  sub    %r9,%r8
  imul   0x28(%rsp),%r8
  lea    (%r14,%r8,1),%rcx
  lea    (%rbx,%r8,4),%rax
  sub    %r8,%rsi
  lea    (%rdi,%rcx,4),%rdi
  mov    $0x1,%ecx
L453:
  mov    (%rax,%rsi,4),%r8d
  cmp    %r8d,(%rax)
  mov    $0x0,%r8d
  cmovge %r8d,%ecx
  add    $0x4,%rax
  cmp    %rax,%rdi
  jne    L453
  test   %ecx,%ecx
  jne    L258
L53:
  add    $0x1,%r9
  cmp    %r13,%r9
  jle    L532
  movslq 0x40(%rsp),%rax
  cmpl   $0x4,0x50(%rsp)
  mov    0x48(%rsp),%r13
  mov    %rax,%rbx
  je     L176
  imul   0x30(%rsp),%rax
  mov    0x8(%rsp),%rdi
  add    %rax,%rdi
  cmp    0x60(%rsp),%rdi
  jle    L33
L531:
  mov    0x60(%rsp),%rsi
  lea    D87(%rip),%rdi
  jmp    L444
L436:
  mov    (%rdx),%ebx
  test   %ebx,%ebx
  jne    L182
  cmpl   $0x4,0x50(%rsp)
  jne    L77
  addq   $0x1,0x30(%rsp)
  mov    0x8(%rsp),%rdi
  jmp    L196
L258:
  mov    %r13,%rax
  sub    %r9,%rax
  imul   0x28(%rsp),%rax
  lea    (%rbx,%rax,4),%rsi
  xor    %eax,%eax
  jmp    L392
  nopw   0x0(%rax,%rax,1)
L591:
  mov    %rcx,%rax
L392:
  xor    %ecx,%ecx
  cmp    %eax,%r11d
  jle    L116
  mov    (%rdx,%rax,4),%ecx
  sub    (%rsi,%rax,4),%ecx
L116:
  mov    %ecx,0x0(%rbp,%rax,4)
  lea    0x1(%rax),%rcx
  cmp    %r15,%rax
  jne    L591
  mov    %r9d,0x40(%rsp)
  lea    0x1(%r13),%r9
  jmp    L53
L44:
  subq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  cmp    $0xffffffffffffffff,%rax
  jne    L232
  mov    0x30(%rsp),%rsi
  lea    D96(%rip),%rdi
L444:
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
L635:
  add    $0x88,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L176:
  mov    0x30(%rsp),%rdi
  sub    $0x1,%rdi
  imul   %rax,%rdi
  add    0x8(%rsp),%rdi
  jmp    L196
L112:
  lea    D12(%rip),%rdi
  call   <puts@plt>
  or     $0xffffffff,%edi
  call   <exit@plt>
  jmp    L433
L39:
  movl   $0x1,0x50(%rsp)
L626:
  movq   $0x0,0x58(%rsp)
  jmp    L146
L514:
  mov    (%rsi),%rsi
  lea    D4(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D0(%rip),%rdi
  call   <puts@plt>
  jmp    L635
L399:
  lea    D95(%rip),%rdi
  call   <puts@plt>
  jmp    L635
L111:
  lea    D9(%rip),%rdi
  jmp    L444
L163:
  movl   $0x0,0x14(%rsp)
  jmp    L414
L77:
  mov    0x8(%rsp),%rdi
  jmp    L196
```

tool_calls: name: parse_data
arguments: tag: D35
type: string
name: parse_data
arguments: tag: D24
type: string
name: parse_data
arguments: tag: D75
type: string
name: parse_data
arguments: tag: D87
type: string
name: parse_data
arguments: tag: D96
type: string
name: parse_data
arguments: tag: D12
type: string
name: parse_data
arguments: tag: D4
type: string
name: parse_data
arguments: tag: D0
type: string
name: parse_data
arguments: tag: D95
type: string
name: parse_data
arguments: tag: D9
type: string

tool: D35: %d,

tool: D24: %d)

tool: D75: [%ld]


tool: D87: Length of sequence exceeds %ld at next step.


tool: D96: Finished. n = %ld


tool: D12: Allocation failed.

tool: D4: Usage: %s ini [max] [opt] [step]


tool: D0: See comment in the source: http://gyafun.jp/ln/basmat.cgi?ini=s

tool: D95: Invalid initial parameter.

tool: D9: Maximum step of calculation %ld has reached.


assistant: ```c
int main(int argc, char *argv[]) {
  int *a, *b, c = 0, g, h, i = 0, j, l, m, y, len, opt;
  long f, k, n = 0, z, step = 0, maxstep;
  char *bm;
  if (argc < 2) {
    printf("Usage: %s ini [max] [opt] [step]\n", argv[0]);
    printf("See comment in the source: http://gyafun.jp/ln/basmat.cgi?ini=s\n");
    return 0;
  }
  bm = argv[1];
  z = (argc > 2) ? atol(argv[2]) : 20;
  if (z < 1)
    z = 1;
  opt = (argc > 3) ? atoi(argv[3]) : 1;
  maxstep = (argc > 4) ? atoi(argv[4]) : 0;
  if (maxstep < 0)
    maxstep = 0;
  len = strlen(bm);
  for (m = 0; m < len; m++) {
    if (bm[m] == ',')
      i++;
    if (bm[m] == ')') {
      if (c < i)
        c = i;
      i = 0;
    }
    if (bm[m] == '[')
      m = len;
  }
  y = c + 1;
  a = malloc(sizeof(int) * y * z);
  b = malloc(sizeof(int) * y);
  if (a == NULL || b == NULL) {
    printf("Allocation failed.\n");
    exit(-1);
  }
  i = j = a[0] = 0;
  for (m = 0; m < len; m++) {
    if (bm[m] == ',')
      i++, a[i + j * y] = 0;
    if (bm[m] == ')')
      j++, i = 0, a[i + j * y] = 0;
    if (bm[m] == '[') {
      for (; m < len; m++) {
        k = bm[m] - '0';
        if (k >= 0 && k <= 9)
          n = n * 10 + k;
      }
    }
    k = bm[m] - '0';
    if (k >= 0 && k <= 9)
      a[i + j * y] = a[i + j * y] * 10 + k;
  }
  if (n < 1)
    n = 2;
  if (j == 0) {
    printf("Invalid initial parameter.\n");
    return 0;
  }
  for (f = j - 1; f >= 0; f--) {
    for (i = 0; i <= f; i++) {
      printf("(");
      for (j = 0; j < c; j++)
        printf("%d,", a[j + i * y]);
      printf("%d)", a[c + i * y]);
    }
    printf("[%ld]\n", n);
    if (opt == 2)
      n++;
    if (opt == 3)
      n *= n;
    if (a[f * y] == 0) {
      g = 0;
      if (opt == 4)
        n++;
    } else {
      m = c + 1;
      g = 0;
      for (j = 0; j <= c; j++) {
        if (a[j + f * y] == 0)
          m = j, j = c + 1;
      }
      for (k = 0; k <= f; k++) {
        h = 1;
        for (l = 0; l < m; l++)
          if (a[l + (f - k) * y] >= a[l + f * y])
            h = 0;
        if (h) {
          for (l = 0; l <= c; l++)
            b[l] = (l < m - 1) ? a[l + f * y] - a[l + (f - k) * y] : 0;
          g = k;
          k = f + 1;
        }
      }
    }
    k = (opt == 4) ? f + g * (n - 1) : f + g * n;
    if (k > z) {
      printf("Length of sequence exceeds %ld at next step.\n", z);
      free(a);
      free(b);
      return 0;
    }
    if (maxstep && step++ >= maxstep) {
      printf("Maximum step of calculation %ld has reached.\n", maxstep);
      free(a);
      free(b);
      return 0;
    }
    while (f < k) {
      for (l = 0; l <= c; l++)
        a[l + f * y] = a[l + (f - g) * y] + b[l];
      f++;
    }
  }
  printf("Finished. n = %ld\n", n);
  free(a);
  free(b);
  return 0;
}
```