user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D76(%rip),%rdi
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  lea    D107(%rip),%rdi
  call   <scanf@plt>
  nopw   0x0(%rax,%rax,1)
L154:
  xor    %eax,%eax
  call   <getchar@plt>
  cmp    $0x20,%al
  je     L154
  nopl   0x0(%rax,%rax,1)
L28:
  xor    %eax,%eax
  call   <getchar@plt>
  movsbl %al,%edi
  cmp    $0xa,%al
  je     L109
L95:
  call   <toupper@plt>
  cmp    $0x41,%al
  je     L188
  cmp    $0x50,%al
  jne    L28
  xor    %eax,%eax
  call   <getchar@plt>
  movsbl %al,%edi
  call   <toupper@plt>
  cmp    $0x4d,%al
  je     L181
  xor    %eax,%eax
  call   <getchar@plt>
  cmp    $0xa,%al
  jne    L28
L181:
  xor    %eax,%eax
  imul   $0x3c,(%rsp),%ebx
  add    0x4(%rsp),%ebx
  call   <getchar@plt>
  add    $0xc,%ebx
  movsbl %al,%edi
  cmp    $0xa,%al
  jne    L95
L109:
  cmp    $0x213,%ebx
  jle    L134
  cmp    $0x27c,%ebx
  jle    L49
  cmp    $0x2d7,%ebx
  jle    L124
  cmp    $0x322,%ebx
  jle    L33
  xor    %edx,%edx
  mov    $0xe,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L114:
  lea    D46(%rip),%rbp
  jmp    L84
L188:
  xor    %eax,%eax
  call   <getchar@plt>
  movsbl %al,%edi
  call   <toupper@plt>
  cmp    $0x4d,%al
  je     L89
  xor    %eax,%eax
  call   <getchar@plt>
  cmp    $0xa,%al
  jne    L28
L89:
  imul   $0x3c,(%rsp),%ebx
  add    0x4(%rsp),%ebx
  jmp    L28
  nop
L134:
  xor    %edx,%edx
  mov    $0x8,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L14:
  lea    D73(%rip),%rbp
L84:
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x8,%edx
  mov    $0x10,%esi
  xor    %eax,%eax
  lea    D54(%rip),%rdi
  call   <printf@plt>
L166:
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L136
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L49:
  mov    $0x2d,%edx
  mov    $0x9,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L14
L124:
  mov    $0x1d,%edx
  mov    $0xb,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D73(%rip),%rdi
  xor    %eax,%eax
  lea    D46(%rip),%rbp
  call   <printf@plt>
  mov    $0x8,%edx
  mov    $0x10,%esi
  xor    %eax,%eax
  lea    D54(%rip),%rdi
  call   <printf@plt>
  jmp    L166
L33:
  mov    $0x2f,%edx
  mov    $0xc,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L114
L136:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D76
data_type: string
name: retrieve_data
arguments: data_tag: D107
data_type: string
name: retrieve_data
arguments: data_tag: D55
data_type: string
name: retrieve_data
arguments: data_tag: D46
data_type: string
name: retrieve_data
arguments: data_tag: D73
data_type: string
name: retrieve_data
arguments: data_tag: D54
data_type: string

tool: D76: Enter a 12-hour time: 

tool: D107: %d:%d

tool: D55: Closest departure time is %.2d:%.2d 

tool: D46: p.m

tool: D73: a.m.

tool: D54: , arriving at %.2d:%.2d 

assistant: ```c
int main(void) {
  int time_closest, a = 480, b = 585, c = 689, d = 767, e = 840;
  int time_arrival, a1 = 616, b1 = 712, c1 = 811, d1 = 900, e1 = 968;
  int hours, minutes, time, ch;
  printf("Enter a 12-hour time: ");
  scanf("%d:%d", &hours, &minutes);
  while (getchar() == ' ')
    ;
  while ((ch = getchar()) != '\n') {
    switch (toupper(ch)) {
    case 'P':
      if (toupper(getchar()) == 'M' || getchar() == '\n')
        time = 60 * hours + minutes + 12;
      break;
    case 'A':
      if (toupper(getchar()) == 'M' || getchar() == '\n')
        time = 60 * hours + minutes;
      break;
    default:
      break;
    }
  }
  if (time < a || time < (a + b) / 2) {
    time_closest = a;
    time_arrival = a1;
  } else if (time < (b + c) / 2) {
    time_closest = b;
    time_arrival = b1;
  } else if (time < (c + d) / 2) {
    time_closest = c;
    time_arrival = c1;
  } else if (time < (d + e) / 2) {
    time_closest = d;
    time_arrival = d1;
  } else {
    time_closest = e;
    time_arrival = e1;
  }
  printf("Closest departure time is %.2d:%.2d ", time_closest / 60, time_closest % 60);
  if (time_closest / 60 < 12)
    printf("a.m.");
  else
    printf("p.m");
  printf(", arriving at %.2d:%.2d ", e1 / 60, e1 % 60);
  if (time_arrival / 60 < 12)
    printf("a.m.\n");
  else
    printf("p.m\n");
  return 0;
}
```