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

```asm
<write_register>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D79(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D77(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %al,-0x11(%rbp)
  jmp    L53
L134:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %al,-0x11(%rbp)
L53:
  cmpb   $0xa,-0x11(%rbp)
  je     L134
  movl   $0x0,-0xc(%rbp)
  movsbl -0x11(%rbp),%eax
  cmp    $0x34,%eax
  je     L74
  cmp    $0x34,%eax
  jg     L1
  cmp    $0x33,%eax
  je     L119
  cmp    $0x33,%eax
  jg     L1
  cmp    $0x31,%eax
  je     L125
  cmp    $0x32,%eax
  je     L3
  jmp    L1
L125:
  movl   $0x78,-0xc(%rbp)
  jmp    L18
L3:
  movl   $0x7a,-0xc(%rbp)
  jmp    L18
L119:
  movl   $0xbc,-0xc(%rbp)
  jmp    L18
L74:
  movl   $0xbe,-0xc(%rbp)
  jmp    L18
L1:
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L9
L18:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <bus_readbyte@plt>
  mov    %eax,%esi
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x10(%rbp)
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D68(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <bus_writebyte@plt>
L9:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L70
  call   <__stack_chk_fail@plt>
L70:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D79
type_guessed: string
name: read_data
arguments: data_label: D77
type_guessed: string
name: read_data
arguments: data_label: D30
type_guessed: string
name: read_data
arguments: data_label: D25
type_guessed: string
name: read_data
arguments: data_label: D33
type_guessed: string
name: read_data
arguments: data_label: D18
type_guessed: string
name: read_data
arguments: data_label: D60
type_guessed: string
name: read_data
arguments: data_label: D68
type_guessed: string

tool: D79: Select destination...

tool: D77: 1. LPT0_DATA

tool: D30: 2. LPT0_CTRL

tool: D25: 3. LPT1_DATA

tool: D33: 4. LPT1_CTRL

tool: D18: Error

tool: D60: Current value: 0x%X, enter new value (hex) 0x: 

tool: D68: %x

assistant: ```c
void write_register() {
  printf("Select destination...\n");
  printf("1. LPT0_DATA\n");
  printf("2. LPT0_CTRL\n");
  printf("3. LPT1_DATA\n");
  printf("4. LPT1_CTRL\n");
  char c = getchar();
  while (c == '\n')
    c = getchar();
  unsigned reg = 0;
  switch (c) {
  case '1':
    reg = 0x78;
    break;
  case '2':
    reg = 0x7A;
    break;
  case '3':
    reg = 0xBC;
    break;
  case '4':
    reg = 0xBE;
    break;
  default:
    printf("Error\n");
    return;
  }
  printf("Current value: 0x%X, enter new value (hex) 0x: ", bus_readbyte(reg));
  unsigned v = 0;
  scanf("%x", &v);
  bus_writebyte(reg, v);
}
```