ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Fork>:
  endbr64
  push   %r12
  call   <fork@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L8
  mov    %r12d,%eax
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L8:
  lea    D8(%rip),%rdi
  call   <unix_error@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
type_guessed: string

tool: D8: Fork error

assistant: ```c
pid_t Fork(void) {
  pid_t pid;
  if ((pid = fork()) < 0) {
    unix_error("Fork error");
  }
  return pid;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Fork>:
  endbr64
  push   %r12
  call   <fork@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L3
  mov    %r12d,%eax
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  lea    D8(%rip),%rdi
  call   <unix_error@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D8
data_type: string

tool: D8: Fork error

assistant: ```c
pid_t Fork(void) {
  pid_t pid;
  if ((pid = fork()) < 0) {
    unix_error("Fork error");
  }
  return pid;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<__mp_printsize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__mp_diag@plt>
  cmpq   $0x1,-0x8(%rbp)
  je     L7
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <__mp_diag@plt>
L7:
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D2
type: string
name: extract_symbolic_data
arguments: label: D14
type: string

tool: D2: %lu byte

tool: D14: s

assistant: ```c
void __mp_printsize(size_t l) {
  __mp_diag("%lu byte", l);
  if (l != 1)
    __mp_diag("s");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<__mp_printsize>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  lea    D11(%rip),%rdi
  mov    $0x0,%eax
  call   <__mp_diag@plt>
  cmp    $0x1,%rbx
  jne    L0
L10:
  pop    %rbx
  ret
L0:
  lea    D17(%rip),%rdi
  mov    $0x0,%eax
  call   <__mp_diag@plt>
  jmp    L10
```

tool_calls: name: disassemble_data
arguments: tag: D11
type: string
name: disassemble_data
arguments: tag: D17
type: string

tool: D11: %lu byte

tool: D17: s

assistant: ```c
void __mp_printsize(size_t l) {
  __mp_diag("%lu byte", l);
  if (l != 1)
    __mp_diag("s");
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<__mp_printsize>:
  endbr64
  push   %rbx
  mov    %rdi,%rsi
  mov    %rdi,%rbx
  xor    %eax,%eax
  lea    D2(%rip),%rdi
  call   <__mp_diag@plt>
  cmp    $0x1,%rbx
  jne    L5
  pop    %rbx
  ret
  nopl   0x0(%rax)
L5:
  lea    D10(%rip),%rdi
  xor    %eax,%eax
  pop    %rbx
  jmp    1050 <__mp_diag@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D2
type_infered: string
name: extract_symbolic_data
arguments: label: D10
type_infered: string

tool: D2: %lu byte

tool: D10: s

assistant: ```c
void __mp_printsize(size_t l) {
  __mp_diag("%lu byte", l);
  if (l != 1)
    __mp_diag("s");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__mp_printsize>:
  endbr64
  push   %rbx
  mov    %rdi,%rsi
  mov    %rdi,%rbx
  xor    %eax,%eax
  lea    D8(%rip),%rdi
  call   <__mp_diag@plt>
  cmp    $0x1,%rbx
  jne    L4
  pop    %rbx
  ret
  nopl   0x0(%rax)
L4:
  lea    D2(%rip),%rdi
  xor    %eax,%eax
  pop    %rbx
  jmp    1050 <__mp_diag@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
type: string
name: extract_symbolic_data
arguments: label: D2
type: string

tool: D8: %lu byte

tool: D2: s

assistant: ```c
void __mp_printsize(size_t l) {
  __mp_diag("%lu byte", l);
  if (l != 1)
    __mp_diag("s");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<readNextArrayValue>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  movb   $0x3,-0x1(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L87
  movb   $0x4,-0x1(%rbp)
L87:
  addq   $0x1,-0x18(%rbp)
  jmp    L93
L148:
  movzbl -0x1(%rbp),%eax
  cmp    $0x3,%eax
  je     L63
  cmp    $0x4,%eax
  je     L1
  jmp    L84
L63:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2c,%al
  jne    L117
  movb   $0x4,-0x1(%rbp)
  jmp    L82
L117:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5d,%al
  jne    L35
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x64,%eax
  jmp    L126
L35:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L82
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L82
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L82
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L82
  mov    $0x68,%eax
  jmp    L126
L1:
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <getValue@plt>
  jmp    L126
L82:
  nop
L84:
  addq   $0x1,-0x18(%rbp)
L93:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L148
  mov    $0x68,%eax
L126:
  leave
  ret
```

assistant: ```c
unsigned int readNextArrayValue(char *start, char **first, char **last, unsigned char *type) {
  unsigned char state = 3;
  if (start[0] == '[') {
    state = 4;
  }
  ++start;
  while (start[0] != '\0') {
    switch (state) {
    case 3:
      if (start[0] == ',') {
        state = 4;
      } else if (start[0] == ']') {
        *first = start;
        *last = start;
        return 100;
      } else if (!(start[0] == ' ' || start[0] == '\t' || start[0] == '\n' || start[0] == '\t')) {
        return 104;
      }
      break;
    case 4:
      return getValue(start, first, last, type);
      break;
    }
    ++start;
  }
  return 104;
}
```
user: Translate the below assembly code into C programming language:

```asm
<readNextArrayValue>:
  endbr64
  mov    %rdi,%rax
  cmpb   $0x5b,(%rdi)
  je     L29
  lea    0x1(%rdi),%rdi
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L30
  mov    $0x3,%r8d
  mov    $0x4,%r10d
  jmp    L65
L92:
  cmp    $0x2c,%al
  je     L18
  cmp    $0x5d,%al
  je     L49
  lea    -0x9(%rax),%r9d
  cmp    $0x1,%r9b
  jbe    L62
  cmp    $0x20,%al
  je     L62
  mov    $0x68,%eax
  ret
L49:
  mov    %rdi,(%rsi)
  mov    %rdi,(%rdx)
  mov    $0x64,%eax
  ret
L18:
  mov    %r10d,%r8d
L62:
  add    $0x1,%rdi
  movzbl (%rdi),%eax
  test   %al,%al
  je     L16
L65:
  cmp    $0x3,%r8b
  je     L92
  cmp    $0x4,%r8b
  jne    L62
L108:
  sub    $0x8,%rsp
  call   <getValue@plt>
  add    $0x8,%rsp
  ret
L16:
  mov    $0x68,%eax
  ret
L30:
  mov    $0x68,%eax
  ret
L29:
  lea    0x1(%rdi),%rdi
  cmpb   $0x0,0x1(%rax)
  jne    L108
  mov    $0x68,%eax
  ret
```

assistant: ```c
unsigned int readNextArrayValue(char *start, char **first, char **last, unsigned char *type) {
  unsigned char state = 3;
  if (start[0] == '[') {
    state = 4;
  }
  ++start;
  while (start[0] != '\0') {
    switch (state) {
    case 3:
      if (start[0] == ',') {
        state = 4;
      } else if (start[0] == ']') {
        *first = start;
        *last = start;
        return 100;
      } else if (!(start[0] == ' ' || start[0] == '\t' || start[0] == '\n' || start[0] == '\t')) {
        return 104;
      }
      break;
    case 4:
      return getValue(start, first, last, type);
      break;
    }
    ++start;
  }
  return 104;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<readNextArrayValue>:
  endbr64
  cmpb   $0x5b,(%rdi)
  movzbl 0x1(%rdi),%eax
  lea    0x1(%rdi),%r8
  je     L98
  test   %al,%al
  je     L69
  cmp    $0x2c,%al
  je     L62
  add    $0x2,%rdi
  cmp    $0x5d,%al
  je     L38
L61:
  cmp    $0x20,%al
  je     L126
  cmp    $0x9,%al
  je     L126
  cmp    $0xa,%al
  jne    L69
L126:
  movzbl (%rdi),%eax
  mov    %rdi,%r9
  test   %al,%al
  je     L69
  cmp    $0x2c,%al
  je     L81
  add    $0x1,%rdi
  cmp    $0x5d,%al
  jne    L61
L49:
  mov    %r9,(%rsi)
  mov    $0x64,%eax
  mov    %r9,(%rdx)
  ret
  nop
L98:
  test   %al,%al
  je     L69
L12:
  mov    %r8,%rdi
  jmp    1050 <getValue@plt>
  nopl   0x0(%rax)
L62:
  mov    %r8,%r9
L81:
  cmpb   $0x0,0x1(%r9)
  lea    0x1(%r9),%r8
  jne    L12
L69:
  mov    $0x68,%eax
  ret
L38:
  mov    %r8,%r9
  jmp    L49
```

assistant: ```c
unsigned int readNextArrayValue(char *start, char **first, char **last, unsigned char *type) {
  unsigned char state = 3;
  if (start[0] == '[') {
    state = 4;
  }
  ++start;
  while (start[0] != '\0') {
    switch (state) {
    case 3:
      if (start[0] == ',') {
        state = 4;
      } else if (start[0] == ']') {
        *first = start;
        *last = start;
        return 100;
      } else if (!(start[0] == ' ' || start[0] == '\t' || start[0] == '\n' || start[0] == '\t')) {
        return 104;
      }
      break;
    case 4:
      return getValue(start, first, last, type);
      break;
    }
    ++start;
  }
  return 104;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<readNextArrayValue>:
  endbr64
  cmpb   $0x5b,(%rdi)
  movzbl 0x1(%rdi),%eax
  lea    0x1(%rdi),%r8
  je     L88
  test   %al,%al
  je     L72
  cmp    $0x2c,%al
  je     L79
  add    $0x2,%rdi
  cmp    $0x5d,%al
  je     L91
L52:
  cmp    $0x20,%al
  je     L13
  cmp    $0x9,%al
  je     L13
  cmp    $0xa,%al
  jne    L72
L13:
  movzbl (%rdi),%eax
  mov    %rdi,%r9
  test   %al,%al
  je     L72
  cmp    $0x2c,%al
  je     L36
  add    $0x1,%rdi
  cmp    $0x5d,%al
  jne    L52
L103:
  mov    %r9,(%rsi)
  mov    $0x64,%eax
  mov    %r9,(%rdx)
  ret
  nop
L88:
  test   %al,%al
  je     L72
L70:
  mov    %r8,%rdi
  jmp    1050 <getValue@plt>
  nopl   0x0(%rax)
L79:
  mov    %r8,%r9
L36:
  cmpb   $0x0,0x1(%r9)
  lea    0x1(%r9),%r8
  jne    L70
L72:
  mov    $0x68,%eax
  ret
L91:
  mov    %r8,%r9
  jmp    L103
```

assistant: ```c
unsigned int readNextArrayValue(char *start, char **first, char **last, unsigned char *type) {
  unsigned char state = 3;
  if (start[0] == '[') {
    state = 4;
  }
  ++start;
  while (start[0] != '\0') {
    switch (state) {
    case 3:
      if (start[0] == ',') {
        state = 4;
      } else if (start[0] == ']') {
        *first = start;
        *last = start;
        return 100;
      } else if (!(start[0] == ' ' || start[0] == '\t' || start[0] == '\n' || start[0] == '\t')) {
        return 104;
      }
      break;
    case 4:
      return getValue(start, first, last, type);
      break;
    }
    ++start;
  }
  return 104;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<swap_my>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %edx,%ebp
  lea    D10(%rip),%rdi
  call   <puts@plt>
  movslq %ebp,%rax
  lea    (%r12,%rax,4),%r15
  movslq %ebx,%rax
  lea    (%r12,%rax,4),%r14
  mov    $0x0,%r9d
  mov    (%r15),%r8d
  mov    %ebp,%ecx
  mov    (%r14),%edx
  mov    %ebx,%esi
  lea    D19(%rip),%r13
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    (%r14),%r12d
  mov    %r12d,%r9d
  mov    (%r15),%r8d
  mov    %ebp,%ecx
  mov    %r12d,%edx
  mov    %ebx,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    (%r15),%edx
  mov    %edx,(%r14)
  mov    %r12d,%r9d
  mov    %edx,%r8d
  mov    %ebp,%ecx
  mov    %ebx,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12d,(%r15)
  mov    %r12d,%r9d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    (%r14),%edx
  mov    %ebx,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D10
datatype: string
name: disassemble_data
arguments: data_tag: D19
datatype: string

tool: D10: in swap.

tool: D19: a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.


assistant: ```c
void swap_my(int a[100], int left, int right) {
  int temp = 0;
  printf("in swap.\n");
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  temp = a[left];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[left] = a[right];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[right] = temp;
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<swap_my>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D0(%rip),%r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  lea    D7(%rip),%rdi
  sub    $0x8,%rsp
  call   <puts@plt>
  movslq %r12d,%rax
  mov    %r12d,%ecx
  mov    %ebp,%esi
  lea    (%rbx,%rax,4),%r15
  movslq %ebp,%rax
  mov    %r13,%rdi
  xor    %r9d,%r9d
  lea    (%rbx,%rax,4),%r14
  mov    (%r15),%r8d
  xor    %eax,%eax
  mov    (%r14),%edx
  call   <printf@plt>
  mov    (%r14),%ebx
  mov    (%r15),%r8d
  mov    %r12d,%ecx
  mov    %ebp,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %ebx,%r9d
  mov    %ebx,%edx
  call   <printf@plt>
  mov    (%r15),%edx
  mov    %ebx,%r9d
  mov    %r12d,%ecx
  mov    %ebp,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %edx,(%r14)
  mov    %edx,%r8d
  call   <printf@plt>
  mov    %ebx,(%r15)
  mov    (%r14),%edx
  add    $0x8,%rsp
  mov    %ebx,%r9d
  mov    %ebx,%r8d
  mov    %r12d,%ecx
  pop    %rbx
  mov    %ebp,%esi
  mov    %r13,%rdi
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D0
type_infered: string
name: extract_symbolic_data
arguments: data_label: D7
type_infered: string

tool: D0: a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.


tool: D7: in swap.

assistant: ```c
void swap_my(int a[100], int left, int right) {
  int temp = 0;
  printf("in swap.\n");
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  temp = a[left];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[left] = a[right];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[right] = temp;
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<swap_my>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D2(%rip),%r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  lea    D9(%rip),%rdi
  sub    $0x8,%rsp
  call   <puts@plt>
  movslq %r12d,%rax
  mov    %r12d,%ecx
  mov    %ebp,%esi
  lea    (%rbx,%rax,4),%r15
  movslq %ebp,%rax
  mov    %r13,%rdi
  xor    %r9d,%r9d
  lea    (%rbx,%rax,4),%r14
  mov    (%r15),%r8d
  xor    %eax,%eax
  mov    (%r14),%edx
  call   <printf@plt>
  mov    (%r14),%ebx
  mov    (%r15),%r8d
  mov    %r12d,%ecx
  mov    %ebp,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %ebx,%r9d
  mov    %ebx,%edx
  call   <printf@plt>
  mov    (%r15),%edx
  mov    %ebx,%r9d
  mov    %r12d,%ecx
  mov    %ebp,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  mov    %edx,(%r14)
  mov    %edx,%r8d
  call   <printf@plt>
  mov    %ebx,(%r15)
  mov    (%r14),%edx
  add    $0x8,%rsp
  mov    %ebx,%r9d
  mov    %ebx,%r8d
  mov    %r12d,%ecx
  pop    %rbx
  mov    %ebp,%esi
  mov    %r13,%rdi
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: label: D2
data_type: string
name: retrieve_data
arguments: label: D9
data_type: string

tool: D2: a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.


tool: D9: in swap.

assistant: ```c
void swap_my(int a[100], int left, int right) {
  int temp = 0;
  printf("in swap.\n");
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  temp = a[left];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[left] = a[right];
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
  a[right] = temp;
  printf("a [ left = %d ] = %d; a [ right = %d ] = %d; temp = %d.\n", left, a[left], right, a[right], temp);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<simple_strtoul>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L74
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  jne    L64
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L64
  movl   $0x10,-0x24(%rbp)
  addq   $0x1,-0x18(%rbp)
L64:
  cmpl   $0x0,-0x24(%rbp)
  jne    L74
  movl   $0x8,-0x24(%rbp)
L74:
  cmpl   $0x0,-0x24(%rbp)
  jne    L16
  movl   $0xa,-0x24(%rbp)
  jmp    L16
L32:
  mov    -0x24(%rbp),%eax
  imul   -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  addq   $0x1,-0x18(%rbp)
L16:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L73
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L25
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  jmp    L104
L25:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %rax,%rax
  je     L62
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  jmp    L104
L62:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
L104:
  mov    %rax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  cmp    %rax,-0x8(%rbp)
  jb     L32
L73:
  cmpq   $0x0,-0x20(%rbp)
  je     L123
  mov    -0x20(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
L123:
  mov    -0x10(%rbp),%rax
  leave
  ret
```

assistant: ```c
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
  unsigned long result = 0, value;
  if (*cp == '0') {
    cp++;
    if ((*cp == 'x') && isxdigit(cp[1])) {
      base = 16;
      cp++;
    }
    if (!base) {
      base = 8;
    }
  }
  if (!base) {
    base = 10;
  }
  while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0' : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
    result = result * base + value;
    cp++;
  }
  if (endp)
    *endp = (char *)cp;
  return result;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<simple_strtoul>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r13
  mov    %edx,%r12d
  cmpb   $0x30,(%rdi)
  je     L59
  test   %edx,%edx
  mov    $0xa,%eax
  cmove  %eax,%r12d
L43:
  mov    $0x0,%ebp
  mov    %r12d,%r12d
  jmp    L148
L59:
  lea    0x1(%rdi),%rbp
  cmpb   $0x78,0x1(%rdi)
  je     L129
L104:
  test   %r12d,%r12d
  je     L40
L28:
  mov    %rbp,%rbx
  jmp    L43
L129:
  movsbl 0x2(%rdi),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L104
  lea    0x2(%rbx),%rbp
  mov    $0x10,%r12d
  jmp    L28
L40:
  mov    %rbp,%rbx
  mov    $0x8,%r12d
  jmp    L43
L12:
  movsbl (%rbx),%edi
  call   <islower@plt>
  test   %rax,%rax
  jne    L50
  movsbl (%rbx),%eax
  sub    $0x37,%eax
  cltq
L35:
  cmp    %rax,%r12
  jbe    L13
  imul   %r12,%rbp
  add    %rax,%rbp
  add    $0x1,%rbx
L148:
  movsbl (%rbx),%edi
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L13
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L12
  movsbl (%rbx),%eax
  sub    $0x30,%eax
  cltq
  jmp    L35
L50:
  movsbl (%rbx),%edi
  call   <toupper@plt>
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  jmp    L35
L13:
  test   %r13,%r13
  je     L84
  mov    %rbx,0x0(%r13)
L84:
  mov    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
  unsigned long result = 0, value;
  if (*cp == '0') {
    cp++;
    if ((*cp == 'x') && isxdigit(cp[1])) {
      base = 16;
      cp++;
    }
    if (!base) {
      base = 8;
    }
  }
  if (!base) {
    base = 10;
  }
  while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0' : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
    result = result * base + value;
    cp++;
  }
  if (endp)
    *endp = (char *)cp;
  return result;
}
```
user: What is the c source code of the assembly code below:

```asm
<simple_strtoul>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  movsbl (%rdi),%edi
  cmp    $0x30,%dil
  je     L41
  test   %edx,%edx
  mov    $0xa,%eax
  cmove  %eax,%edx
L17:
  xor    %r12d,%r12d
  mov    %edx,%ebx
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L18:
  movsbl 0x0(%r13),%eax
  sub    $0x30,%eax
  cltq
L105:
  cmp    %rax,%rbx
  jbe    L58
L50:
  imul   %rbx,%r12
  movsbl 0x1(%r13),%edi
  add    $0x1,%r13
  add    %rax,%r12
L37:
  call   <isxdigit@plt>
  test   %rax,%rax
  je     L58
  movsbl 0x0(%r13),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L18
  movsbl 0x0(%r13),%edi
  call   <islower@plt>
  test   %rax,%rax
  jne    L46
  movsbl 0x0(%r13),%eax
  sub    $0x37,%eax
  cltq
  cmp    %rax,%rbx
  ja     L50
  xchg   %ax,%ax
L58:
  test   %rbp,%rbp
  je     L103
  mov    %r13,0x0(%rbp)
L103:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L46:
  movsbl 0x0(%r13),%edi
  call   <toupper@plt>
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  jmp    L105
  nopw   0x0(%rax,%rax,1)
L41:
  cmpb   $0x78,0x1(%r13)
  lea    0x1(%r13),%r12
  je     L125
L16:
  movsbl 0x1(%r13),%edi
  mov    %r12,%r13
  test   %edx,%edx
  jne    L17
  mov    $0x8,%edx
  jmp    L17
L125:
  movsbl 0x2(%r13),%edi
  mov    %edx,0xc(%rsp)
  call   <isxdigit@plt>
  mov    0xc(%rsp),%edx
  test   %rax,%rax
  je     L16
  movsbl 0x2(%r13),%edi
  mov    $0x10,%edx
  add    $0x2,%r13
  jmp    L17
```

assistant: ```c
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) {
  unsigned long result = 0, value;
  if (*cp == '0') {
    cp++;
    if ((*cp == 'x') && isxdigit(cp[1])) {
      base = 16;
      cp++;
    }
    if (!base) {
      base = 8;
    }
  }
  if (!base) {
    base = 10;
  }
  while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0' : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
    result = result * base + value;
    cp++;
  }
  if (endp)
    *endp = (char *)cp;
  return result;
}
```