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

```asm
<draw_hex_table>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    D14(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%ebx
  mov    $0x1,%ebp
  lea    D20(%rip),%r13
  lea    D47(%rip),%r12
  jmp    L80
L174:
  mov    %edx,%edi
  mov    %ebp,%r10d
  mov    %esi,%ecx
  shl    %cl,%r10d
  or     %r10d,%edx
  cmp    $0x1,%eax
  cmovne %edi,%edx
L153:
  add    $0x1,%esi
  cmp    $0x4,%esi
  je     L143
L179:
  lea    (%rsi,%rsi,1),%ecx
  mov    %ebx,%eax
  shr    %cl,%eax
  and    $0x3,%eax
  cmp    $0x2,%eax
  je     L57
  cmp    $0x3,%eax
  jne    L174
  add    $0x1,%r9d
  jmp    L153
L57:
  add    $0x1,%r8d
  jmp    L153
L143:
  cmp    $0x4,%r9d
  je     L66
  cmp    $0x4,%r8d
  je     L124
  test   %r9d,%r9d
  je     L146
  test   %r8d,%r8d
  je     L2
L146:
  test   %r8d,%r8d
  je     L37
  lea    D49(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L47:
  add    $0x1,%ebx
  test   $0x7,%bl
  je     L49
L35:
  cmp    $0x100,%ebx
  je     L171
L80:
  mov    $0x0,%esi
  mov    $0x0,%edx
  mov    $0x0,%r8d
  mov    $0x0,%r9d
  jmp    L179
L66:
  lea    D25(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L47
L124:
  lea    D21(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L47
L2:
  lea    D22(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L47
L37:
  mov    %edx,%edx
  movsbl 0x0(%r13,%rdx,1),%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L47
L49:
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L35
L171:
  lea    D41(%rip),%rdi
  call   <puts@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D14
datatype: string
name: extract_symbolic_data
arguments: label: D20
datatype: string
name: extract_symbolic_data
arguments: label: D47
datatype: string
name: extract_symbolic_data
arguments: label: D49
datatype: string
name: extract_symbolic_data
arguments: label: D25
datatype: string
name: extract_symbolic_data
arguments: label: D21
datatype: string
name: extract_symbolic_data
arguments: label: D22
datatype: string
name: extract_symbolic_data
arguments: label: D41
datatype: string

tool: D14: extern const char hex_digits[256] = {

tool: D20: 0123456789abcdef

tool: D47:  '%c',

tool: D49:  'X',

tool: D25:  'z',

tool: D21:  'x',

tool: D22:  'Z',

tool: D41: };

assistant: ```c
void draw_hex_table() {
  unsigned idx;
  printf("extern const char hex_digits[256] = {\n");
  for (idx = 0; idx < 256; idx += 1) {
    unsigned cnt_z = 0, cnt_x = 0;
    unsigned bv = 0, bdx;
    for (bdx = 0; bdx < 4; bdx += 1) {
      switch ((idx >> (bdx * 2)) & 3) {
      case 0:
        break;
      case 1:
        bv |= 1 << bdx;
        break;
      case 2:
        cnt_x += 1;
        break;
      case 3:
        cnt_z += 1;
        break;
      }
    }
    if (cnt_z == 4)
      printf(" 'z',");
    else if (cnt_x == 4)
      printf(" 'x',");
    else if ((cnt_z > 0) && (cnt_x == 0))
      printf(" 'Z',");
    else if (cnt_x > 0)
      printf(" 'X',");
    else
      printf(" '%c',", "0123456789abcdef"[bv]);
    if (((idx + 1) % 8) == 0)
      printf("\n");
  }
  printf("};\n");
}
```