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

```asm
<determine_length>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  lea    D181(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  lea    D153(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  mov    $0x0,%ebx
  lea    D24(%rip),%r12
  lea    D263(%rip),%r15
  jmp    L251
L219:
  mov    %rsp,%rdi
  lea    D278(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L298
  mov    %rsp,%r13
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  mov    %r13,%rdi
  call   <string_length@plt>
  add    %eax,%ebx
  jmp    L251
L298:
  mov    %rsp,%rdi
  lea    D251(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L251
  mov    %rsp,%r13
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  mov    %r13,%rdi
  call   <string_length@plt>
  lea    0x1(%rbx,%rax,1),%ebx
  jmp    L251
L153:
  add    $0x1,%ebx
L251:
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  test   %rax,%rax
  je     L61
  cmpb   $0x2e,(%rsp)
  je     L219
  mov    %rsp,%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  mov    %r15,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D11(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D245(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D105(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D126(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D179(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D15(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D250(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D47(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D157(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D113(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D173(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D208(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L153
  mov    %rsp,%rdi
  lea    D232(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L159
  mov    %rsp,%rdi
  lea    D184(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L150
L159:
  add    $0x2,%ebx
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  jmp    L251
L150:
  mov    %rsp,%rdi
  lea    D121(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L159
  mov    %rsp,%rdi
  lea    D272(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L159
  mov    %rsp,%rdi
  lea    D22(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L75
  mov    %rsp,%r13
  mov    %rbp,%rdx
  mov    $0x100,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  lea    D146(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L27
  mov    %rsp,%rdi
  lea    D293(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L267
L27:
  add    $0x2,%ebx
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  jmp    L251
L267:
  mov    %rsp,%rdi
  lea    D45(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L251
  add    $0x3,%ebx
  mov    %rsp,%rdi
  mov    %rbp,%rdx
  mov    $0x100,%esi
  call   <fgets@plt>
  jmp    L251
L314:
  mov    %rsp,%rdi
  lea    D144(%rip),%rsi
  call   <strtok@plt>
  mov    %rax,%rdx
  lea    D110(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebx,%edx
  lea    D59(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x1,%eax
L268:
  movslq %r13d,%rdx
  movzbl (%rsp,%rdx,1),%edx
  test   %eax,%eax
  jne    L251
  test   %dl,%dl
  je     L251
  cmp    $0x3a,%dl
  je     L314
  add    $0x1,%r13d
  mov    $0x0,%eax
  jmp    L268
L75:
  mov    $0x0,%eax
  mov    $0x0,%r13d
  jmp    L268
L61:
  mov    %ebx,%esi
  lea    D59(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %r14,%rdi
  call   <fclose@plt>
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L362
  mov    $0x0,%eax
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L362:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D181
type_infered: string
name: parse_data
arguments: label: D153
type_infered: string
name: parse_data
arguments: label: D24
type_infered: string
name: parse_data
arguments: label: D263
type_infered: string
name: parse_data
arguments: label: D278
type_infered: string
name: parse_data
arguments: label: D251
type_infered: string
name: parse_data
arguments: label: D11
type_infered: string
name: parse_data
arguments: label: D245
type_infered: string
name: parse_data
arguments: label: D105
type_infered: string
name: parse_data
arguments: label: D126
type_infered: string
name: parse_data
arguments: label: D179
type_infered: string
name: parse_data
arguments: label: D15
type_infered: string
name: parse_data
arguments: label: D250
type_infered: string
name: parse_data
arguments: label: D47
type_infered: string
name: parse_data
arguments: label: D157
type_infered: string
name: parse_data
arguments: label: D113
type_infered: string
name: parse_data
arguments: label: D173
type_infered: string
name: parse_data
arguments: label: D208
type_infered: string
name: parse_data
arguments: label: D232
type_infered: string
name: parse_data
arguments: label: D184
type_infered: string
name: parse_data
arguments: label: D121
type_infered: string
name: parse_data
arguments: label: D272
type_infered: string
name: parse_data
arguments: label: D22
type_infered: string
name: parse_data
arguments: label: D146
type_infered: string
name: parse_data
arguments: label: D293
type_infered: string
name: parse_data
arguments: label: D45
type_infered: string
name: parse_data
arguments: label: D144
type_infered: string
name: parse_data
arguments: label: D110
type_infered: string
name: parse_data
arguments: label: D59
type_infered: string

tool: D181: r

tool: D153: w

tool: D24: ret


tool: D263: cli


tool: D278: .ascii


tool: D251: .asciz


tool: D11: sti


tool: D245: clc


tool: D105: stc


tool: D126: cld


tool: D179: std


tool: D15: hlt


tool: D250: pusha


tool: D47: popa


tool: D157: lodsw


tool: D113: lodsb


tool: D173: int3


tool: D208: nop


tool: D232: int


tool: D184: pause


tool: D121: fnop


tool: D272: cpuid


tool: D22: mov


tool: D146: ah


tool: D293: al


tool: D45: dx


tool: D144: :

tool: D110: %s


tool: D59: %d


assistant: ```c
int determine_length(char *input, char *output) {
  FILE *source = fopen(input, "r");
  FILE *target = fopen(output, "w");
  char string[256];
  int length = 0;
  char *token;
  while (fgets(string, sizeof(string), source) != NULL) {
    int size_string = 0;
    int ch = 0;
    int stop = 0;
    if (string[0] == '.') {
      if (strcmp(string, ".ascii\n") == 0) {
        fgets(string, sizeof(string), source);
        length = length + string_length(string);
      } else if (strcmp(string, ".asciz\n") == 0) {
        fgets(string, sizeof(string), source);
        length = length + string_length(string) + 1;
      }
    } else {
      if (strcmp(string, "ret\n") == 0 || strcmp(string, "cli\n") == 0 || strcmp(string, "sti\n") == 0 || strcmp(string, "clc\n") == 0 || strcmp(string, "stc\n") == 0 || strcmp(string, "cld\n") == 0 || strcmp(string, "std\n") == 0 || strcmp(string, "hlt\n") == 0 || strcmp(string, "pusha\n") == 0 || strcmp(string, "popa\n") == 0 || strcmp(string, "lodsw\n") == 0 || strcmp(string, "lodsb\n") == 0 || strcmp(string, "int3\n") == 0 || strcmp(string, "nop\n") == 0) {
        length++;
      } else if (strcmp(string, "int\n") == 0 || strcmp(string, "pause\n") == 0 || strcmp(string, "fnop\n") == 0 || strcmp(string, "cpuid\n") == 0) {
        length = length + 2;
        fgets(string, sizeof(string), source);
      } else if (strcmp(string, "mov\n") == 0) {
        fgets(string, sizeof(string), source);
        if (strcmp(string, "ah\n") == 0 || strcmp(string, "al\n") == 0) {
          length = length + 2;
          fgets(string, sizeof(string), source);
        } else if (strcmp(string, "dx\n") == 0) {
          length = length + 3;
          fgets(string, sizeof(string), source);
        }
      } else {
        while (string[ch] != '\0' && stop == 0) {
          if (string[ch] == ':') {
            token = strtok(string, ":");
            fprintf(target, "%s\n", token);
            stop++;
            fprintf(target, "%d\n", length);
          } else {
            ch++;
          }
        }
      }
    }
  }
  printf("%d\n", length);
  fclose(source);
  fclose(target);
}
```