user: Converte this assembly snippet into its equivalent C code:

```asm
<printhex>:
  endbr64
  test   %edi,%edi
  je     L77
  mov    %edi,%eax
  push   %r13
  sar    $0x1f,%eax
  push   %r12
  shr    $0x1c,%eax
  push   %rbp
  push   %rbx
  lea    (%rdi,%rax,1),%ebx
  and    $0xf,%ebx
  sub    %eax,%ebx
  lea    0xf(%rdi),%eax
  sub    $0x8,%rsp
  test   %edi,%edi
  cmovns %edi,%eax
  mov    %eax,%edx
  sar    $0x4,%edx
  jne    L167
  xor    %edi,%edi
  call   <putchar@plt>
L230:
  mov    $0x61,%edi
  cmp    $0xa,%ebx
  je     L281
  lea    -0xb(%rbx),%eax
  cmp    $0x4,%eax
  ja     L118
  lea    D31(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L118:
  lea    0x30(%rbx),%edi
  xchg   %ax,%ax
L281:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
L77:
  jmp    1050 <putchar@plt>
  nop
L167:
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rdx,%rax,1),%ebp
  and    $0xf,%ebp
  sub    %eax,%ebp
  test   %edx,%edx
  lea    0xf(%rdx),%eax
  cmovns %edx,%eax
  mov    %eax,%edx
  sar    $0x4,%edx
  je     L176
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rdx,%rax,1),%r12d
  and    $0xf,%r12d
  sub    %eax,%r12d
  test   %edx,%edx
  lea    0xf(%rdx),%eax
  cmovns %edx,%eax
  mov    %eax,%edx
  sar    $0x4,%edx
  jne    L81
  xor    %edi,%edi
  call   <putchar@plt>
L205:
  cmp    $0xa,%r12d
  je     L231
  lea    -0xb(%r12),%eax
  cmp    $0x4,%eax
  ja     L90
  lea    D15(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L176:
  xor    %edi,%edi
  call   <putchar@plt>
L23:
  cmp    $0xa,%ebp
  je     L86
  lea    -0xb(%rbp),%eax
  cmp    $0x4,%eax
  ja     L240
  lea    D36(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   (%rax)
  mov    $0x65,%edi
  jmp    L281
  nopw   0x0(%rax,%rax,1)
  mov    $0x64,%edi
  jmp    L281
  nopw   0x0(%rax,%rax,1)
  mov    $0x63,%edi
  jmp    L281
  nopw   0x0(%rax,%rax,1)
  mov    $0x62,%edi
  jmp    L281
  nopw   0x0(%rax,%rax,1)
  mov    $0x66,%edi
  jmp    L281
  nopw   0x0(%rax,%rax,1)
L81:
  sar    $0x1f,%eax
  lea    0xf(%rdx),%edi
  shr    $0x1c,%eax
  lea    (%rdx,%rax,1),%r13d
  and    $0xf,%r13d
  sub    %eax,%r13d
  test   %edx,%edx
  cmovns %edx,%edi
  sar    $0x4,%edi
  call   <printhex>
  cmp    $0xa,%r13d
  je     L258
  lea    -0xb(%r13),%eax
  cmp    $0x4,%eax
  ja     L78
  lea    D9(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
L86:
  mov    $0x61,%edi
  call   <putchar@plt>
  jmp    L230
  nopw   0x0(%rax,%rax,1)
  mov    $0x65,%edi
  call   <putchar@plt>
  jmp    L230
  nop
  mov    $0x64,%edi
  call   <putchar@plt>
  jmp    L230
  nop
  mov    $0x63,%edi
  call   <putchar@plt>
  jmp    L230
  nop
  mov    $0x62,%edi
  call   <putchar@plt>
  jmp    L230
  nop
  mov    $0x66,%edi
  call   <putchar@plt>
  jmp    L230
  nop
  mov    $0x65,%edi
  call   <putchar@plt>
  jmp    L23
  nop
  mov    $0x64,%edi
  call   <putchar@plt>
  jmp    L23
  nop
  mov    $0x63,%edi
  call   <putchar@plt>
  jmp    L23
  nop
  mov    $0x62,%edi
  call   <putchar@plt>
  jmp    L23
  nop
  mov    $0x66,%edi
  call   <putchar@plt>
  jmp    L23
  nop
L258:
  mov    $0x61,%edi
  call   <putchar@plt>
  jmp    L205
  mov    $0x65,%edi
  call   <putchar@plt>
  jmp    L205
  mov    $0x64,%edi
  call   <putchar@plt>
  jmp    L205
  mov    $0x63,%edi
  call   <putchar@plt>
  jmp    L205
  mov    $0x62,%edi
  call   <putchar@plt>
  jmp    L205
  mov    $0x66,%edi
  call   <putchar@plt>
  jmp    L205
L240:
  lea    0x30(%rbp),%edi
  call   <putchar@plt>
  jmp    L230
  nopw   0x0(%rax,%rax,1)
L231:
  mov    $0x61,%edi
  call   <putchar@plt>
  jmp    L23
L90:
  lea    0x30(%r12),%edi
  call   <putchar@plt>
  jmp    L23
L78:
  lea    0x30(%r13),%edi
  call   <putchar@plt>
  jmp    L205
```

assistant: ```c
void printhex(int h) {
  if (h == 0) {
    putchar(0);
  } else {
    int pos = h % 16;
    printhex(h / 16);
    if (pos == 10) {
      putchar(97);
    } else if (pos == 11) {
      putchar(98);
    } else if (pos == 12) {
      putchar(99);
    } else if (pos == 13) {
      putchar(100);
    } else if (pos == 14) {
      putchar(101);
    } else if (pos == 15) {
      putchar(102);
    } else {
      putchar(pos + 48);
    }
  }
}
```