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

```asm
<customPrint_nolf>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  mov    %ebp,%edi
  sub    $0x410,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <va_start@plt>
  mov    %r12,%rdx
  mov    $0x3ff,%esi
  mov    %ebp,%ecx
  mov    %r13,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r13,%rsi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    0x408(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x410,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D9
type: string

tool: D9: %s

assistant: ```c
int customPrint_nolf(const char *msg, ...) {
  va_list fmtargs;
  char buffer[1024];
  va_start(fmtargs, msg);
  vsnprintf(buffer, sizeof(buffer) - 1, msg, fmtargs);
  va_end(fmtargs);
  return printf("%s", buffer);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<customPrint_nolf>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  mov    %ebp,%edi
  sub    $0x410,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <va_start@plt>
  mov    %r12,%rdx
  mov    $0x3ff,%esi
  mov    %ebp,%ecx
  mov    %r13,%rdi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r13,%rsi
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    0x408(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x410,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D0
type_infered: string

tool: D0: %s

assistant: ```c
int customPrint_nolf(const char *msg, ...) {
  va_list fmtargs;
  char buffer[1024];
  va_start(fmtargs, msg);
  vsnprintf(buffer, sizeof(buffer) - 1, msg, fmtargs);
  va_end(fmtargs);
  return printf("%s", buffer);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L59
  lea    D49(%rip),%rax
  jmp    L9
L59:
  lea    D7(%rip),%rax
L9:
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L53
  lea    D49(%rip),%rax
  jmp    L31
L53:
  lea    D7(%rip),%rax
L31:
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movl   $0x8,-0xc(%rbp)
  cmpl   $0x8,-0xc(%rbp)
  jne    L18
  lea    D49(%rip),%rax
  jmp    L14
L18:
  lea    D7(%rip),%rax
L14:
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D49
data_type: string
name: extract_symbolic_data
arguments: tag: D7
data_type: string
name: extract_symbolic_data
arguments: tag: D2
data_type: string

tool: D49: null

tool: D7: valid

tool: D2: Got a %s pointer.


assistant: ```c
void main() {
  char *ptr;
  int ptr_len;
  printf("Got a %s pointer.\n", (ptr = (char *)malloc(0)) == NULL ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = strlen(ptr = (char *)malloc(0))) == 0 ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = sizeof(ptr = (char *)malloc(0))) == 8 ? "null" : "valid");
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x0,%edi
  call   <malloc@plt>
  test   %rax,%rax
  lea    D60(%rip),%rsi
  lea    D53(%rip),%rax
  cmovne %rax,%rsi
  lea    D67(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  lea    D60(%rip),%rsi
  lea    D53(%rip),%rax
  cmovne %rax,%rsi
  lea    D67(%rip),%rbx
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D60(%rip),%rsi
  mov    %rbx,%rdi
  call   <printf@plt>
  pop    %rbx
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D60
type_infered: string
name: parse_data
arguments: data_tag: D53
type_infered: string
name: parse_data
arguments: data_tag: D67
type_infered: string

tool: D60: null

tool: D53: valid

tool: D67: Got a %s pointer.


assistant: ```c
void main() {
  char *ptr;
  int ptr_len;
  printf("Got a %s pointer.\n", (ptr = (char *)malloc(0)) == NULL ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = strlen(ptr = (char *)malloc(0))) == 0 ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = sizeof(ptr = (char *)malloc(0))) == 8 ? "null" : "valid");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %r12
  xor    %edi,%edi
  lea    D18(%rip),%r12
  push   %rbp
  lea    D25(%rip),%rbp
  push   %rbx
  lea    D21(%rip),%rbx
  call   <malloc@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  test   %rax,%rax
  cmove  %r12,%rsi
  call   <printf@plt>
  xor    %edi,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  test   %eax,%eax
  cmove  %r12,%rbx
  mov    %rbx,%rsi
  call   <printf@plt>
  pop    %rbx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <printf@plt>
```

tool_calls: name: read_data
arguments: data_tag: D18
type_guessed: string
name: read_data
arguments: data_tag: D25
type_guessed: string
name: read_data
arguments: data_tag: D21
type_guessed: string

tool: D18: null

tool: D25: Got a %s pointer.


tool: D21: valid

assistant: ```c
void main() {
  char *ptr;
  int ptr_len;
  printf("Got a %s pointer.\n", (ptr = (char *)malloc(0)) == NULL ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = strlen(ptr = (char *)malloc(0))) == 0 ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = sizeof(ptr = (char *)malloc(0))) == 8 ? "null" : "valid");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r12
  xor    %edi,%edi
  lea    D25(%rip),%r12
  push   %rbp
  lea    D13(%rip),%rbp
  push   %rbx
  lea    D3(%rip),%rbx
  call   <malloc@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  test   %rax,%rax
  cmove  %r12,%rsi
  call   <printf@plt>
  xor    %edi,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  test   %eax,%eax
  cmove  %r12,%rbx
  mov    %rbx,%rsi
  call   <printf@plt>
  pop    %rbx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <printf@plt>
```

tool_calls: name: unpack_data
arguments: tag: D25
type_guessed: string
name: unpack_data
arguments: tag: D13
type_guessed: string
name: unpack_data
arguments: tag: D3
type_guessed: string

tool: D25: null

tool: D13: Got a %s pointer.


tool: D3: valid

assistant: ```c
void main() {
  char *ptr;
  int ptr_len;
  printf("Got a %s pointer.\n", (ptr = (char *)malloc(0)) == NULL ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = strlen(ptr = (char *)malloc(0))) == 0 ? "null" : "valid");
  printf("Got a %s pointer.\n", (ptr_len = sizeof(ptr = (char *)malloc(0))) == 8 ? "null" : "valid");
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x22,-0x8(%rbp)
  movss  D35(%rip),%xmm0
  movss  %xmm0,-0x4(%rbp)
  movb   $0x41,-0x9(%rbp)
  mov    -0x8(%rbp),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movss  -0x4(%rbp),%xmm0
  cvttss2si %xmm0,%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movsbl -0x9(%rbp),%eax
  mov    %eax,%esi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D35
data_type: f32
name: read_data
arguments: data_tag: D33
data_type: string
name: read_data
arguments: data_tag: D34
data_type: string
name: read_data
arguments: data_tag: D11
data_type: string

tool: D35: 56.7

tool: D33: The value of x=%d 


tool: D34: The value of y=%f 


tool: D11: The value of z=%c 


assistant: ```c
main() {
  int x = 34;
  float y = 56.7;
  char z = 'A';
  printf("The value of "
         "x"
         "="
         "%d"
         " \n",
         x);
  printf("The value of "
         "y"
         "="
         "%f"
         " \n",
         y);
  printf("The value of "
         "z"
         "="
         "%c"
         " \n",
         z);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x22,%esi
  lea    D25(%rip),%rdi
  call   <printf@plt>
  mov    $0x38,%esi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    $0x41,%esi
  lea    D6(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D25
type: string
name: extract_symbolic_data
arguments: tag: D9
type: string
name: extract_symbolic_data
arguments: tag: D6
type: string

tool: D25: The value of x=%d 


tool: D9: The value of y=%f 


tool: D6: The value of z=%c 


assistant: ```c
main() {
  int x = 34;
  float y = 56.7;
  char z = 'A';
  printf("The value of "
         "x"
         "="
         "%d"
         " \n",
         x);
  printf("The value of "
         "y"
         "="
         "%f"
         " \n",
         y);
  printf("The value of "
         "z"
         "="
         "%c"
         " \n",
         z);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x22,%esi
  lea    D13(%rip),%rdi
  call   <printf@plt>
  mov    $0x38,%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  mov    $0x41,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: label: D13
type_infered: string
name: read_data
arguments: label: D1
type_infered: string
name: read_data
arguments: label: D4
type_infered: string

tool: D13: The value of x=%d 


tool: D1: The value of y=%f 


tool: D4: The value of z=%c 


assistant: ```c
main() {
  int x = 34;
  float y = 56.7;
  char z = 'A';
  printf("The value of "
         "x"
         "="
         "%d"
         " \n",
         x);
  printf("The value of "
         "y"
         "="
         "%f"
         " \n",
         y);
  printf("The value of "
         "z"
         "="
         "%c"
         " \n",
         z);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x22,%esi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    $0x38,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    $0x41,%esi
  lea    D28(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D9
type: string
name: disassemble_data
arguments: label: D4
type: string
name: disassemble_data
arguments: label: D28
type: string

tool: D9: The value of x=%d 


tool: D4: The value of y=%f 


tool: D28: The value of z=%c 


assistant: ```c
main() {
  int x = 34;
  float y = 56.7;
  char z = 'A';
  printf("The value of "
         "x"
         "="
         "%d"
         " \n",
         x);
  printf("The value of "
         "y"
         "="
         "%f"
         " \n",
         y);
  printf("The value of "
         "z"
         "="
         "%c"
         " \n",
         z);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ipf_para>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <write_break@plt>
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <write_line@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_label: D3
type: string

tool: D3: :p.

assistant: ```c
void ipf_para(void) {
  write_break();
  write_line(":p.");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ipf_para>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <write_break@plt>
  lea    D0(%rip),%rdi
  call   <write_line@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: label: D0
type_infered: string

tool: D0: :p.

assistant: ```c
void ipf_para(void) {
  write_break();
  write_line(":p.");
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<ipf_para>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <write_break@plt>
  lea    D5(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <write_line@plt>
```

tool_calls: name: read_data
arguments: data_tag: D5
type_infered: string

tool: D5: :p.

assistant: ```c
void ipf_para(void) {
  write_break();
  write_line(":p.");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ipf_para>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <write_break@plt>
  lea    D0(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <write_line@plt>
```

tool_calls: name: read_data
arguments: data_tag: D0
datatype: string

tool: D0: :p.

assistant: ```c
void ipf_para(void) {
  write_break();
  write_line(":p.");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<mid_pred>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jle    L28
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jle    L73
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L25
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L73
L25:
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L73
L28:
  mov    -0x8(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jle    L73
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L11
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L73
L11:
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
L73:
  mov    -0x8(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int mid_pred(int a, int b, int c) {
  if (a > b) {
    if (c > b) {
      if (c > a)
        b = a;
      else
        b = c;
    }
  } else {
    if (b > c) {
      if (c > a)
        b = c;
      else
        b = a;
    }
  }
  return b;
}
```
user: Translate the below assembly code into C programming language:

```asm
<mid_pred>:
  endbr64
  mov    %esi,%eax
  cmp    %esi,%edi
  jle    L4
  cmp    %edx,%edi
  cmovg  %edx,%edi
  cmp    %edx,%esi
  cmovl  %edi,%eax
  ret
L4:
  cmp    %edx,%edi
  cmovl  %edx,%edi
  cmp    %edx,%esi
  cmovg  %edi,%eax
  ret
```

assistant: ```c
int mid_pred(int a, int b, int c) {
  if (a > b) {
    if (c > b) {
      if (c > a)
        b = a;
      else
        b = c;
    }
  } else {
    if (b > c) {
      if (c > a)
        b = c;
      else
        b = a;
    }
  }
  return b;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mid_pred>:
  endbr64
  mov    %esi,%eax
  cmp    %esi,%edi
  jle    L1
  cmp    %edx,%edi
  cmovg  %edx,%edi
  cmp    %edx,%esi
  cmovl  %edi,%eax
  ret
  nopl   (%rax)
L1:
  cmp    %edx,%edi
  cmovl  %edx,%edi
  cmp    %edx,%esi
  cmovg  %edi,%eax
  ret
```

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

```asm
<mid_pred>:
  endbr64
  mov    %esi,%eax
  cmp    %esi,%edi
  jle    L5
  cmp    %edx,%edi
  cmovg  %edx,%edi
  cmp    %edx,%esi
  cmovl  %edi,%eax
  ret
  nopl   (%rax)
L5:
  cmp    %edx,%edi
  cmovl  %edx,%edi
  cmp    %edx,%esi
  cmovg  %edi,%eax
  ret
```

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

```asm
<f>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  setne  %al
  mov    %al,-0x5(%rbp)
  movzbl -0x5(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <g@plt>
  cmpl   $0x0,-0x4(%rbp)
  je     L26
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <g@plt>
  jmp    L17
L26:
  cmpb   $0x0,-0x5(%rbp)
  je     L16
  mov    $0x0,%eax
  call   <link_error@plt>
L16:
  mov    $0x0,%eax
L17:
  leave
  ret
```

assistant: ```c
int f(int sum) {
  _Bool c = sum != 0;
  int d = c;
  g(d);
  if (d != 0)
    return 0 + g(0);
  if (c != 0)
    link_error();
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<f>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  test   %edi,%edi
  setne  %dil
  movzbl %dil,%edi
  mov    $0x0,%eax
  call   <g@plt>
  test   %ebx,%ebx
  jne    L2
L19:
  mov    %ebx,%eax
  pop    %rbx
  ret
L2:
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <g@plt>
  mov    %eax,%ebx
  jmp    L19
```

assistant: ```c
int f(int sum) {
  _Bool c = sum != 0;
  int d = c;
  g(d);
  if (d != 0)
    return 0 + g(0);
  if (c != 0)
    link_error();
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<f>:
  endbr64
  test   %edi,%edi
  push   %rbx
  mov    %edi,%ebx
  setne  %dil
  xor    %eax,%eax
  movzbl %dil,%edi
  call   <g@plt>
  test   %ebx,%ebx
  jne    L2
  xor    %eax,%eax
  pop    %rbx
  ret
L2:
  xor    %edi,%edi
  xor    %eax,%eax
  pop    %rbx
  jmp    1050 <g@plt>
```

assistant: ```c
int f(int sum) {
  _Bool c = sum != 0;
  int d = c;
  g(d);
  if (d != 0)
    return 0 + g(0);
  if (c != 0)
    link_error();
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<f>:
  endbr64
  test   %edi,%edi
  push   %rbx
  mov    %edi,%ebx
  setne  %dil
  xor    %eax,%eax
  movzbl %dil,%edi
  call   <g@plt>
  test   %ebx,%ebx
  jne    L9
  xor    %eax,%eax
  pop    %rbx
  ret
L9:
  xor    %edi,%edi
  xor    %eax,%eax
  pop    %rbx
  jmp    1050 <g@plt>
```

assistant: ```c
int f(int sum) {
  _Bool c = sum != 0;
  int d = c;
  g(d);
  if (d != 0)
    return 0 + g(0);
  if (c != 0)
    link_error();
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<mounted>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x160,%rsp
  mov    %rdi,-0x158(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x130(%rbp),%rdx
  mov    -0x158(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L91
  mov    -0x158(%rbp),%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <weprintf@plt>
  mov    $0x0,%eax
  jmp    L49
L91:
  lea    D22(%rip),%rax
  mov    %rax,%rsi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <setmntent@plt>
  mov    %rax,-0x140(%rbp)
  cmpq   $0x0,-0x140(%rbp)
  jne    L45
  lea    D3(%rip),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <eprintf@plt>
  jmp    L45
L64:
  mov    -0x138(%rbp),%rax
  mov    (%rax),%rax
  lea    -0x120(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L101
  mov    -0x138(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <weprintf@plt>
  jmp    L45
L101:
  mov    -0x130(%rbp),%rdx
  mov    -0x120(%rbp),%rax
  cmp    %rax,%rdx
  jne    L45
  mov    -0x128(%rbp),%rdx
  mov    -0x118(%rbp),%rax
  cmp    %rax,%rdx
  jne    L45
  mov    $0x1,%eax
  jmp    L49
L45:
  lea    -0x110(%rbp),%rdx
  lea    -0x148(%rbp),%rsi
  mov    -0x140(%rbp),%rax
  mov    $0x100,%ecx
  mov    %rax,%rdi
  call   <getmntent_r@plt>
  mov    %rax,-0x138(%rbp)
  cmpq   $0x0,-0x138(%rbp)
  jne    L64
  mov    -0x140(%rbp),%rax
  mov    %rax,%rdi
  call   <endmntent@plt>
  mov    $0x0,%eax
L49:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L53
  call   <__stack_chk_fail@plt>
L53:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D0
type_infered: string
name: unpack_data
arguments: tag: D22
type_infered: string
name: unpack_data
arguments: tag: D3
type_infered: string
name: unpack_data
arguments: tag: D35
type_infered: string

tool: D0: stat %s:

tool: D22: r

tool: D3: /proc/mounts

tool: D35: setmntent %s:

assistant: ```c
int mounted(const char *dir) {
  FILE *fp;
  struct mntent *me, mebuf;
  struct stat st1, st2;
  char linebuf[256];
  if (stat(dir, &st1) < 0) {
    weprintf("stat %s:", dir);
    return 0;
  }
  if (!(fp = setmntent("/proc/mounts", "r")))
    eprintf("setmntent %s:", "/proc/mounts");
  while ((me = getmntent_r(fp, &mebuf, linebuf, sizeof(linebuf)))) {
    if (stat(me->mnt_dir, &st2) < 0) {
      weprintf("stat %s:", me->mnt_dir);
      continue;
    }
    if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
      return 1;
  }
  endmntent(fp);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<mounted>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x140,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  call   <stat@plt>
  test   %rax,%rax
  js     L89
  lea    D7(%rip),%rsi
  lea    D40(%rip),%rdi
  call   <setmntent@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L90
L77:
  lea    D27(%rip),%r12
  jmp    L21
L89:
  mov    %rbx,%rsi
  lea    D27(%rip),%rdi
  call   <weprintf@plt>
  mov    $0x0,%eax
  jmp    L65
L90:
  lea    D40(%rip),%rsi
  lea    D32(%rip),%rdi
  call   <eprintf@plt>
  jmp    L77
L93:
  mov    (%rbx),%rsi
  mov    %r12,%rdi
  call   <weprintf@plt>
L21:
  lea    0x30(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  mov    $0x100,%ecx
  mov    %rbp,%rdi
  call   <getmntent_r@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L25
  lea    0x20(%rsp),%rsi
  mov    (%rbx),%rdi
  call   <stat@plt>
  test   %rax,%rax
  js     L93
  mov    0x20(%rsp),%rax
  cmp    %rax,0x10(%rsp)
  jne    L21
  mov    0x28(%rsp),%rax
  cmp    %rax,0x18(%rsp)
  jne    L21
  mov    $0x1,%eax
  jmp    L65
L25:
  mov    %rbp,%rdi
  call   <endmntent@plt>
  mov    $0x0,%eax
L65:
  mov    0x138(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x140,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D7
data_type: string
name: unpack_data
arguments: label: D40
data_type: string
name: unpack_data
arguments: label: D27
data_type: string
name: unpack_data
arguments: label: D32
data_type: string

tool: D7: r

tool: D40: /proc/mounts

tool: D27: stat %s:

tool: D32: setmntent %s:

assistant: ```c
int mounted(const char *dir) {
  FILE *fp;
  struct mntent *me, mebuf;
  struct stat st1, st2;
  char linebuf[256];
  if (stat(dir, &st1) < 0) {
    weprintf("stat %s:", dir);
    return 0;
  }
  if (!(fp = setmntent("/proc/mounts", "r")))
    eprintf("setmntent %s:", "/proc/mounts");
  while ((me = getmntent_r(fp, &mebuf, linebuf, sizeof(linebuf)))) {
    if (stat(me->mnt_dir, &st2) < 0) {
      weprintf("stat %s:", me->mnt_dir);
      continue;
    }
    if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
      return 1;
  }
  endmntent(fp);
  return 0;
}
```