ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<re_match>:
  endbr64
  sub    $0x8,%rsp
  mov    %ecx,%r9d
  xor    %eax,%eax
  mov    %rsi,%rcx
  push   %rdx
  xor    %esi,%esi
  push   %r8
  mov    %edx,%r8d
  xor    %edx,%edx
  call   <re_match_2_internal@plt>
  add    $0x18,%rsp
  ret
```

assistant: ```c
int re_match(bufp, string, size, pos, regs)
struct re_pattern_buffer *bufp;
const char *string;
int size, pos;
struct re_registers *regs;
{
  int result = re_match_2_internal(bufp, (void *)0, 0, string, size, pos, regs, size);
  __builtin_alloca(0);
  return result;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x6c6c6568,-0xe(%rbp)
  movw   $0x6f,-0xa(%rbp)
  movzbl -0xe(%rbp),%eax
  movsbl %al,%edx
  lea    -0xe(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x18(%rbp)
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  ret
```

assistant: ```c
int main(void) {
  const char p[] = "hello";
  char *q = strchr(p, p[0]);
  q[0];
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x6c6c6568,0x2(%rsp)
  movw   $0x6f,0x6(%rsp)
  lea    0x2(%rsp),%rdi
  mov    $0x68,%esi
  call   <strchr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  mov    $0x0,%eax
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  const char p[] = "hello";
  char *q = strchr(p, p[0]);
  q[0];
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x68,%esi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x2(%rsp),%rdi
  mov    $0x6f,%eax
  movl   $0x6c6c6568,0x2(%rsp)
  mov    %ax,0x6(%rsp)
  call   <strchr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  const char p[] = "hello";
  char *q = strchr(p, p[0]);
  q[0];
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x68,%esi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x2(%rsp),%rdi
  mov    $0x6f,%eax
  movl   $0x6c6c6568,0x2(%rsp)
  mov    %ax,0x6(%rsp)
  call   <strchr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(void) {
  const char p[] = "hello";
  char *q = strchr(p, p[0]);
  q[0];
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<K>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x13,-0x4(%rbp)
  jg     L11
  mov    $0x5a827999,%eax
  jmp    L35
L11:
  cmpl   $0x27,-0x4(%rbp)
  jg     L45
  mov    $0x6ed9eba1,%eax
  jmp    L35
L45:
  cmpl   $0x3b,-0x4(%rbp)
  jg     L39
  mov    $0x8f1bbcdc,%eax
  jmp    L35
L39:
  mov    $0xca62c1d6,%eax
L35:
  pop    %rbp
  ret
```

assistant: ```c
unsigned int K(int t) {
  if (t < 20)
    return 0x5A827999;
  else if (t < 40)
    return 0x6ED9EBA1;
  else if (t < 60)
    return 0x8F1BBCDC;
  return 0xCA62C1D6;
}
```
user: Translate the below assembly code into C programming language:

```asm
<K>:
  endbr64
  mov    $0x5a827999,%eax
  cmp    $0x13,%edi
  jle    L4
  mov    $0x6ed9eba1,%eax
  cmp    $0x27,%edi
  jle    L4
  cmp    $0x3b,%edi
  mov    $0xca62c1d6,%eax
  mov    $0x8f1bbcdc,%edx
  cmovle %edx,%eax
L4:
  ret
```

assistant: ```c
unsigned int K(int t) {
  if (t < 20)
    return 0x5A827999;
  else if (t < 40)
    return 0x6ED9EBA1;
  else if (t < 60)
    return 0x8F1BBCDC;
  return 0xCA62C1D6;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<K>:
  endbr64
  mov    $0x5a827999,%eax
  cmp    $0x13,%edi
  jle    L3
  mov    $0x6ed9eba1,%eax
  cmp    $0x27,%edi
  jle    L3
  cmp    $0x3b,%edi
  mov    $0xca62c1d6,%eax
  mov    $0x8f1bbcdc,%edx
  cmovle %edx,%eax
L3:
  ret
```

assistant: ```c
unsigned int K(int t) {
  if (t < 20)
    return 0x5A827999;
  else if (t < 40)
    return 0x6ED9EBA1;
  else if (t < 60)
    return 0x8F1BBCDC;
  return 0xCA62C1D6;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<K>:
  endbr64
  mov    $0x5a827999,%eax
  cmp    $0x13,%edi
  jle    L7
  mov    $0x6ed9eba1,%eax
  cmp    $0x27,%edi
  jle    L7
  cmp    $0x3b,%edi
  mov    $0xca62c1d6,%eax
  mov    $0x8f1bbcdc,%edx
  cmovle %edx,%eax
L7:
  ret
```

assistant: ```c
unsigned int K(int t) {
  if (t < 20)
    return 0x5A827999;
  else if (t < 40)
    return 0x6ED9EBA1;
  else if (t < 60)
    return 0x8F1BBCDC;
  return 0xCA62C1D6;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<rightrot>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  call   <wordlength@plt>
  sub    -0x18(%rbp),%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%ecx
  shrl   %cl,-0x14(%rbp)
  mov    -0x4(%rbp),%eax
  or     %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  leave
  ret
```

assistant: ```c
unsigned rightrot(unsigned x, int n) {
  int wordlength(void);
  unsigned rbit;
  rbit = x << (wordlength() - n);
  x = x >> n;
  x = x | rbit;
  return x;
}
```
user: What is the c source code of the assembly code below?

```asm
<rightrot>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  call   <wordlength@plt>
  sub    %ebp,%eax
  mov    %eax,%ecx
  mov    %ebx,%eax
  shl    %cl,%eax
  mov    %ebp,%ecx
  shr    %cl,%ebx
  or     %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned rightrot(unsigned x, int n) {
  int wordlength(void);
  unsigned rbit;
  rbit = x << (wordlength() - n);
  x = x >> n;
  x = x | rbit;
  return x;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<rightrot>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  call   <wordlength@plt>
  add    $0x8,%rsp
  sub    %ebp,%eax
  mov    %eax,%ecx
  mov    %ebx,%eax
  shl    %cl,%eax
  mov    %ebp,%ecx
  shr    %cl,%ebx
  or     %ebx,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned rightrot(unsigned x, int n) {
  int wordlength(void);
  unsigned rbit;
  rbit = x << (wordlength() - n);
  x = x >> n;
  x = x | rbit;
  return x;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rightrot>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  call   <wordlength@plt>
  add    $0x8,%rsp
  sub    %ebp,%eax
  mov    %eax,%ecx
  mov    %ebx,%eax
  shl    %cl,%eax
  mov    %ebp,%ecx
  shr    %cl,%ebx
  or     %ebx,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned rightrot(unsigned x, int n) {
  int wordlength(void);
  unsigned rbit;
  rbit = x << (wordlength() - n);
  x = x >> n;
  x = x | rbit;
  return x;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<lenmax>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jl     L4
  mov    -0x4(%rbp),%eax
  jmp    L15
L4:
  mov    -0x8(%rbp),%eax
L15:
  pop    %rbp
  ret
```

assistant: ```c
int lenmax(int len1, int len2) {
  if (len1 >= len2)
    return len1;
  else
    return len2;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<lenmax>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int lenmax(int len1, int len2) {
  if (len1 >= len2)
    return len1;
  else
    return len2;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<lenmax>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int lenmax(int len1, int len2) {
  if (len1 >= len2)
    return len1;
  else
    return len2;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<lenmax>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int lenmax(int len1, int len2) {
  if (len1 >= len2)
    return len1;
  else
    return len2;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x12ff78,-0x20(%rbp)
  movb   $0x80,-0x21(%rbp)
  movsbl -0x21(%rbp),%eax
  mov    %eax,%esi
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0x12(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x4,%esi
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D39
datatype: string
name: parse_data
arguments: label: D29
datatype: string
name: parse_data
arguments: label: D33
datatype: string
name: parse_data
arguments: label: D21
datatype: string
name: parse_data
arguments: label: D10
datatype: string

tool: D39: c=%d


tool: D29: %d


tool: D33: sizeof(int) = %d


tool: D21: sizeof(long) = %d


tool: D10: sizeof(*) = %d


assistant: ```c
int main() {
  unsigned long a = 1245048;
  char c = 128;
  printf("c=%d\n", c);
  char aa[10];
  printf("%d\n", strlen(aa));
  printf("sizeof(int) = %d\n", sizeof(int));
  printf("sizeof(long) = %d\n", sizeof(long));
  printf("sizeof(*) = %d\n", sizeof(void *));
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0xffffff80,%esi
  lea    D12(%rip),%rdi
  call   <printf@plt>
  lea    0xe(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%esi
  lea    D14(%rip),%rdi
  call   <printf@plt>
  mov    $0x4,%esi
  lea    D39(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  mov    $0x0,%eax
  add    $0x28,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D12
data_type: string
name: parse_data
arguments: label: D14
data_type: string
name: parse_data
arguments: label: D39
data_type: string
name: parse_data
arguments: label: D38
data_type: string
name: parse_data
arguments: label: D8
data_type: string

tool: D12: c=%d


tool: D14: %d


tool: D39: sizeof(int) = %d


tool: D38: sizeof(long) = %d


tool: D8: sizeof(*) = %d


assistant: ```c
int main() {
  unsigned long a = 1245048;
  char c = 128;
  printf("c=%d\n", c);
  char aa[10];
  printf("%d\n", strlen(aa));
  printf("sizeof(int) = %d\n", sizeof(int));
  printf("sizeof(long) = %d\n", sizeof(long));
  printf("sizeof(*) = %d\n", sizeof(void *));
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    $0xffffff80,%esi
  lea    D38(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0xe(%rsp),%rdi
  call   <strlen@plt>
  lea    D43(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  mov    $0x4,%esi
  lea    D11(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D3(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D38
datatype: string
name: disassemble_data
arguments: data_label: D43
datatype: string
name: disassemble_data
arguments: data_label: D11
datatype: string
name: disassemble_data
arguments: data_label: D3
datatype: string
name: disassemble_data
arguments: data_label: D4
datatype: string

tool: D38: c=%d


tool: D43: %d


tool: D11: sizeof(int) = %d


tool: D3: sizeof(long) = %d


tool: D4: sizeof(*) = %d


assistant: ```c
int main() {
  unsigned long a = 1245048;
  char c = 128;
  printf("c=%d\n", c);
  char aa[10];
  printf("%d\n", strlen(aa));
  printf("sizeof(int) = %d\n", sizeof(int));
  printf("sizeof(long) = %d\n", sizeof(long));
  printf("sizeof(*) = %d\n", sizeof(void *));
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    $0xffffff80,%esi
  lea    D23(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0xe(%rsp),%rdi
  call   <strlen@plt>
  lea    D26(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  mov    $0x4,%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D15(%rip),%rdi
  call   <printf@plt>
  mov    $0x8,%esi
  lea    D43(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D23
type_infered: string
name: retrieve_data
arguments: label: D26
type_infered: string
name: retrieve_data
arguments: label: D5
type_infered: string
name: retrieve_data
arguments: label: D15
type_infered: string
name: retrieve_data
arguments: label: D43
type_infered: string

tool: D23: c=%d


tool: D26: %d


tool: D5: sizeof(int) = %d


tool: D15: sizeof(long) = %d


tool: D43: sizeof(*) = %d


assistant: ```c
int main() {
  unsigned long a = 1245048;
  char c = 128;
  printf("c=%d\n", c);
  char aa[10];
  printf("%d\n", strlen(aa));
  printf("sizeof(int) = %d\n", sizeof(int));
  printf("sizeof(long) = %d\n", sizeof(long));
  printf("sizeof(*) = %d\n", sizeof(void *));
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<qsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jge    L22
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L40
L4:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  test   %eax,%eax
  jns    L29
  addl   $0x1,-0x4(%rbp)
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
L29:
  mov    -0x4(%rbp),%edx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x4(%rbp),%eax
  lea    -0x1(%rax),%edi
  mov    -0x28(%rbp),%rdx
  mov    -0x1c(%rbp),%esi
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rcx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <qsort>
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <qsort>
  addl   $0x1,-0x8(%rbp)
L40:
  mov    -0x8(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jle    L4
  jmp    L3
L22:
  nop
L3:
  leave
  ret
```

assistant: ```c
void qsort(void *v[], int left, int right, int (*comp)(void *, void *)) {
  int i = 0;
  int last = 0;
  if (left >= right)
    return;
  swap(v, left, (left + right) / 2);
  last = left;
  for (i = left + 1; i <= right; i++) {
    if (((*comp)(v[i], v[left])) < 0)
      swap(v, ++last, i);
    swap(v, left, last);
    qsort(v, left, last - 1, comp);
    qsort(v, last + 1, right, comp);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<qsort>:
  endbr64
  cmp    %edx,%esi
  jl     L9
  ret
L9:
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r12d
  mov    %edx,%r13d
  mov    %rcx,%r14
  lea    (%rsi,%rdx,1),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  sar    %edx
  call   <swap@plt>
  lea    0x1(%r12),%ebp
  cmp    %ebp,%r13d
  jl     L35
  movslq %r12d,%rax
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x8(%rsp)
  movslq %ebp,%rbp
  mov    %r12d,%r15d
  jmp    L41
L21:
  mov    %r15d,%edx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <swap@plt>
  lea    -0x1(%r15),%edx
  mov    %r14,%rcx
  mov    %r12d,%esi
  mov    %rbx,%rdi
  call   <qsort>
  lea    0x1(%r15),%esi
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %rbx,%rdi
  call   <qsort>
  add    $0x1,%rbp
  cmp    %ebp,%r13d
  jl     L35
L41:
  mov    %ebp,0x4(%rsp)
  mov    (%rbx,%rbp,8),%rdi
  mov    0x8(%rsp),%rax
  mov    (%rax),%rsi
  call   *%r14
  test   %eax,%eax
  jns    L21
  add    $0x1,%r15d
  mov    0x4(%rsp),%edx
  mov    %r15d,%esi
  mov    %rbx,%rdi
  call   <swap@plt>
  jmp    L21
L35:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void qsort(void *v[], int left, int right, int (*comp)(void *, void *)) {
  int i = 0;
  int last = 0;
  if (left >= right)
    return;
  swap(v, left, (left + right) / 2);
  last = left;
  for (i = left + 1; i <= right; i++) {
    if (((*comp)(v[i], v[left])) < 0)
      swap(v, ++last, i);
    swap(v, left, last);
    qsort(v, left, last - 1, comp);
    qsort(v, last + 1, right, comp);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<qsort>:
  endbr64
  cmp    %edx,%esi
  jl     L23
  ret
  nopl   0x0(%rax)
L23:
  lea    (%rsi,%rdx,1),%eax
  push   %r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edx,%r12d
  mov    %eax,%edx
  push   %rbp
  shr    $0x1f,%edx
  mov    %esi,%ebp
  push   %rbx
  add    %eax,%edx
  lea    0x1(%rbp),%r14d
  mov    %rdi,%rbx
  sar    %edx
  sub    $0x18,%rsp
  call   <swap@plt>
  cmp    %r14d,%r12d
  jl     L45
  movslq %ebp,%rax
  mov    %ebp,(%rsp)
  movslq %r14d,%r15
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x8(%rsp)
L21:
  mov    0x8(%rsp),%rax
  mov    (%rbx,%r15,8),%rdi
  mov    %r15d,0x4(%rsp)
  mov    (%rax),%rsi
  call   *%r13
  test   %eax,%eax
  js     L39
  mov    (%rsp),%eax
  lea    -0x1(%rax),%r9d
L25:
  mov    (%rsp),%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  mov    %r9d,0x4(%rsp)
  add    $0x1,%r15
  call   <swap@plt>
  mov    0x4(%rsp),%edx
  mov    %r13,%rcx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <qsort>
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %rbx,%rdi
  call   <qsort>
  cmp    %r15d,%r12d
  jge    L21
L45:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L39:
  mov    0x4(%rsp),%edx
  mov    %r14d,%esi
  mov    %rbx,%rdi
  call   <swap@plt>
  mov    (%rsp),%r9d
  mov    %r14d,(%rsp)
  add    $0x1,%r14d
  jmp    L25
```

assistant: ```c
void qsort(void *v[], int left, int right, int (*comp)(void *, void *)) {
  int i = 0;
  int last = 0;
  if (left >= right)
    return;
  swap(v, left, (left + right) / 2);
  last = left;
  for (i = left + 1; i <= right; i++) {
    if (((*comp)(v[i], v[left])) < 0)
      swap(v, ++last, i);
    swap(v, left, last);
    qsort(v, left, last - 1, comp);
    qsort(v, last + 1, right, comp);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<qsort>:
  endbr64
  cmp    %edx,%esi
  jl     L1
  ret
  nopl   0x0(%rax)
L1:
  lea    (%rsi,%rdx,1),%eax
  push   %r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edx,%r12d
  mov    %eax,%edx
  push   %rbp
  shr    $0x1f,%edx
  mov    %esi,%ebp
  push   %rbx
  add    %eax,%edx
  lea    0x1(%rbp),%r14d
  mov    %rdi,%rbx
  sar    %edx
  sub    $0x18,%rsp
  call   <swap@plt>
  cmp    %r14d,%r12d
  jl     L16
  movslq %ebp,%rax
  mov    %ebp,(%rsp)
  movslq %r14d,%r15
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x8(%rsp)
L58:
  mov    0x8(%rsp),%rax
  mov    (%rbx,%r15,8),%rdi
  mov    %r15d,0x4(%rsp)
  mov    (%rax),%rsi
  call   *%r13
  test   %eax,%eax
  js     L20
  mov    (%rsp),%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  add    $0x1,%r15
  call   <swap@plt>
  mov    (%rsp),%eax
  mov    %r13,%rcx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  lea    -0x1(%rax),%edx
  call   <qsort>
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %rbx,%rdi
  call   <qsort>
  cmp    %r15d,%r12d
  jge    L58
L16:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L20:
  mov    0x4(%rsp),%edx
  mov    %r14d,%esi
  mov    %rbx,%rdi
  add    $0x1,%r15
  call   <swap@plt>
  mov    %r14d,%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <swap@plt>
  mov    (%rsp),%edx
  mov    %r13,%rcx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <qsort>
  mov    (%rsp),%esi
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %rbx,%rdi
  add    $0x2,%esi
  call   <qsort>
  cmp    %r15d,%r12d
  jl     L16
  mov    %r14d,(%rsp)
  add    $0x1,%r14d
  jmp    L58
```

assistant: ```c
void qsort(void *v[], int left, int right, int (*comp)(void *, void *)) {
  int i = 0;
  int last = 0;
  if (left >= right)
    return;
  swap(v, left, (left + right) / 2);
  last = left;
  for (i = left + 1; i <= right; i++) {
    if (((*comp)(v[i], v[left])) < 0)
      swap(v, ++last, i);
    swap(v, left, last);
    qsort(v, left, last - 1, comp);
    qsort(v, last + 1, right, comp);
  }
}
```