ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<do_instruction>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%ebx
  mov    %rsi,%r12
  mov    %rdx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r12,(%rsp)
  mov    %rbp,0x8(%rsp)
  movl   $0x4,0x10(%rsp)
  mov    $0x1,%edi
  call   <SPI_IOC_MESSAGE@plt>
  mov    %eax,%esi
  mov    %r13,%rdx
  mov    %ebx,%edi
  call   <ioctl@plt>
  mov    $0x1,%edx
  cmp    $0x4,%eax
  je     L9
  test   %eax,%eax
  js     L17
  lea    D11(%rip),%rdi
  call   <print_err@plt>
  mov    $0x0,%edx
L9:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L38
  mov    %edx,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L17:
  lea    D10(%rip),%rdi
  call   <print_errno@plt>
  mov    $0x0,%edx
  jmp    L9
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D11
type: string
name: retrieve_data
arguments: label: D10
type: string

tool: D11: short response from SPI_IOC_MESSAGE

tool: D10: SPI_IOC_MESSAGE

assistant: ```c
int do_instruction(int fd, uint8_t tx[4], uint8_t rx[4]) {
  struct spi_ioc_transfer xfer;
  int res;
  memset(&xfer, 0, sizeof xfer);
  xfer.tx_buf = (uintptr_t)tx;
  xfer.rx_buf = (uintptr_t)rx;
  xfer.len = 4;
  res = ioctl(fd, SPI_IOC_MESSAGE(1), &xfer);
  if (res == 4)
    return 1;
  if (res < 0)
    print_errno("SPI_IOC_MESSAGE");
  else
    print_err("short response from SPI_IOC_MESSAGE");
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<do_instruction>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rdx,%rbx
  mov    $0x18,%edx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %r13,%rdi
  call   <memset@plt>
  mov    $0x1,%edi
  mov    %r12,(%rsp)
  mov    %rbx,0x8(%rsp)
  movl   $0x4,0x10(%rsp)
  call   <SPI_IOC_MESSAGE@plt>
  mov    %r13,%rdx
  mov    %ebp,%edi
  mov    %eax,%esi
  call   <ioctl@plt>
  mov    $0x1,%r8d
  cmp    $0x4,%eax
  je     L17
  test   %eax,%eax
  js     L33
  lea    D13(%rip),%rdi
  call   <print_err@plt>
  xor    %r8d,%r8d
L17:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x28,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L33:
  lea    D15(%rip),%rdi
  call   <print_errno@plt>
  xor    %r8d,%r8d
  jmp    L17
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D13
type: string
name: parse_data
arguments: tag: D15
type: string

tool: D13: short response from SPI_IOC_MESSAGE

tool: D15: SPI_IOC_MESSAGE

assistant: ```c
int do_instruction(int fd, uint8_t tx[4], uint8_t rx[4]) {
  struct spi_ioc_transfer xfer;
  int res;
  memset(&xfer, 0, sizeof xfer);
  xfer.tx_buf = (uintptr_t)tx;
  xfer.rx_buf = (uintptr_t)rx;
  xfer.len = 4;
  res = ioctl(fd, SPI_IOC_MESSAGE(1), &xfer);
  if (res == 4)
    return 1;
  if (res < 0)
    print_errno("SPI_IOC_MESSAGE");
  else
    print_err("short response from SPI_IOC_MESSAGE");
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<do_instruction>:
  endbr64
  push   %r12
  movq   %rdx,%xmm1
  movq   %rsi,%xmm0
  xor    %esi,%esi
  push   %rbp
  punpcklqdq %xmm1,%xmm0
  mov    $0x18,%edx
  mov    %edi,%ebp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  movaps %xmm0,(%rsp)
  mov    %r12,%rdi
  call   <memset@plt>
  movdqa (%rsp),%xmm0
  mov    $0x1,%edi
  movl   $0x4,0x20(%rsp)
  movaps %xmm0,0x10(%rsp)
  call   <SPI_IOC_MESSAGE@plt>
  mov    %r12,%rdx
  mov    %ebp,%edi
  mov    %eax,%esi
  call   <ioctl@plt>
  mov    $0x1,%r8d
  cmp    $0x4,%eax
  je     L28
  test   %eax,%eax
  js     L18
  lea    D5(%rip),%rdi
  call   <print_err@plt>
  xor    %r8d,%r8d
L28:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L12
  add    $0x38,%rsp
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L18:
  lea    D1(%rip),%rdi
  call   <print_errno@plt>
  xor    %r8d,%r8d
  jmp    L28
L12:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D5
type: string
name: unpack_data
arguments: tag: D1
type: string

tool: D5: short response from SPI_IOC_MESSAGE

tool: D1: SPI_IOC_MESSAGE

assistant: ```c
int do_instruction(int fd, uint8_t tx[4], uint8_t rx[4]) {
  struct spi_ioc_transfer xfer;
  int res;
  memset(&xfer, 0, sizeof xfer);
  xfer.tx_buf = (uintptr_t)tx;
  xfer.rx_buf = (uintptr_t)rx;
  xfer.len = 4;
  res = ioctl(fd, SPI_IOC_MESSAGE(1), &xfer);
  if (res == 4)
    return 1;
  if (res < 0)
    print_errno("SPI_IOC_MESSAGE");
  else
    print_err("short response from SPI_IOC_MESSAGE");
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<malloc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  addq   $0x8,-0x18(%rbp)
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  or     $0x20,%eax
  mov    %eax,%ecx
  mov    D15(%rip),%rax
  mov    (%rax),%edx
  mov    D27(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%r9d
  mov    $0xffffffff,%r8d
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <_mmap@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L1
  mov    $0x0,%eax
  jmp    L19
L1:
  mov    -0x8(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
L19:
  leave
  ret
```

assistant: ```c
void *malloc(size_t size) {
  size += sizeof(size_t);
  void *p = _mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | 0x20, -1, 0);
  if (p == 0)
    return 0;
  *(size_t *)p = size;
  return p + sizeof(size_t);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<malloc>:
  endbr64
  push   %rbx
  lea    0x8(%rdi),%rbx
  mov    D11(%rip),%rax
  mov    (%rax),%ecx
  or     $0x20,%ecx
  mov    D21(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  or     (%rax),%edx
  mov    $0x0,%r9d
  mov    $0xffffffff,%r8d
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <_mmap@plt>
  test   %rax,%rax
  je     L6
  mov    %rbx,(%rax)
  add    $0x8,%rax
L6:
  pop    %rbx
  ret
```

assistant: ```c
void *malloc(size_t size) {
  size += sizeof(size_t);
  void *p = _mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | 0x20, -1, 0);
  if (p == 0)
    return 0;
  *(size_t *)p = size;
  return p + sizeof(size_t);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<malloc>:
  endbr64
  mov    D17(%rip),%rax
  push   %rbx
  lea    0x8(%rdi),%rbx
  xor    %r9d,%r9d
  xor    %edi,%edi
  mov    $0xffffffff,%r8d
  mov    %rbx,%rsi
  mov    (%rax),%ecx
  mov    D2(%rip),%rax
  mov    (%rax),%edx
  mov    D24(%rip),%rax
  or     $0x20,%ecx
  or     (%rax),%edx
  call   <_mmap@plt>
  test   %rax,%rax
  je     L4
  mov    %rbx,(%rax)
  add    $0x8,%rax
L4:
  pop    %rbx
  ret
```

assistant: ```c
void *malloc(size_t size) {
  size += sizeof(size_t);
  void *p = _mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | 0x20, -1, 0);
  if (p == 0)
    return 0;
  *(size_t *)p = size;
  return p + sizeof(size_t);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<malloc>:
  endbr64
  mov    D10(%rip),%rax
  push   %rbx
  lea    0x8(%rdi),%rbx
  xor    %r9d,%r9d
  xor    %edi,%edi
  mov    $0xffffffff,%r8d
  mov    %rbx,%rsi
  mov    (%rax),%ecx
  mov    D29(%rip),%rax
  mov    (%rax),%edx
  mov    D24(%rip),%rax
  or     $0x20,%ecx
  or     (%rax),%edx
  call   <_mmap@plt>
  test   %rax,%rax
  je     L8
  mov    %rbx,(%rax)
  add    $0x8,%rax
L8:
  pop    %rbx
  ret
```

assistant: ```c
void *malloc(size_t size) {
  size += sizeof(size_t);
  void *p = _mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | 0x20, -1, 0);
  if (p == 0)
    return 0;
  *(size_t *)p = size;
  return p + sizeof(size_t);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D3(%rip),%rax
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x20(%rbp)
  movabs $0x7663787a66647361,%rax
  mov    %rax,-0x12(%rbp)
  movw   $0x2121,-0xa(%rbp)
  mov    -0x20(%rbp),%rdx
  lea    -0x12(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0xa,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L3
  call   <__stack_chk_fail@plt>
L3:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D3
type_guessed: string
name: unpack_data
arguments: data_label: D14
type_guessed: string

tool: D3: wb

tool: D14: C:\Users\marcoc\Desktop\test.txt

assistant: ```c
int main() {
  FILE *fp;
  fp = fopen("C:\\Users\\marcoc\\Desktop\\test.txt", "wb");
  char x[10] = "asdfzxcv!!";
  fwrite(x, sizeof(x[0]), sizeof(x) / sizeof(x[0]), fp);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D2(%rip),%rsi
  lea    D7(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rcx
  movabs $0x7663787a66647361,%rax
  mov    %rax,0xe(%rsp)
  movw   $0x2121,0x16(%rsp)
  lea    0xe(%rsp),%rdi
  mov    $0xa,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  mov    $0x0,%eax
  add    $0x28,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D2
type_infered: string
name: retrieve_data
arguments: data_tag: D7
type_infered: string

tool: D2: wb

tool: D7: C:\Users\marcoc\Desktop\test.txt

assistant: ```c
int main() {
  FILE *fp;
  fp = fopen("C:\\Users\\marcoc\\Desktop\\test.txt", "wb");
  char x[10] = "asdfzxcv!!";
  fwrite(x, sizeof(x[0]), sizeof(x) / sizeof(x[0]), fp);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  lea    D1(%rip),%rsi
  lea    D6(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    0xe(%rsp),%rdi
  mov    $0xa,%edx
  mov    $0x1,%esi
  mov    %rax,%rcx
  movabs $0x7663787a66647361,%rax
  mov    %rax,0xe(%rsp)
  mov    $0x2121,%eax
  mov    %ax,0x16(%rsp)
  call   <fwrite@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D1
type_guessed: string
name: parse_data
arguments: label: D6
type_guessed: string

tool: D1: wb

tool: D6: C:\Users\marcoc\Desktop\test.txt

assistant: ```c
int main() {
  FILE *fp;
  fp = fopen("C:\\Users\\marcoc\\Desktop\\test.txt", "wb");
  char x[10] = "asdfzxcv!!";
  fwrite(x, sizeof(x[0]), sizeof(x) / sizeof(x[0]), fp);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  lea    D14(%rip),%rsi
  lea    D3(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  lea    0xe(%rsp),%rdi
  mov    $0xa,%edx
  mov    $0x1,%esi
  mov    %rax,%rcx
  movabs $0x7663787a66647361,%rax
  mov    %rax,0xe(%rsp)
  mov    $0x2121,%eax
  mov    %ax,0x16(%rsp)
  call   <fwrite@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D14
type_guessed: string
name: read_data
arguments: data_tag: D3
type_guessed: string

tool: D14: wb

tool: D3: C:\Users\marcoc\Desktop\test.txt

assistant: ```c
int main() {
  FILE *fp;
  fp = fopen("C:\\Users\\marcoc\\Desktop\\test.txt", "wb");
  char x[10] = "asdfzxcv!!";
  fwrite(x, sizeof(x[0]), sizeof(x) / sizeof(x[0]), fp);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<tosFile_write1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x18(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <tosError_setContext@plt>
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x24(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  je     L1
  cmpl   $0x0,-0x4(%rbp)
  js     L1
  mov    $0xffffffff,%eax
  jmp    L21
L1:
  mov    -0x4(%rbp),%eax
L21:
  leave
  ret
```

assistant: ```c
int tosFile_write1(int fd, const void *pBuffer, int start, int n) {
  int result;
  tosError_setContext(0, 0);
  ;
  result = write(fd, ((const char *)pBuffer) + start, n);
  if (result != n && result >= 0) {
    return -1;
  }
  return result;
}
```
user: What is the c source code of the assembly code below:

```asm
<tosFile_write1>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r13d
  mov    %rsi,%rbx
  mov    %edx,%ebp
  mov    %ecx,%r12d
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <tosError_setContext@plt>
  movslq %ebp,%rbp
  lea    (%rbx,%rbp,1),%rsi
  mov    %r12d,%edx
  mov    %r13d,%edi
  call   <write@plt>
  cmp    %eax,%r12d
  je     L9
  test   %eax,%eax
  mov    $0xffffffff,%edx
  cmovns %edx,%eax
L9:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int tosFile_write1(int fd, const void *pBuffer, int start, int n) {
  int result;
  tosError_setContext(0, 0);
  ;
  result = write(fd, ((const char *)pBuffer) + start, n);
  if (result != n && result >= 0) {
    return -1;
  }
  return result;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<tosFile_write1>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  xor    %edi,%edi
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  movslq %edx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  xor    %esi,%esi
  sub    $0x8,%rsp
  call   <tosError_setContext@plt>
  lea    (%rbx,%rbp,1),%rsi
  mov    %r12d,%edx
  mov    %r13d,%edi
  call   <write@plt>
  cmp    %eax,%r12d
  je     L1
  test   %eax,%eax
  mov    $0xffffffff,%edx
  cmovns %edx,%eax
L1:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int tosFile_write1(int fd, const void *pBuffer, int start, int n) {
  int result;
  tosError_setContext(0, 0);
  ;
  result = write(fd, ((const char *)pBuffer) + start, n);
  if (result != n && result >= 0) {
    return -1;
  }
  return result;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<tosFile_write1>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  xor    %edi,%edi
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  movslq %edx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  xor    %esi,%esi
  sub    $0x8,%rsp
  call   <tosError_setContext@plt>
  lea    (%rbx,%rbp,1),%rsi
  mov    %r12d,%edx
  mov    %r13d,%edi
  call   <write@plt>
  cmp    %eax,%r12d
  je     L3
  test   %eax,%eax
  mov    $0xffffffff,%edx
  cmovns %edx,%eax
L3:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int tosFile_write1(int fd, const void *pBuffer, int start, int n) {
  int result;
  tosError_setContext(0, 0);
  ;
  result = write(fd, ((const char *)pBuffer) + start, n);
  if (result != n && result >= 0) {
    return -1;
  }
  return result;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<QSort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  cmpq   $0x0,-0x60(%rbp)
  je     L65
L84:
  mov    -0x38(%rbp),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  movabs $0x4ec4ec4ec4ec4ec5,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x2,%rax
  mov    %rax,-0x38(%rbp)
  cmpq   $0x9,-0x38(%rbp)
  je     L117
  cmpq   $0xa,-0x38(%rbp)
  jne    L69
L117:
  movq   $0xb,-0x38(%rbp)
  jmp    L34
L69:
  cmpq   $0x0,-0x38(%rbp)
  jne    L34
  movq   $0x1,-0x38(%rbp)
L34:
  movl   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L85
L1:
  mov    -0x40(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  imul   -0x68(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    -0x70(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  test   %eax,%eax
  jle    L91
  mov    -0x68(%rbp),%rax
  mov    %eax,-0x44(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L15:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    (%rdx),%rdx
  mov    %rdx,(%rax)
  mov    -0x20(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  subl   $0x1,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jne    L15
  movl   $0x1,-0x48(%rbp)
L91:
  addq   $0x1,-0x40(%rbp)
  mov    -0x68(%rbp),%rax
  add    %rax,-0x30(%rbp)
L85:
  mov    -0x60(%rbp),%rax
  sub    -0x38(%rbp),%rax
  cmp    %rax,-0x40(%rbp)
  jb     L1
  cmpq   $0x1,-0x38(%rbp)
  ja     L84
  cmpl   $0x0,-0x48(%rbp)
  jne    L84
  jmp    L71
L65:
  nop
L71:
  leave
  ret
```

assistant: ```c
void QSort(void *base, size_t members, size_t size, int (*compar)(const void *, const void *)) {
  size_t i, j;
  size_t gap = members;
  uintptr_t p1, p2;
  bool worked;
  if (!members) {
    return;
  }
  do {
    gap = (gap * 10) / 13;
    if (gap == 9 || gap == 10) {
      gap = 11;
    } else if (gap < 1) {
      gap = 1;
    }
    worked = false;
    for (i = 0, p1 = (uintptr_t)base; i < members - gap; i++, p1 += size) {
      j = i + gap;
      p2 = (uintptr_t)base + j * size;
      if (compar((void *)p1, (void *)p2) > 0) {
        int k = size;
        uint8_t tmp;
        uint8_t *tp1;
        uint8_t *tp2;
        tp1 = (uint8_t *)p1;
        tp2 = (uint8_t *)p2;
        do {
          tmp = *tp1;
          *tp1++ = *tp2;
          *tp2++ = tmp;
        } while (--k);
        worked = true;
      }
    }
  } while (gap > 1 || worked);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<QSort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,0x20(%rsp)
  mov    %rsi,0x30(%rsp)
  mov    %rdx,(%rsp)
  test   %rsi,%rsi
  je     L81
  mov    %rcx,%r15
  lea    -0x1(%rdx),%eax
  mov    %rsi,0x10(%rsp)
  lea    -0xb(%rsi),%rdx
  mov    %rdx,0x38(%rsp)
  lea    0x8(,%rax,8),%rax
  mov    %rax,0x28(%rsp)
  jmp    L80
L47:
  add    $0x1,%r14
  mov    (%rsp),%rax
  add    %rax,%r12
  add    %rax,%r13
  add    %rax,%rbp
  cmp    0x8(%rsp),%r14
  jae    L20
L143:
  mov    %r12,%rbx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   *%r15
  test   %eax,%eax
  jle    L47
  mov    %r13,%rdi
  sub    %r12,%rdi
L83:
  lea    (%rbx,%rdi,1),%rax
  mov    (%rbx),%rdx
  mov    %rbx,%rcx
  add    $0x8,%rbx
  mov    (%rax),%rsi
  mov    %rsi,(%rcx)
  mov    %rdx,(%rax)
  cmp    %rbp,%rbx
  jne    L83
  movl   $0x1,0x1c(%rsp)
  jmp    L47
L20:
  cmpq   $0x1,0x10(%rsp)
  ja     L80
  cmpl   $0x0,0x1c(%rsp)
  je     L81
L80:
  mov    0x10(%rsp),%rax
  lea    (%rax,%rax,4),%rcx
  add    %rcx,%rcx
  movabs $0x4ec4ec4ec4ec4ec5,%rax
  mul    %rcx
  shr    $0x2,%rdx
  mov    %rdx,0x10(%rsp)
  lea    -0x9(%rdx),%rax
  cmp    $0x1,%rax
  jbe    L76
  cmp    $0xc,%rcx
  jbe    L150
  mov    0x20(%rsp),%r12
  mov    0x30(%rsp),%rax
  sub    %rdx,%rax
  mov    %rax,0x8(%rsp)
  jne    L57
  movl   $0x0,0x1c(%rsp)
  jmp    L20
L76:
  mov    0x20(%rsp),%r12
  mov    0x38(%rsp),%rax
  mov    %rax,0x8(%rsp)
  movq   $0xb,0x10(%rsp)
  test   %rax,%rax
  je     L80
L57:
  mov    (%rsp),%r13
  imul   0x10(%rsp),%r13
  add    %r12,%r13
  mov    0x28(%rsp),%rax
  lea    (%rax,%r12,1),%rbp
  movl   $0x0,0x1c(%rsp)
  mov    $0x0,%r14d
  jmp    L143
L150:
  mov    0x20(%rsp),%r12
  mov    0x30(%rsp),%rax
  sub    $0x1,%rax
  mov    %rax,0x8(%rsp)
  je     L81
  movq   $0x1,0x10(%rsp)
  jmp    L57
L81:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void QSort(void *base, size_t members, size_t size, int (*compar)(const void *, const void *)) {
  size_t i, j;
  size_t gap = members;
  uintptr_t p1, p2;
  bool worked;
  if (!members) {
    return;
  }
  do {
    gap = (gap * 10) / 13;
    if (gap == 9 || gap == 10) {
      gap = 11;
    } else if (gap < 1) {
      gap = 1;
    }
    worked = false;
    for (i = 0, p1 = (uintptr_t)base; i < members - gap; i++, p1 += size) {
      j = i + gap;
      p2 = (uintptr_t)base + j * size;
      if (compar((void *)p1, (void *)p2) > 0) {
        int k = size;
        uint8_t tmp;
        uint8_t *tp1;
        uint8_t *tp2;
        tp1 = (uint8_t *)p1;
        tp2 = (uint8_t *)p2;
        do {
          tmp = *tp1;
          *tp1++ = *tp2;
          *tp2++ = tmp;
        } while (--k);
        worked = true;
      }
    }
  } while (gap > 1 || worked);
}
```