ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<voidline>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x210,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <ftell@plt>
  mov    %rbp,%rsi
  mov    $0x9,%edi
  movslq %eax,%r12
  call   <fputc@plt>
  mov    %rbp,%rdi
  call   <fflush@plt>
  mov    %rbp,%rdx
  mov    $0x200,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  mov    %rbp,%rdx
  mov    $0x200,%esi
  mov    %r13,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L71
  movzbl (%rsp),%eax
  sub    $0x9,%eax
  cmp    $0x1,%al
  jbe    L20
L71:
  mov    %rbp,%rdi
  call   <fflush@plt>
  mov    D0(%rip),%rbx
  lea    -0x2(%r12),%rsi
  mov    %rbp,%rdi
  mov    (%rbx),%edx
  call   <fseek@plt>
  jmp    L52
  nopl   (%rax)
L33:
  mov    %rbp,%rdi
  call   <ftell@plt>
  cmp    $0x1,%eax
  jle    L7
  mov    D34(%rip),%rax
  mov    $0xfffffffffffffffe,%rsi
  mov    %rbp,%rdi
  mov    (%rax),%edx
  call   <fseek@plt>
L52:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  cmp    $0xa,%al
  jne    L33
L7:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  sub    $0x9,%eax
  cmp    $0x1,%al
  jbe    L39
L57:
  mov    %rbp,%rdi
  call   <fflush@plt>
  mov    (%rbx),%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fseek@plt>
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  add    $0x210,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L39:
  mov    D34(%rip),%r14
  mov    %rbp,%rdi
  mov    $0xffffffffffffffff,%rsi
  mov    (%r14),%edx
  call   <fseek@plt>
  mov    %rbp,%rdx
  mov    %r13,%rdi
  mov    $0x200,%esi
  call   <fgets@plt>
  mov    (%r14),%edx
  mov    %rbp,%rdi
  mov    $0xffffffffffffffff,%rsi
  call   <fseek@plt>
  mov    %rbp,%rsi
  mov    $0x9,%edi
  call   <fputc@plt>
  jmp    L57
  nopl   (%rax)
L20:
  mov    D34(%rip),%rax
  mov    %r13,%rdi
  mov    (%rax),%r14d
  call   <strlen@plt>
  mov    %rbp,%rdi
  not    %eax
  mov    %r14d,%edx
  movslq %eax,%rsi
  call   <fseek@plt>
  mov    %rbp,%rsi
  mov    $0x9,%edi
  call   <fputc@plt>
  jmp    L71
L86:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void voidline(FILE *master) {
  char buff[512], ch;
  unsigned long start;
  start = ftell(master);
  fputc('\t', master);
  fflush(master);
  fgets(buff, 512, master);
  if (fgets(buff, 512, master))
    if (buff[0] == '\t' || buff[0] == '\n') {
      fseek(master, -(strlen(buff) + 1), SEEK_CUR);
      fputc('\t', master);
    }
  fflush(master);
  fseek(master, start - 2, SEEK_SET);
  while (fgetc(master) != '\n') {
    if (ftell(master) < 2)
      break;
    fseek(master, -2, SEEK_CUR);
  }
  ch = fgetc(master);
  if (ch == '\t' || ch == '\n') {
    fseek(master, -1, SEEK_CUR);
    fgets(buff, 512, master);
    fseek(master, -1, SEEK_CUR);
    fputc('\t', master);
  }
  fflush(master);
  fseek(master, start, SEEK_SET);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<send_bytes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    %ecx,-0x10(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    $0x12,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    $0x13,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    $0x12,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    $0x13,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  nop
  leave
  ret
```

assistant: ```c
void send_bytes(int byte0, int byte1, int byte2, int byte3) {
  write_data(0x20, 0x12, byte0);
  write_data(0x20, 0x13, byte1);
  write_data(0x21, 0x12, byte2);
  write_data(0x21, 0x13, byte3);
}
```
user: Translate the below assembly code into C programming language:

```asm
<send_bytes>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%r12d
  mov    %edx,%ebp
  mov    %ecx,%ebx
  mov    %edi,%edx
  mov    $0x12,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    %r12d,%edx
  mov    $0x13,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    %ebp,%edx
  mov    $0x12,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  mov    %ebx,%edx
  mov    $0x13,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void send_bytes(int byte0, int byte1, int byte2, int byte3) {
  write_data(0x20, 0x12, byte0);
  write_data(0x20, 0x13, byte1);
  write_data(0x21, 0x12, byte2);
  write_data(0x21, 0x13, byte3);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<send_bytes>:
  endbr64
  push   %r14
  mov    %esi,%r14d
  mov    $0x12,%esi
  push   %r13
  mov    %edx,%r13d
  mov    %edi,%edx
  mov    $0x20,%edi
  push   %r12
  mov    %ecx,%r12d
  call   <write_data@plt>
  mov    %r14d,%edx
  mov    $0x13,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    %r13d,%edx
  mov    $0x12,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  mov    %r12d,%edx
  mov    $0x13,%esi
  pop    %r12
  mov    $0x21,%edi
  pop    %r13
  pop    %r14
  jmp    1050 <write_data@plt>
```

assistant: ```c
void send_bytes(int byte0, int byte1, int byte2, int byte3) {
  write_data(0x20, 0x12, byte0);
  write_data(0x20, 0x13, byte1);
  write_data(0x21, 0x12, byte2);
  write_data(0x21, 0x13, byte3);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<send_bytes>:
  endbr64
  push   %r14
  mov    %esi,%r14d
  mov    $0x12,%esi
  push   %r13
  mov    %edx,%r13d
  mov    %edi,%edx
  mov    $0x20,%edi
  push   %r12
  mov    %ecx,%r12d
  call   <write_data@plt>
  mov    %r14d,%edx
  mov    $0x13,%esi
  mov    $0x20,%edi
  call   <write_data@plt>
  mov    %r13d,%edx
  mov    $0x12,%esi
  mov    $0x21,%edi
  call   <write_data@plt>
  mov    %r12d,%edx
  mov    $0x13,%esi
  pop    %r12
  mov    $0x21,%edi
  pop    %r13
  pop    %r14
  jmp    1050 <write_data@plt>
```

assistant: ```c
void send_bytes(int byte0, int byte1, int byte2, int byte3) {
  write_data(0x20, 0x12, byte0);
  write_data(0x20, 0x13, byte1);
  write_data(0x21, 0x12, byte2);
  write_data(0x21, 0x13, byte3);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<decode_domain_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x130,%rsp
  mov    %rdi,-0x128(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movw   $0x0,-0x116(%rbp)
  movw   $0x0,-0x114(%rbp)
  movb   $0x0,-0x110(%rbp)
  jmp    L76
L79:
  movzwl -0x116(%rbp),%edx
  mov    -0x128(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cbtw
  mov    %ax,-0x112(%rbp)
  movzwl -0x116(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x116(%rbp)
  movzwl -0x112(%rbp),%edx
  movzwl -0x114(%rbp),%eax
  add    %edx,%eax
  cmp    $0x100,%eax
  jle    L97
  mov    $0x1,%eax
  jmp    L1
L97:
  movzwl -0x112(%rbp),%edx
  movzwl -0x116(%rbp),%eax
  add    %edx,%eax
  cmp    $0x100,%eax
  jle    L66
  mov    $0x1,%eax
  jmp    L1
L27:
  movzwl -0x116(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %dx,-0x116(%rbp)
  movzwl %ax,%edx
  mov    -0x128(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  movzwl -0x114(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %dx,-0x114(%rbp)
  movzwl %ax,%eax
  movzbl (%rcx),%edx
  cltq
  mov    %dl,-0x110(%rbp,%rax,1)
  movzwl -0x112(%rbp),%eax
  sub    $0x1,%eax
  mov    %ax,-0x112(%rbp)
L66:
  cmpw   $0x0,-0x112(%rbp)
  jne    L27
  movzwl -0x114(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %dx,-0x114(%rbp)
  movzwl %ax,%eax
  cltq
  movb   $0x2e,-0x110(%rbp,%rax,1)
L76:
  movzwl -0x116(%rbp),%edx
  mov    -0x128(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L69
  cmpw   $0xff,-0x116(%rbp)
  jbe    L79
L69:
  cmpw   $0x0,-0x114(%rbp)
  je     L94
  movzwl -0x114(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,-0x110(%rbp,%rax,1)
L94:
  lea    -0x110(%rbp),%rcx
  mov    -0x128(%rbp),%rax
  mov    $0x100,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    $0x0,%eax
L1:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L81
  call   <__stack_chk_fail@plt>
L81:
  leave
  ret
```

assistant: ```c
int decode_domain_name(char *query) {
  char decoded[256];
  unsigned short int idx;
  unsigned short didx;
  unsigned short len;
  idx = 0;
  didx = 0;
  decoded[0] = 0;
  while (query[idx] && idx < 256) {
    len = query[idx];
    idx++;
    if (len + didx > 256)
      return 1;
    if (len + idx > 256)
      return 1;
    for (; len > 0; len--) {
      decoded[didx++] = query[idx++];
    }
    decoded[didx++] = '.';
  }
  if (didx > 0)
    decoded[didx - 1] = 0;
  strncpy(query, decoded, 256);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<decode_domain_name>:
  endbr64
  sub    $0x118,%rsp
  mov    %rdi,%r9
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rsp)
  movzbl (%rdi),%esi
  test   %sil,%sil
  je     L137
  movsbw %sil,%si
  lea    -0x100(%rsi),%eax
  cmp    $0xfeff,%ax
  jbe    L132
  mov    $0x1,%edx
  mov    $0x0,%r10d
  jmp    L109
L66:
  mov    %r10d,%esi
  mov    %edx,%edi
L33:
  lea    0x1(%rsi),%r10d
  movzwl %si,%esi
  movb   $0x2e,(%rsp,%rsi,1)
  movzwl %di,%eax
  movzbl (%r9,%rax,1),%esi
  cmp    $0xff,%di
  ja     L16
  test   %sil,%sil
  je     L16
  movsbw %sil,%si
  lea    0x1(%rdi),%edx
  movzwl %si,%ecx
  movzwl %r10w,%eax
  add    %ecx,%eax
  cmp    $0x100,%eax
  jg     L8
  movzwl %dx,%eax
  add    %ecx,%eax
  cmp    $0x100,%eax
  jg     L92
L109:
  test   %si,%si
  je     L66
  lea    (%rsi,%rdx,1),%edi
  mov    %edx,%eax
  mov    %r10d,%r8d
  sub    %edx,%r8d
L25:
  lea    (%r8,%rax,1),%edx
  mov    %eax,%ecx
  add    $0x1,%eax
  movzwl %dx,%edx
  movzwl %cx,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,(%rsp,%rdx,1)
  cmp    %di,%ax
  jne    L25
  add    %r10d,%esi
  jmp    L33
L16:
  test   %r10w,%r10w
  je     L137
  movzwl %r10w,%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,(%rsp,%rax,1)
L137:
  mov    %rsp,%rsi
  mov    $0x100,%edx
  mov    %r9,%rdi
  call   <strncpy@plt>
  mov    $0x0,%eax
L71:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x118,%rsp
  ret
L132:
  mov    $0x1,%eax
  jmp    L71
L8:
  mov    $0x1,%eax
  jmp    L71
L92:
  mov    $0x1,%eax
  jmp    L71
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int decode_domain_name(char *query) {
  char decoded[256];
  unsigned short int idx;
  unsigned short didx;
  unsigned short len;
  idx = 0;
  didx = 0;
  decoded[0] = 0;
  while (query[idx] && idx < 256) {
    len = query[idx];
    idx++;
    if (len + didx > 256)
      return 1;
    if (len + idx > 256)
      return 1;
    for (; len > 0; len--) {
      decoded[didx++] = query[idx++];
    }
    decoded[didx++] = '.';
  }
  if (didx > 0)
    decoded[didx - 1] = 0;
  strncpy(query, decoded, 256);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<decode_domain_name>:
  endbr64
  sub    $0x118,%rsp
  movsbw (%rdi),%si
  mov    %rdi,%r9
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rsp)
  test   %sil,%sil
  je     L33
  mov    $0x1,%eax
  xor    %r10d,%r10d
  cmp    $0xff,%si
  ja     L7
  nopl   0x0(%rax)
L72:
  mov    %r10d,%edi
  lea    (%rsi,%rax,1),%r8d
  sub    %eax,%edi
  nopl   0x0(%rax)
L91:
  movzwl %ax,%ecx
  lea    (%rax,%rdi,1),%edx
  add    $0x1,%eax
  movzbl (%r9,%rcx,1),%ecx
  movzwl %dx,%edx
  mov    %cl,(%rsp,%rdx,1)
  cmp    %r8w,%ax
  jne    L91
  add    %r10d,%esi
  movzwl %ax,%edx
  lea    0x1(%rsi),%r10d
  movzwl %si,%esi
  movb   $0x2e,(%rsp,%rsi,1)
  movsbw (%r9,%rdx,1),%si
  cmp    $0xff,%ax
  ja     L68
  test   %sil,%sil
  je     L68
  movzwl %si,%ecx
  movzwl %r10w,%edx
  add    $0x1,%eax
  add    %ecx,%edx
  cmp    $0x100,%edx
  jg     L7
  movzwl %ax,%edx
  add    %ecx,%edx
  cmp    $0x100,%edx
  jle    L72
L7:
  mov    $0x1,%eax
  jmp    L17
L68:
  test   %r10w,%r10w
  je     L33
  movzwl %r10w,%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,(%rsp,%rax,1)
L33:
  mov    %rsp,%rsi
  mov    $0x100,%edx
  mov    %r9,%rdi
  call   <strncpy@plt>
  xor    %eax,%eax
L17:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L37
  add    $0x118,%rsp
  ret
L37:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int decode_domain_name(char *query) {
  char decoded[256];
  unsigned short int idx;
  unsigned short didx;
  unsigned short len;
  idx = 0;
  didx = 0;
  decoded[0] = 0;
  while (query[idx] && idx < 256) {
    len = query[idx];
    idx++;
    if (len + didx > 256)
      return 1;
    if (len + idx > 256)
      return 1;
    for (; len > 0; len--) {
      decoded[didx++] = query[idx++];
    }
    decoded[didx++] = '.';
  }
  if (didx > 0)
    decoded[didx - 1] = 0;
  strncpy(query, decoded, 256);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<decode_domain_name>:
  endbr64
  sub    $0x118,%rsp
  movsbw (%rdi),%si
  mov    %rdi,%r9
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rsp)
  test   %sil,%sil
  je     L10
  mov    $0x1,%eax
  xor    %r10d,%r10d
  cmp    $0xff,%si
  ja     L45
  nopl   0x0(%rax)
L36:
  mov    %r10d,%edi
  lea    (%rsi,%rax,1),%r8d
  sub    %eax,%edi
  nopl   0x0(%rax)
L11:
  movzwl %ax,%ecx
  lea    (%rax,%rdi,1),%edx
  add    $0x1,%eax
  movzbl (%r9,%rcx,1),%ecx
  movzwl %dx,%edx
  mov    %cl,(%rsp,%rdx,1)
  cmp    %r8w,%ax
  jne    L11
  add    %r10d,%esi
  movzwl %ax,%edx
  lea    0x1(%rsi),%r10d
  movzwl %si,%esi
  movb   $0x2e,(%rsp,%rsi,1)
  movsbw (%r9,%rdx,1),%si
  cmp    $0xff,%ax
  ja     L55
  test   %sil,%sil
  je     L55
  movzwl %si,%ecx
  movzwl %r10w,%edx
  add    $0x1,%eax
  add    %ecx,%edx
  cmp    $0x100,%edx
  jg     L45
  movzwl %ax,%edx
  add    %ecx,%edx
  cmp    $0x100,%edx
  jle    L36
L45:
  mov    $0x1,%eax
  jmp    L22
L55:
  test   %r10w,%r10w
  je     L10
  movzwl %r10w,%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,(%rsp,%rax,1)
L10:
  mov    %rsp,%rsi
  mov    $0x100,%edx
  mov    %r9,%rdi
  call   <strncpy@plt>
  xor    %eax,%eax
L22:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L7
  add    $0x118,%rsp
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int decode_domain_name(char *query) {
  char decoded[256];
  unsigned short int idx;
  unsigned short didx;
  unsigned short len;
  idx = 0;
  didx = 0;
  decoded[0] = 0;
  while (query[idx] && idx < 256) {
    len = query[idx];
    idx++;
    if (len + didx > 256)
      return 1;
    if (len + idx > 256)
      return 1;
    for (; len > 0; len--) {
      decoded[didx++] = query[idx++];
    }
    decoded[didx++] = '.';
  }
  if (didx > 0)
    decoded[didx - 1] = 0;
  strncpy(query, decoded, 256);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<partition>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  movl   $0x1,-0x8(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L73
L59:
  movl   $0x0,-0x8(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L70
L63:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L19
  mov    -0xc(%rbp),%edx
  mov    -0x4(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  movl   $0x1,-0x8(%rbp)
L19:
  subl   $0x1,-0xc(%rbp)
L70:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jg     L63
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L75
L30:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L77
  mov    -0xc(%rbp),%edx
  mov    -0x4(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  movl   $0x1,-0x8(%rbp)
L77:
  addl   $0x1,-0xc(%rbp)
L75:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L30
L73:
  cmpl   $0x1,-0x8(%rbp)
  je     L59
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int partition(int *array, int start, int end) {
  int i, swapped = 1;
  int pivotPoint = start;
  while (swapped == 1) {
    swapped = 0;
    for (i = end; i > pivotPoint; i--) {
      if (array[i] < array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
    for (i = start; i < pivotPoint; i++) {
      if (array[i] > array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
  }
  return pivotPoint;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<partition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r14d
  mov    %edx,%r13d
  mov    $0x0,%r15d
  mov    $0x1,%r12d
  jmp    L116
L17:
  sub    $0x1,%rbx
  cmp    %ebx,%esi
  jge    L82
L119:
  mov    %ebx,%edx
  movslq %esi,%rax
  mov    0x0(%rbp,%rax,4),%eax
  cmp    %eax,0x0(%rbp,%rbx,4)
  jge    L17
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %ebx,%esi
  mov    %r12d,%ecx
  jmp    L17
L82:
  cmp    %r14d,%esi
  jle    L77
L36:
  movslq %r14d,%rbx
  jmp    L37
L48:
  add    $0x1,%rbx
  cmp    %ebx,%esi
  jle    L77
L37:
  mov    %ebx,%edx
  movslq %esi,%rax
  mov    0x0(%rbp,%rax,4),%eax
  cmp    %eax,0x0(%rbp,%rbx,4)
  jle    L48
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %ebx,%esi
  mov    %r12d,%ecx
  jmp    L48
L77:
  cmp    $0x1,%ecx
  jne    L127
L116:
  movslq %r13d,%rbx
  mov    %r15d,%ecx
  cmp    %esi,%r13d
  jg     L119
  cmp    %esi,%r14d
  jge    L127
  mov    %r15d,%ecx
  jmp    L36
L127:
  mov    %esi,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int partition(int *array, int start, int end) {
  int i, swapped = 1;
  int pivotPoint = start;
  while (swapped == 1) {
    swapped = 0;
    for (i = end; i > pivotPoint; i--) {
      if (array[i] < array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
    for (i = start; i < pivotPoint; i++) {
      if (array[i] > array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
  }
  return pivotPoint;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<partition>:
  endbr64
  push   %r13
  xor    %ecx,%ecx
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x8,%rsp
  jmp    L23
  nopl   (%rax)
L16:
  sub    $0x1,%ebx
L23:
  cmp    %esi,%ebx
  jle    L70
L76:
  movslq %esi,%rdx
  movslq %ebx,%rax
  mov    0x0(%rbp,%rdx,4),%edi
  cmp    %edi,0x0(%rbp,%rax,4)
  jge    L16
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %ebx,%esi
  mov    $0x1,%ecx
  jmp    L16
  nopw   0x0(%rax,%rax,1)
L70:
  cmp    %r12d,%esi
  jle    L40
L114:
  movslq %r12d,%rbx
  jmp    L109
  nopw   0x0(%rax,%rax,1)
L11:
  add    $0x1,%rbx
  cmp    %ebx,%esi
  jle    L40
L109:
  movslq %esi,%rax
  mov    %ebx,%edx
  mov    0x0(%rbp,%rax,4),%eax
  cmp    %eax,0x0(%rbp,%rbx,4)
  jle    L11
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %ebx,%esi
  add    $0x1,%rbx
  mov    $0x1,%ecx
  cmp    %ebx,%esi
  jg     L109
L40:
  cmp    $0x1,%ecx
  jne    L45
  mov    %r13d,%ebx
  xor    %ecx,%ecx
  cmp    %esi,%r13d
  jg     L76
  cmp    %esi,%r12d
  jl     L114
L45:
  add    $0x8,%rsp
  mov    %esi,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int partition(int *array, int start, int end) {
  int i, swapped = 1;
  int pivotPoint = start;
  while (swapped == 1) {
    swapped = 0;
    for (i = end; i > pivotPoint; i--) {
      if (array[i] < array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
    for (i = start; i < pivotPoint; i++) {
      if (array[i] > array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
  }
  return pivotPoint;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<partition>:
  endbr64
  push   %r14
  xor    %ecx,%ecx
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  jmp    L87
  nopl   0x0(%rax,%rax,1)
L106:
  sub    $0x1,%ebx
L87:
  cmp    %esi,%ebx
  jle    L95
L20:
  movslq %esi,%rdx
  movslq %ebx,%rax
  mov    0x0(%rbp,%rdx,4),%edi
  cmp    %edi,0x0(%rbp,%rax,4)
  jge    L106
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %ebx,%esi
  mov    $0x1,%ecx
  jmp    L106
  nopw   0x0(%rax,%rax,1)
L95:
  cmp    %r12d,%esi
  jle    L16
L113:
  movslq %r12d,%rbx
  movslq %esi,%rdx
  nopl   0x0(%rax,%rax,1)
L76:
  mov    0x0(%rbp,%rdx,4),%eax
  mov    %ebx,%r14d
  cmp    %eax,0x0(%rbp,%rbx,4)
  jg     L66
  add    $0x1,%rbx
  cmp    %ebx,%esi
  jg     L76
L16:
  cmp    $0x1,%ecx
  jne    L9
L99:
  mov    %r13d,%ebx
  xor    %ecx,%ecx
  cmp    %esi,%r13d
  jg     L20
  cmp    %esi,%r12d
  jl     L113
L9:
  pop    %rbx
  mov    %esi,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L66:
  mov    %ebx,%edx
  mov    %rbp,%rdi
  add    $0x1,%rbx
  call   <swap@plt>
  cmp    %ebx,%r14d
  jle    L111
  movslq %r14d,%rdx
  mov    $0x1,%ecx
  mov    %rdx,%rsi
  jmp    L76
  nopl   0x0(%rax,%rax,1)
L111:
  mov    %r14d,%esi
  jmp    L99
```

assistant: ```c
int partition(int *array, int start, int end) {
  int i, swapped = 1;
  int pivotPoint = start;
  while (swapped == 1) {
    swapped = 0;
    for (i = end; i > pivotPoint; i--) {
      if (array[i] < array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
    for (i = start; i < pivotPoint; i++) {
      if (array[i] > array[pivotPoint]) {
        swap(array, pivotPoint, i);
        pivotPoint = i;
        swapped = 1;
      }
    }
  }
  return pivotPoint;
}
```