ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的?

```asm
<print_list>:
  endbr64
  test   %rdi,%rdi
  je     L25
  push   %r12
  push   %rbp
  push   %rbx
  mov    -0x8(%rdi),%eax
  mov    %rdi,%rbx
  test   %eax,%eax
  jle    L0
  sub    $0x1,%eax
  lea    D9(%rip),%rbp
  lea    0x4(%rdi,%rax,4),%r12
  cs nopw 0x0(%rax,%rax,1)
L4:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L4
L0:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L25:
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D9
type_guessed: string

tool: D9: %d


assistant: ```c
void print_list(int *list) {
  int len = ((list) ? ((((int *)(list))[-2])) : 0);
  for (int i = 0; i < len; i++)
    printf("%d\n", list[i]);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<print_list>:
  endbr64
  test   %rdi,%rdi
  je     L7
  push   %r12
  push   %rbp
  push   %rbx
  mov    -0x8(%rdi),%eax
  mov    %rdi,%rbx
  test   %eax,%eax
  jle    L19
  sub    $0x1,%eax
  lea    D8(%rip),%rbp
  lea    0x4(%rdi,%rax,4),%r12
  cs nopw 0x0(%rax,%rax,1)
L23:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L23
L19:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L7:
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D8
datatype: string

tool: D8: %d


assistant: ```c
void print_list(int *list) {
  int len = ((list) ? ((((int *)(list))[-2])) : 0);
  for (int i = 0; i < len; i++)
    printf("%d\n", list[i]);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<next_word_end>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L23
L10:
  addq   $0x1,-0x8(%rbp)
L23:
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L6
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  je     L10
L6:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
size_t next_word_end(const char *str) {
  size_t res = 0;
  while (str[res] != '\0' && !isspace((unsigned char)str[res])) {
    res++;
  }
  return res;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<next_word_end>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  movzbl (%rdi),%edi
  mov    $0x0,%ebx
  test   %dil,%dil
  je     L0
L16:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L0
  add    $0x1,%rbx
  movzbl 0x0(%rbp,%rbx,1),%edi
  test   %dil,%dil
  jne    L16
L0:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
size_t next_word_end(const char *str) {
  size_t res = 0;
  while (str[res] != '\0' && !isspace((unsigned char)str[res])) {
    res++;
  }
  return res;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<next_word_end>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%edi
  test   %dil,%dil
  jne    L15
  jmp    L5
  nopl   0x0(%rax,%rax,1)
L26:
  add    $0x1,%r12
  movzbl (%rbx,%r12,1),%edi
  test   %dil,%dil
  je     L5
L15:
  call   <isspace@plt>
  test   %eax,%eax
  je     L26
L5:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
size_t next_word_end(const char *str) {
  size_t res = 0;
  while (str[res] != '\0' && !isspace((unsigned char)str[res])) {
    res++;
  }
  return res;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<next_word_end>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%edi
  test   %dil,%dil
  jne    L4
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L2:
  add    $0x1,%r12
  movzbl (%rbx,%r12,1),%edi
  test   %dil,%dil
  je     L12
L4:
  call   <isspace@plt>
  test   %eax,%eax
  je     L2
L12:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
size_t next_word_end(const char *str) {
  size_t res = 0;
  while (str[res] != '\0' && !isspace((unsigned char)str[res])) {
    res++;
  }
  return res;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<message_is_read>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    D7(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L8
  mov    $0xffffffff,%eax
  jmp    L3
L8:
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  mov    $0x53,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
L3:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D7
datatype: string

tool: D7: :2

assistant: ```c
int message_is_read(const char *name) {
  const char *flags;
  flags = strstr(name, ":2");
  if (flags == NULL)
    return -1;
  return strchr(flags + 2, 'S') == NULL ? 0 : 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<message_is_read>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rsi
  call   <strstr@plt>
  mov    $0xffffffff,%edx
  test   %rax,%rax
  je     L1
  lea    0x2(%rax),%rdi
  mov    $0x53,%esi
  call   <strchr@plt>
  test   %rax,%rax
  setne  %dl
  movzbl %dl,%edx
L1:
  mov    %edx,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D2
type: string

tool: D2: :2

assistant: ```c
int message_is_read(const char *name) {
  const char *flags;
  flags = strstr(name, ":2");
  if (flags == NULL)
    return -1;
  return strchr(flags + 2, 'S') == NULL ? 0 : 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<message_is_read>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rsi
  call   <strstr@plt>
  mov    $0xffffffff,%r8d
  test   %rax,%rax
  je     L6
  lea    0x2(%rax),%rdi
  mov    $0x53,%esi
  call   <strchr@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  setne  %r8b
L6:
  mov    %r8d,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D2
type_infered: string

tool: D2: :2

assistant: ```c
int message_is_read(const char *name) {
  const char *flags;
  flags = strstr(name, ":2");
  if (flags == NULL)
    return -1;
  return strchr(flags + 2, 'S') == NULL ? 0 : 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<message_is_read>:
  endbr64
  sub    $0x8,%rsp
  lea    D7(%rip),%rsi
  call   <strstr@plt>
  mov    $0xffffffff,%r8d
  test   %rax,%rax
  je     L4
  lea    0x2(%rax),%rdi
  mov    $0x53,%esi
  call   <strchr@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  setne  %r8b
L4:
  mov    %r8d,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: tag: D7
type_guessed: string

tool: D7: :2

assistant: ```c
int message_is_read(const char *name) {
  const char *flags;
  flags = strstr(name, ":2");
  if (flags == NULL)
    return -1;
  return strchr(flags + 2, 'S') == NULL ? 0 : 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<Uart_Print>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  jmp    L11
L18:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <Uart_Putch@plt>
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L17
  mov    $0xd,%edi
  call   <Uart_Putch@plt>
L17:
  addq   $0x1,-0x8(%rbp)
L11:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L18
  nop
  nop
  leave
  ret
```

assistant: ```c
void Uart_Print(char *UartPrintData) {
  while (*UartPrintData != '\0') {
    Uart_Putch(*UartPrintData);
    if (*UartPrintData == 0x0A)
      Uart_Putch(0x0D);
    UartPrintData++;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Uart_Print>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  test   %dil,%dil
  jne    L5
L26:
  pop    %rbx
  ret
L21:
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L26
L5:
  movsbl %dil,%edi
  call   <Uart_Putch@plt>
  cmpb   $0xa,(%rbx)
  jne    L21
  mov    $0xd,%edi
  call   <Uart_Putch@plt>
  jmp    L21
```

assistant: ```c
void Uart_Print(char *UartPrintData) {
  while (*UartPrintData != '\0') {
    Uart_Putch(*UartPrintData);
    if (*UartPrintData == 0x0A)
      Uart_Putch(0x0D);
    UartPrintData++;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Uart_Print>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movsbl (%rdi),%edi
  test   %dil,%dil
  jne    L22
  jmp    L16
  nopw   0x0(%rax,%rax,1)
L35:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L16
L22:
  call   <Uart_Putch@plt>
  cmpb   $0xa,(%rbx)
  jne    L35
  mov    $0xd,%edi
  add    $0x1,%rbx
  call   <Uart_Putch@plt>
  movsbl (%rbx),%edi
  test   %dil,%dil
  jne    L22
L16:
  pop    %rbx
  ret
```

assistant: ```c
void Uart_Print(char *UartPrintData) {
  while (*UartPrintData != '\0') {
    Uart_Putch(*UartPrintData);
    if (*UartPrintData == 0x0A)
      Uart_Putch(0x0D);
    UartPrintData++;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<Uart_Print>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L25
L24:
  call   <Uart_Putch@plt>
  cmpb   $0xa,(%rbx)
  je     L15
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L24
L25:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L15:
  mov    $0xd,%edi
  add    $0x1,%rbx
  call   <Uart_Putch@plt>
  movsbl (%rbx),%edi
  test   %dil,%dil
  jne    L24
  pop    %rbx
  ret
```

assistant: ```c
void Uart_Print(char *UartPrintData) {
  while (*UartPrintData != '\0') {
    Uart_Putch(*UartPrintData);
    if (*UartPrintData == 0x0A)
      Uart_Putch(0x0D);
    UartPrintData++;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<itoa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jne    L37
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x20(%rbp),%rax
  jmp    L38
L37:
  cmpl   $0x0,-0x14(%rbp)
  jns    L10
  cmpl   $0xa,-0x18(%rbp)
  jne    L10
  movl   $0x1,-0x8(%rbp)
  negl   -0x14(%rbp)
  jmp    L10
L63:
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %edx,-0x4(%rbp)
  cmpl   $0x9,-0x4(%rbp)
  jle    L11
  mov    -0x4(%rbp),%eax
  add    $0x57,%eax
  mov    %eax,%ecx
  jmp    L64
L11:
  mov    -0x4(%rbp),%eax
  add    $0x30,%eax
  mov    %eax,%ecx
L64:
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %cl,(%rax)
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,-0x14(%rbp)
L10:
  cmpl   $0x0,-0x14(%rbp)
  jne    L63
  cmpl   $0x0,-0x8(%rbp)
  je     L53
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
L53:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0xc(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <reverse@plt>
  mov    -0x20(%rbp),%rax
L38:
  leave
  ret
```

assistant: ```c
char *itoa(int num, char *str, int base) {
  int i = 0;
  bool isNegative = false;
  if (num == 0) {
    str[i++] = '0';
    str[i] = '\0';
    return str;
  }
  if (num < 0 && base == 10) {
    isNegative = true;
    num = -num;
  }
  while (num != 0) {
    int rem = num % base;
    str[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
    num = num / base;
  }
  if (isNegative)
    str[i++] = '-';
  str[i] = '\0';
  reverse(str, i);
  return str;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<itoa>:
  endbr64
  push   %rbx
  mov    %rsi,%rbx
  test   %edi,%edi
  je     L56
  mov    %edi,%ecx
  mov    %edx,%esi
  jns    L44
  cmp    $0xa,%edx
  jne    L44
  neg    %ecx
  mov    $0x1,%r10d
L0:
  mov    %rbx,%rdi
  mov    $0x0,%r9d
  jmp    L68
L56:
  movb   $0x30,(%rsi)
  movb   $0x0,0x1(%rsi)
  jmp    L50
L31:
  mov    %r8d,%r9d
L68:
  mov    %ecx,%eax
  cltd
  idiv   %esi
  lea    0x57(%rdx),%r8d
  lea    0x30(%rdx),%eax
  cmp    $0xa,%edx
  cmovge %r8d,%eax
  lea    0x1(%r9),%r8d
  mov    %al,(%rdi)
  mov    %ecx,%eax
  cltd
  idiv   %esi
  mov    %eax,%ecx
  add    $0x1,%rdi
  test   %eax,%eax
  jne    L31
  test   %r10d,%r10d
  je     L40
  movslq %r8d,%r8
  movb   $0x2d,(%rbx,%r8,1)
  lea    0x2(%r9),%r8d
L40:
  movslq %r8d,%rax
  movb   $0x0,(%rbx,%rax,1)
  mov    %r8d,%esi
  mov    %rbx,%rdi
  call   <reverse@plt>
L50:
  mov    %rbx,%rax
  pop    %rbx
  ret
L44:
  mov    $0x0,%r10d
  jmp    L0
```

assistant: ```c
char *itoa(int num, char *str, int base) {
  int i = 0;
  bool isNegative = false;
  if (num == 0) {
    str[i++] = '0';
    str[i] = '\0';
    return str;
  }
  if (num < 0 && base == 10) {
    isNegative = true;
    num = -num;
  }
  while (num != 0) {
    int rem = num % base;
    str[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
    num = num / base;
  }
  if (isNegative)
    str[i++] = '-';
  str[i] = '\0';
  reverse(str, i);
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<itoa>:
  endbr64
  push   %r12
  mov    %edi,%eax
  mov    %rsi,%r12
  test   %edi,%edi
  je     L4
  mov    %edx,%edi
  jns    L0
  cmp    $0xa,%edx
  jne    L0
  neg    %eax
  mov    $0x1,%r10d
L22:
  mov    %r12,%rsi
  xor    %r9d,%r9d
  jmp    L30
  nopl   0x0(%rax,%rax,1)
L25:
  mov    %r8d,%r9d
L30:
  cltd
  idiv   %edi
  lea    0x57(%rdx),%r8d
  cmp    $0xa,%edx
  lea    0x30(%rdx),%ecx
  cmovge %r8d,%ecx
  lea    0x1(%r9),%r8d
  add    $0x1,%rsi
  mov    %cl,-0x1(%rsi)
  test   %eax,%eax
  jne    L25
  test   %r10d,%r10d
  je     L26
  movslq %r8d,%r8
  movb   $0x2d,(%r12,%r8,1)
  lea    0x2(%r9),%r8d
L26:
  movslq %r8d,%rax
  mov    %r12,%rdi
  mov    %r8d,%esi
  movb   $0x0,(%r12,%rax,1)
  call   <reverse@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L0:
  xor    %r10d,%r10d
  jmp    L22
  nopl   (%rax)
L4:
  mov    $0x30,%eax
  mov    %ax,(%rsi)
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *itoa(int num, char *str, int base) {
  int i = 0;
  bool isNegative = false;
  if (num == 0) {
    str[i++] = '0';
    str[i] = '\0';
    return str;
  }
  if (num < 0 && base == 10) {
    isNegative = true;
    num = -num;
  }
  while (num != 0) {
    int rem = num % base;
    str[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
    num = num / base;
  }
  if (isNegative)
    str[i++] = '-';
  str[i] = '\0';
  reverse(str, i);
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<itoa>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  test   %edi,%edi
  je     L41
  mov    %edi,%eax
  mov    %edx,%esi
  jns    L20
  cmp    $0xa,%edx
  jne    L20
  neg    %eax
  mov    $0x1,%r9d
L18:
  mov    %r12,%rcx
  xor    %edi,%edi
  jmp    L83
  nopl   0x0(%rax,%rax,1)
L74:
  add    $0x57,%edx
  add    $0x1,%rcx
  mov    %dl,-0x1(%rcx)
  test   %eax,%eax
  je     L6
L11:
  mov    %r8d,%edi
L83:
  cltd
  lea    0x1(%rdi),%r8d
  idiv   %esi
  cmp    $0x9,%edx
  jg     L74
  add    $0x30,%edx
  add    $0x1,%rcx
  mov    %dl,-0x1(%rcx)
  test   %eax,%eax
  jne    L11
L6:
  test   %r9d,%r9d
  je     L45
  movslq %r8d,%r8
  movb   $0x2d,(%r12,%r8,1)
  lea    0x2(%rdi),%r8d
L45:
  movslq %r8d,%rax
  mov    %r12,%rdi
  mov    %r8d,%esi
  movb   $0x0,(%r12,%rax,1)
  call   <reverse@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L20:
  xor    %r9d,%r9d
  jmp    L18
  nopl   (%rax)
L41:
  mov    $0x30,%eax
  mov    %ax,(%rsi)
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *itoa(int num, char *str, int base) {
  int i = 0;
  bool isNegative = false;
  if (num == 0) {
    str[i++] = '0';
    str[i] = '\0';
    return str;
  }
  if (num < 0 && base == 10) {
    isNegative = true;
    num = -num;
  }
  while (num != 0) {
    int rem = num % base;
    str[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
    num = num / base;
  }
  if (isNegative)
    str[i++] = '-';
  str[i] = '\0';
  reverse(str, i);
  return str;
}
```
user: What is the c source code of the assembly code below:

```asm
<hex2bin>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <smalloc@plt>
  cltq
  mov    %rax,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x14(%rbp)
  jmp    L68
L42:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  cmpl   $0x2f,-0xc(%rbp)
  jle    L39
  cmpl   $0x39,-0xc(%rbp)
  jg     L39
  mov    -0xc(%rbp),%eax
  sub    $0x30,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L22
L39:
  cmpl   $0x60,-0xc(%rbp)
  jle    L63
  cmpl   $0x66,-0xc(%rbp)
  jg     L63
  mov    -0xc(%rbp),%eax
  sub    $0x57,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L22
L63:
  cmpl   $0x40,-0xc(%rbp)
  jle    L3
  cmpl   $0x46,-0xc(%rbp)
  jg     L3
  mov    -0xc(%rbp),%eax
  sub    $0x37,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L22
L3:
  movl   $0x0,-0x10(%rbp)
L22:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  mov    %eax,%edi
  mov    -0x14(%rbp),%eax
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  and    $0x1,%eax
  sub    %ecx,%eax
  mov    %eax,%ecx
  mov    $0x1,%eax
  sub    %ecx,%eax
  shl    $0x2,%eax
  mov    -0x10(%rbp),%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  mov    %esi,%eax
  or     %eax,%edi
  mov    %edi,%ecx
  movslq %edx,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x14(%rbp)
L68:
  mov    -0x2c(%rbp),%eax
  add    %eax,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L42
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
unsigned char *hex2bin(const char *in, int outlen) {
  unsigned char *ret = ((unsigned char *)smalloc((outlen) * sizeof(unsigned char)));
  int i;
  memset(ret, 0, outlen * sizeof(unsigned char));
  for (i = 0; i < outlen * 2; i++) {
    int c = in[i];
    int v;
    assert(c != 0);
    if (c >= '0' && c <= '9')
      v = c - '0';
    else if (c >= 'a' && c <= 'f')
      v = c - 'a' + 10;
    else if (c >= 'A' && c <= 'F')
      v = c - 'A' + 10;
    else
      v = 0;
    ret[i / 2] |= v << (4 * (1 - (i % 2)));
  }
  return ret;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<hex2bin>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r15
  mov    %esi,%r14d
  movslq %esi,%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <smalloc@plt>
  movslq %eax,%r13
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  add    %r14d,%r14d
  test   %r14d,%r14d
  jle    L19
  mov    %r14d,%r14d
  mov    $0x0,%r12d
  jmp    L60
L9:
  lea    -0x61(%rbx),%eax
  cmp    $0x5,%eax
  ja     L8
  sub    $0x57,%ebx
L40:
  mov    %ebp,%eax
  shr    $0x1f,%eax
  add    %ebp,%eax
  sar    %eax
  cltq
  mov    %ebp,%edx
  shr    $0x1f,%edx
  add    %edx,%ebp
  and    $0x1,%ebp
  sub    %ebp,%edx
  lea    0x4(,%rdx,4),%ecx
  shl    %cl,%ebx
  or     %bl,0x0(%r13,%rax,1)
  add    $0x1,%r12
  cmp    %r14,%r12
  je     L19
L60:
  mov    %r12d,%ebp
  movsbl (%r15,%r12,1),%ebx
  test   %ebx,%ebx
  setne  %dil
  movzbl %dil,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  lea    -0x30(%rbx),%eax
  cmp    $0x9,%eax
  ja     L9
  mov    %eax,%ebx
  jmp    L40
L8:
  lea    -0x41(%rbx),%eax
  sub    $0x37,%ebx
  cmp    $0x6,%eax
  mov    $0x0,%eax
  cmovae %eax,%ebx
  jmp    L40
L19:
  mov    %r13,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned char *hex2bin(const char *in, int outlen) {
  unsigned char *ret = ((unsigned char *)smalloc((outlen) * sizeof(unsigned char)));
  int i;
  memset(ret, 0, outlen * sizeof(unsigned char));
  for (i = 0; i < outlen * 2; i++) {
    int c = in[i];
    int v;
    assert(c != 0);
    if (c >= '0' && c <= '9')
      v = c - '0';
    else if (c >= 'a' && c <= 'f')
      v = c - 'a' + 10;
    else if (c >= 'A' && c <= 'F')
      v = c - 'A' + 10;
    else
      v = 0;
    ret[i / 2] |= v << (4 * (1 - (i % 2)));
  }
  return ret;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<hex2bin>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  movslq %esi,%r13
  push   %r12
  mov    %rdi,%r12
  mov    %r13,%rdi
  push   %rbp
  push   %rbx
  mov    %r13,%rbx
  add    %ebx,%ebx
  sub    $0x8,%rsp
  call   <smalloc@plt>
  mov    %r13,%rdx
  xor    %esi,%esi
  movslq %eax,%r14
  mov    %r14,%rdi
  call   <memset@plt>
  test   %ebx,%ebx
  jle    L1
  movslq %ebx,%r13
  xor    %ebp,%ebp
  jmp    L4
  nopw   0x0(%rax,%rax,1)
L32:
  lea    -0x57(%r15),%eax
L24:
  mov    %eax,%edx
  shl    %cl,%edx
L11:
  sar    %ebx
  add    $0x1,%rbp
  movslq %ebx,%rax
  or     %dl,(%r14,%rax,1)
  cmp    %r13,%rbp
  je     L1
L4:
  movsbl (%r12,%rbp,1),%r15d
  xor    %edi,%edi
  mov    %ebp,%ebx
  test   %r15d,%r15d
  setne  %dil
  xor    %eax,%eax
  call   <assert@plt>
  mov    %ebp,%ecx
  lea    -0x30(%r15),%eax
  not    %ecx
  and    $0x1,%ecx
  shl    $0x2,%ecx
  cmp    $0x9,%eax
  jbe    L24
  lea    -0x61(%r15),%eax
  cmp    $0x5,%eax
  jbe    L32
  lea    -0x41(%r15),%eax
  sub    $0x37,%r15d
  shl    %cl,%r15d
  cmp    $0x6,%eax
  mov    $0x0,%eax
  mov    %r15d,%edx
  cmovae %eax,%edx
  jmp    L11
L1:
  add    $0x8,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned char *hex2bin(const char *in, int outlen) {
  unsigned char *ret = ((unsigned char *)smalloc((outlen) * sizeof(unsigned char)));
  int i;
  memset(ret, 0, outlen * sizeof(unsigned char));
  for (i = 0; i < outlen * 2; i++) {
    int c = in[i];
    int v;
    assert(c != 0);
    if (c >= '0' && c <= '9')
      v = c - '0';
    else if (c >= 'a' && c <= 'f')
      v = c - 'a' + 10;
    else if (c >= 'A' && c <= 'F')
      v = c - 'A' + 10;
    else
      v = 0;
    ret[i / 2] |= v << (4 * (1 - (i % 2)));
  }
  return ret;
}
```