ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movl   $0x94ce,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <to_naf@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,-0x18(%rbp)
  movl   $0x3039,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <to_naf@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <add_naf@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%ecx
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0xc(%rbp),%ecx
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x20(%rbp),%edx
  mov    -0x14(%rbp),%eax
  lea    (%rdx,%rax,1),%esi
  mov    -0x8(%rbp),%r8d
  mov    -0x10(%rbp),%edi
  mov    -0x1c(%rbp),%ecx
  mov    -0x14(%rbp),%edx
  mov    -0x20(%rbp),%eax
  push   %rsi
  mov    -0x4(%rbp),%esi
  push   %rsi
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D12
type_guessed: string
name: disassemble_data
arguments: data_label: D25
type_guessed: string

tool: D12: %X -> %X -> %X


tool: D25: %d + %d -> %X + %X = %X -> %d = %d


assistant: ```c
int main() {
  int a = 38094;
  int b = to_naf(a);
  int c = from_naf(b);
  int d = 12345;
  int e = to_naf(d);
  int f = from_naf(e);
  int g = add_naf(b, e);
  int h = from_naf(g);
  printf("%X -> %X -> %X\n", a, b, c);
  printf("%X -> %X -> %X\n", d, e, f);
  printf("%d + %d -> %X + %X = %X -> %d = %d\n", a, d, b, e, g, h, a + d);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x94ce,%edi
  call   <to_naf@plt>
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,%r15d
  mov    $0x3039,%edi
  call   <to_naf@plt>
  mov    %eax,%ebp
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,%r14d
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <add_naf@plt>
  mov    %eax,%r12d
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %eax,%r13d
  mov    %r15d,%ecx
  mov    %ebx,%edx
  mov    $0x94ce,%esi
  lea    D2(%rip),%r15
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r14d,%ecx
  mov    %ebp,%edx
  mov    $0x3039,%esi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  push   $0xc507
  push   %r13
  mov    %r12d,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  mov    $0x3039,%edx
  mov    $0x94ce,%esi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: tag: D2
type_infered: string
name: unpack_data
arguments: tag: D9
type_infered: string

tool: D2: %X -> %X -> %X


tool: D9: %d + %d -> %X + %X = %X -> %d = %d


assistant: ```c
int main() {
  int a = 38094;
  int b = to_naf(a);
  int c = from_naf(b);
  int d = 12345;
  int e = to_naf(d);
  int f = from_naf(e);
  int g = add_naf(b, e);
  int h = from_naf(g);
  printf("%X -> %X -> %X\n", a, b, c);
  printf("%X -> %X -> %X\n", d, e, f);
  printf("%d + %d -> %X + %X = %X -> %d = %d\n", a, d, b, e, g, h, a + d);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x94ce,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <to_naf@plt>
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <from_naf@plt>
  mov    $0x3039,%edi
  mov    %eax,%r15d
  call   <to_naf@plt>
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %ebx,%esi
  mov    %r12d,%edi
  mov    %eax,%r14d
  call   <add_naf@plt>
  mov    %eax,%edi
  mov    %eax,%ebp
  call   <from_naf@plt>
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    $0x94ce,%esi
  lea    D10(%rip),%r15
  mov    %eax,%r13d
  xor    %eax,%eax
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14d,%ecx
  mov    %ebx,%edx
  mov    %r15,%rdi
  mov    $0x3039,%esi
  xor    %eax,%eax
  call   <printf@plt>
  push   $0xc507
  mov    %ebp,%r9d
  mov    %ebx,%r8d
  push   %r13
  mov    %r12d,%ecx
  mov    $0x3039,%edx
  mov    $0x94ce,%esi
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D10
datatype: string
name: extract_symbolic_data
arguments: data_label: D6
datatype: string

tool: D10: %X -> %X -> %X


tool: D6: %d + %d -> %X + %X = %X -> %d = %d


assistant: ```c
int main() {
  int a = 38094;
  int b = to_naf(a);
  int c = from_naf(b);
  int d = 12345;
  int e = to_naf(d);
  int f = from_naf(e);
  int g = add_naf(b, e);
  int h = from_naf(g);
  printf("%X -> %X -> %X\n", a, b, c);
  printf("%X -> %X -> %X\n", d, e, f);
  printf("%d + %d -> %X + %X = %X -> %d = %d\n", a, d, b, e, g, h, a + d);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x94ce,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <to_naf@plt>
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <from_naf@plt>
  mov    $0x3039,%edi
  mov    %eax,%r15d
  call   <to_naf@plt>
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <from_naf@plt>
  mov    %ebx,%esi
  mov    %r12d,%edi
  mov    %eax,%r14d
  call   <add_naf@plt>
  mov    %eax,%edi
  mov    %eax,%ebp
  call   <from_naf@plt>
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    $0x94ce,%esi
  lea    D7(%rip),%r15
  mov    %eax,%r13d
  xor    %eax,%eax
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14d,%ecx
  mov    %ebx,%edx
  mov    %r15,%rdi
  mov    $0x3039,%esi
  xor    %eax,%eax
  call   <printf@plt>
  push   $0xc507
  mov    %ebp,%r9d
  mov    %ebx,%r8d
  push   %r13
  mov    %r12d,%ecx
  mov    $0x3039,%edx
  mov    $0x94ce,%esi
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D7
data_type: string
name: extract_symbolic_data
arguments: label: D12
data_type: string

tool: D7: %X -> %X -> %X


tool: D12: %d + %d -> %X + %X = %X -> %d = %d


assistant: ```c
int main() {
  int a = 38094;
  int b = to_naf(a);
  int c = from_naf(b);
  int d = 12345;
  int e = to_naf(d);
  int f = from_naf(e);
  int g = add_naf(b, e);
  int h = from_naf(g);
  printf("%X -> %X -> %X\n", a, b, c);
  printf("%X -> %X -> %X\n", d, e, f);
  printf("%d + %d -> %X + %X = %X -> %d = %d\n", a, d, b, e, g, h, a + d);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<bounded_increment>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    $0xff,%edx
  sub    %eax,%edx
  movzbl -0xc(%rbp),%eax
  cmp    %eax,%edx
  jge    L11
  mov    -0x8(%rbp),%rax
  movb   $0xff,(%rax)
  jmp    L17
L11:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  movzbl -0xc(%rbp),%eax
  add    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
L17:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void bounded_increment(unsigned char *value, unsigned char inc) {
  if (255 - *value < inc)
    *value = 255;
  else
    *value += inc;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<bounded_increment>:
  endbr64
  movzbl (%rdi),%eax
  mov    %eax,%edx
  not    %edx
  movzbl %dl,%edx
  movzbl %sil,%ecx
  add    %esi,%eax
  cmp    %ecx,%edx
  mov    $0xffffffff,%edx
  cmovl  %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void bounded_increment(unsigned char *value, unsigned char inc) {
  if (255 - *value < inc)
    *value = 255;
  else
    *value += inc;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<bounded_increment>:
  endbr64
  movzbl (%rdi),%eax
  mov    %eax,%edx
  add    %esi,%eax
  not    %edx
  cmp    %sil,%dl
  mov    $0xffffffff,%edx
  cmovb  %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void bounded_increment(unsigned char *value, unsigned char inc) {
  if (255 - *value < inc)
    *value = 255;
  else
    *value += inc;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<bounded_increment>:
  endbr64
  movzbl (%rdi),%eax
  mov    %eax,%edx
  add    %esi,%eax
  not    %edx
  cmp    %sil,%dl
  mov    $0xffffffff,%edx
  cmovb  %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void bounded_increment(unsigned char *value, unsigned char inc) {
  if (255 - *value < inc)
    *value = 255;
  else
    *value += inc;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<servo_init>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xe0008004,%eax
  movq   $0x0,(%rax)
  mov    $0xe0008008,%eax
  movq   $0x0,(%rax)
  mov    $0xe0008010,%eax
  movq   $0x0,(%rax)
  mov    $0xe000800c,%eax
  movq   $0xe7,(%rax)
  mov    $0xe0008000,%eax
  movq   $0x1,(%rax)
  mov    $0xe0008014,%eax
  movq   $0x1,(%rax)
  mov    $0xe0008018,%eax
  movq   $0x11ee,(%rax)
  mov    $0xe0008004,%eax
  movq   $0x1,(%rax)
  mov    $0x0,%eax
  call   <enable_servo_interrupt@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void servo_init(void) {
  (*(volatile unsigned long *)((0xE0008004))) = 0;
  (*(volatile unsigned long *)((0xE0008008))) = 0;
  (*(volatile unsigned long *)((0xE0008010))) = 0;
  (*(volatile unsigned long *)((0xE000800C))) = (int)(((14745000 * 4) / 1000) / 255);
  (*(volatile unsigned long *)((0xE0008000))) = 0x01;
  (*(volatile unsigned long *)((0xE0008014))) = 0x01;
  (*(volatile unsigned long *)((0xE0008018))) = 255 * 18;
  (*(volatile unsigned long *)((0xE0008004))) = 1;
  enable_servo_interrupt();
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<servo_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe0008004,%eax
  movq   $0x0,(%rax)
  mov    $0xe0008008,%edx
  movq   $0x0,(%rdx)
  mov    $0xe0008010,%ecx
  movq   $0x0,(%rcx)
  mov    $0xe000800c,%esi
  movq   $0xe7,(%rsi)
  mov    $0xe0008000,%edi
  movq   $0x1,(%rdi)
  lea    0xc(%rdx),%rdx
  movq   $0x1,(%rdx)
  lea    0x8(%rcx),%rcx
  movq   $0x11ee,(%rcx)
  movq   $0x1,(%rax)
  mov    $0x0,%eax
  call   <enable_servo_interrupt@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void servo_init(void) {
  (*(volatile unsigned long *)((0xE0008004))) = 0;
  (*(volatile unsigned long *)((0xE0008008))) = 0;
  (*(volatile unsigned long *)((0xE0008010))) = 0;
  (*(volatile unsigned long *)((0xE000800C))) = (int)(((14745000 * 4) / 1000) / 255);
  (*(volatile unsigned long *)((0xE0008000))) = 0x01;
  (*(volatile unsigned long *)((0xE0008014))) = 0x01;
  (*(volatile unsigned long *)((0xE0008018))) = 255 * 18;
  (*(volatile unsigned long *)((0xE0008004))) = 1;
  enable_servo_interrupt();
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<servo_init>:
  endbr64
  mov    $0xe0008004,%eax
  mov    $0xe0008008,%edx
  mov    $0xe0008010,%ecx
  mov    $0xe000800c,%esi
  mov    $0xe0008000,%edi
  movq   $0x0,(%rax)
  movq   $0x0,(%rdx)
  movq   $0x0,(%rcx)
  movq   $0xe7,(%rsi)
  movq   $0x1,(%rdi)
  movq   $0x1,0xc(%rdx)
  movq   $0x11ee,0x8(%rcx)
  movq   $0x1,(%rax)
  xor    %eax,%eax
  jmp    1050 <enable_servo_interrupt@plt>
```

assistant: ```c
void servo_init(void) {
  (*(volatile unsigned long *)((0xE0008004))) = 0;
  (*(volatile unsigned long *)((0xE0008008))) = 0;
  (*(volatile unsigned long *)((0xE0008010))) = 0;
  (*(volatile unsigned long *)((0xE000800C))) = (int)(((14745000 * 4) / 1000) / 255);
  (*(volatile unsigned long *)((0xE0008000))) = 0x01;
  (*(volatile unsigned long *)((0xE0008014))) = 0x01;
  (*(volatile unsigned long *)((0xE0008018))) = 255 * 18;
  (*(volatile unsigned long *)((0xE0008004))) = 1;
  enable_servo_interrupt();
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<servo_init>:
  endbr64
  mov    $0xe0008004,%eax
  mov    $0xe0008008,%edx
  mov    $0xe0008010,%ecx
  mov    $0xe000800c,%esi
  mov    $0xe0008000,%edi
  movq   $0x0,(%rax)
  movq   $0x0,(%rdx)
  movq   $0x0,(%rcx)
  movq   $0xe7,(%rsi)
  movq   $0x1,(%rdi)
  movq   $0x1,0xc(%rdx)
  movq   $0x11ee,0x8(%rcx)
  movq   $0x1,(%rax)
  xor    %eax,%eax
  jmp    1050 <enable_servo_interrupt@plt>
```

assistant: ```c
void servo_init(void) {
  (*(volatile unsigned long *)((0xE0008004))) = 0;
  (*(volatile unsigned long *)((0xE0008008))) = 0;
  (*(volatile unsigned long *)((0xE0008010))) = 0;
  (*(volatile unsigned long *)((0xE000800C))) = (int)(((14745000 * 4) / 1000) / 255);
  (*(volatile unsigned long *)((0xE0008000))) = 0x01;
  (*(volatile unsigned long *)((0xE0008014))) = 0x01;
  (*(volatile unsigned long *)((0xE0008018))) = 255 * 18;
  (*(volatile unsigned long *)((0xE0008004))) = 1;
  enable_servo_interrupt();
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<hex2data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %rsi,-0x20(%rbp)
  mov    %ax,-0x14(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L111
L169:
  shll   $0x4,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cmp    $0x36,%eax
  ja     L28
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D2(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D2(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  addl   $0x1,-0x4(%rbp)
  jmp    L28
  addl   $0x2,-0x4(%rbp)
  jmp    L28
  addl   $0x3,-0x4(%rbp)
  jmp    L28
  addl   $0x4,-0x4(%rbp)
  jmp    L28
  addl   $0x5,-0x4(%rbp)
  jmp    L28
  addl   $0x6,-0x4(%rbp)
  jmp    L28
  addl   $0x7,-0x4(%rbp)
  jmp    L28
  addl   $0x8,-0x4(%rbp)
  jmp    L28
  addl   $0x9,-0x4(%rbp)
  jmp    L28
  addl   $0xa,-0x4(%rbp)
  jmp    L28
  addl   $0xb,-0x4(%rbp)
  jmp    L28
  addl   $0xc,-0x4(%rbp)
  jmp    L28
  addl   $0xd,-0x4(%rbp)
  jmp    L28
  addl   $0xe,-0x4(%rbp)
  jmp    L28
  addl   $0xf,-0x4(%rbp)
  nop
L28:
  addl   $0x1,-0x8(%rbp)
L111:
  movswl -0x14(%rbp),%eax
  cmp    %eax,-0x8(%rbp)
  jl     L169
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int hex2data(short size_v, const char res[]) {
  int k;
  int data;
  data = 0;
  for (k = 0; k < size_v; k++) {
    data *= 16;
    switch (res[k]) {
    case '0':
      break;
    case '1':
      data += 1;
      break;
    case '2':
      data += 2;
      break;
    case '3':
      data += 3;
      break;
    case '4':
      data += 4;
      break;
    case '5':
      data += 5;
      break;
    case '6':
      data += 6;
      break;
    case '7':
      data += 7;
      break;
    case '8':
      data += 8;
      break;
    case '9':
      data += 9;
      break;
    case 'a':
      data += 10;
      break;
    case 'b':
      data += 11;
      break;
    case 'c':
      data += 12;
      break;
    case 'd':
      data += 13;
      break;
    case 'e':
      data += 14;
      break;
    case 'f':
      data += 15;
      break;
    }
  };
  return data;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<hex2data>:
  endbr64
  test   %di,%di
  jle    L38
  mov    %rsi,%rdx
  movswl %di,%edi
  lea    -0x1(%rdi),%eax
  lea    0x1(%rsi,%rax,1),%rdi
  mov    $0x0,%ecx
  lea    D1(%rip),%rsi
  jmp    L164
  add    $0x1,%ecx
L67:
  add    $0x1,%rdx
  cmp    %rdi,%rdx
  je     L100
L164:
  shl    $0x4,%ecx
  movzbl (%rdx),%eax
  sub    $0x31,%eax
  cmp    $0x35,%al
  ja     L67
  movzbl %al,%eax
  movslq (%rsi,%rax,4),%rax
  add    %rsi,%rax
  notrack jmp *%rax
  add    $0x2,%ecx
  jmp    L67
  add    $0x3,%ecx
  jmp    L67
  add    $0x4,%ecx
  jmp    L67
  add    $0x5,%ecx
  jmp    L67
  add    $0x6,%ecx
  jmp    L67
  add    $0x7,%ecx
  jmp    L67
  add    $0x8,%ecx
  jmp    L67
  add    $0x9,%ecx
  jmp    L67
  add    $0xa,%ecx
  jmp    L67
  add    $0xb,%ecx
  jmp    L67
  add    $0xc,%ecx
  jmp    L67
  add    $0xd,%ecx
  jmp    L67
  add    $0xe,%ecx
  jmp    L67
  add    $0xf,%ecx
  jmp    L67
L38:
  mov    $0x0,%ecx
L100:
  mov    %ecx,%eax
  ret
```

assistant: ```c
int hex2data(short size_v, const char res[]) {
  int k;
  int data;
  data = 0;
  for (k = 0; k < size_v; k++) {
    data *= 16;
    switch (res[k]) {
    case '0':
      break;
    case '1':
      data += 1;
      break;
    case '2':
      data += 2;
      break;
    case '3':
      data += 3;
      break;
    case '4':
      data += 4;
      break;
    case '5':
      data += 5;
      break;
    case '6':
      data += 6;
      break;
    case '7':
      data += 7;
      break;
    case '8':
      data += 8;
      break;
    case '9':
      data += 9;
      break;
    case 'a':
      data += 10;
      break;
    case 'b':
      data += 11;
      break;
    case 'c':
      data += 12;
      break;
    case 'd':
      data += 13;
      break;
    case 'e':
      data += 14;
      break;
    case 'f':
      data += 15;
      break;
    }
  };
  return data;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<hex2data>:
  endbr64
  test   %di,%di
  jle    L46
  movswl %di,%edi
  xor    %r8d,%r8d
  lea    D5(%rip),%rdx
  lea    -0x1(%rdi),%eax
  lea    0x1(%rsi,%rax,1),%rcx
  nopw   0x0(%rax,%rax,1)
L83:
  movzbl (%rsi),%eax
  shl    $0x4,%r8d
  sub    $0x31,%eax
  cmp    $0x35,%al
  ja     L15
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax,%rax,1)
  add    $0xf,%r8d
  nopl   0x0(%rax)
L15:
  add    $0x1,%rsi
  cmp    %rcx,%rsi
  jne    L83
L25:
  mov    %r8d,%eax
  ret
  nopl   (%rax)
  add    $0x1,%rsi
  add    $0xe,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nop
  add    $0x1,%rsi
  add    $0xd,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nop
  add    $0x1,%rsi
  add    $0xc,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nop
  add    $0x1,%rsi
  add    $0xb,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nop
  add    $0x1,%rsi
  add    $0xa,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nopl   0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x9,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  nopl   0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x8,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x7,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x6,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x5,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x4,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x3,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x2,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x1,%r8d
  cmp    %rcx,%rsi
  jne    L83
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
L46:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int hex2data(short size_v, const char res[]) {
  int k;
  int data;
  data = 0;
  for (k = 0; k < size_v; k++) {
    data *= 16;
    switch (res[k]) {
    case '0':
      break;
    case '1':
      data += 1;
      break;
    case '2':
      data += 2;
      break;
    case '3':
      data += 3;
      break;
    case '4':
      data += 4;
      break;
    case '5':
      data += 5;
      break;
    case '6':
      data += 6;
      break;
    case '7':
      data += 7;
      break;
    case '8':
      data += 8;
      break;
    case '9':
      data += 9;
      break;
    case 'a':
      data += 10;
      break;
    case 'b':
      data += 11;
      break;
    case 'c':
      data += 12;
      break;
    case 'd':
      data += 13;
      break;
    case 'e':
      data += 14;
      break;
    case 'f':
      data += 15;
      break;
    }
  };
  return data;
}
```
user: What is the c source code of the assembly code below?

```asm
<hex2data>:
  endbr64
  test   %di,%di
  jle    L92
  movswl %di,%edi
  xor    %r8d,%r8d
  lea    D5(%rip),%rdx
  lea    -0x1(%rdi),%eax
  lea    0x1(%rsi,%rax,1),%rcx
  nopw   0x0(%rax,%rax,1)
L159:
  movzbl (%rsi),%eax
  shl    $0x4,%r8d
  sub    $0x31,%eax
  cmp    $0x35,%al
  ja     L109
  movzbl %al,%eax
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   0x0(%rax,%rax,1)
  add    $0xf,%r8d
  nopl   0x0(%rax)
L109:
  add    $0x1,%rsi
  cmp    %rcx,%rsi
  jne    L159
L293:
  mov    %r8d,%eax
  ret
  nopl   (%rax)
  add    $0x1,%rsi
  add    $0xe,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nop
  add    $0x1,%rsi
  add    $0xd,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nop
  add    $0x1,%rsi
  add    $0xc,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nop
  add    $0x1,%rsi
  add    $0xb,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nop
  add    $0x1,%rsi
  add    $0xa,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nopl   0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x9,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  nopl   0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x8,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x7,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x6,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x5,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x4,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x3,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x2,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
  add    $0x1,%rsi
  add    $0x1,%r8d
  cmp    %rcx,%rsi
  jne    L159
  jmp    L293
  cs nopw 0x0(%rax,%rax,1)
L92:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int hex2data(short size_v, const char res[]) {
  int k;
  int data;
  data = 0;
  for (k = 0; k < size_v; k++) {
    data *= 16;
    switch (res[k]) {
    case '0':
      break;
    case '1':
      data += 1;
      break;
    case '2':
      data += 2;
      break;
    case '3':
      data += 3;
      break;
    case '4':
      data += 4;
      break;
    case '5':
      data += 5;
      break;
    case '6':
      data += 6;
      break;
    case '7':
      data += 7;
      break;
    case '8':
      data += 8;
      break;
    case '9':
      data += 9;
      break;
    case 'a':
      data += 10;
      break;
    case 'b':
      data += 11;
      break;
    case 'c':
      data += 12;
      break;
    case 'd':
      data += 13;
      break;
    case 'e':
      data += 14;
      break;
    case 'f':
      data += 15;
      break;
    }
  };
  return data;
}
```