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

```asm
<convert_time_to_standard>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x448,%rsp
  mov    %rsi,0x20(%rsp)
  mov    %rcx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x438(%rsp)
  xor    %eax,%eax
  cmpb   $0x0,(%rdi)
  je     L81
  mov    %rdi,%r14
  mov    %rdx,%r13
  xor    %ebx,%ebx
  jmp    L186
  nopl   (%rax)
L112:
  movsbl (%r14,%rbx,1),%edi
  call   <tolower@plt>
  mov    %al,(%r14,%rbx,1)
  add    $0x1,%rbx
L186:
  mov    %r14,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jg     L112
  movl   $0x0,0x1c(%rsp)
  xor    %r15d,%r15d
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  movl   $0x0,0x18(%rsp)
  movl   $0x0,0x14(%rsp)
  jmp    L43
  nopw   0x0(%rax,%rax,1)
L201:
  mov    %r14,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %r12d,%eax
  je     L26
  movzbl (%r14,%r15,1),%ecx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %cl,0x30(%rsp,%rax,1)
L180:
  add    $0x1,%r15
L43:
  mov    %r14,%rdi
  mov    %r15d,%r12d
  call   <strlen@plt>
  cmp    %r15d,%eax
  jle    L118
  movzbl (%r14,%r15,1),%eax
  lea    (%r14,%r15,1),%rcx
  cmp    0x0(%r13),%al
  je     L95
  mov    0x8(%rsp),%rdx
  cmp    (%rdx),%al
  je     L95
  cmp    $0x3a,%al
  je     L26
  cmp    $0x2e,%al
  jne    L201
L26:
  mov    %r14,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %r12d,%eax
  jne    L166
  movzbl (%r14,%r15,1),%ecx
  movslq %ebx,%rax
  add    $0x1,%ebx
  mov    %cl,0x30(%rsp,%rax,1)
L166:
  movslq %ebx,%rbx
  movb   $0x0,0x30(%rsp,%rbx,1)
  cmp    $0x1,%ebp
  je     L217
  cmp    $0x2,%ebp
  je     L24
  test   %ebp,%ebp
  je     L240
L80:
  add    $0x1,%ebp
  xor    %ebx,%ebx
  jmp    L180
  nopw   0x0(%rax,%rax,1)
L217:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x18(%rsp)
  jmp    L80
L240:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x14(%rsp)
  jmp    L80
L24:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x1c(%rsp)
  jmp    L80
L95:
  movslq %ebx,%rbx
  movb   $0x0,0x30(%rsp,%rbx,1)
  cmp    $0x1,%ebp
  je     L190
  cmp    $0x2,%ebp
  je     L187
  test   %ebp,%ebp
  je     L203
L118:
  mov    0x1c(%rsp),%r8d
  mov    0x18(%rsp),%ecx
  lea    D7(%rip),%rsi
  mov    0x14(%rsp),%edx
  mov    0x20(%rsp),%rdi
  call   <sprintf@plt>
L78:
  mov    0x438(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L21
  add    $0x448,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L81:
  movb   $0x0,(%rsi)
  jmp    L78
  nopl   (%rax)
L203:
  lea    0x30(%rsp),%rdi
  mov    %rcx,0x28(%rsp)
  call   <atoi@plt>
  mov    0x8(%rsp),%rsi
  mov    0x28(%rsp),%rcx
  mov    %eax,0x14(%rsp)
  movzbl (%rsi),%esi
  cmp    %sil,(%rcx)
  jne    L118
  cmp    $0xb,%eax
  mov    %eax,%esi
  lea    0xc(%rax),%eax
  setle  %dl
  test   %dl,%dl
  cmove  %esi,%eax
  mov    %eax,0x14(%rsp)
  jmp    L118
  xchg   %ax,%ax
L187:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x1c(%rsp)
  jmp    L118
  nopl   0x0(%rax,%rax,1)
L190:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x18(%rsp)
  jmp    L118
L21:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D7
type_infered: string

tool: D7: %02d:%02d:%02d

assistant: ```c
void convert_time_to_standard(char timestr[], char converted[], char am[], char pm[]) {
  int i, ctr = 0, state = 0;
  int hr = 0, min = 0, sec = 0;
  char str[1024];
  if (timestr[0] == 0) {
    converted[0] = 0;
    return;
  }
  for (i = 0; i < strlen(timestr); i++)
    timestr[i] = tolower(timestr[i]);
  for (i = 0; i < strlen(timestr); i++) {
    if ((timestr[i] == am[0]) || (timestr[i] == pm[0])) {
      str[ctr] = 0;
      switch (state) {
      case 0: {
        hr = atoi(str);
        if (timestr[i] == pm[0])
          if (hr < 12)
            hr += 12;
        break;
      }
      case 1: {
        min = atoi(str);
        break;
      }
      case 2: {
        sec = atoi(str);
        break;
      }
      }
      break;
    }
    if ((timestr[i] == ':') || (timestr[i] == '.') || (i == strlen(timestr) - 1)) {
      if (i == strlen(timestr) - 1)
        str[ctr++] = timestr[i];
      str[ctr] = 0;
      switch (state) {
      case 0: {
        hr = atoi(str);
        break;
      }
      case 1: {
        min = atoi(str);
        break;
      }
      case 2: {
        sec = atoi(str);
        break;
      }
      }
      ctr = 0;
      state++;
    } else
      str[ctr++] = timestr[i];
  }
  sprintf(converted, "%02d:%02d:%02d", hr, min, sec);
}
```