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

```asm
<main>:
  endbr64
  push   %r15
  lea    D49(%rip),%rsi
  lea    D9(%rip),%rdi
  push   %r14
  push   %r13
  lea    D10(%rip),%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    0x1c(%rsp),%rdx
  mov    %r13,%rsi
  movl   $0x0,0x1c(%rsp)
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <fscanf@plt>
  mov    0x1c(%rsp),%edx
  test   %edx,%edx
  jle    L4
  lea    0x20(%rsp),%rax
  movl   $0x1,0x4(%rsp)
  mov    %rax,0x8(%rsp)
  nopl   (%rax)
L87:
  mov    0x4(%rsp),%esi
  lea    D60(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  movl   $0x0,0x20(%rsp)
  call   <fscanf@plt>
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jle    L78
  xor    %ebx,%ebx
  mov    $0x1,%ebp
  lea    0x24(%rsp),%r14
  xor    %r15d,%r15d
  jmp    L27
  nop
L76:
  add    $0x1,%ebx
  cmp    %ebx,0x20(%rsp)
  jle    L73
L27:
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  movl   $0x0,0x24(%rsp)
  call   <fscanf@plt>
  add    0x24(%rsp),%r15d
  cmp    $0x7,%r15d
  je     L107
  jle    L76
  lea    -0x7(%r15),%edx
  mov    %ebp,%esi
  lea    D30(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x1,%ebp
  xor    %r15d,%r15d
  add    $0x1,%ebx
  cmp    %ebx,0x20(%rsp)
  jg     L27
L73:
  test   %r15d,%r15d
  jle    L78
  mov    $0x7,%edx
  mov    %ebp,%esi
  lea    D61(%rip),%rdi
  xor    %eax,%eax
  sub    %r15d,%edx
  call   <printf@plt>
L78:
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    %eax,0x1c(%rsp)
  jge    L87
L4:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L105
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L107:
  mov    %ebp,%esi
  lea    D39(%rip),%rdi
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <printf@plt>
  xor    %r15d,%r15d
  jmp    L76
L105:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D49
type_guessed: string
name: parse_data
arguments: data_tag: D9
type_guessed: string
name: parse_data
arguments: data_tag: D10
type_guessed: string
name: parse_data
arguments: data_tag: D60
type_guessed: string
name: parse_data
arguments: data_tag: D30
type_guessed: string
name: parse_data
arguments: data_tag: D61
type_guessed: string
name: parse_data
arguments: data_tag: D39
type_guessed: string

tool: D49: r

tool: D9: ice.in

tool: D10: %d

tool: D60: Session #%d:


tool: D30:    Cup #%d: %d cubes too many!


tool: D61:    Cup #%d: Need %d more cubes!


tool: D39:    Cup #%d: Perfect!


assistant: ```c
int main() {
  FILE *fp;
  fp = fopen("ice.in", "r");
  int numCases = 0;
  fscanf(fp, "%d", &numCases);
  int z;
  for (z = 1; z <= numCases; z++) {
    printf("Session #%d:\n", z);
    int iceCounter = 0;
    int numCups = 1;
    int numDispense = 0;
    fscanf(fp, "%d", &numDispense);
    int i = 0;
    for (i = 0; i < numDispense; i++) {
      int dispensed = 0;
      fscanf(fp, "%d", &dispensed);
      iceCounter += dispensed;
      if (iceCounter == 7) {
        printf("   Cup #%d: Perfect!\n", numCups);
        numCups++;
        iceCounter = 0;
      } else if (iceCounter > 7) {
        printf("   Cup #%d: %d cubes too many!\n", numCups, iceCounter - 7);
        numCups++;
        iceCounter = 0;
      }
    }
    if (iceCounter > 0) {
      printf("   Cup #%d: Need %d more cubes!\n", numCups, 7 - iceCounter);
    }
    printf("\n");
  }
  return 0;
}
```