user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<output_q_hex>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  mov    $0x30,%edi
  push   %rbx
  movabs $0xffffffffffffff,%rbx
  sub    $0x8,%rsp
  call   <output_char@plt>
  mov    $0x78,%edi
  call   <output_char@plt>
  mov    %rbp,%rdx
  lea    0xf(%rbp),%rax
  and    $0xf,%edx
  shl    $0x4,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0x4,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  lea    0xff(%rbp),%rdx
  shl    $0x4,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x8,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  lea    0xfff(%rbp),%rax
  shl    $0x4,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0xc,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  lea    0xffff(%rbp),%rdx
  shl    $0x4,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x10,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  lea    0xfffff(%rbp),%rax
  shl    $0x4,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0x14,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  lea    0xffffff(%rbp),%rdx
  shl    $0x4,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x18,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  lea    0xfffffff(%rbp),%rax
  shl    $0x4,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0x1c,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  mov    $0xffffffff,%edx
  shl    $0x4,%rax
  add    %rbp,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x20,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  movabs $0xfffffffff,%rax
  shl    $0x4,%rdx
  add    %rbp,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0x24,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  movabs $0xffffffffff,%rdx
  shl    $0x4,%rax
  add    %rbp,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x28,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  movabs $0xfffffffffff,%rax
  shl    $0x4,%rdx
  add    %rbp,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rax
  sar    $0x2c,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  movabs $0xffffffffffff,%rdx
  shl    $0x4,%rax
  add    %rbp,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rdx
  sar    $0x30,%rdx
  and    $0xf,%edx
  add    %rax,%rdx
  movabs $0xfffffffffffff,%rax
  add    %rbp,%rax
  shl    $0x4,%rdx
  test   %rbp,%rbp
  cmovns %rbp,%rax
  add    %rbp,%rbx
  sar    $0x34,%rax
  and    $0xf,%eax
  add    %rdx,%rax
  shl    $0x4,%rax
  test   %rbp,%rbp
  cmovns %rbp,%rbx
  mov    $0xf,%ebp
  sar    $0x38,%rbx
  and    $0xf,%ebx
  add    %rax,%rbx
  cs nopw 0x0(%rax,%rax,1)
L2:
  mov    %rbx,%rax
  sar    $0x4,%rbx
  and    $0xf,%eax
  cmp    $0x9,%rax
  lea    0x30(%rax),%rdx
  lea    0x37(%rax),%rdi
  cmovle %rdx,%rdi
  call   <output_char@plt>
  sub    $0x1,%rbp
  jne    L2
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void output_q_hex(long n) {
  long num;
  long c;
  long num2;
  long i;
  num = n;
  num2 = n;
  output_char((long)'0');
  output_char((long)'x');
  num2 = 0;
  i = 0;
output_q_hex_j1:
  c = num & 0xF;
  num = num / 16;
  num2 = num2 * 16;
  num2 = num2 + c;
  i = i + 1;
  if (i < 15) {
    goto output_q_hex_j1;
  }
  i = 0;
output_q_hex_j2:
  c = num2 & 0xF;
  num2 = num2 / 16;
  if (c < 10) {
    c = c + 48;
  } else {
    c = c + 55;
  }
  output_char((long)c);
  i = i + 1;
  if (i < 15) {
    goto output_q_hex_j2;
  }
  return;
}
```