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

```asm
<ipforest_strtol>:
  endbr64
  movl   $0x0,(%rdx)
  test   %rsi,%rsi
  je     L12
  mov    $0x1,%ecx
  xor    %r8d,%r8d
  jmp    L23
  nopl   0x0(%rax)
L26:
  movsbl %al,%eax
  lea    (%r8,%r8,4),%r8d
  mov    %ecx,(%rdx)
  lea    (%rax,%r8,2),%r8d
  lea    0x1(%rcx),%rax
  cmp    %rcx,%rsi
  je     L4
  mov    %rax,%rcx
L23:
  movzbl -0x1(%rdi,%rcx,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L26
  movl   $0xffffffff,(%rdx)
  xor    %r8d,%r8d
L4:
  mov    %r8d,%eax
  ret
L12:
  xor    %r8d,%r8d
  jmp    L4
```

assistant: ```c
int ipforest_strtol(const char *str, size_t len, ssize_t *plen) {
  int i, ret;
  *plen = 0;
  ret = 0;
  for (i = 0; i < len; i++) {
    if (str[i] <= '9' && str[i] >= '0') {
      ret = ret * 10 + (str[i] - '0');
      *plen += 1;
    } else {
      *plen = -1;
      return 0;
    }
  }
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<open_log_file>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  lea    D19(%rip),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D19
type_guessed: string
name: read_data
arguments: tag: D2
type_guessed: string

tool: D19: a+

tool: D2: /tmp/hwq.log

assistant: ```c
FILE *open_log_file() {
  FILE *fp = fopen("/tmp/hwq.log", "a+");
  return fp;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<open_log_file>:
  endbr64
  sub    $0x8,%rsp
  lea    D4(%rip),%rsi
  lea    D5(%rip),%rdi
  call   <fopen@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D4
data_type: string
name: retrieve_data
arguments: label: D5
data_type: string

tool: D4: a+

tool: D5: /tmp/hwq.log

assistant: ```c
FILE *open_log_file() {
  FILE *fp = fopen("/tmp/hwq.log", "a+");
  return fp;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<open_log_file>:
  endbr64
  lea    D2(%rip),%rsi
  lea    D8(%rip),%rdi
  jmp    1050 <fopen@plt>
```

tool_calls: name: unpack_data
arguments: label: D2
datatype: string
name: unpack_data
arguments: label: D8
datatype: string

tool: D2: a+

tool: D8: /tmp/hwq.log

assistant: ```c
FILE *open_log_file() {
  FILE *fp = fopen("/tmp/hwq.log", "a+");
  return fp;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<open_log_file>:
  endbr64
  lea    D18(%rip),%rsi
  lea    D1(%rip),%rdi
  jmp    1050 <fopen@plt>
```

tool_calls: name: unpack_data
arguments: label: D18
type: string
name: unpack_data
arguments: label: D1
type: string

tool: D18: a+

tool: D1: /tmp/hwq.log

assistant: ```c
FILE *open_log_file() {
  FILE *fp = fopen("/tmp/hwq.log", "a+");
  return fp;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<read_sysfs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x160,%rsp
  mov    %edi,-0x154(%rbp)
  mov    %rsi,-0x160(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L36
  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)
L36:
  mov    %fs:0x28,%rax
  mov    %rax,-0xb8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x140(%rbp)
  movq   $0x0,-0x138(%rbp)
  movq   $0x0,-0x130(%rbp)
  mov    -0x160(%rbp),%rdx
  mov    -0x144(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0x144(%rbp),%ecx
  mov    -0x160(%rbp),%rdx
  lea    -0x120(%rbp),%rax
  mov    $0x64,%esi
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    -0x144(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  lea    -0x120(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x128(%rbp)
  cmpq   $0x0,-0x128(%rbp)
  jne    L5
  cmpl   $0x0,-0x154(%rbp)
  je     L32
  lea    -0x120(%rbp),%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L32:
  mov    $0x0,%eax
  jmp    L13
L5:
  mov    -0x128(%rbp),%rdx
  lea    -0x138(%rbp),%rcx
  lea    -0x140(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <getline@plt>
  test   %rax,%rax
  jle    L16
  mov    -0x140(%rbp),%rax
  lea    -0x130(%rbp),%rdx
  lea    D18(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
L16:
  mov    -0x128(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x140(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x130(%rbp),%rax
L13:
  mov    -0xb8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D16
type_infered: string
name: read_data
arguments: data_tag: D0
type_infered: string
name: read_data
arguments: data_tag: D18
type_infered: string

tool: D16: r

tool: D0: missing %s


tool: D18: %lu

assistant: ```c
unsigned long read_sysfs(int warn, char *fmt, ...) {
  char *line = NULL;
  size_t linelen = 0;
  char buf[100];
  FILE *f;
  va_list ap;
  unsigned long val = 0;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof buf, fmt, ap);
  va_end(ap);
  f = fopen(buf, "r");
  if (!f) {
    if (warn)
      printf("missing %s\n", buf);
    return 0;
  }
  if (getline(&line, &linelen, f) > 0) {
    sscanf(line, "%lu", &val);
  }
  fclose(f);
  free(line);
  return val;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<read_sysfs>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  lea    0x20(%rsp),%r13
  mov    %ebp,%ecx
  mov    %rbx,%rdx
  mov    $0x64,%esi
  mov    %r13,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  lea    D16(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L43
  mov    %rax,%rbx
  lea    0x10(%rsp),%rsi
  lea    0x8(%rsp),%rdi
  mov    %rax,%rdx
  call   <getline@plt>
  test   %rax,%rax
  jg     L50
L51:
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
L1:
  mov    0x88(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L43:
  mov    $0x0,%eax
  test   %r12d,%r12d
  je     L1
  mov    %r13,%rsi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L1
L50:
  lea    0x18(%rsp),%rdx
  lea    D0(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <sscanf@plt>
  jmp    L51
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D16
type: string
name: read_data
arguments: tag: D4
type: string
name: read_data
arguments: tag: D0
type: string

tool: D16: r

tool: D4: missing %s


tool: D0: %lu

assistant: ```c
unsigned long read_sysfs(int warn, char *fmt, ...) {
  char *line = NULL;
  size_t linelen = 0;
  char buf[100];
  FILE *f;
  va_list ap;
  unsigned long val = 0;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof buf, fmt, ap);
  va_end(ap);
  f = fopen(buf, "r");
  if (!f) {
    if (warn)
      printf("missing %s\n", buf);
    return 0;
  }
  if (getline(&line, &linelen, f) > 0) {
    sscanf(line, "%lu", &val);
  }
  fclose(f);
  free(line);
  return val;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<read_sysfs>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %edi,%ebx
  mov    %ebp,%edi
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%r13
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  call   <va_start@plt>
  mov    $0x64,%esi
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    %r13,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  lea    D22(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L44
  lea    0x10(%rsp),%rsi
  lea    0x8(%rsp),%rdi
  mov    %rax,%rdx
  mov    %rax,%rbp
  call   <getline@plt>
  test   %rax,%rax
  jg     L40
L51:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%r12
L2:
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L49
  add    $0x98,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L40:
  mov    0x8(%rsp),%rdi
  lea    0x18(%rsp),%rdx
  lea    D27(%rip),%rsi
  call   <sscanf@plt>
  jmp    L51
L44:
  xor    %r12d,%r12d
  test   %ebx,%ebx
  je     L2
  mov    %r13,%rsi
  lea    D18(%rip),%rdi
  call   <printf@plt>
  jmp    L2
L49:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D22
type_infered: string
name: read_data
arguments: label: D27
type_infered: string
name: read_data
arguments: label: D18
type_infered: string

tool: D22: r

tool: D27: %lu

tool: D18: missing %s


assistant: ```c
unsigned long read_sysfs(int warn, char *fmt, ...) {
  char *line = NULL;
  size_t linelen = 0;
  char buf[100];
  FILE *f;
  va_list ap;
  unsigned long val = 0;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof buf, fmt, ap);
  va_end(ap);
  f = fopen(buf, "r");
  if (!f) {
    if (warn)
      printf("missing %s\n", buf);
    return 0;
  }
  if (getline(&line, &linelen, f) > 0) {
    sscanf(line, "%lu", &val);
  }
  fclose(f);
  free(line);
  return val;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<read_sysfs>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %edi,%ebx
  mov    %ebp,%edi
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%r13
  movq   $0x0,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  call   <va_start@plt>
  mov    $0x64,%esi
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    %r13,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  lea    D24(%rip),%rsi
  mov    %r13,%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L18
  lea    0x10(%rsp),%rsi
  lea    0x8(%rsp),%rdi
  mov    %rax,%rdx
  mov    %rax,%rbp
  call   <getline@plt>
  test   %rax,%rax
  jg     L3
L44:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%r12
L38:
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x98,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L3:
  mov    0x8(%rsp),%rdi
  lea    0x18(%rsp),%rdx
  lea    D9(%rip),%rsi
  call   <sscanf@plt>
  jmp    L44
L18:
  xor    %r12d,%r12d
  test   %ebx,%ebx
  je     L38
  mov    %r13,%rsi
  lea    D15(%rip),%rdi
  call   <printf@plt>
  jmp    L38
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D24
type: string
name: extract_symbolic_data
arguments: label: D9
type: string
name: extract_symbolic_data
arguments: label: D15
type: string

tool: D24: r

tool: D9: %lu

tool: D15: missing %s


assistant: ```c
unsigned long read_sysfs(int warn, char *fmt, ...) {
  char *line = NULL;
  size_t linelen = 0;
  char buf[100];
  FILE *f;
  va_list ap;
  unsigned long val = 0;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof buf, fmt, ap);
  va_end(ap);
  f = fopen(buf, "r");
  if (!f) {
    if (warn)
      printf("missing %s\n", buf);
    return 0;
  }
  if (getline(&line, &linelen, f) > 0) {
    sscanf(line, "%lu", &val);
  }
  fclose(f);
  free(line);
  return val;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<scan_statement_list_with_new_block>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    $0x0,%eax
  call   <make_new_block@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <scan_optimize_statement_list@plt>
  mov    %rax,-0x8(%rbp)
  mov    $0x0,%eax
  call   <delete_block@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
struct statement_list *scan_statement_list_with_new_block(struct statement_list *list) {
  make_new_block();
  list = scan_optimize_statement_list(list);
  delete_block();
  return list;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<scan_statement_list_with_new_block>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x0,%eax
  call   <make_new_block@plt>
  mov    %rbx,%rdi
  call   <scan_optimize_statement_list@plt>
  mov    %rax,%rbx
  mov    $0x0,%eax
  call   <delete_block@plt>
  mov    %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
struct statement_list *scan_statement_list_with_new_block(struct statement_list *list) {
  make_new_block();
  list = scan_optimize_statement_list(list);
  delete_block();
  return list;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<scan_statement_list_with_new_block>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %rdi,%r12
  call   <make_new_block@plt>
  mov    %r12,%rdi
  call   <scan_optimize_statement_list@plt>
  mov    %rax,%r12
  xor    %eax,%eax
  call   <delete_block@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
struct statement_list *scan_statement_list_with_new_block(struct statement_list *list) {
  make_new_block();
  list = scan_optimize_statement_list(list);
  delete_block();
  return list;
}
```
user: What is the c source code of the assembly code below:

```asm
<scan_statement_list_with_new_block>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %rdi,%r12
  call   <make_new_block@plt>
  mov    %r12,%rdi
  call   <scan_optimize_statement_list@plt>
  mov    %rax,%r12
  xor    %eax,%eax
  call   <delete_block@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
struct statement_list *scan_statement_list_with_new_block(struct statement_list *list) {
  make_new_block();
  list = scan_optimize_statement_list(list);
  delete_block();
  return list;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<buildMaxHeap>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  shr    %eax
  sub    $0x1,%eax
  mov    %eax,-0x4(%rbp)
L5:
  mov    -0x1c(%rbp),%edx
  mov    -0x4(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <maxHeapify@plt>
  subl   $0x1,-0x4(%rbp)
  jmp    L5
```

assistant: ```c
void buildMaxHeap(int *A, unsigned int length) {
  for (unsigned int i = length / 2 - 1; i >= 0; i--)
    maxHeapify(A, i, length);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<buildMaxHeap>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %esi,%ebp
  mov    %esi,%ebx
  shr    %ebx
  sub    $0x1,%ebx
L7:
  mov    %ebp,%edx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <maxHeapify@plt>
  sub    $0x1,%ebx
  jmp    L7
```

assistant: ```c
void buildMaxHeap(int *A, unsigned int length) {
  for (unsigned int i = length / 2 - 1; i >= 0; i--)
    maxHeapify(A, i, length);
}
```
user: Translate the below assembly code into C programming language:

```asm
<buildMaxHeap>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %esi,%ebx
  shr    %ebx
  sub    $0x1,%ebx
  nopl   0x0(%rax)
L6:
  mov    %ebx,%esi
  mov    %ebp,%edx
  mov    %r12,%rdi
  sub    $0x1,%ebx
  call   <maxHeapify@plt>
  jmp    L6
```

assistant: ```c
void buildMaxHeap(int *A, unsigned int length) {
  for (unsigned int i = length / 2 - 1; i >= 0; i--)
    maxHeapify(A, i, length);
}
```
user: What is the c source code of the assembly code below:

```asm
<buildMaxHeap>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %esi,%ebx
  shr    %ebx
  sub    $0x1,%ebx
  nopl   0x0(%rax)
L3:
  mov    %ebx,%esi
  mov    %ebp,%edx
  mov    %r12,%rdi
  sub    $0x1,%ebx
  call   <maxHeapify@plt>
  jmp    L3
```

assistant: ```c
void buildMaxHeap(int *A, unsigned int length) {
  for (unsigned int i = length / 2 - 1; i >= 0; i--)
    maxHeapify(A, i, length);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cras_recv_with_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x40,%rsp
  mov    %edi,%r12d
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %rcx,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  mov    $0x4,%edi
  call   <CMSG_SPACE@plt>
  movslq %eax,%rdx
  add    $0xf,%rdx
  mov    %rdx,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rdx
  mov    %rsp,%rcx
  sub    %rdx,%rcx
L71:
  cmp    %rcx,%rsp
  je     L13
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L71
L13:
  mov    %rsi,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L67
  orq    $0x0,-0x8(%rsp,%rdx,1)
L67:
  movl   $0xffffffff,(%rbx)
  lea    -0x60(%rbp),%rdx
  mov    %rdx,-0x38(%rbp)
  movl   $0x1,-0x50(%rbp)
  mov    %r14,-0x58(%rbp)
  mov    %r13,-0x60(%rbp)
  mov    %rsp,-0x48(%rbp)
  mov    %eax,-0x40(%rbp)
  lea    -0x50(%rbp),%rsi
  mov    $0x0,%edx
  mov    %r12d,%edi
  call   <recvmsg@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  js     L80
  lea    -0x50(%rbp),%rdi
  call   <CMSG_FIRSTHDR@plt>
  mov    %rax,%rsi
  test   %rax,%rax
  je     L80
  mov    D15(%rip),%r13
  jmp    L1
L17:
  lea    -0x50(%rbp),%rdi
  call   <CMSG_NXTHDR@plt>
  mov    %rax,%rsi
  test   %rax,%rax
  je     L80
L1:
  mov    0x0(%r13),%rax
  cmp    %rax,(%rsi)
  jne    L17
  mov    D12(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,0x8(%rsi)
  jne    L17
  mov    %rsi,%rdi
  call   <CMSG_DATA@plt>
  mov    %eax,%esi
  mov    $0x4,%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
L80:
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L36
  mov    %r12d,%eax
  lea    -0x20(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %rbp
  ret
L36:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cras_recv_with_fd(int sockfd, void *buf, size_t len, int *fd) {
  struct msghdr msg = {0};
  struct iovec iov;
  struct cmsghdr *cmsg;
  char control[CMSG_SPACE(sizeof(int))];
  int rc;
  *fd = -1;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  iov.iov_base = buf;
  iov.iov_len = len;
  msg.msg_control = control;
  msg.msg_controllen = sizeof(control);
  rc = recvmsg(sockfd, &msg, 0);
  if (rc < 0)
    return rc;
  for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
    if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
      memcpy(fd, CMSG_DATA(cmsg), sizeof(*fd));
      break;
    }
  }
  return rc;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<cras_recv_with_fd>:
  endbr64
  push   %rbp
  pxor   %xmm0,%xmm0
  mov    %rsp,%rbp
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edi,%r12d
  mov    $0x4,%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x30(%rbp)
  movaps %xmm0,-0x50(%rbp)
  movaps %xmm0,-0x40(%rbp)
  call   <CMSG_SPACE@plt>
  mov    %rsp,%rsi
  movslq %eax,%rdx
  add    $0xf,%rdx
  mov    %rdx,%rcx
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L0
L90:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L90
L0:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  jne    L107
L47:
  movl   $0xffffffff,0x0(%r13)
  lea    -0x60(%rbp),%rdx
  mov    %r12d,%edi
  mov    %rbx,-0x60(%rbp)
  lea    -0x50(%rbp),%rbx
  mov    %rdx,-0x38(%rbp)
  mov    %rbx,%rsi
  xor    %edx,%edx
  mov    %r14,-0x58(%rbp)
  movl   $0x1,-0x50(%rbp)
  mov    %rsp,-0x48(%rbp)
  mov    %eax,-0x40(%rbp)
  call   <recvmsg@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  js     L106
  mov    %rbx,%rdi
  call   <CMSG_FIRSTHDR@plt>
  mov    %rax,%rsi
  test   %rax,%rax
  je     L106
  mov    D14(%rip),%r12
  nopl   0x0(%rax,%rax,1)
L1:
  mov    (%r12),%rax
  cmp    %rax,(%rsi)
  jne    L20
  mov    D16(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,0x8(%rsi)
  je     L19
L20:
  mov    %rbx,%rdi
  call   <CMSG_NXTHDR@plt>
  mov    %rax,%rsi
  test   %rax,%rax
  jne    L1
L106:
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L14
  lea    -0x20(%rbp),%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L107:
  orq    $0x0,-0x8(%rsp,%rcx,1)
  jmp    L47
  nopl   0x0(%rax,%rax,1)
L19:
  mov    %rsi,%rdi
  call   <CMSG_DATA@plt>
  mov    $0x4,%edx
  mov    %r13,%rdi
  mov    %eax,%esi
  call   <memcpy@plt>
  jmp    L106
L14:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cras_recv_with_fd(int sockfd, void *buf, size_t len, int *fd) {
  struct msghdr msg = {0};
  struct iovec iov;
  struct cmsghdr *cmsg;
  char control[CMSG_SPACE(sizeof(int))];
  int rc;
  *fd = -1;
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  iov.iov_base = buf;
  iov.iov_len = len;
  msg.msg_control = control;
  msg.msg_controllen = sizeof(control);
  rc = recvmsg(sockfd, &msg, 0);
  if (rc < 0)
    return rc;
  for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
    if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
      memcpy(fd, CMSG_DATA(cmsg), sizeof(*fd));
      break;
    }
  }
  return rc;
}
```