ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<create_page_table>:
  endbr64
  movq   $0x56000c12,0x30005000
  mov    $0x30000000,%eax
L9:
  mov    %rax,%rcx
  shr    $0x14,%rcx
  mov    %rax,%rdx
  and    $0xfff00000,%edx
  or     $0xc1e,%rdx
  mov    %rdx,0x30000000(,%rcx,8)
  add    $0x100000,%rax
  cmp    $0x34000000,%rax
  jne    L9
  ret
```

assistant: ```c
void create_page_table() {
  unsigned long *ttb = (unsigned long *)0x30000000;
  unsigned long vaddr, paddr;
  vaddr = 0xA0000000;
  paddr = 0x56000000;
  *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
  vaddr = 0x30000000;
  paddr = 0x30000000;
  while (vaddr < 0x34000000) {
    *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0) | (1 << 3) | (1 << 2));
    vaddr = vaddr + 0x100000;
    paddr = paddr + 0x100000;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<create_page_table>:
  endbr64
  movq   $0x56000c12,0x30005000
  mov    $0x30000000,%eax
  nopl   (%rax)
L2:
  mov    %rax,%rdx
  mov    %rax,%rcx
  add    $0x100000,%rax
  shr    $0x14,%rdx
  or     $0xc1e,%rcx
  mov    %rcx,0x30000000(,%rdx,8)
  cmp    $0x34000000,%rax
  jne    L2
  ret
```

assistant: ```c
void create_page_table() {
  unsigned long *ttb = (unsigned long *)0x30000000;
  unsigned long vaddr, paddr;
  vaddr = 0xA0000000;
  paddr = 0x56000000;
  *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
  vaddr = 0x30000000;
  paddr = 0x30000000;
  while (vaddr < 0x34000000) {
    *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0) | (1 << 3) | (1 << 2));
    vaddr = vaddr + 0x100000;
    paddr = paddr + 0x100000;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<create_page_table>:
  endbr64
  movq   $0x56000c12,0x30005000
  mov    $0x30000000,%eax
  nopl   (%rax)
L4:
  mov    %rax,%rdx
  mov    %rax,%rcx
  add    $0x100000,%rax
  shr    $0x14,%rdx
  or     $0xc1e,%rcx
  mov    %rcx,0x30000000(,%rdx,8)
  cmp    $0x34000000,%rax
  jne    L4
  ret
```

assistant: ```c
void create_page_table() {
  unsigned long *ttb = (unsigned long *)0x30000000;
  unsigned long vaddr, paddr;
  vaddr = 0xA0000000;
  paddr = 0x56000000;
  *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0));
  vaddr = 0x30000000;
  paddr = 0x30000000;
  while (vaddr < 0x34000000) {
    *(ttb + (vaddr >> 20)) = (paddr & 0xFFF00000) | ((3 << 10) | (0 << 5) | (1 << 4) | (2 << 0) | (1 << 3) | (1 << 2));
    vaddr = vaddr + 0x100000;
    paddr = paddr + 0x100000;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<SSIDisable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <SSIBaseValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%rax
  mov    -0x8(%rbp),%rdx
  add    $0x4,%rdx
  and    $0xfffffffffffffffd,%rax
  mov    %rax,(%rdx)
  nop
  leave
  ret
```

assistant: ```c
void SSIDisable(unsigned long ulBase) {
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~(0x00000002);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<SSIDisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <SSIBaseValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    0x4(%rbx),%rax
  and    $0xfffffffffffffffd,%rax
  mov    %rax,0x4(%rbx)
  pop    %rbx
  ret
```

assistant: ```c
void SSIDisable(unsigned long ulBase) {
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~(0x00000002);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<SSIDisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <SSIBaseValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    0x4(%rbx),%rax
  and    $0xfffffffffffffffd,%rax
  mov    %rax,0x4(%rbx)
  pop    %rbx
  ret
```

assistant: ```c
void SSIDisable(unsigned long ulBase) {
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~(0x00000002);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<SSIDisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <SSIBaseValid@plt>
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    0x4(%rbx),%rax
  and    $0xfffffffffffffffd,%rax
  mov    %rax,0x4(%rbx)
  pop    %rbx
  ret
```

assistant: ```c
void SSIDisable(unsigned long ulBase) {
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~(0x00000002);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<kmain>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <vga_clear@plt>
  mov    $0xd,%ecx
  lea    D5(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vga_write@plt>
  mov    $0x5,%ecx
  lea    D18(%rip),%rax
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <vga_write@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D5
datatype: string
name: extract_symbolic_data
arguments: label: D18
datatype: string

tool: D5: Hello World!

tool: D18: https://github.com/JacisNonsense/x86-Baseline

assistant: ```c
void kmain(void) {
  vga_clear();
  vga_write(0, 0, "Hello World!", 0b101 | 0b1000);
  vga_write(1, 0, "https://github.com/JacisNonsense/x86-Baseline", 0b101);
  return;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<kmain>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <vga_clear@plt>
  mov    $0xd,%ecx
  lea    D1(%rip),%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vga_write@plt>
  mov    $0x5,%ecx
  lea    D4(%rip),%rdx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <vga_write@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D1
type_infered: string
name: retrieve_data
arguments: tag: D4
type_infered: string

tool: D1: Hello World!

tool: D4: https://github.com/JacisNonsense/x86-Baseline

assistant: ```c
void kmain(void) {
  vga_clear();
  vga_write(0, 0, "Hello World!", 0b101 | 0b1000);
  vga_write(1, 0, "https://github.com/JacisNonsense/x86-Baseline", 0b101);
  return;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<kmain>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <vga_clear@plt>
  mov    $0xd,%ecx
  xor    %esi,%esi
  xor    %edi,%edi
  lea    D7(%rip),%rdx
  call   <vga_write@plt>
  mov    $0x5,%ecx
  xor    %esi,%esi
  add    $0x8,%rsp
  lea    D18(%rip),%rdx
  mov    $0x1,%edi
  jmp    1060 <vga_write@plt>
```

tool_calls: name: read_data
arguments: data_label: D7
type: string
name: read_data
arguments: data_label: D18
type: string

tool: D7: Hello World!

tool: D18: https://github.com/JacisNonsense/x86-Baseline

assistant: ```c
void kmain(void) {
  vga_clear();
  vga_write(0, 0, "Hello World!", 0b101 | 0b1000);
  vga_write(1, 0, "https://github.com/JacisNonsense/x86-Baseline", 0b101);
  return;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<kmain>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <vga_clear@plt>
  mov    $0xd,%ecx
  xor    %esi,%esi
  xor    %edi,%edi
  lea    D13(%rip),%rdx
  call   <vga_write@plt>
  mov    $0x5,%ecx
  xor    %esi,%esi
  add    $0x8,%rsp
  lea    D3(%rip),%rdx
  mov    $0x1,%edi
  jmp    1060 <vga_write@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D13
type_infered: string
name: disassemble_data
arguments: data_tag: D3
type_infered: string

tool: D13: Hello World!

tool: D3: https://github.com/JacisNonsense/x86-Baseline

assistant: ```c
void kmain(void) {
  vga_clear();
  vga_write(0, 0, "Hello World!", 0b101 | 0b1000);
  vga_write(1, 0, "https://github.com/JacisNonsense/x86-Baseline", 0b101);
  return;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movb   $0xff,-0x5(%rbp)
  movl   $0x4,-0x4(%rbp)
  movsbl -0x5(%rbp),%eax
  cmp    %eax,-0x4(%rbp)
  setbe  %al
  movzbl %al,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  char c = 0xff;
  unsigned int d = 4;
  return c >= d;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int main() {
  char c = 0xff;
  unsigned int d = 4;
  return c >= d;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int main() {
  char c = 0xff;
  unsigned int d = 4;
  return c >= d;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int main() {
  char c = 0xff;
  unsigned int d = 4;
  return c >= d;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<print_ptr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  cmpq   $0x2f,-0x8(%rbp)
  jne    L5
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L85
L5:
  mov    -0x8(%rbp),%rax
  and    $0x3,%eax
  test   %rax,%rax
  jne    L91
  mov    -0x8(%rbp),%rax
  sar    $0x2,%rax
  mov    %rax,%rsi
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L85
L91:
  mov    -0x8(%rbp),%rax
  movzbl %al,%eax
  cmp    $0xf,%rax
  jne    L34
  mov    -0x8(%rbp),%rax
  sar    $0x8,%rax
  mov    %eax,%edi
  call   <putchar@plt>
  jmp    L85
L34:
  mov    -0x8(%rbp),%rax
  and    $0x7f,%eax
  cmp    $0x1f,%rax
  jne    L50
  mov    -0x8(%rbp),%rax
  sar    $0x7,%rax
  cmp    $0x1,%rax
  jne    L37
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L85
L37:
  mov    -0x8(%rbp),%rax
  sar    $0x7,%rax
  test   %rax,%rax
  jne    L111
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L85
L111:
  mov    -0x8(%rbp),%rax
  sar    $0x7,%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L85
L50:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D53(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L85:
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D22
type: string
name: parse_data
arguments: data_label: D31
type: string
name: parse_data
arguments: data_label: D6
type: string
name: parse_data
arguments: data_label: D43
type: string
name: parse_data
arguments: data_label: D0
type: string
name: parse_data
arguments: data_label: D53
type: string

tool: D22: ()

tool: D31: %ld

tool: D6: #t

tool: D43: #f

tool: D0: bad bool: %d

tool: D53: unkown type for value: %ld

assistant: ```c
void print_ptr(long val) {
  if (val == 47) {
    printf("()");
  } else if ((val & 3) == 0) {
    printf("%ld", val >> 2);
  } else if ((val & 255) == 15) {
    printf("%c", (int)(val >> 8));
  } else if ((val & 127) == 31) {
    if ((val >> 7) == 1) {
      printf("#t");
    } else if ((val >> 7) == 0) {
      printf("#f");
    } else {
      printf("bad bool: %d", val >> 7);
    }
  } else {
    printf("unkown type for value: %ld", val);
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<print_ptr>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x2f,%rdi
  je     L11
  mov    %rdi,%rsi
  test   $0x3,%dil
  je     L47
  cmp    $0xf,%dil
  je     L32
  mov    %rdi,%rax
  and    $0x7f,%eax
  cmp    $0x1f,%rax
  jne    L95
  sar    $0x7,%rsi
  cmp    $0x1,%rsi
  je     L119
  test   %rsi,%rsi
  jne    L97
  lea    D36(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L81
L11:
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L81
L47:
  sar    $0x2,%rsi
  lea    D26(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L81:
  add    $0x8,%rsp
  ret
L32:
  sar    $0x8,%rsi
  mov    %esi,%edi
  call   <putchar@plt>
  jmp    L81
L119:
  lea    D25(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L81
L97:
  lea    D22(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L81
L95:
  lea    D37(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L81
```

tool_calls: name: retrieve_data
arguments: data_label: D36
type: string
name: retrieve_data
arguments: data_label: D32
type: string
name: retrieve_data
arguments: data_label: D26
type: string
name: retrieve_data
arguments: data_label: D25
type: string
name: retrieve_data
arguments: data_label: D22
type: string
name: retrieve_data
arguments: data_label: D37
type: string

tool: D36: #f

tool: D32: ()

tool: D26: %ld

tool: D25: #t

tool: D22: bad bool: %d

tool: D37: unkown type for value: %ld

assistant: ```c
void print_ptr(long val) {
  if (val == 47) {
    printf("()");
  } else if ((val & 3) == 0) {
    printf("%ld", val >> 2);
  } else if ((val & 255) == 15) {
    printf("%c", (int)(val >> 8));
  } else if ((val & 127) == 31) {
    if ((val >> 7) == 1) {
      printf("#t");
    } else if ((val >> 7) == 0) {
      printf("#f");
    } else {
      printf("bad bool: %d", val >> 7);
    }
  } else {
    printf("unkown type for value: %ld", val);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_ptr>:
  endbr64
  mov    %rdi,%rsi
  cmp    $0x2f,%rdi
  je     L34
  test   $0x3,%dil
  je     L23
  cmp    $0xf,%dil
  je     L8
  mov    %rdi,%rax
  and    $0x7f,%eax
  cmp    $0x1f,%rax
  jne    L41
  sar    $0x7,%rsi
  cmp    $0x1,%rsi
  je     L58
  test   %rsi,%rsi
  jne    L25
  lea    D4(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  nopw   0x0(%rax,%rax,1)
L23:
  sar    $0x2,%rsi
  lea    D17(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  nopw   0x0(%rax,%rax,1)
L41:
  lea    D45(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L34:
  lea    D24(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L8:
  sar    $0x8,%rsi
  mov    %esi,%edi
  jmp    1060 <putchar@plt>
  nopl   0x0(%rax,%rax,1)
L25:
  lea    D46(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L58:
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type_infered: string
name: retrieve_data
arguments: data_label: D17
type_infered: string
name: retrieve_data
arguments: data_label: D45
type_infered: string
name: retrieve_data
arguments: data_label: D24
type_infered: string
name: retrieve_data
arguments: data_label: D46
type_infered: string
name: retrieve_data
arguments: data_label: D36
type_infered: string

tool: D4: #f

tool: D17: %ld

tool: D45: unkown type for value: %ld

tool: D24: ()

tool: D46: bad bool: %d

tool: D36: #t

assistant: ```c
void print_ptr(long val) {
  if (val == 47) {
    printf("()");
  } else if ((val & 3) == 0) {
    printf("%ld", val >> 2);
  } else if ((val & 255) == 15) {
    printf("%c", (int)(val >> 8));
  } else if ((val & 127) == 31) {
    if ((val >> 7) == 1) {
      printf("#t");
    } else if ((val >> 7) == 0) {
      printf("#f");
    } else {
      printf("bad bool: %d", val >> 7);
    }
  } else {
    printf("unkown type for value: %ld", val);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<print_ptr>:
  endbr64
  mov    %rdi,%rsi
  cmp    $0x2f,%rdi
  je     L18
  test   $0x3,%dil
  je     L1
  cmp    $0xf,%dil
  je     L21
  mov    %rdi,%rax
  and    $0x7f,%eax
  cmp    $0x1f,%rax
  jne    L13
  sar    $0x7,%rsi
  cmp    $0x1,%rsi
  je     L9
  test   %rsi,%rsi
  jne    L27
  lea    D26(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  nopw   0x0(%rax,%rax,1)
L1:
  sar    $0x2,%rsi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  nopw   0x0(%rax,%rax,1)
L13:
  lea    D11(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L18:
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L21:
  sar    $0x8,%rsi
  mov    %esi,%edi
  jmp    1060 <putchar@plt>
  nopl   0x0(%rax,%rax,1)
L27:
  lea    D2(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
  xchg   %ax,%ax
L9:
  lea    D42(%rip),%rdi
  xor    %eax,%eax
  jmp    1070 <printf@plt>
```

tool_calls: name: read_data
arguments: label: D26
type_guessed: string
name: read_data
arguments: label: D20
type_guessed: string
name: read_data
arguments: label: D11
type_guessed: string
name: read_data
arguments: label: D12
type_guessed: string
name: read_data
arguments: label: D2
type_guessed: string
name: read_data
arguments: label: D42
type_guessed: string

tool: D26: #f

tool: D20: %ld

tool: D11: unkown type for value: %ld

tool: D12: ()

tool: D2: bad bool: %d

tool: D42: #t

assistant: ```c
void print_ptr(long val) {
  if (val == 47) {
    printf("()");
  } else if ((val & 3) == 0) {
    printf("%ld", val >> 2);
  } else if ((val & 255) == 15) {
    printf("%c", (int)(val >> 8));
  } else if ((val & 127) == 31) {
    if ((val >> 7) == 1) {
      printf("#t");
    } else if ((val >> 7) == 0) {
      printf("#f");
    } else {
      printf("bad bool: %d", val >> 7);
    }
  } else {
    printf("unkown type for value: %ld", val);
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<htoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x5(%rbp)
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L17
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %al,-0x5(%rbp)
L17:
  cmpb   $0x2f,-0x5(%rbp)
  jle    L61
  cmpb   $0x39,-0x5(%rbp)
  jg     L61
  movsbl -0x5(%rbp),%eax
  sub    $0x30,%eax
  shl    $0x4,%eax
  jmp    L10
L61:
  movsbl -0x5(%rbp),%eax
  sub    $0x57,%eax
  shl    $0x4,%eax
L10:
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  mov    %al,-0x5(%rbp)
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L65
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %al,-0x5(%rbp)
L65:
  cmpb   $0x2f,-0x5(%rbp)
  jle    L46
  cmpb   $0x39,-0x5(%rbp)
  jg     L46
  movsbl -0x5(%rbp),%eax
  sub    $0x30,%eax
  jmp    L48
L46:
  movsbl -0x5(%rbp),%eax
  sub    $0x57,%eax
L48:
  add    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int htoi(s)
unsigned char *s;
{
  int value;
  char c;
  c = s[0];
  if (isupper(c))
    c = tolower(c);
  value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
  c = s[1];
  if (isupper(c))
    c = tolower(c);
  value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
  return (value);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<htoi>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  movzbl (%rdi),%ebx
  movsbl %bl,%ebp
  mov    %ebp,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L12
  mov    %ebp,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
L12:
  lea    -0x30(%rbx),%eax
  cmp    $0x9,%al
  ja     L37
  movsbl %bl,%ebp
  sub    $0x30,%ebp
  shl    $0x4,%ebp
L7:
  movzbl 0x1(%r12),%ebx
  movsbl %bl,%r12d
  mov    %r12d,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L38
  mov    %r12d,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
L38:
  lea    -0x30(%rbx),%eax
  cmp    $0x9,%al
  ja     L20
  movsbl %bl,%ebx
  sub    $0x30,%ebx
L23:
  lea    0x0(%rbp,%rbx,1),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L37:
  movsbl %bl,%ebp
  sub    $0x57,%ebp
  shl    $0x4,%ebp
  jmp    L7
L20:
  movsbl %bl,%ebx
  sub    $0x57,%ebx
  jmp    L23
```

assistant: ```c
int htoi(s)
unsigned char *s;
{
  int value;
  char c;
  c = s[0];
  if (isupper(c))
    c = tolower(c);
  value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
  c = s[1];
  if (isupper(c))
    c = tolower(c);
  value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
  return (value);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<htoi>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%r13d
  mov    %r13d,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L13
  mov    %r13d,%edi
  call   <tolower@plt>
  mov    %eax,%ebp
  movsbl %al,%ebx
L23:
  sub    $0x30,%ebp
  cmp    $0x9,%bpl
  ja     L30
  sub    $0x30,%ebx
  movsbl %bl,%ebx
  shl    $0x4,%ebx
L26:
  movsbl 0x1(%r12),%r13d
  mov    %r13d,%edi
  mov    %r13d,%ebp
  movsbl %r13b,%r12d
  call   <isupper@plt>
  test   %eax,%eax
  je     L9
  mov    %r13d,%edi
  call   <tolower@plt>
  mov    %eax,%ebp
  movsbl %al,%r12d
L9:
  sub    $0x30,%ebp
  cmp    $0x9,%bpl
  ja     L12
  sub    $0x30,%r12d
  add    $0x8,%rsp
  movsbl %r12b,%r12d
  lea    (%rbx,%r12,1),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L30:
  sub    $0x57,%ebx
  shl    $0x4,%ebx
  jmp    L26
  nopl   0x0(%rax,%rax,1)
L13:
  mov    %r13d,%ebp
  movsbl %r13b,%ebx
  jmp    L23
  nopl   0x0(%rax)
L12:
  add    $0x8,%rsp
  sub    $0x57,%r12d
  lea    (%rbx,%r12,1),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int htoi(s)
unsigned char *s;
{
  int value;
  char c;
  c = s[0];
  if (isupper(c))
    c = tolower(c);
  value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
  c = s[1];
  if (isupper(c))
    c = tolower(c);
  value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
  return (value);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<htoi>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%r13d
  mov    %r13d,%edi
  call   <isupper@plt>
  test   %eax,%eax
  je     L51
  mov    %r13d,%edi
  call   <tolower@plt>
  mov    %eax,%ebp
  movsbl %al,%ebx
L37:
  sub    $0x30,%ebp
  cmp    $0x9,%bpl
  ja     L43
  sub    $0x30,%ebx
  movsbl %bl,%ebx
  shl    $0x4,%ebx
L58:
  movsbl 0x1(%r12),%r13d
  mov    %r13d,%edi
  mov    %r13d,%ebp
  movsbl %r13b,%r12d
  call   <isupper@plt>
  test   %eax,%eax
  je     L13
  mov    %r13d,%edi
  call   <tolower@plt>
  mov    %eax,%ebp
  movsbl %al,%r12d
L13:
  sub    $0x30,%ebp
  cmp    $0x9,%bpl
  ja     L2
  sub    $0x30,%r12d
  add    $0x8,%rsp
  movsbl %r12b,%r12d
  lea    (%rbx,%r12,1),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L43:
  sub    $0x57,%ebx
  shl    $0x4,%ebx
  jmp    L58
  nopl   0x0(%rax,%rax,1)
L51:
  mov    %r13d,%ebp
  movsbl %r13b,%ebx
  jmp    L37
  nopl   0x0(%rax)
L2:
  add    $0x8,%rsp
  sub    $0x57,%r12d
  lea    (%rbx,%r12,1),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int htoi(s)
unsigned char *s;
{
  int value;
  char c;
  c = s[0];
  if (isupper(c))
    c = tolower(c);
  value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
  c = s[1];
  if (isupper(c))
    c = tolower(c);
  value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
  return (value);
}
```