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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x70(%rbp),%rax
  mov    %rax,%rsi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movq   $0x1,-0x58(%rbp)
  jmp    L104
L4:
  mov    %rsp,%rax
  mov    %rax,%rbx
  movq   $0x0,-0x60(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %eax,-0x6c(%rbp)
  lea    -0x68(%rbp),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x68(%rbp),%rax
  add    $0x1,%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  mov    %rax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  mov    %rax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L78:
  cmp    %rdx,%rsp
  je     L24
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L78
L24:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L66
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L66:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  mov    $0x0,%eax
  call   <getchar@plt>
L33:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %al,-0x71(%rbp)
  cmpb   $0x2f,-0x71(%rbp)
  jle    L54
  cmpb   $0x39,-0x71(%rbp)
  jg     L54
  movsbl -0x71(%rbp),%ecx
  mov    -0x60(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x60(%rbp)
  sub    $0x30,%ecx
  mov    -0x40(%rbp),%rdx
  mov    %ecx,(%rdx,%rax,4)
  jmp    L33
L54:
  movq   $0x0,-0x60(%rbp)
  jmp    L35
L92:
  mov    -0x60(%rbp),%rax
  cmp    -0x50(%rbp),%rax
  jle    L94
  addl   $0x1,-0x6c(%rbp)
  addq   $0x1,-0x50(%rbp)
L94:
  mov    -0x40(%rbp),%rax
  mov    -0x60(%rbp),%rdx
  mov    (%rax,%rdx,4),%eax
  cltq
  add    %rax,-0x50(%rbp)
  addq   $0x1,-0x60(%rbp)
L35:
  mov    -0x68(%rbp),%rax
  cmp    %rax,-0x60(%rbp)
  jle    L92
  mov    -0x6c(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    %rbx,%rsp
  addq   $0x1,-0x58(%rbp)
L104:
  mov    -0x70(%rbp),%eax
  cltq
  cmp    %rax,-0x58(%rbp)
  jle    L4
  mov    $0x0,%eax
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L113
  call   <__stack_chk_fail@plt>
L113:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D11
data_type: string
name: retrieve_data
arguments: data_tag: D5
data_type: string
name: retrieve_data
arguments: data_tag: D9
data_type: string

tool: D11: %d

tool: D5: %lld

tool: D9: Case #%lld: %lld


assistant: ```c
int main() {
  int t;
  long long int i, j, k, l, Smax, sum, res;
  char ch;
  scanf("%d", &t);
  for (l = 1; l <= t; l++) {
    int count = sum = i = 0;
    scanf("%lld", &Smax);
    int arr[Smax + 1];
    getchar();
    while (1) {
      ch = getchar();
      if (ch >= 48 && ch < 58)
        arr[i++] = ch - 48;
      else
        break;
    }
    for (i = 0; i <= Smax; i++) {
      if (i <= sum) {
      } else {
        count++;
        sum++;
      }
      sum += arr[i];
    }
    printf("Case #%lld: %lld\n", l, count);
  }
  return 0;
}
```