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

```asm
<transformInfile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x840,%rsp
  mov    %rdi,-0x1838(%rbp)
  mov    %rsi,-0x1840(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x1828(%rbp)
  movl   $0x0,-0x1824(%rbp)
  jmp    L10
L36:
  movl   $0x0,-0x1814(%rbp)
  movl   $0x0,-0x1820(%rbp)
  movl   $0x0,-0x181c(%rbp)
  movl   $0x0,-0x1818(%rbp)
  lea    -0x1810(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x1828(%rbp)
  mov    -0x1828(%rbp),%eax
  add    %eax,-0x1824(%rbp)
  mov    -0x1828(%rbp),%edx
  mov    -0x1840(%rbp),%rax
  lea    D16(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L15
L21:
  mov    -0x1828(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %ecx,%edx
  mov    -0x181c(%rbp),%eax
  cltq
  mov    %dl,-0x810(%rbp,%rax,1)
  mov    -0x1828(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x1828(%rbp)
  addl   $0x1,-0x181c(%rbp)
L15:
  cmpl   $0x0,-0x1828(%rbp)
  jne    L21
  mov    -0x181c(%rbp),%eax
  cltq
  movb   $0x0,-0x810(%rbp,%rax,1)
  lea    -0x810(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1814(%rbp)
  mov    -0x1814(%rbp),%eax
  mov    %eax,-0x1818(%rbp)
  jmp    L28
L48:
  mov    -0x1818(%rbp),%eax
  cltq
  movzbl -0x1810(%rbp,%rax,1),%edx
  mov    -0x1820(%rbp),%eax
  cltq
  mov    %dl,-0x1010(%rbp,%rax,1)
  addl   $0x1,-0x1820(%rbp)
  addl   $0x1,-0x1818(%rbp)
L28:
  mov    -0x1818(%rbp),%eax
  cltq
  movzbl -0x1810(%rbp,%rax,1),%eax
  test   %al,%al
  jne    L48
  mov    -0x1820(%rbp),%eax
  cltq
  movb   $0x0,-0x1010(%rbp,%rax,1)
  mov    -0x1840(%rbp),%rdx
  lea    -0x1010(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fputs@plt>
L10:
  mov    -0x1838(%rbp),%rdx
  lea    -0x1810(%rbp),%rax
  mov    $0x800,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L36
  mov    -0x1824(%rbp),%edx
  mov    -0x1840(%rbp),%rax
  lea    D6(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L61
  call   <__stack_chk_fail@plt>
L61:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D16
type_guessed: string
name: parse_data
arguments: data_label: D6
type_guessed: string

tool: D16: num: %d


tool: D6: %d


assistant: ```c
void transformInfile(FILE *fin, FILE *fout) {
  int num = 0;
  int total = 0;
  char data[2048];
  while (fgets(data, sizeof(data), fin)) {
    char newdata[2048];
    char numdata[2048];
    int numlength = 0;
    int i = 0;
    int j = 0;
    int k = 0;
    num = atoi(data);
    total += num;
    fprintf(fout, "num: %d\n", num);
    while (num != 0) {
      numdata[j] = num % 10;
      num = num / 10;
      j++;
    }
    numdata[j] = '\0';
    numlength = strlen(numdata);
    for (k = numlength; data[k] != '\0'; k++) {
      newdata[i] = data[k];
      i++;
    }
    newdata[i] = '\0';
    fprintf(fout, "%s", newdata);
  }
  fprintf(fout, "%d\n", total);
}
```