user: Translate the below assembly code into C programming language:

```asm
<u8_escape_wchar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %edx,-0x14(%rbp)
  cmpq   $0x2,-0x10(%rbp)
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  cmpl   $0xa,-0x14(%rbp)
  jne    L164
  mov    -0x8(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L164:
  cmpl   $0x9,-0x14(%rbp)
  jne    L35
  mov    -0x8(%rbp),%rax
  lea    D98(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L35:
  cmpl   $0xd,-0x14(%rbp)
  jne    L171
  mov    -0x8(%rbp),%rax
  lea    D100(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L171:
  cmpl   $0x1b,-0x14(%rbp)
  jne    L64
  mov    -0x8(%rbp),%rax
  lea    D77(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L64:
  cmpl   $0x8,-0x14(%rbp)
  jne    L235
  mov    -0x8(%rbp),%rax
  lea    D76(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L235:
  cmpl   $0xc,-0x14(%rbp)
  jne    L155
  mov    -0x8(%rbp),%rax
  lea    D111(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L155:
  cmpl   $0xb,-0x14(%rbp)
  jne    L183
  mov    -0x8(%rbp),%rax
  lea    D73(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L183:
  cmpl   $0x7,-0x14(%rbp)
  jne    L232
  mov    -0x8(%rbp),%rax
  lea    D57(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L232:
  cmpl   $0x5c,-0x14(%rbp)
  jne    L105
  mov    -0x8(%rbp),%rax
  lea    D27(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <buf_put2c@plt>
  jmp    L111
L105:
  cmpl   $0x1f,-0x14(%rbp)
  jle    L28
  cmpl   $0x7f,-0x14(%rbp)
  jne    L16
L28:
  mov    -0x14(%rbp),%eax
  movzbl %al,%edx
  mov    -0x10(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  lea    D90(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L111
L16:
  cmpl   $0xffff,-0x14(%rbp)
  jle    L101
  mov    -0x14(%rbp),%eax
  movzwl %ax,%edx
  mov    -0x10(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  lea    D117(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L111
L101:
  cmpl   $0x7f,-0x14(%rbp)
  jle    L148
  mov    -0x14(%rbp),%eax
  movzwl %ax,%edx
  mov    -0x10(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  lea    D69(%rip),%rdx
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L111
L148:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  mov    $0x1,%eax
L111:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D8
datatype: string
name: read_data
arguments: label: D98
datatype: string
name: read_data
arguments: label: D100
datatype: string
name: read_data
arguments: label: D77
datatype: string
name: read_data
arguments: label: D76
datatype: string
name: read_data
arguments: label: D111
datatype: string
name: read_data
arguments: label: D73
datatype: string
name: read_data
arguments: label: D57
datatype: string
name: read_data
arguments: label: D27
datatype: string
name: read_data
arguments: label: D90
datatype: string
name: read_data
arguments: label: D117
datatype: string
name: read_data
arguments: label: D69
datatype: string

tool: D8: \n

tool: D98: \t

tool: D100: \r

tool: D77: \e

tool: D76: \b

tool: D111: \f

tool: D73: \v

tool: D57: \a

tool: D27: \\

tool: D90: \x%.2hhx

tool: D117: \U%.8x

tool: D69: \u%.4hx

assistant: ```c
int u8_escape_wchar(char *buf, size_t sz, uint32_t ch) {
  assert(sz > 2);
  if (ch == L'\n')
    return buf_put2c(buf, "\\n");
  else if (ch == L'\t')
    return buf_put2c(buf, "\\t");
  else if (ch == L'\r')
    return buf_put2c(buf, "\\r");
  else if (ch == L'\x1B')
    return buf_put2c(buf, "\\e");
  else if (ch == L'\b')
    return buf_put2c(buf, "\\b");
  else if (ch == L'\f')
    return buf_put2c(buf, "\\f");
  else if (ch == L'\v')
    return buf_put2c(buf, "\\v");
  else if (ch == L'\a')
    return buf_put2c(buf, "\\a");
  else if (ch == L'\\')
    return buf_put2c(buf, "\\\\");
  else if (ch < 32 || ch == 0x7f)
    return snprintf(buf, sz, "\\x%.2hhx", (unsigned char)ch);
  else if (ch > 0xFFFF)
    return snprintf(buf, sz, "\\U%.8x", (uint32_t)ch);
  else if (ch >= 0x80)
    return snprintf(buf, sz, "\\u%.4hx", (unsigned short)ch);
  buf[0] = (char)ch;
  buf[1] = '\0';
  return 1;
}
```