ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<do_dirname>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  mov    %rdi,%rcx
  xor    %eax,%eax
  push   %rbp
  mov    %rsi,%rbp
  lea    D4(%rip),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  sub    $0x8,%rsp
  call   <snprintf@plt>
  mov    $0x2f,%esi
  mov    %rbp,%rdi
  call   <rindex@plt>
  test   %rax,%rax
  je     L3
  cmp    %rax,%rbp
  je     L12
  movb   $0x0,(%rax)
L12:
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L3:
  add    $0x8,%rsp
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D12(%rip),%rdx
  pop    %rbp
  pop    %r12
  jmp    1060 <snprintf@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type_infered: string
name: retrieve_data
arguments: data_label: D12
type_infered: string

tool: D4: %s

tool: D12: .

assistant: ```c
void do_dirname(const char *fname, char *dname, size_t dname_len) {
  char *ls;
  snprintf(dname, dname_len, "%s", fname);
  ls = rindex(dname, '/');
  if (!ls) {
    snprintf(dname, dname_len, ".");
    return;
  }
  if (ls == dname) {
    return;
  }
  *ls = '\0';
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    $0xf,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D6
datatype: string

tool: D6: Line: %d


assistant: ```c
int main(int argc, char **argv) {
  printf("Line: %d\n", 15);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xf,%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D1
type_guessed: string

tool: D1: Line: %d


assistant: ```c
int main(int argc, char **argv) {
  printf("Line: %d\n", 15);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xf,%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

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

tool: D5: Line: %d


assistant: ```c
int main(int argc, char **argv) {
  printf("Line: %d\n", 15);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xf,%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D5
type: string

tool: D5: Line: %d


assistant: ```c
int main(int argc, char **argv) {
  printf("Line: %d\n", 15);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jle    L30
  movl   $0x1,-0x10(%rbp)
  jmp    L46
L25:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L67
L20:
  cmpb   $0x20,-0x11(%rbp)
  je     L11
  addl   $0x1,-0xc(%rbp)
L11:
  cmpb   $0x65,-0x11(%rbp)
  jne    L67
  addl   $0x1,-0x8(%rbp)
L67:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  mov    (%rdx),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,(%rdx)
  movzbl (%rax),%eax
  mov    %al,-0x11(%rbp)
  cmpb   $0x0,-0x11(%rbp)
  jne    L20
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x8(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd %xmm0,%xmm1
  movsd  D16(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0xc(%rbp),%xmm1
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,-0x4(%rbp)
  pxor   %xmm2,%xmm2
  cvtss2sd -0x4(%rbp),%xmm2
  movq   %xmm2,%rcx
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%eax
  movq   %rcx,%xmm0
  mov    %eax,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  addl   $0x1,-0x10(%rbp)
L46:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L25
  jmp    L27
L30:
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L27:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D9
type_infered: string
name: read_data
arguments: data_tag: D16
type_infered: f64
name: read_data
arguments: data_tag: D0
type_infered: string
name: read_data
arguments: data_tag: D23
type_infered: string

tool: D9: Eingabe #%d: %s


tool: D16: 100

tool: D0: e:%d	 total:%d	 percent:%.1f


tool: D23: Eingabe fehlt

assistant: ```c
int main(int argc, char *argv[]) {
  if (argc >= 1) {
    char c;
    int i, s, e;
    float f;
    for (i = 1; i < argc; i++) {
      printf("Eingabe #%d: %s\n", i, argv[i]);
      s = 0;
      e = 0;
      while (c = *argv[i]++) {
        if (c != ' ')
          s++;
        if (c == 'e')
          e++;
      }
      f = 100.0 * ((float)e) / ((float)s);
      printf("e:%d\t total:%d\t percent:%.1f\n", e, s, f);
    }
  } else {
    printf("Eingabe fehlt\n");
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %edi,%edi
  jle    L45
  mov    %edi,%r13d
  cmp    $0x1,%edi
  jle    L13
  lea    0x8(%rsi),%rbp
  mov    $0x1,%r12d
  lea    D28(%rip),%r15
  lea    D31(%rip),%r14
  jmp    L74
L75:
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movzbl (%rax),%eax
  test   %al,%al
  je     L33
L68:
  cmp    $0x20,%al
  je     L75
  add    $0x1,%ecx
  cmp    $0x65,%al
  sete   %al
  movzbl %al,%eax
  add    %eax,%esi
  jmp    L75
L0:
  mov    $0x0,%esi
  mov    $0x0,%ecx
L33:
  pxor   %xmm0,%xmm0
  cvtsi2ss %esi,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  D25(%rip),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %ecx,%xmm1
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  cvtss2sd %xmm0,%xmm0
  mov    %ecx,%edx
  mov    %r14,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  add    $0x1,%r12d
  add    $0x8,%rbp
  cmp    %r12d,%r13d
  je     L13
L74:
  mov    %rbp,%rbx
  mov    0x0(%rbp),%rdx
  mov    %r12d,%esi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x0(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  je     L0
  mov    $0x0,%esi
  mov    $0x0,%ecx
  jmp    L68
L45:
  lea    D18(%rip),%rdi
  call   <puts@plt>
L13:
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D28
type_infered: string
name: retrieve_data
arguments: data_label: D31
type_infered: string
name: retrieve_data
arguments: data_label: D25
type_infered: f64
name: retrieve_data
arguments: data_label: D18
type_infered: string

tool: D28: Eingabe #%d: %s


tool: D31: e:%d	 total:%d	 percent:%.1f


tool: D25: 100

tool: D18: Eingabe fehlt

assistant: ```c
int main(int argc, char *argv[]) {
  if (argc >= 1) {
    char c;
    int i, s, e;
    float f;
    for (i = 1; i < argc; i++) {
      printf("Eingabe #%d: %s\n", i, argv[i]);
      s = 0;
      e = 0;
      while (c = *argv[i]++) {
        if (c != ' ')
          s++;
        if (c == 'e')
          e++;
      }
      f = 100.0 * ((float)e) / ((float)s);
      printf("e:%d\t total:%d\t percent:%.1f\n", e, s, f);
    }
  } else {
    printf("Eingabe fehlt\n");
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %edi,%edi
  jle    L65
  mov    %edi,%ebx
  cmp    $0x1,%edi
  je     L42
  lea    0x8(%rsi),%r13
  mov    $0x1,%r14d
  lea    D10(%rip),%r12
  lea    D1(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L34:
  mov    0x0(%r13),%rdx
  mov    %r14d,%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x0(%r13),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L63
  add    $0x2,%rax
  xor    %esi,%esi
  xor    %r8d,%r8d
  nopl   0x0(%rax)
L12:
  cmp    $0x20,%dl
  je     L23
  add    $0x1,%r8d
  cmp    $0x65,%dl
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%esi
L23:
  mov    %rax,0x0(%r13)
  movzbl -0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  jne    L12
L76:
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  mov    %r8d,%edx
  mov    %rbp,%rdi
  cvtsi2ss %esi,%xmm0
  mov    $0x1,%eax
  add    $0x1,%r14d
  add    $0x8,%r13
  cvtsi2ss %r8d,%xmm1
  cvtss2sd %xmm0,%xmm0
  mulsd  D15(%rip),%xmm0
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  cmp    %r14d,%ebx
  jne    L34
L42:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L63:
  xor    %esi,%esi
  xor    %r8d,%r8d
  jmp    L76
L65:
  lea    D26(%rip),%rdi
  call   <puts@plt>
  jmp    L42
```

tool_calls: name: extract_symbolic_data
arguments: tag: D10
data_type: string
name: extract_symbolic_data
arguments: tag: D1
data_type: string
name: extract_symbolic_data
arguments: tag: D15
data_type: f64
name: extract_symbolic_data
arguments: tag: D26
data_type: string

tool: D10: Eingabe #%d: %s


tool: D1: e:%d	 total:%d	 percent:%.1f


tool: D15: 100

tool: D26: Eingabe fehlt

assistant: ```c
int main(int argc, char *argv[]) {
  if (argc >= 1) {
    char c;
    int i, s, e;
    float f;
    for (i = 1; i < argc; i++) {
      printf("Eingabe #%d: %s\n", i, argv[i]);
      s = 0;
      e = 0;
      while (c = *argv[i]++) {
        if (c != ' ')
          s++;
        if (c == 'e')
          e++;
      }
      f = 100.0 * ((float)e) / ((float)s);
      printf("e:%d\t total:%d\t percent:%.1f\n", e, s, f);
    }
  } else {
    printf("Eingabe fehlt\n");
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %edi,%edi
  jle    L57
  mov    %edi,%ebx
  cmp    $0x1,%edi
  je     L23
  lea    0x8(%rsi),%r13
  mov    $0x1,%r14d
  lea    D5(%rip),%r12
  lea    D9(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L22:
  mov    0x0(%r13),%rdx
  mov    %r14d,%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x0(%r13),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L50
  add    $0x2,%rax
  xor    %esi,%esi
  xor    %r8d,%r8d
  nopl   0x0(%rax)
L35:
  cmp    $0x20,%dl
  je     L1
  add    $0x1,%r8d
  cmp    $0x65,%dl
  sete   %dl
  movzbl %dl,%edx
  add    %edx,%esi
L1:
  mov    %rax,0x0(%r13)
  movzbl -0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  jne    L35
L64:
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  mov    %r8d,%edx
  mov    %rbp,%rdi
  cvtsi2ss %esi,%xmm0
  mov    $0x1,%eax
  add    $0x1,%r14d
  add    $0x8,%r13
  cvtsi2ss %r8d,%xmm1
  cvtss2sd %xmm0,%xmm0
  mulsd  D20(%rip),%xmm0
  cvtss2sd %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  cvtss2sd %xmm0,%xmm0
  call   <printf@plt>
  cmp    %r14d,%ebx
  jne    L22
L23:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L50:
  xor    %esi,%esi
  xor    %r8d,%r8d
  jmp    L64
L57:
  lea    D39(%rip),%rdi
  call   <puts@plt>
  jmp    L23
```

tool_calls: name: disassemble_data
arguments: tag: D5
type: string
name: disassemble_data
arguments: tag: D9
type: string
name: disassemble_data
arguments: tag: D20
type: f64
name: disassemble_data
arguments: tag: D39
type: string

tool: D5: Eingabe #%d: %s


tool: D9: e:%d	 total:%d	 percent:%.1f


tool: D20: 100

tool: D39: Eingabe fehlt

assistant: ```c
int main(int argc, char *argv[]) {
  if (argc >= 1) {
    char c;
    int i, s, e;
    float f;
    for (i = 1; i < argc; i++) {
      printf("Eingabe #%d: %s\n", i, argv[i]);
      s = 0;
      e = 0;
      while (c = *argv[i]++) {
        if (c != ' ')
          s++;
        if (c == 'e')
          e++;
      }
      f = 100.0 * ((float)e) / ((float)s);
      printf("e:%d\t total:%d\t percent:%.1f\n", e, s, f);
    }
  } else {
    printf("Eingabe fehlt\n");
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<htdel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L8
  cmpq   $0x0,-0x10(%rbp)
  jne    L19
L8:
  mov    $0x0,%eax
  jmp    L15
L19:
  mov    -0x10(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
L15:
  pop    %rbp
  ret
```

assistant: ```c
void *htdel(void **ptable, void *slot, size_t size) {
  if (!*ptable || !slot)
    return NULL;
  (*(const char **)((slot) + 0)) = NULL;
  return slot;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<htdel>:
  endbr64
  cmpq   $0x0,(%rdi)
  je     L1
  test   %rsi,%rsi
  je     L1
  movq   $0x0,(%rsi)
  mov    %rsi,%rax
  ret
L1:
  mov    $0x0,%eax
  ret
```

assistant: ```c
void *htdel(void **ptable, void *slot, size_t size) {
  if (!*ptable || !slot)
    return NULL;
  (*(const char **)((slot) + 0)) = NULL;
  return slot;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<htdel>:
  endbr64
  cmpq   $0x0,(%rdi)
  je     L4
  test   %rsi,%rsi
  je     L4
  movq   $0x0,(%rsi)
  mov    %rsi,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L4:
  xor    %eax,%eax
  ret
```

assistant: ```c
void *htdel(void **ptable, void *slot, size_t size) {
  if (!*ptable || !slot)
    return NULL;
  (*(const char **)((slot) + 0)) = NULL;
  return slot;
}
```
user: Translate the below assembly code into C programming language:

```asm
<htdel>:
  endbr64
  cmpq   $0x0,(%rdi)
  je     L7
  test   %rsi,%rsi
  je     L7
  movq   $0x0,(%rsi)
  mov    %rsi,%rax
  ret
  nopw   0x0(%rax,%rax,1)
L7:
  xor    %eax,%eax
  ret
```

assistant: ```c
void *htdel(void **ptable, void *slot, size_t size) {
  if (!*ptable || !slot)
    return NULL;
  (*(const char **)((slot) + 0)) = NULL;
  return slot;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Set_19200>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xfd0f39fe,-0xc(%rbp)
  lea    -0xc(%rbp),%rcx
  mov    -0x14(%rbp),%eax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <Write_LCD@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

assistant: ```c
void Set_19200(int fd) {
  char cmd[] = {254, 57, 0x0F, 253};
  Write_LCD(fd, cmd, 4);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Set_19200>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0xfd0f39fe,0x4(%rsp)
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  call   <Write_LCD@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Set_19200(int fd) {
  char cmd[] = {254, 57, 0x0F, 253};
  Write_LCD(fd, cmd, 4);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<Set_19200>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x4,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  movl   $0xfd0f39fe,0x4(%rsp)
  call   <Write_LCD@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x18,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Set_19200(int fd) {
  char cmd[] = {254, 57, 0x0F, 253};
  Write_LCD(fd, cmd, 4);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<write_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %rsi,%r12
  mov    %rdx,%rbx
  mov    %ecx,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    $0x4,%edi
  call   <CMSG_SPACE@plt>
  mov    %eax,%edx
  cltq
  mov    $0xc,%ecx
  cmp    %rcx,%rax
  cmovb  %rcx,%rax
  add    $0x3,%rax
  and    $0xfffffffffffffffc,%rax
  add    $0xf,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L13:
  cmp    %rcx,%rsp
  je     L24
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L13
L24:
  mov    %rsi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L21
  orq    $0x0,-0x8(%rsp,%rax,1)
L21:
  mov    %rsp,-0x60(%rbp)
  mov    %edx,-0x58(%rbp)
  lea    -0x60(%rbp),%r15
  mov    %r15,%rdi
  call   <CMSG_FIRSTHDR@plt>
  mov    %rax,%r14
  mov    $0x4,%edi
  call   <CMSG_LEN@plt>
  mov    %eax,0x8(%r14)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x4(%r14)
  mov    D6(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,(%r14)
  mov    %r14,%rdi
  call   <CMSG_DATA@plt>
  mov    %r13d,(%rax)
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x48(%rbp)
  mov    %r12,-0x68(%rbp)
  mov    %rbx,-0x70(%rbp)
  lea    -0x70(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  movl   $0x1,-0x54(%rbp)
  mov    $0x0,%edx
  mov    %r15,%rsi
  mov    -0x74(%rbp),%edi
  call   <sendmsg@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd) {
  struct msghdr msg;
  struct iovec iov;
  union {
    struct cmsghdr cm;
    char control[CMSG_SPACE(sizeof(int))];
  } control_un;
  struct cmsghdr *cmptr;
  msg.msg_control = control_un.control;
  msg.msg_controllen = sizeof(control_un.control);
  cmptr = CMSG_FIRSTHDR(&msg);
  cmptr->cmsg_len = CMSG_LEN(sizeof(int));
  cmptr->cmsg_level = SOL_SOCKET;
  cmptr->cmsg_type = SCM_RIGHTS;
  *((int *)CMSG_DATA(cmptr)) = sendfd;
  msg.msg_name = NULL;
  msg.msg_namelen = 0;
  iov.iov_base = ptr;
  iov.iov_len = nbytes;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  return (sendmsg(fd, &msg, 0));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<write_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %edi,%r12d
  mov    $0x4,%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <CMSG_SPACE@plt>
  mov    $0xc,%ecx
  mov    %rsp,%rsi
  movslq %eax,%rdx
  cmp    %rcx,%rdx
  cmovb  %rcx,%rdx
  add    $0x3,%rdx
  and    $0xfffffffffffffffc,%rdx
  add    $0xf,%rdx
  mov    %rdx,%rcx
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L21
L44:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L44
L21:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L20
L26:
  lea    -0x60(%rbp),%rsi
  mov    %rsp,-0x60(%rbp)
  mov    %rsi,%rdi
  mov    %rsi,-0x78(%rbp)
  mov    %eax,-0x58(%rbp)
  call   <CMSG_FIRSTHDR@plt>
  mov    $0x4,%edi
  mov    %rax,%r15
  call   <CMSG_LEN@plt>
  mov    %r15,%rdi
  mov    %eax,0x8(%r15)
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x4(%r15)
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,(%r15)
  call   <CMSG_DATA@plt>
  mov    -0x78(%rbp),%rsi
  xor    %edx,%edx
  mov    %r12d,%edi
  mov    %r14d,(%rax)
  lea    -0x70(%rbp),%rax
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x48(%rbp)
  mov    %r13,-0x68(%rbp)
  mov    %rbx,-0x70(%rbp)
  mov    %rax,-0x50(%rbp)
  movl   $0x1,-0x54(%rbp)
  call   <sendmsg@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L17
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L20:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L26
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd) {
  struct msghdr msg;
  struct iovec iov;
  union {
    struct cmsghdr cm;
    char control[CMSG_SPACE(sizeof(int))];
  } control_un;
  struct cmsghdr *cmptr;
  msg.msg_control = control_un.control;
  msg.msg_controllen = sizeof(control_un.control);
  cmptr = CMSG_FIRSTHDR(&msg);
  cmptr->cmsg_len = CMSG_LEN(sizeof(int));
  cmptr->cmsg_level = SOL_SOCKET;
  cmptr->cmsg_type = SCM_RIGHTS;
  *((int *)CMSG_DATA(cmptr)) = sendfd;
  msg.msg_name = NULL;
  msg.msg_namelen = 0;
  iov.iov_base = ptr;
  iov.iov_len = nbytes;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  return (sendmsg(fd, &msg, 0));
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<write_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %edi,%r12d
  mov    $0x4,%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <CMSG_SPACE@plt>
  mov    $0xc,%ecx
  mov    %rsp,%rsi
  movslq %eax,%rdx
  cmp    %rcx,%rdx
  cmovb  %rcx,%rdx
  add    $0x3,%rdx
  and    $0xfffffffffffffffc,%rdx
  add    $0xf,%rdx
  mov    %rdx,%rcx
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L30
L4:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L4
L30:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L23
L41:
  lea    -0x60(%rbp),%rsi
  mov    %rsp,-0x60(%rbp)
  mov    %rsi,%rdi
  mov    %rsi,-0x78(%rbp)
  mov    %eax,-0x58(%rbp)
  call   <CMSG_FIRSTHDR@plt>
  mov    $0x4,%edi
  mov    %rax,%r15
  call   <CMSG_LEN@plt>
  mov    D16(%rip),%rdx
  mov    %r15,%rdi
  mov    %eax,0x8(%r15)
  mov    D19(%rip),%rax
  movd   (%rdx),%xmm0
  mov    (%rax),%eax
  movd   %eax,%xmm1
  punpckldq %xmm1,%xmm0
  movq   %xmm0,(%r15)
  call   <CMSG_DATA@plt>
  mov    -0x78(%rbp),%rsi
  xor    %edx,%edx
  mov    %r12d,%edi
  mov    %r14d,(%rax)
  lea    -0x70(%rbp),%rax
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x48(%rbp)
  mov    %r13,-0x68(%rbp)
  mov    %rbx,-0x70(%rbp)
  mov    %rax,-0x50(%rbp)
  movl   $0x1,-0x54(%rbp)
  call   <sendmsg@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L23:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L41
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd) {
  struct msghdr msg;
  struct iovec iov;
  union {
    struct cmsghdr cm;
    char control[CMSG_SPACE(sizeof(int))];
  } control_un;
  struct cmsghdr *cmptr;
  msg.msg_control = control_un.control;
  msg.msg_controllen = sizeof(control_un.control);
  cmptr = CMSG_FIRSTHDR(&msg);
  cmptr->cmsg_len = CMSG_LEN(sizeof(int));
  cmptr->cmsg_level = SOL_SOCKET;
  cmptr->cmsg_type = SCM_RIGHTS;
  *((int *)CMSG_DATA(cmptr)) = sendfd;
  msg.msg_name = NULL;
  msg.msg_namelen = 0;
  iov.iov_base = ptr;
  iov.iov_len = nbytes;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  return (sendmsg(fd, &msg, 0));
}
```