user: 请将以下的汇编代码转换成C语言代码:

```asm
<xmlSerializeHexCharRef>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x26,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x23,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x78,(%rax)
  cmpl   $0xf,-0x1c(%rbp)
  jg     L11
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L166
L11:
  cmpl   $0xff,-0x1c(%rbp)
  jg     L118
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L166
L118:
  cmpl   $0xfff,-0x1c(%rbp)
  jg     L1
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L166
L1:
  cmpl   $0xffff,-0x1c(%rbp)
  jg     L232
  mov    -0x18(%rbp),%rax
  add    $0x3,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L166
L232:
  cmpl   $0xfffff,-0x1c(%rbp)
  jg     L82
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L166
L82:
  mov    -0x18(%rbp),%rax
  add    $0x5,%rax
  mov    %rax,-0x8(%rbp)
L166:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L233
L281:
  mov    -0x1c(%rbp),%eax
  and    $0xf,%eax
  cmp    $0xf,%eax
  ja     L49
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D9(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D9(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x30,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x31,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x32,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x33,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x34,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x35,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x36,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x37,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x38,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x39,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x41,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x42,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x43,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x44,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x45,(%rax)
  jmp    L107
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x46,(%rax)
  jmp    L107
L49:
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x30,(%rax)
  nop
L107:
  sarl   $0x4,-0x1c(%rbp)
L233:
  cmpl   $0x0,-0x1c(%rbp)
  jg     L281
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movb   $0x3b,(%rax)
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned char *xmlSerializeHexCharRef(unsigned char *out, int val) {
  unsigned char *ptr;
  *out++ = '&';
  *out++ = '#';
  *out++ = 'x';
  if (val < 0x10)
    ptr = out;
  else if (val < 0x100)
    ptr = out + 1;
  else if (val < 0x1000)
    ptr = out + 2;
  else if (val < 0x10000)
    ptr = out + 3;
  else if (val < 0x100000)
    ptr = out + 4;
  else
    ptr = out + 5;
  out = ptr + 1;
  while (val > 0) {
    switch (val & 0xF) {
    case 0:
      *ptr-- = '0';
      break;
    case 1:
      *ptr-- = '1';
      break;
    case 2:
      *ptr-- = '2';
      break;
    case 3:
      *ptr-- = '3';
      break;
    case 4:
      *ptr-- = '4';
      break;
    case 5:
      *ptr-- = '5';
      break;
    case 6:
      *ptr-- = '6';
      break;
    case 7:
      *ptr-- = '7';
      break;
    case 8:
      *ptr-- = '8';
      break;
    case 9:
      *ptr-- = '9';
      break;
    case 0xA:
      *ptr-- = 'A';
      break;
    case 0xB:
      *ptr-- = 'B';
      break;
    case 0xC:
      *ptr-- = 'C';
      break;
    case 0xD:
      *ptr-- = 'D';
      break;
    case 0xE:
      *ptr-- = 'E';
      break;
    case 0xF:
      *ptr-- = 'F';
      break;
    default:
      *ptr-- = '0';
      break;
    }
    val >>= 4;
  }
  *out++ = ';';
  *out = 0;
  return (out);
}
```