ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的?

```asm
<minuspr>:
  endbr64
  push   %rbp
  mov    %edi,%edx
  mov    %esi,%ecx
  lea    D17(%rip),%rsi
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  call   <sprintf@plt>
  xor    %eax,%eax
  mov    %rbp,%rsi
  lea    D16(%rip),%rdi
  call   <printf@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x30,%rsp
  xor    %eax,%eax
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D17
data_type: string
name: read_data
arguments: data_label: D16
data_type: string

tool: D17: %d-%d

tool: D16:  %4s

assistant: ```c
minuspr(x, y) {
  char buf[30];
  sprintf(buf, "%d-%d", x, y);
  printf(" %4s", buf);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<_sum_row>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L15
L10:
  mov    -0x20(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
L15:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L10
  movsd  -0x8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
double _sum_row(double *X, int n, int i) {
  int j;
  double sum = 0.0;
  for (j = 0; j < n; j++)
    sum += X[i * n + j];
  return sum;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_sum_row>:
  endbr64
  test   %esi,%esi
  jle    L14
  imul   %esi,%edx
  movslq %edx,%rdx
  lea    (%rdi,%rdx,8),%rax
  lea    -0x1(%rsi),%ecx
  add    %rcx,%rdx
  lea    0x8(%rdi,%rdx,8),%rdx
  pxor   %xmm0,%xmm0
L11:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L11
  ret
L14:
  pxor   %xmm0,%xmm0
  ret
```

assistant: ```c
double _sum_row(double *X, int n, int i) {
  int j;
  double sum = 0.0;
  for (j = 0; j < n; j++)
    sum += X[i * n + j];
  return sum;
}
```
user: Translate the below assembly code into C programming language:

```asm
<_sum_row>:
  endbr64
  test   %esi,%esi
  jle    L12
  imul   %esi,%edx
  lea    -0x1(%rsi),%ecx
  pxor   %xmm0,%xmm0
  movslq %edx,%rdx
  lea    (%rdi,%rdx,8),%rax
  add    %rcx,%rdx
  lea    0x8(%rdi,%rdx,8),%rdx
  nopl   0x0(%rax)
L6:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L6
  ret
  cs nopw 0x0(%rax,%rax,1)
L12:
  pxor   %xmm0,%xmm0
  ret
```

assistant: ```c
double _sum_row(double *X, int n, int i) {
  int j;
  double sum = 0.0;
  for (j = 0; j < n; j++)
    sum += X[i * n + j];
  return sum;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<_sum_row>:
  endbr64
  mov    %edx,%eax
  test   %esi,%esi
  jle    L24
  imul   %esi,%eax
  cmp    $0x1,%esi
  je     L6
  mov    %esi,%ecx
  movslq %eax,%rdx
  pxor   %xmm0,%xmm0
  shr    %ecx
  lea    (%rdi,%rdx,8),%rdx
  lea    -0x1(%rcx),%r8d
  shl    $0x4,%r8
  add    %rdx,%r8
  nopl   0x0(%rax)
L14:
  movsd  (%rdx),%xmm1
  mov    %rdx,%rcx
  add    $0x10,%rdx
  addsd  %xmm1,%xmm0
  movsd  -0x8(%rdx),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rcx,%r8
  jne    L14
  mov    %esi,%edx
  and    $0xfffffffe,%edx
  and    $0x1,%esi
  je     L46
L28:
  add    %edx,%eax
  cltq
  addsd  (%rdi,%rax,8),%xmm0
  ret
  nopl   0x0(%rax)
L46:
  ret
  nopl   0x0(%rax)
L24:
  pxor   %xmm0,%xmm0
  ret
L6:
  pxor   %xmm0,%xmm0
  xor    %edx,%edx
  jmp    L28
```

assistant: ```c
double _sum_row(double *X, int n, int i) {
  int j;
  double sum = 0.0;
  for (j = 0; j < n; j++)
    sum += X[i * n + j];
  return sum;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<table>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L1
L9:
  mov    -0x4(%rbp),%eax
  imul   -0x14(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x14(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L1:
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jle    L9
  nop
  nop
  leave
  ret
```

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

tool: D1: 	%d x %d = %d


assistant: ```c
void table(int n) {
  int i;
  for (i = 1; i <= n; i++) {
    printf("\t%d x %d = %d\n", i, n, i * n);
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<table>:
  endbr64
  test   %edi,%edi
  jle    L14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %edi,%r12d
  mov    $0x1,%ebx
  lea    D3(%rip),%r13
L6:
  mov    %r12d,%ecx
  mov    %ebp,%edx
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <printf@plt>
  add    $0x1,%ebx
  add    %ebp,%r12d
  cmp    %ebx,%ebp
  jge    L6
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L14:
  ret
```

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

tool: D3: 	%d x %d = %d


assistant: ```c
void table(int n) {
  int i;
  for (i = 1; i <= n; i++) {
    printf("\t%d x %d = %d\n", i, n, i * n);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<table>:
  endbr64
  test   %edi,%edi
  jle    L9
  push   %r13
  lea    D8(%rip),%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L4:
  mov    %r12d,%ecx
  mov    %ebx,%esi
  mov    %ebp,%edx
  mov    %r13,%rdi
  call   <printf@plt>
  add    $0x1,%ebx
  add    %ebp,%r12d
  cmp    %ebx,%ebp
  jge    L4
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L9:
  ret
```

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

tool: D8: 	%d x %d = %d


assistant: ```c
void table(int n) {
  int i;
  for (i = 1; i <= n; i++) {
    printf("\t%d x %d = %d\n", i, n, i * n);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<table>:
  endbr64
  test   %edi,%edi
  jle    L1
  push   %r13
  lea    D2(%rip),%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L6:
  mov    %r12d,%ecx
  mov    %ebx,%esi
  mov    %ebp,%edx
  mov    %r13,%rdi
  call   <printf@plt>
  add    $0x1,%ebx
  add    %ebp,%r12d
  cmp    %ebx,%ebp
  jge    L6
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L1:
  ret
```

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

tool: D2: 	%d x %d = %d


assistant: ```c
void table(int n) {
  int i;
  for (i = 1; i <= n; i++) {
    printf("\t%d x %d = %d\n", i, n, i * n);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<r_open>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %esi,-0xcc(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L3
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L3:
  mov    -0xcc(%rbp),%edx
  mov    -0xb8(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <va_start@plt>
  nop
L22:
  mov    -0xb8(%rbp),%edx
  mov    -0xcc(%rbp),%ecx
  mov    -0xc8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0xb4(%rbp)
  cmpl   $0xffffffff,-0xb4(%rbp)
  jne    L1
  mov    D3(%rip),%rax
  mov    (%rax),%rdx
  mov    D18(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L22
L1:
  mov    -0xb8(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0xb4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int r_open(char *path, int oflag, ...) {
  va_list ap;
  int retval;
  va_start(ap, oflag);
  while ((retval = open(path, oflag, ap)) == -1 && errno == EINTR)
    ;
  va_end(ap);
  return retval;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<r_open>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %esi,%ebp
  mov    $0x0,%edx
  mov    %edx,%edi
  call   <va_start@plt>
L18:
  mov    $0x0,%edx
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <open@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  jne    L13
  mov    D14(%rip),%rdx
  mov    D16(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L18
L13:
  mov    $0x0,%edx
  mov    %edx,%edi
  call   <va_end@plt>
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int r_open(char *path, int oflag, ...) {
  va_list ap;
  int retval;
  va_start(ap, oflag);
  while ((retval = open(path, oflag, ap)) == -1 && errno == EINTR)
    ;
  va_end(ap);
  return retval;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<r_open>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %esi,%ebx
  call   <va_start@plt>
  jmp    L6
  cs nopw 0x0(%rax,%rax,1)
L27:
  mov    D6(%rip),%rax
  mov    D0(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L4
L6:
  xor    %edx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <open@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L27
L4:
  xor    %edi,%edi
  call   <va_end@plt>
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int r_open(char *path, int oflag, ...) {
  va_list ap;
  int retval;
  va_start(ap, oflag);
  while ((retval = open(path, oflag, ap)) == -1 && errno == EINTR)
    ;
  va_end(ap);
  return retval;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<r_open>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %esi,%ebx
  call   <va_start@plt>
  jmp    L2
  cs nopw 0x0(%rax,%rax,1)
L0:
  mov    D13(%rip),%rax
  mov    D7(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L7
L2:
  xor    %edx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <open@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L0
L7:
  xor    %edi,%edi
  call   <va_end@plt>
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int r_open(char *path, int oflag, ...) {
  va_list ap;
  int retval;
  va_start(ap, oflag);
  while ((retval = open(path, oflag, ap)) == -1 && errno == EINTR)
    ;
  va_end(ap);
  return retval;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<findv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %rdx,-0x18(%rbp)
  jmp    L14
L18:
  mov    -0x8(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <findin@plt>
  subl   $0x1,-0xc(%rbp)
L14:
  cmpl   $0x0,-0xc(%rbp)
  jg     L18
  nop
  leave
  ret
```

assistant: ```c
findv(dirv, dirc, cp) char **dirv;
int dirc;
char *cp;
{
  while (dirc > 0)
    findin(*dirv++, cp), dirc--;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<findv>:
  endbr64
  test   %esi,%esi
  jle    L2
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rdx,%rbp
  mov    %esi,%esi
  lea    (%rdi,%rsi,8),%r12
L18:
  add    $0x8,%rbx
  mov    -0x8(%rbx),%rdi
  mov    %rbp,%rsi
  mov    $0x0,%eax
  call   <findin@plt>
  cmp    %r12,%rbx
  jne    L18
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L2:
  ret
```

assistant: ```c
findv(dirv, dirc, cp) char **dirv;
int dirc;
char *cp;
{
  while (dirc > 0)
    findin(*dirv++, cp), dirc--;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<findv>:
  endbr64
  test   %esi,%esi
  jle    L9
  movslq %esi,%rsi
  push   %r12
  lea    (%rdi,%rsi,8),%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  nopl   0x0(%rax)
L7:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  xor    %eax,%eax
  mov    %rbp,%rsi
  call   <findin@plt>
  cmp    %r12,%rbx
  jne    L7
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L9:
  ret
```

assistant: ```c
findv(dirv, dirc, cp) char **dirv;
int dirc;
char *cp;
{
  while (dirc > 0)
    findin(*dirv++, cp), dirc--;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<findv>:
  endbr64
  test   %esi,%esi
  jle    L4
  movslq %esi,%rsi
  push   %r12
  lea    (%rdi,%rsi,8),%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  nopl   0x0(%rax)
L1:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  xor    %eax,%eax
  mov    %rbp,%rsi
  call   <findin@plt>
  cmp    %r12,%rbx
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L4:
  ret
```

assistant: ```c
findv(dirv, dirc, cp) char **dirv;
int dirc;
char *cp;
{
  while (dirc > 0)
    findin(*dirv++, cp), dirc--;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<print_help>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: tag: D24
type: string
name: read_data
arguments: tag: D0
type: string
name: read_data
arguments: tag: D35
type: string
name: read_data
arguments: tag: D19
type: string

tool: D24: Usage: cpu_speed [SPEED]


tool: D0: SPEED should be a multiple of 3 between 45 and 81 inclusively.


tool: D35: The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.


tool: D19: To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.


assistant: ```c
void print_help() {
  printf("Usage: cpu_speed [SPEED]\n");
  printf("SPEED should be a multiple of 3 between 45 and 81 inclusively.\n");
  printf("The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.\n");
  printf("To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.\n");
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<print_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D22(%rip),%rdi
  call   <printf@plt>
  lea    D37(%rip),%rdi
  call   <printf@plt>
  lea    D17(%rip),%rdi
  call   <printf@plt>
  lea    D28(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: data_label: D22
type: string
name: parse_data
arguments: data_label: D37
type: string
name: parse_data
arguments: data_label: D17
type: string
name: parse_data
arguments: data_label: D28
type: string

tool: D22: Usage: cpu_speed [SPEED]


tool: D37: SPEED should be a multiple of 3 between 45 and 81 inclusively.


tool: D17: The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.


tool: D28: To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.


assistant: ```c
void print_help() {
  printf("Usage: cpu_speed [SPEED]\n");
  printf("SPEED should be a multiple of 3 between 45 and 81 inclusively.\n");
  printf("The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.\n");
  printf("To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.\n");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<print_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D13(%rip),%rdi
  call   <printf@plt>
  lea    D7(%rip),%rdi
  call   <printf@plt>
  lea    D34(%rip),%rdi
  call   <printf@plt>
  lea    D11(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: unpack_data
arguments: label: D13
type_guessed: string
name: unpack_data
arguments: label: D7
type_guessed: string
name: unpack_data
arguments: label: D34
type_guessed: string
name: unpack_data
arguments: label: D11
type_guessed: string

tool: D13: Usage: cpu_speed [SPEED]


tool: D7: SPEED should be a multiple of 3 between 45 and 81 inclusively.


tool: D34: The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.


tool: D11: To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.


assistant: ```c
void print_help() {
  printf("Usage: cpu_speed [SPEED]\n");
  printf("SPEED should be a multiple of 3 between 45 and 81 inclusively.\n");
  printf("The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.\n");
  printf("To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.\n");
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<print_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D32(%rip),%rdi
  call   <printf@plt>
  lea    D10(%rip),%rdi
  call   <printf@plt>
  lea    D30(%rip),%rdi
  call   <printf@plt>
  lea    D35(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D32
datatype: string
name: disassemble_data
arguments: tag: D10
datatype: string
name: disassemble_data
arguments: tag: D30
datatype: string
name: disassemble_data
arguments: tag: D35
datatype: string

tool: D32: Usage: cpu_speed [SPEED]


tool: D10: SPEED should be a multiple of 3 between 45 and 81 inclusively.


tool: D30: The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.


tool: D35: To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.


assistant: ```c
void print_help() {
  printf("Usage: cpu_speed [SPEED]\n");
  printf("SPEED should be a multiple of 3 between 45 and 81 inclusively.\n");
  printf("The Apple OS default is 66MHz, ZeroSlackr's default is 75MHz.\n");
  printf("To prevent your iPod from overheating, avoid extended usage at 78MHz or higher.\n");
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<_ts_lmatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  test   %eax,%eax
  je     L65
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <_ts_lmatch>
  jmp    L103
L65:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  test   %eax,%eax
  je     L138
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <_ts_lmatch>
  jmp    L103
L138:
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jne    L118
  mov    $0x1,%eax
  jmp    L103
L118:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L133
  mov    $0x0,%eax
  jmp    L103
L133:
  movl   $0x1,-0x4(%rbp)
  jmp    L111
L8:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x4(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L106
  mov    $0x0,%eax
  jmp    L103
L106:
  addl   $0x1,-0x4(%rbp)
L111:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x4(%rbp)
  jle    L8
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0x1,%rax
  add    %rax,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0x1,%rax
  add    %rax,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L104
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L104
  mov    $0x1,%eax
  jmp    L103
L104:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <_ts_lmatch>
L103:
  leave
  ret
```

assistant: ```c
int _ts_lmatch(unsigned char *a, unsigned char *l1, unsigned char *l2) {
  int len;
  if (*l1 & 0xc0)
    return _ts_lmatch(a, a + _ts_ljump(l1), l2);
  if (*l2 & 0xc0)
    return _ts_lmatch(a, l1, a + _ts_ljump(l2));
  if (l1 == l2)
    return 1;
  if (*l1 != *l2)
    return 0;
  for (len = 1; len <= *l1; len++)
    if (l1[len] != l2[len])
      return 0;
  l1 += *l1 + 1;
  l2 += *l2 + 1;
  if (*l1 == 0 && *l2 == 0)
    return 1;
  return _ts_lmatch(a, l1, l2);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_ts_lmatch>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %rdx,%rbp
  movzbl (%rsi),%edx
  test   $0xc0,%dl
  jne    L40
  movzbl 0x0(%rbp),%esi
  test   $0xc0,%sil
  jne    L41
  cmp    %rbp,%rbx
  je     L66
  mov    $0x0,%eax
  cmp    %sil,%dl
  jne    L69
  movzbl %dl,%ecx
  test   %ecx,%ecx
  jle    L18
  mov    $0x1,%eax
L105:
  movzbl 0x0(%rbp,%rax,1),%edi
  cmp    %dil,(%rbx,%rax,1)
  jne    L83
  add    $0x1,%rax
  cmp    %eax,%ecx
  jge    L105
L18:
  movzbl %dl,%edx
  lea    0x1(%rbx,%rdx,1),%rcx
  movzbl %sil,%esi
  lea    0x1(%rbp,%rsi,1),%rdx
  cmpb   $0x0,(%rcx)
  jne    L81
  mov    $0x1,%eax
  cmpb   $0x0,(%rdx)
  je     L69
L81:
  mov    %rcx,%rsi
  mov    %r12,%rdi
  call   <_ts_lmatch>
  jmp    L69
L40:
  mov    %rsi,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%rsi
  add    %r12,%rsi
  mov    %rbp,%rdx
  mov    %r12,%rdi
  call   <_ts_lmatch>
L69:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L41:
  mov    %rbp,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%rdx
  add    %r12,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <_ts_lmatch>
  jmp    L69
L66:
  mov    $0x1,%eax
  jmp    L69
L83:
  mov    $0x0,%eax
  jmp    L69
```

assistant: ```c
int _ts_lmatch(unsigned char *a, unsigned char *l1, unsigned char *l2) {
  int len;
  if (*l1 & 0xc0)
    return _ts_lmatch(a, a + _ts_ljump(l1), l2);
  if (*l2 & 0xc0)
    return _ts_lmatch(a, l1, a + _ts_ljump(l2));
  if (l1 == l2)
    return 1;
  if (*l1 != *l2)
    return 0;
  for (len = 1; len <= *l1; len++)
    if (l1[len] != l2[len])
      return 0;
  l1 += *l1 + 1;
  l2 += *l2 + 1;
  if (*l1 == 0 && *l2 == 0)
    return 1;
  return _ts_lmatch(a, l1, l2);
}
```
user: Translate the below assembly code into C programming language:

```asm
<_ts_lmatch>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
L92:
  movzbl 0x0(%rbp),%edx
  test   $0xc0,%dl
  jne    L118
  movzbl (%r12),%esi
  test   $0xc0,%sil
  jne    L65
  cmp    %r12,%rbp
  je     L88
  cmp    %sil,%dl
  jne    L38
  movzbl %dl,%ecx
  test   %dl,%dl
  je     L94
  mov    $0x1,%eax
  jmp    L93
  nopl   (%rax)
L25:
  add    $0x1,%rax
  cmp    %eax,%ecx
  jl     L94
L93:
  movzbl (%r12,%rax,1),%edi
  cmp    %dil,0x0(%rbp,%rax,1)
  je     L25
L38:
  xor    %eax,%eax
L53:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L118:
  mov    %rbp,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%rbp
  add    %rbx,%rbp
  jmp    L92
L65:
  mov    %r12,%rdi
  call   <_ts_ljump@plt>
  movslq %eax,%r12
  add    %rbx,%r12
  jmp    L92
L94:
  add    $0x1,%edx
  add    $0x1,%esi
  movzbl %dl,%edx
  movzbl %sil,%esi
  add    %rdx,%rbp
  add    %rsi,%r12
  cmpb   $0x0,0x0(%rbp)
  jne    L92
  cmpb   $0x0,(%r12)
  jne    L92
L88:
  mov    $0x1,%eax
  jmp    L53
```

assistant: ```c
int _ts_lmatch(unsigned char *a, unsigned char *l1, unsigned char *l2) {
  int len;
  if (*l1 & 0xc0)
    return _ts_lmatch(a, a + _ts_ljump(l1), l2);
  if (*l2 & 0xc0)
    return _ts_lmatch(a, l1, a + _ts_ljump(l2));
  if (l1 == l2)
    return 1;
  if (*l1 != *l2)
    return 0;
  for (len = 1; len <= *l1; len++)
    if (l1[len] != l2[len])
      return 0;
  l1 += *l1 + 1;
  l2 += *l2 + 1;
  if (*l1 == 0 && *l2 == 0)
    return 1;
  return _ts_lmatch(a, l1, l2);
}
```