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

```asm
<accessorThread>:
  endbr64
  push   %rbx
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  movl   $0x0,(%rax)
L0:
  mov    %rbx,%rdi
  call   <swizzle@plt>
  mov    $0x0,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0x51eb851f,%rdx,%rdx
  sar    $0x25,%rdx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x64,%edx,%edx
  sub    %edx,%eax
  lea    0xa(%rax),%edi
  call   <usleep@plt>
  cmpl   $0x63,(%rbx)
  jle    L0
  mov    %rbx,%rdi
  call   <pthread_exit@plt>
  pop    %rbx
  ret
```

assistant: ```c
void *accessorThread(void *arg) {
  int *result = (int *)malloc(sizeof(int));
  ;
  *result = 0;
  while (*result < 100) {
    swizzle(result);
    usleep(10 + (rand() % 100));
  }
  pthread_exit(result);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<accessorThread>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <malloc@plt>
  movl   $0x0,(%rax)
  mov    %rax,%rbp
  nopl   0x0(%rax,%rax,1)
L7:
  mov    %rbp,%rdi
  call   <swizzle@plt>
  xor    %eax,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x51eb851f,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x25,%rdx
  sub    %ecx,%edx
  imul   $0x64,%edx,%edx
  sub    %edx,%eax
  lea    0xa(%rax),%edi
  call   <usleep@plt>
  cmpl   $0x63,0x0(%rbp)
  jle    L7
  mov    %rbp,%rdi
  call   <pthread_exit@plt>
  pop    %rbp
  ret
```

assistant: ```c
void *accessorThread(void *arg) {
  int *result = (int *)malloc(sizeof(int));
  ;
  *result = 0;
  while (*result < 100) {
    swizzle(result);
    usleep(10 + (rand() % 100));
  }
  pthread_exit(result);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<accessorThread>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <malloc@plt>
  movl   $0x0,(%rax)
  mov    %rax,%rbp
  nopl   0x0(%rax,%rax,1)
L3:
  mov    %rbp,%rdi
  call   <swizzle@plt>
  xor    %eax,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x51eb851f,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x25,%rdx
  sub    %ecx,%edx
  imul   $0x64,%edx,%edx
  sub    %edx,%eax
  lea    0xa(%rax),%edi
  call   <usleep@plt>
  cmpl   $0x63,0x0(%rbp)
  jle    L3
  mov    %rbp,%rdi
  call   <pthread_exit@plt>
  pop    %rbp
  ret
```

assistant: ```c
void *accessorThread(void *arg) {
  int *result = (int *)malloc(sizeof(int));
  ;
  *result = 0;
  while (*result < 100) {
    swizzle(result);
    usleep(10 + (rand() % 100));
  }
  pthread_exit(result);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<make_bulk_transfer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L3
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <pabort@plt>
L3:
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    $0xcb,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <add_transfer@plt>
  nop
  leave
  ret
```

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

tool: D3: malloc failed

assistant: ```c
void make_bulk_transfer(int len) {
  uint8_t *buf = malloc(len);
  if (NULL == buf)
    pabort("malloc failed");
  memset(buf, 0xCB, len);
  add_transfer(buf, len);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<make_bulk_transfer>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L8
L2:
  mov    %ebp,%edx
  mov    $0xcb,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <add_transfer@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L8:
  lea    D0(%rip),%rdi
  call   <pabort@plt>
  jmp    L2
```

tool_calls: name: disassemble_data
arguments: tag: D0
type_infered: string

tool: D0: malloc failed

assistant: ```c
void make_bulk_transfer(int len) {
  uint8_t *buf = malloc(len);
  if (NULL == buf)
    pabort("malloc failed");
  memset(buf, 0xCB, len);
  add_transfer(buf, len);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<make_bulk_transfer>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L1
L6:
  mov    %rbp,%rdi
  mov    %r12d,%edx
  mov    $0xcb,%esi
  call   <memset@plt>
  add    $0x8,%rsp
  mov    %r12d,%esi
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <add_transfer@plt>
  nopl   (%rax)
L1:
  lea    D7(%rip),%rdi
  call   <pabort@plt>
  jmp    L6
```

tool_calls: name: extract_symbolic_data
arguments: label: D7
type: string

tool: D7: malloc failed

assistant: ```c
void make_bulk_transfer(int len) {
  uint8_t *buf = malloc(len);
  if (NULL == buf)
    pabort("malloc failed");
  memset(buf, 0xCB, len);
  add_transfer(buf, len);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<make_bulk_transfer>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L16
L9:
  mov    %rbp,%rdi
  mov    %r12d,%edx
  mov    $0xcb,%esi
  call   <memset@plt>
  add    $0x8,%rsp
  mov    %r12d,%esi
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <add_transfer@plt>
  nopl   (%rax)
L16:
  lea    D7(%rip),%rdi
  call   <pabort@plt>
  jmp    L9
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D7
type: string

tool: D7: malloc failed

assistant: ```c
void make_bulk_transfer(int len) {
  uint8_t *buf = malloc(len);
  if (NULL == buf)
    pabort("malloc failed");
  memset(buf, 0xCB, len);
  add_transfer(buf, len);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<WinstC>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <Ws@plt>
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <wRelative12@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: label: D1
data_type: string

tool: D1: rjmp  

assistant: ```c
int WinstC(int i, int code) {
  Ws("rjmp  ");
  wRelative12(i, code);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<WinstC>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  lea    D2(%rip),%rdi
  call   <Ws@plt>
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <wRelative12@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D2
type_guessed: string

tool: D2: rjmp  

assistant: ```c
int WinstC(int i, int code) {
  Ws("rjmp  ");
  wRelative12(i, code);
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<WinstC>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edi,%ebp
  lea    D1(%rip),%rdi
  sub    $0x8,%rsp
  call   <Ws@plt>
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <wRelative12@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D1
data_type: string

tool: D1: rjmp  

assistant: ```c
int WinstC(int i, int code) {
  Ws("rjmp  ");
  wRelative12(i, code);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<WinstC>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edi,%ebp
  lea    D5(%rip),%rdi
  sub    $0x8,%rsp
  call   <Ws@plt>
  mov    %r12d,%esi
  mov    %ebp,%edi
  call   <wRelative12@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

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

tool: D5: rjmp  

assistant: ```c
int WinstC(int i, int code) {
  Ws("rjmp  ");
  wRelative12(i, code);
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movzbl -0x8(%rbp),%eax
  and    $0xfffffffe,%eax
  mov    %al,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  or     $0x3fffffff,%eax
  mov    %eax,-0x4(%rbp)
  movzbl -0x8(%rbp),%eax
  and    $0xfffffff9,%eax
  or     $0x2,%eax
  mov    %al,-0x8(%rbp)
  movzbl -0x8(%rbp),%eax
  and    $0xffffffc7,%eax
  or     $0x8,%eax
  mov    %al,-0x8(%rbp)
  movzwl -0x8(%rbp),%eax
  and    $0xfc3f,%ax
  or     $0x40,%eax
  mov    %ax,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x3fffffff,%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x4(%rbp),%eax
  or     $0x3fffffff,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x3fffffff,%eax
  mov    %eax,%esi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D18
type: string

tool: D18: %u


assistant: ```c
int main() {
  struct {
    unsigned happy : 1;
    unsigned sad : 2;
    unsigned confused : 3;
    unsigned focused : 4;
    unsigned furious : 30;
  } fields;
  fields.happy = 0;
  fields.furious = 0x3fffffff;
  fields.sad = 1;
  fields.confused = 1;
  fields.focused = 1;
  printf("%u\n", fields.furious);
  fields.furious = 0x7fffffff;
  printf("%u\n", fields.furious);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x3fffffff,%esi
  lea    D6(%rip),%rbx
  mov    %rbx,%rdi
  call   <printf@plt>
  mov    $0x3fffffff,%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

tool_calls: name: read_data
arguments: tag: D6
datatype: string

tool: D6: %u


assistant: ```c
int main() {
  struct {
    unsigned happy : 1;
    unsigned sad : 2;
    unsigned confused : 3;
    unsigned focused : 4;
    unsigned furious : 30;
  } fields;
  fields.happy = 0;
  fields.furious = 0x3fffffff;
  fields.sad = 1;
  fields.confused = 1;
  fields.focused = 1;
  printf("%u\n", fields.furious);
  fields.furious = 0x7fffffff;
  printf("%u\n", fields.furious);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D2(%rip),%rbp
  mov    $0x3fffffff,%esi
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  mov    $0x3fffffff,%esi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_label: D2
type_infered: string

tool: D2: %u


assistant: ```c
int main() {
  struct {
    unsigned happy : 1;
    unsigned sad : 2;
    unsigned confused : 3;
    unsigned focused : 4;
    unsigned furious : 30;
  } fields;
  fields.happy = 0;
  fields.furious = 0x3fffffff;
  fields.sad = 1;
  fields.confused = 1;
  fields.focused = 1;
  printf("%u\n", fields.furious);
  fields.furious = 0x7fffffff;
  printf("%u\n", fields.furious);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D9(%rip),%rbp
  mov    $0x3fffffff,%esi
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  mov    $0x3fffffff,%esi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: tag: D9
type: string

tool: D9: %u


assistant: ```c
int main() {
  struct {
    unsigned happy : 1;
    unsigned sad : 2;
    unsigned confused : 3;
    unsigned focused : 4;
    unsigned furious : 30;
  } fields;
  fields.happy = 0;
  fields.furious = 0x3fffffff;
  fields.sad = 1;
  fields.confused = 1;
  fields.focused = 1;
  printf("%u\n", fields.furious);
  fields.furious = 0x7fffffff;
  printf("%u\n", fields.furious);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpl   $0x2,-0x14(%rbp)
  jne    L9
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L9
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <trim_before@plt>
  mov    %eax,%edi
  call   <ft_print@plt>
L9:
  mov    $0x1,%edx
  lea    D0(%rip),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <write@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D0
data_type: string

tool: D0: 


assistant: ```c
int main(int argc, char **argv) {
  int i;
  i = 0;
  if (argc == 2 && argv[1][0] != '\0') {
    ft_print(trim_before(argv[1]));
  }
  write(1, "\n", 1);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x2,%edi
  je     L6
L29:
  mov    $0x1,%edx
  lea    D3(%rip),%rsi
  mov    $0x1,%edi
  call   <write@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
L6:
  mov    0x8(%rsi),%rdi
  cmpb   $0x0,(%rdi)
  je     L29
  call   <trim_before@plt>
  mov    %eax,%edi
  call   <ft_print@plt>
  jmp    L29
```

tool_calls: name: disassemble_data
arguments: label: D3
data_type: string

tool: D3: 


assistant: ```c
int main(int argc, char **argv) {
  int i;
  i = 0;
  if (argc == 2 && argv[1][0] != '\0') {
    ft_print(trim_before(argv[1]));
  }
  write(1, "\n", 1);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x2,%edi
  je     L24
L23:
  mov    $0x1,%edx
  lea    D0(%rip),%rsi
  mov    $0x1,%edi
  call   <write@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
L24:
  mov    0x8(%rsi),%rdi
  cmpb   $0x0,(%rdi)
  je     L23
  call   <trim_before@plt>
  mov    %eax,%edi
  call   <ft_print@plt>
  jmp    L23
```

tool_calls: name: disassemble_data
arguments: tag: D0
type: string

tool: D0: 


assistant: ```c
int main(int argc, char **argv) {
  int i;
  i = 0;
  if (argc == 2 && argv[1][0] != '\0') {
    ft_print(trim_before(argv[1]));
  }
  write(1, "\n", 1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x2,%edi
  je     L11
L1:
  mov    $0x1,%edx
  lea    D2(%rip),%rsi
  mov    $0x1,%edi
  call   <write@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
L11:
  mov    0x8(%rsi),%rdi
  cmpb   $0x0,(%rdi)
  je     L1
  call   <trim_before@plt>
  mov    %eax,%edi
  call   <ft_print@plt>
  jmp    L1
```

tool_calls: name: read_data
arguments: data_tag: D2
datatype: string

tool: D2: 


assistant: ```c
int main(int argc, char **argv) {
  int i;
  i = 0;
  if (argc == 2 && argv[1][0] != '\0') {
    ft_print(trim_before(argv[1]));
  }
  write(1, "\n", 1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<eval_literal_int>:
  endbr64
  movzbl (%rdi),%edx
  cmp    $0x27,%dl
  je     L89
  cmp    $0x30,%dl
  je     L63
  test   %dl,%dl
  je     L64
L101:
  add    $0x1,%rdi
  mov    $0x0,%eax
L102:
  lea    (%rax,%rax,4),%eax
  movsbl %dl,%edx
  lea    -0x30(%rdx,%rax,2),%eax
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L102
  ret
L89:
  movzbl 0x1(%rdi),%edx
  movsbl %dl,%eax
  cmp    $0x5c,%dl
  je     L146
L127:
  ret
L146:
  movzbl 0x2(%rdi),%eax
  lea    -0x66(%rax),%edx
  cmp    $0x10,%dl
  ja     L40
  movzbl %dl,%edx
  lea    D2(%rip),%rcx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
  mov    $0xd,%eax
  ret
  mov    $0xc,%eax
  ret
  mov    $0xb,%eax
  ret
L40:
  movsbl %al,%eax
  ret
L63:
  movzbl 0x1(%rdi),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L151
  movzbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L30
  add    $0x3,%rdi
  mov    $0x0,%eax
  jmp    L23
L53:
  lea    -0x41(%rdx),%ecx
  cmp    $0x5,%cl
  ja     L172
  shl    $0x4,%eax
  movsbl %dl,%edx
  lea    -0x37(%rax,%rdx,1),%eax
L11:
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%edx
  test   %dl,%dl
  je     L175
L23:
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  ja     L53
  shl    $0x4,%eax
  movsbl %dl,%edx
  lea    -0x30(%rax,%rdx,1),%eax
  jmp    L11
L172:
  shl    $0x4,%eax
  movsbl %dl,%edx
  lea    -0x57(%rax,%rdx,1),%eax
  jmp    L11
L175:
  ret
L64:
  mov    $0x0,%eax
  ret
L151:
  cmp    $0x4f,%al
  jne    L101
  movzbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L130
  add    $0x3,%rdi
  mov    $0x0,%eax
L156:
  movsbl %dl,%edx
  lea    -0x30(%rdx,%rax,8),%eax
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L156
  ret
  mov    $0xa,%eax
  ret
  mov    $0x9,%eax
  ret
L30:
  mov    $0x0,%eax
  ret
L130:
  mov    $0x0,%eax
  jmp    L127
```

assistant: ```c
int eval_literal_int(char *str) {
  int val = 0;
  int i;
  if (str[0] == '\'') {
    if (str[1] == '\\') {
      switch (str[2]) {
      case 'n':
        val = '\n';
        break;
      case 'r':
        val = '\r';
        break;
      case 't':
        val = '\t';
        break;
      case 'f':
        val = '\f';
        break;
      case 'v':
        val = '\v';
        break;
      default:
        val = str[2];
      }
    } else {
      val = str[1];
    }
  } else if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) {
    i = 2;
    while (str[i]) {
      if (str[i] >= '0' && str[i] <= '9') {
        val = val * 16 + str[i] - '0';
      } else if (str[i] >= 'A' && str[i] <= 'F') {
        val = val * 16 + str[i] - 'A' + 10;
      } else {
        val = val * 16 + str[i] - 'a' + 10;
      }
      i++;
    }
  } else if (str[0] == '0' && (str[1] == 'o' || str[1] == 'O')) {
    i = 2;
    while (str[i]) {
      val = val * 8 + str[i] - '0';
      i++;
    }
  } else {
    i = 0;
    while (str[i]) {
      val = val * 10 + str[i] - '0';
      i++;
    }
  }
  return val;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<eval_literal_int>:
  endbr64
  movsbl (%rdi),%edx
  cmp    $0x27,%dl
  je     L80
  cmp    $0x30,%dl
  je     L125
  test   %dl,%dl
  je     L6
L103:
  add    $0x1,%rdi
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L81:
  lea    (%rax,%rax,4),%eax
  add    $0x1,%rdi
  lea    -0x30(%rdx,%rax,2),%eax
  movsbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L81
  ret
  nopl   0x0(%rax)
L125:
  movzbl 0x1(%rdi),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L126
  movzbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L6
  add    $0x3,%rdi
  xor    %eax,%eax
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L11:
  sub    $0x30,%eax
L35:
  movzbl (%rdi),%edx
  add    $0x1,%rdi
  test   %dl,%dl
  je     L141
L89:
  movsbl %dl,%ecx
  shl    $0x4,%eax
  add    %ecx,%eax
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  jbe    L11
  sub    $0x41,%edx
  lea    -0x37(%rax),%ecx
  sub    $0x57,%eax
  cmp    $0x5,%dl
  cmovbe %ecx,%eax
  jmp    L35
  nopl   0x0(%rax,%rax,1)
L80:
  movsbl 0x1(%rdi),%eax
  cmp    $0x5c,%al
  je     L56
L109:
  ret
  nopl   0x0(%rax)
L56:
  movsbl 0x2(%rdi),%eax
  lea    -0x66(%rax),%edx
  cmp    $0x10,%dl
  ja     L109
  lea    D7(%rip),%rcx
  movzbl %dl,%edx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
L126:
  cmp    $0x4f,%al
  jne    L103
  movsbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L6
  add    $0x3,%rdi
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L8:
  add    $0x1,%rdi
  lea    -0x30(%rdx,%rax,8),%eax
  movsbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L8
  ret
  nopl   0x0(%rax)
L141:
  ret
  nopl   0x0(%rax)
L6:
  xor    %eax,%eax
  ret
  mov    $0xb,%eax
  ret
  mov    $0xd,%eax
  ret
  mov    $0xc,%eax
  ret
  mov    $0x9,%eax
  ret
  mov    $0xa,%eax
  ret
```

assistant: ```c
int eval_literal_int(char *str) {
  int val = 0;
  int i;
  if (str[0] == '\'') {
    if (str[1] == '\\') {
      switch (str[2]) {
      case 'n':
        val = '\n';
        break;
      case 'r':
        val = '\r';
        break;
      case 't':
        val = '\t';
        break;
      case 'f':
        val = '\f';
        break;
      case 'v':
        val = '\v';
        break;
      default:
        val = str[2];
      }
    } else {
      val = str[1];
    }
  } else if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) {
    i = 2;
    while (str[i]) {
      if (str[i] >= '0' && str[i] <= '9') {
        val = val * 16 + str[i] - '0';
      } else if (str[i] >= 'A' && str[i] <= 'F') {
        val = val * 16 + str[i] - 'A' + 10;
      } else {
        val = val * 16 + str[i] - 'a' + 10;
      }
      i++;
    }
  } else if (str[0] == '0' && (str[1] == 'o' || str[1] == 'O')) {
    i = 2;
    while (str[i]) {
      val = val * 8 + str[i] - '0';
      i++;
    }
  } else {
    i = 0;
    while (str[i]) {
      val = val * 10 + str[i] - '0';
      i++;
    }
  }
  return val;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<eval_literal_int>:
  endbr64
  movsbl (%rdi),%edx
  cmp    $0x27,%dl
  je     L100
  cmp    $0x30,%dl
  je     L49
  test   %dl,%dl
  je     L3
L115:
  add    $0x1,%rdi
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L105:
  lea    (%rax,%rax,4),%eax
  add    $0x1,%rdi
  lea    -0x30(%rdx,%rax,2),%eax
  movsbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L105
  ret
  nopl   0x0(%rax)
L49:
  movzbl 0x1(%rdi),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L58
  movzbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L3
  add    $0x3,%rdi
  xor    %eax,%eax
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L131:
  sub    $0x30,%eax
L129:
  movzbl (%rdi),%edx
  add    $0x1,%rdi
  test   %dl,%dl
  je     L124
L12:
  movsbl %dl,%ecx
  shl    $0x4,%eax
  add    %ecx,%eax
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  jbe    L131
  sub    $0x41,%edx
  lea    -0x37(%rax),%ecx
  sub    $0x57,%eax
  cmp    $0x5,%dl
  cmovbe %ecx,%eax
  jmp    L129
  nopl   0x0(%rax,%rax,1)
L100:
  movsbl 0x1(%rdi),%eax
  cmp    $0x5c,%al
  je     L23
L86:
  ret
  nopl   0x0(%rax)
L23:
  movsbl 0x2(%rdi),%eax
  lea    -0x66(%rax),%edx
  cmp    $0x10,%dl
  ja     L86
  lea    D1(%rip),%rcx
  movzbl %dl,%edx
  movslq (%rcx,%rdx,4),%rdx
  add    %rcx,%rdx
  notrack jmp *%rdx
L58:
  cmp    $0x4f,%al
  jne    L115
  movsbl 0x2(%rdi),%edx
  test   %dl,%dl
  je     L3
  add    $0x3,%rdi
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L7:
  add    $0x1,%rdi
  lea    -0x30(%rdx,%rax,8),%eax
  movsbl -0x1(%rdi),%edx
  test   %dl,%dl
  jne    L7
  ret
  nopl   0x0(%rax)
L124:
  ret
  nopl   0x0(%rax)
L3:
  xor    %eax,%eax
  ret
  mov    $0xb,%eax
  ret
  mov    $0xd,%eax
  ret
  mov    $0xc,%eax
  ret
  mov    $0x9,%eax
  ret
  mov    $0xa,%eax
  ret
```

assistant: ```c
int eval_literal_int(char *str) {
  int val = 0;
  int i;
  if (str[0] == '\'') {
    if (str[1] == '\\') {
      switch (str[2]) {
      case 'n':
        val = '\n';
        break;
      case 'r':
        val = '\r';
        break;
      case 't':
        val = '\t';
        break;
      case 'f':
        val = '\f';
        break;
      case 'v':
        val = '\v';
        break;
      default:
        val = str[2];
      }
    } else {
      val = str[1];
    }
  } else if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) {
    i = 2;
    while (str[i]) {
      if (str[i] >= '0' && str[i] <= '9') {
        val = val * 16 + str[i] - '0';
      } else if (str[i] >= 'A' && str[i] <= 'F') {
        val = val * 16 + str[i] - 'A' + 10;
      } else {
        val = val * 16 + str[i] - 'a' + 10;
      }
      i++;
    }
  } else if (str[0] == '0' && (str[1] == 'o' || str[1] == 'O')) {
    i = 2;
    while (str[i]) {
      val = val * 8 + str[i] - '0';
      i++;
    }
  } else {
    i = 0;
    while (str[i]) {
      val = val * 10 + str[i] - '0';
      i++;
    }
  }
  return val;
}
```