ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movl   $0xa,-0x14(%rbp)
  movl   $0x14,-0x10(%rbp)
  movss  D24(%rip),%xmm0
  movss  %xmm0,-0xc(%rbp)
  movsd  D11(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mov    -0xc(%rbp),%ecx
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  movapd %xmm0,%xmm1
  movd   %ecx,%xmm0
  mov    %eax,%esi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D24
type_infered: f32
name: disassemble_data
arguments: data_tag: D11
type_infered: f64
name: disassemble_data
arguments: data_tag: D21
type_infered: string

tool: D24: 3.14

tool: D11: 123456789.1234

tool: D21: var = %d, %d, %f, %f


assistant: ```c
main() {
  int var;
  int Var;
  float this_is_float_var;
  double ThisIsDoubleVar;
  var = 10;
  Var = 20;
  this_is_float_var = 3.14;
  ThisIsDoubleVar = 123456789.1234;
  printf("var = %d, %d, %f, %f\n", var, Var, this_is_float_var, ThisIsDoubleVar);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  movsd  D5(%rip),%xmm1
  movss  D27(%rip),%xmm0
  mov    $0x14,%edx
  mov    $0xa,%esi
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D5
data_type: f64
name: extract_symbolic_data
arguments: data_tag: D27
data_type: f32
name: extract_symbolic_data
arguments: data_tag: D2
data_type: string

tool: D5: 123456789.1234

tool: D27: 3.14

tool: D2: var = %d, %d, %f, %f


assistant: ```c
main() {
  int var;
  int Var;
  float this_is_float_var;
  double ThisIsDoubleVar;
  var = 10;
  Var = 20;
  this_is_float_var = 3.14;
  ThisIsDoubleVar = 123456789.1234;
  printf("var = %d, %d, %f, %f\n", var, Var, this_is_float_var, ThisIsDoubleVar);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  movsd  D12(%rip),%xmm1
  movss  D5(%rip),%xmm0
  mov    $0x14,%edx
  mov    $0xa,%esi
  lea    D21(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D12
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D5
type_infered: f32
name: extract_symbolic_data
arguments: data_tag: D21
type_infered: string

tool: D12: 123456789.1234

tool: D5: 3.14

tool: D21: var = %d, %d, %f, %f


assistant: ```c
main() {
  int var;
  int Var;
  float this_is_float_var;
  double ThisIsDoubleVar;
  var = 10;
  Var = 20;
  this_is_float_var = 3.14;
  ThisIsDoubleVar = 123456789.1234;
  printf("var = %d, %d, %f, %f\n", var, Var, this_is_float_var, ThisIsDoubleVar);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  movsd  D18(%rip),%xmm1
  movss  D20(%rip),%xmm0
  mov    $0x14,%edx
  mov    $0xa,%esi
  lea    D17(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D18
type_infered: f64
name: disassemble_data
arguments: label: D20
type_infered: f32
name: disassemble_data
arguments: label: D17
type_infered: string

tool: D18: 123456789.1234

tool: D20: 3.14

tool: D17: var = %d, %d, %f, %f


assistant: ```c
main() {
  int var;
  int Var;
  float this_is_float_var;
  double ThisIsDoubleVar;
  var = 10;
  Var = 20;
  this_is_float_var = 3.14;
  ThisIsDoubleVar = 123456789.1234;
  printf("var = %d, %d, %f, %f\n", var, Var, this_is_float_var, ThisIsDoubleVar);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<fdt_first_subnode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  lea    -0xc(%rbp),%rdx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fdt_next_node@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  js     L6
  mov    -0xc(%rbp),%eax
  cmp    $0x1,%eax
  je     L10
L6:
  mov    $0xffffffff,%eax
  jmp    L2
L10:
  mov    -0x1c(%rbp),%eax
L2:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L23
  call   <__stack_chk_fail@plt>
L23:
  leave
  ret
```

assistant: ```c
int fdt_first_subnode(const void *fdt, int offset) {
  int depth = 0;
  offset = fdt_next_node(fdt, offset, &depth);
  if (offset < 0 || depth != 1)
    return -1;
  return offset;
}
```
user: Translate the below assembly code into C programming language:

```asm
<fdt_first_subnode>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  lea    0x4(%rsp),%rdx
  call   <fdt_next_node@plt>
  test   %eax,%eax
  js     L24
  cmpl   $0x1,0x4(%rsp)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L14:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L23
  add    $0x18,%rsp
  ret
L24:
  mov    $0xffffffff,%eax
  jmp    L14
L23:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fdt_first_subnode(const void *fdt, int offset) {
  int depth = 0;
  offset = fdt_next_node(fdt, offset, &depth);
  if (offset < 0 || depth != 1)
    return -1;
  return offset;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fdt_first_subnode>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  movl   $0x0,0x4(%rsp)
  call   <fdt_next_node@plt>
  test   %eax,%eax
  js     L10
  cmpl   $0x1,0x4(%rsp)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L18:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x18,%rsp
  ret
L10:
  mov    $0xffffffff,%eax
  jmp    L18
L22:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fdt_first_subnode(const void *fdt, int offset) {
  int depth = 0;
  offset = fdt_next_node(fdt, offset, &depth);
  if (offset < 0 || depth != 1)
    return -1;
  return offset;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<fdt_first_subnode>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  movl   $0x0,0x4(%rsp)
  call   <fdt_next_node@plt>
  test   %eax,%eax
  js     L21
  cmpl   $0x1,0x4(%rsp)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L27:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L13
  add    $0x18,%rsp
  ret
L21:
  mov    $0xffffffff,%eax
  jmp    L27
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fdt_first_subnode(const void *fdt, int offset) {
  int depth = 0;
  offset = fdt_next_node(fdt, offset, &depth);
  if (offset < 0 || depth != 1)
    return -1;
  return offset;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<print_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D9
datatype: string

tool: D9: El entero vale %i


assistant: ```c
void print_int(void *d) {
  int a = *((int *)d);
  printf("El entero vale %i\n", a);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<print_int>:
  endbr64
  sub    $0x8,%rsp
  mov    (%rdi),%esi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: label: D9
datatype: string

tool: D9: El entero vale %i


assistant: ```c
void print_int(void *d) {
  int a = *((int *)d);
  printf("El entero vale %i\n", a);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<print_int>:
  endbr64
  mov    (%rdi),%esi
  lea    D7(%rip),%rdi
  jmp    1050 <printf@plt>
```

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

tool: D7: El entero vale %i


assistant: ```c
void print_int(void *d) {
  int a = *((int *)d);
  printf("El entero vale %i\n", a);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_int>:
  endbr64
  mov    (%rdi),%esi
  lea    D2(%rip),%rdi
  jmp    1050 <printf@plt>
```

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

tool: D2: El entero vale %i


assistant: ```c
void print_int(void *d) {
  int a = *((int *)d);
  printf("El entero vale %i\n", a);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<make_dir_rec1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  sub    $0xb0,%rsp
  mov    %rdi,-0xa8(%rbp)
  mov    %rsi,%r12
  mov    %rdx,-0xb0(%rbp)
  mov    %rcx,-0xb8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %r12,%rbx
  jmp    L39
L13:
  movzbl (%rbx),%eax
  cmp    $0x2f,%al
  jne    L50
  mov    %rbx,%rax
  sub    %r12,%rax
  mov    %rax,%rdx
  lea    -0xa0(%rbp),%rax
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %rbx,%rax
  sub    %r12,%rax
  movb   $0x0,-0xa0(%rbp,%rax,1)
  mov    -0xb8(%rbp),%rcx
  mov    -0xb0(%rbp),%rdx
  lea    -0xa0(%rbp),%rsi
  mov    -0xa8(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <make_dir1@plt>
  cmp    $0xffffffff,%eax
  jne    L50
  mov    $0xffffffff,%eax
  jmp    L43
L50:
  add    $0x1,%rbx
L39:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L13
  mov    $0x0,%eax
L43:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  add    $0xb0,%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
int make_dir_rec1(env, path, error_handler, message_handler)
struct wnn_env *env;
register char *path;
int (*error_handler)(const char *), (*message_handler)(const char *);
{
  char gomi[128];
  register char *c;
  for (c = path; *c; c++) {
    if (*c == '/') {
      strncpy(gomi, path, c - path);
      gomi[c - path] = 0;
      if (make_dir1(env, gomi, error_handler, message_handler) == -1) {
        return (-1);
      }
    }
  }
  return (0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<make_dir_rec1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  movzbl (%rsi),%eax
  test   %al,%al
  je     L4
  mov    %rsi,%rbp
  mov    %rdx,%r14
  mov    %rcx,%r15
  mov    %rsi,%rbx
  lea    0x10(%rsp),%r13
  jmp    L17
L57:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L65
L17:
  cmp    $0x2f,%al
  jne    L57
  mov    %rbx,%r12
  sub    %rbp,%r12
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x10(%rsp,%r12,1)
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    0x8(%rsp),%rdi
  mov    $0x0,%eax
  call   <make_dir1@plt>
  cmp    $0xffffffff,%eax
  jne    L57
  jmp    L45
L65:
  mov    $0x0,%eax
L45:
  mov    0x98(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L37
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  mov    $0x0,%eax
  jmp    L45
L37:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int make_dir_rec1(env, path, error_handler, message_handler)
struct wnn_env *env;
register char *path;
int (*error_handler)(const char *), (*message_handler)(const char *);
{
  char gomi[128];
  register char *c;
  for (c = path; *c; c++) {
    if (*c == '/') {
      strncpy(gomi, path, c - path);
      gomi[c - path] = 0;
      if (make_dir1(env, gomi, error_handler, message_handler) == -1) {
        return (-1);
      }
    }
  }
  return (0);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<make_dir_rec1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  movzbl (%rsi),%eax
  test   %al,%al
  je     L0
  mov    %rdi,%r12
  mov    %rsi,%r15
  mov    %rdx,%r13
  mov    %rcx,%r14
  mov    %rsi,%rbx
  lea    0x10(%rsp),%rbp
  jmp    L41
  nopl   0x0(%rax)
L15:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L0
L41:
  cmp    $0x2f,%al
  jne    L15
  mov    %rbx,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  sub    %r15,%rdx
  mov    %rdx,0x8(%rsp)
  call   <strncpy@plt>
  mov    0x8(%rsp),%rdx
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movb   $0x0,0x10(%rsp,%rdx,1)
  mov    %r13,%rdx
  call   <make_dir1@plt>
  cmp    $0xffffffff,%eax
  jne    L15
  nopl   0x0(%rax,%rax,1)
L43:
  mov    0x98(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L61
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L0:
  xor    %eax,%eax
  jmp    L43
L61:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int make_dir_rec1(env, path, error_handler, message_handler)
struct wnn_env *env;
register char *path;
int (*error_handler)(const char *), (*message_handler)(const char *);
{
  char gomi[128];
  register char *c;
  for (c = path; *c; c++) {
    if (*c == '/') {
      strncpy(gomi, path, c - path);
      gomi[c - path] = 0;
      if (make_dir1(env, gomi, error_handler, message_handler) == -1) {
        return (-1);
      }
    }
  }
  return (0);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<make_dir_rec1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  movzbl (%rsi),%eax
  test   %al,%al
  je     L66
  mov    %rdi,%r12
  mov    %rsi,%r15
  mov    %rdx,%r13
  mov    %rcx,%r14
  mov    %rsi,%rbx
  lea    0x10(%rsp),%rbp
  jmp    L65
  nopl   0x0(%rax)
L40:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L66
L65:
  cmp    $0x2f,%al
  jne    L40
  mov    %rbx,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  sub    %r15,%rdx
  mov    %rdx,0x8(%rsp)
  call   <strncpy@plt>
  mov    0x8(%rsp),%rdx
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movb   $0x0,0x10(%rsp,%rdx,1)
  mov    %r13,%rdx
  call   <make_dir1@plt>
  cmp    $0xffffffff,%eax
  jne    L40
  nopl   0x0(%rax,%rax,1)
L50:
  mov    0x98(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L39
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L66:
  xor    %eax,%eax
  jmp    L50
L39:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int make_dir_rec1(env, path, error_handler, message_handler)
struct wnn_env *env;
register char *path;
int (*error_handler)(const char *), (*message_handler)(const char *);
{
  char gomi[128];
  register char *c;
  for (c = path; *c; c++) {
    if (*c == '/') {
      strncpy(gomi, path, c - path);
      gomi[c - path] = 0;
      if (make_dir1(env, gomi, error_handler, message_handler) == -1) {
        return (-1);
      }
    }
  }
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<st_strtok>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L97
  mov    D25(%rip),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L49
L97:
  mov    -0x18(%rbp),%rax
  mov    %rax,D46(%rip)
L49:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    D46(%rip),%rax
  test   %rax,%rax
  jne    L0
  mov    $0x0,%eax
  jmp    L72
L52:
  movl   $0x0,-0xc(%rbp)
  jmp    L7
L59:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L31
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,D46(%rip)
  mov    -0x8(%rbp),%rax
  jmp    L72
L31:
  addl   $0x1,-0xc(%rbp)
L7:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0xc(%rbp)
  jl     L59
  addq   $0x1,-0x18(%rbp)
L0:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L52
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L29
  mov    $0x0,%eax
  jmp    L72
L29:
  movq   $0x0,D46(%rip)
  mov    -0x8(%rbp),%rax
L72:
  leave
  ret
```

assistant: ```c
char *st_strtok(char *s, const char *delim) {
  int i;
  static char *s2;
  char *s3;
  if (s == NULL)
    s = s2;
  else
    s2 = s;
  s3 = s;
  if (s2 == NULL)
    return NULL;
  while (*s != '\0') {
    for (i = 0; i < strlen(delim); i++) {
      if (*s == delim[i]) {
        *s = '\0';
        s2 = s + 1;
        return s3;
      }
    }
    s++;
  }
  if (s3 == s)
    return NULL;
  s2 = NULL;
  return s3;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<st_strtok>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  test   %rdi,%rdi
  je     L22
  mov    %rdi,%r13
  mov    %rdi,D32(%rip)
L89:
  mov    %r13,%r12
  cmpb   $0x0,0x0(%r13)
  je     L67
L27:
  mov    $0x0,%ebx
L85:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L31
  add    $0x1,%rbx
  movzbl -0x1(%rbp,%rbx,1),%eax
  cmp    %al,(%r12)
  jne    L85
  movb   $0x0,(%r12)
  add    $0x1,%r12
  mov    %r12,D38(%rip)
L41:
  mov    %r13,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L22:
  mov    D38(%rip),%r13
  test   %r13,%r13
  jne    L89
  jmp    L41
L67:
  mov    $0x0,%r13d
  jmp    L41
L31:
  add    $0x1,%r12
  cmpb   $0x0,(%r12)
  jne    L27
  cmp    %r13,%r12
  je     L34
  movq   $0x0,D38(%rip)
  jmp    L41
L34:
  mov    $0x0,%r13d
  jmp    L41
```

assistant: ```c
char *st_strtok(char *s, const char *delim) {
  int i;
  static char *s2;
  char *s3;
  if (s == NULL)
    s = s2;
  else
    s2 = s;
  s3 = s;
  if (s2 == NULL)
    return NULL;
  while (*s != '\0') {
    for (i = 0; i < strlen(delim); i++) {
      if (*s == delim[i]) {
        *s = '\0';
        s2 = s + 1;
        return s3;
      }
    }
    s++;
  }
  if (s3 == s)
    return NULL;
  s2 = NULL;
  return s3;
}
```
user: What is the c source code of the assembly code below:

```asm
<st_strtok>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L42
  mov    %rdi,D21(%rip)
  mov    %rdi,%r13
L34:
  cmpb   $0x0,0x0(%r13)
  mov    %r13,%r12
  je     L36
L59:
  xor    %ebx,%ebx
  jmp    L23
  xchg   %ax,%ax
L75:
  add    $0x1,%rbx
  movzbl -0x1(%rbp,%rbx,1),%eax
  cmp    %al,(%r12)
  je     L45
L23:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jg     L75
  add    $0x1,%r12
  cmpb   $0x0,(%r12)
  jne    L59
  cmp    %r13,%r12
  je     L36
  movq   $0x0,D21(%rip)
  jmp    L40
  nopl   0x0(%rax,%rax,1)
L45:
  movb   $0x0,(%r12)
  add    $0x1,%r12
  mov    %r12,D34(%rip)
L40:
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L42:
  mov    D34(%rip),%r13
  test   %r13,%r13
  jne    L34
L36:
  add    $0x8,%rsp
  xor    %r13d,%r13d
  pop    %rbx
  mov    %r13,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *st_strtok(char *s, const char *delim) {
  int i;
  static char *s2;
  char *s3;
  if (s == NULL)
    s = s2;
  else
    s2 = s;
  s3 = s;
  if (s2 == NULL)
    return NULL;
  while (*s != '\0') {
    for (i = 0; i < strlen(delim); i++) {
      if (*s == delim[i]) {
        *s = '\0';
        s2 = s + 1;
        return s3;
      }
    }
    s++;
  }
  if (s3 == s)
    return NULL;
  s2 = NULL;
  return s3;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<st_strtok>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L59
  mov    %rdi,D4(%rip)
  mov    %rdi,%r13
L54:
  cmpb   $0x0,0x0(%r13)
  mov    %r13,%r12
  je     L53
L30:
  xor    %ebx,%ebx
  jmp    L84
  xchg   %ax,%ax
L75:
  add    $0x1,%rbx
  movzbl -0x1(%rbp,%rbx,1),%eax
  cmp    %al,(%r12)
  je     L14
L84:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jg     L75
  add    $0x1,%r12
  cmpb   $0x0,(%r12)
  jne    L30
  cmp    %r13,%r12
  je     L53
  movq   $0x0,D4(%rip)
  jmp    L4
  nopl   0x0(%rax,%rax,1)
L14:
  movb   $0x0,(%r12)
  add    $0x1,%r12
  mov    %r12,D34(%rip)
L4:
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L59:
  mov    D34(%rip),%r13
  test   %r13,%r13
  jne    L54
L53:
  add    $0x8,%rsp
  xor    %r13d,%r13d
  pop    %rbx
  mov    %r13,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *st_strtok(char *s, const char *delim) {
  int i;
  static char *s2;
  char *s3;
  if (s == NULL)
    s = s2;
  else
    s2 = s;
  s3 = s;
  if (s2 == NULL)
    return NULL;
  while (*s != '\0') {
    for (i = 0; i < strlen(delim); i++) {
      if (*s == delim[i]) {
        *s = '\0';
        s2 = s + 1;
        return s3;
      }
    }
    s++;
  }
  if (s3 == s)
    return NULL;
  s2 = NULL;
  return s3;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<hdd_image_calc_chs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    -0x50(%rbp),%rax
  shl    $0xb,%rax
  mov    %rax,-0x28(%rbp)
  cmpq   $0xfeff010,-0x28(%rbp)
  jle    L69
  movq   $0xfeff010,-0x28(%rbp)
L69:
  cmpq   $0x3effc0f,-0x28(%rbp)
  jle    L4
  movq   $0xff,-0x20(%rbp)
  movq   $0x10,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rax,-0x10(%rbp)
  jmp    L55
L4:
  movq   $0x11,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  add    $0x3ff,%rax
  lea    0x3ff(%rax),%rdx
  test   %rax,%rax
  cmovs  %rdx,%rax
  sar    $0xa,%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x3,-0x18(%rbp)
  jg     L36
  movq   $0x4,-0x18(%rbp)
L36:
  mov    -0x18(%rbp),%rax
  shl    $0xa,%rax
  cmp    %rax,-0x10(%rbp)
  jge    L26
  cmpq   $0x10,-0x18(%rbp)
  jle    L35
L26:
  movq   $0x1f,-0x20(%rbp)
  movq   $0x10,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rax,-0x10(%rbp)
L35:
  mov    -0x18(%rbp),%rax
  shl    $0xa,%rax
  cmp    %rax,-0x10(%rbp)
  jl     L55
  movq   $0x3f,-0x20(%rbp)
  movq   $0x10,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rax,-0x10(%rbp)
L55:
  mov    -0x10(%rbp),%rax
  cqto
  idivq  -0x18(%rbp)
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x40(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x48(%rbp),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void hdd_image_calc_chs(uint32_t *c, uint32_t *h, uint32_t *s, uint32_t size) {
  uint64_t ts = ((uint64_t)size) << 11LL;
  uint32_t spt, heads, cyl, cth;
  if (ts > 65535 * 16 * 255)
    ts = 65535 * 16 * 255;
  if (ts >= 65535 * 16 * 63) {
    spt = 255;
    heads = 16;
    cth = (uint32_t)(ts / spt);
  } else {
    spt = 17;
    cth = (uint32_t)(ts / spt);
    heads = (cth + 1023) / 1024;
    if (heads < 4)
      heads = 4;
    if ((cth >= (heads * 1024)) || (heads > 16)) {
      spt = 31;
      heads = 16;
      cth = (uint32_t)(ts / spt);
    }
    if (cth >= (heads * 1024)) {
      spt = 63;
      heads = 16;
      cth = (uint32_t)(ts / spt);
    }
  }
  cyl = cth / heads;
  *c = cyl;
  *h = heads;
  *s = spt;
}
```