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    %rdi,%rbx
  mov    %rsi,0x28(%rsp)
  mov    %rdx,%r15
  mov    %rcx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x438(%rsp)
  xor    %eax,%eax
  mov    $0x0,%ebp
  cmpb   $0x0,(%rdi)
  jne    L62
  movb   $0x0,(%rsi)
  jmp    L24
L63:
  movsbl (%rbx,%rbp,1),%edi
  call   <tolower@plt>
  mov    %al,(%rbx,%rbp,1)
  add    $0x1,%rbp
L62:
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    %ebp,%eax
  jg     L63
  mov    $0x0,%ebp
  movl   $0x0,0x24(%rsp)
  movl   $0x0,0x20(%rsp)
  movl   $0x0,0x1c(%rsp)
  mov    $0x0,%r13d
  mov    $0x0,%r12d
  jmp    L150
L131:
  movslq %r12d,%r12
  movb   $0x0,0x30(%rsp,%r12,1)
  cmp    $0x1,%r13d
  je     L120
  cmp    $0x2,%r13d
  je     L80
  test   %r13d,%r13d
  je     L57
L149:
  mov    0x24(%rsp),%r8d
  mov    0x20(%rsp),%ecx
  mov    0x1c(%rsp),%edx
  lea    D5(%rip),%rsi
  mov    0x28(%rsp),%rdi
  call   <sprintf@plt>
L24:
  mov    0x438(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L187
  add    $0x448,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L57:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x1c(%rsp)
  mov    0x10(%rsp),%rsi
  mov    0x8(%rsp),%rdx
  movzbl (%rdx),%edx
  cmp    %dl,(%rsi)
  jne    L149
  mov    %eax,%esi
  cmp    $0xb,%eax
  setle  %dl
  lea    0xc(%rax),%eax
  test   %dl,%dl
  cmove  %esi,%eax
  mov    %eax,0x1c(%rsp)
  jmp    L149
L120:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x20(%rsp)
  jmp    L149
L80:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x24(%rsp)
  jmp    L149
L121:
  mov    %rbx,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %r14d,%eax
  je     L213
L239:
  movslq %r12d,%r12
  movb   $0x0,0x30(%rsp,%r12,1)
  cmp    $0x1,%r13d
  je     L184
  cmp    $0x2,%r13d
  je     L37
  test   %r13d,%r13d
  je     L156
L203:
  add    $0x1,%r13d
  mov    $0x0,%r12d
L231:
  add    $0x1,%rbp
L150:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %ebp,%r14d
  cmp    %ebp,%eax
  jle    L149
  lea    (%rbx,%rbp,1),%rax
  mov    %rax,0x10(%rsp)
  movzbl (%rbx,%rbp,1),%eax
  cmp    (%r15),%al
  je     L131
  mov    0x8(%rsp),%rcx
  cmp    (%rcx),%al
  je     L131
  cmp    $0x3a,%al
  je     L121
  cmp    $0x2e,%al
  je     L121
  mov    %rbx,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %r14d,%eax
  je     L121
  movslq %r12d,%rax
  movzbl (%rbx,%rbp,1),%edx
  mov    %dl,0x30(%rsp,%rax,1)
  lea    0x1(%r12),%r12d
  jmp    L231
L213:
  movslq %r12d,%rax
  movzbl (%rbx,%rbp,1),%edx
  mov    %dl,0x30(%rsp,%rax,1)
  lea    0x1(%r12),%r12d
  jmp    L239
L156:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x1c(%rsp)
  jmp    L203
L184:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x20(%rsp)
  jmp    L203
L37:
  lea    0x30(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,0x24(%rsp)
  jmp    L203
L187:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D5
type_infered: string

tool: D5: %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);
}
```