ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码：

```asm
<htfind>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,(%rsp)
  mov    %rsi,0x8(%rsp)
  test   %rdi,%rdi
  je     L48
  mov    %rsi,%r14
  mov    %rdx,%r12
  call   <malloc_usable_size@plt>
  movslq %eax,%rbx
  add    $0x7,%r12
  and    $0xfffffffffffffff8,%r12
  add    $0x8,%r12
  mov    %rbx,%rax
  mov    $0x0,%edx
  div    %r12
  mov    %rax,%r15
  mov    %rax,%r13
  mov    %r14,%rdi
  call   <strhash@plt>
  mov    %rax,%r14
  cmp    %r12,%rbx
  jb     L88
  mov    $0x0,%ebp
  jmp    L80
L40:
  add    $0x5,%rbp
  cmp    %rbp,%r15
  jbe    L66
L80:
  lea    (%r14,%rbp,1),%rax
  mov    $0x0,%edx
  div    %r13
  imul   %r12,%rdx
  mov    (%rsp),%rax
  lea    (%rax,%rdx,1),%rbx
  mov    (%rbx),%rsi
  test   %rsi,%rsi
  je     L40
  mov    0x8(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L40
  jmp    L86
L66:
  mov    $0x0,%ebx
L86:
  mov    %rbx,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L48:
  mov    (%rsp),%rbx
  jmp    L86
L88:
  mov    $0x0,%ebx
  jmp    L86
```

assistant: ```c
void *htfind(void *table, const char *key, size_t size) {
  size_t i, index, hash, cap;
  void *slot;
  if (!table)
    return NULL;
  cap = (malloc_usable_size(table) / (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
  hash = strhash(key);
  for (i = 0; i < cap; i += (5)) {
    index = (hash + i) % cap;
    slot = ((table) + index * (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
    if ((*(const char **)((slot) + 0)) && strcmp(key, (*(const char **)((slot) + 0))) == 0)
      return slot;
  }
  return NULL;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<htfind>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L24
  mov    %rdx,%rbx
  mov    %rsi,%rbp
  mov    %rdi,%r15
  call   <malloc_usable_size@plt>
  add    $0x7,%rbx
  xor    %edx,%edx
  mov    %rbp,%rdi
  and    $0xfffffffffffffff8,%rbx
  movslq %eax,%r12
  lea    0x8(%rbx),%r13
  mov    %r12,%rax
  div    %r13
  mov    %r13,0x8(%rsp)
  mov    %rax,%r14
  call   <strhash@plt>
  mov    %rax,%rbx
  cmp    %r13,%r12
  jb     L24
  xor    %r13d,%r13d
  nopw   0x0(%rax,%rax,1)
L7:
  lea    (%rbx,%r13,1),%rax
  xor    %edx,%edx
  div    %r14
  imul   0x8(%rsp),%rdx
  lea    (%r15,%rdx,1),%r12
  mov    (%r12),%rsi
  test   %rsi,%rsi
  je     L43
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L36
L43:
  add    $0x5,%r13
  cmp    %r13,%r14
  ja     L7
L24:
  xor    %r12d,%r12d
L36:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void *htfind(void *table, const char *key, size_t size) {
  size_t i, index, hash, cap;
  void *slot;
  if (!table)
    return NULL;
  cap = (malloc_usable_size(table) / (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
  hash = strhash(key);
  for (i = 0; i < cap; i += (5)) {
    index = (hash + i) % cap;
    slot = ((table) + index * (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
    if ((*(const char **)((slot) + 0)) && strcmp(key, (*(const char **)((slot) + 0))) == 0)
      return slot;
  }
  return NULL;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<htfind>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  je     L14
  mov    %rdx,%rbx
  mov    %rsi,%rbp
  mov    %rdi,%r15
  call   <malloc_usable_size@plt>
  add    $0x7,%rbx
  xor    %edx,%edx
  mov    %rbp,%rdi
  and    $0xfffffffffffffff8,%rbx
  movslq %eax,%r12
  lea    0x8(%rbx),%r13
  mov    %r12,%rax
  div    %r13
  mov    %r13,0x8(%rsp)
  mov    %rax,%r14
  call   <strhash@plt>
  mov    %rax,%rbx
  cmp    %r13,%r12
  jb     L14
  xor    %r13d,%r13d
  nopw   0x0(%rax,%rax,1)
L6:
  lea    (%rbx,%r13,1),%rax
  xor    %edx,%edx
  div    %r14
  imul   0x8(%rsp),%rdx
  lea    (%r15,%rdx,1),%r12
  mov    (%r12),%rsi
  test   %rsi,%rsi
  je     L19
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L18
L19:
  add    $0x5,%r13
  cmp    %r13,%r14
  ja     L6
L14:
  xor    %r12d,%r12d
L18:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void *htfind(void *table, const char *key, size_t size) {
  size_t i, index, hash, cap;
  void *slot;
  if (!table)
    return NULL;
  cap = (malloc_usable_size(table) / (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
  hash = strhash(key);
  for (i = 0; i < cap; i += (5)) {
    index = (hash + i) % cap;
    slot = ((table) + index * (sizeof(const char *) + (((size) + ((sizeof(void *)) - 1)) & ~((sizeof(void *)) - 1))));
    if ((*(const char **)((slot) + 0)) && strcmp(key, (*(const char **)((slot) + 0))) == 0)
      return slot;
  }
  return NULL;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<disable_flow_control>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <tcgetattr@plt>
  mov    -0xc(%rbp),%edx
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    D17(%rip),%rax
  mov    (%rax),%eax
  lea    -0xc(%rbp),%rdx
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <tcsetattr@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  ret
```

assistant: ```c
void disable_flow_control(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_iflag &= ~IXON;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<disable_flow_control>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <tcgetattr@plt>
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  not    %eax
  and    %eax,0x4(%rsp)
  mov    %rbx,%rdx
  mov    D3(%rip),%rax
  mov    (%rax),%esi
  mov    $0x0,%edi
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x10,%rsp
  pop    %rbx
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_flow_control(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_iflag &= ~IXON;
  tcsetattr(0, TCSANOW, &term);
}
```
user: What is the c source code of the assembly code below?

```asm
<disable_flow_control>:
  endbr64
  push   %r12
  xor    %edi,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  call   <tcgetattr@plt>
  mov    D17(%rip),%rax
  xor    %edi,%edi
  mov    %r12,%rdx
  mov    (%rax),%eax
  not    %eax
  and    %eax,0x4(%rsp)
  mov    D18(%rip),%rax
  mov    (%rax),%esi
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x10,%rsp
  pop    %r12
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_flow_control(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_iflag &= ~IXON;
  tcsetattr(0, TCSANOW, &term);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<disable_flow_control>:
  endbr64
  push   %r12
  xor    %edi,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  call   <tcgetattr@plt>
  mov    D0(%rip),%rax
  xor    %edi,%edi
  mov    %r12,%rdx
  mov    (%rax),%eax
  not    %eax
  and    %eax,0x4(%rsp)
  mov    D8(%rip),%rax
  mov    (%rax),%esi
  call   <tcsetattr@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x10,%rsp
  pop    %r12
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void disable_flow_control(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_iflag &= ~IXON;
  tcsetattr(0, TCSANOW, &term);
}
```
user: Translate the below assembly code into C programming language:

```asm
<remove_old>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_old_pairs@plt>
  nop
  leave
  ret
```

assistant: ```c
void remove_old(long long time_stamp) {
  if (0) {
    sniffer_trace("ENTERING: remove_old");
  }
  remove_old_pairs(time_stamp);
  if (0) {
    sniffer_trace("LEAVING: remove_old");
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<remove_old>:
  endbr64
  sub    $0x8,%rsp
  call   <remove_old_pairs@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void remove_old(long long time_stamp) {
  if (0) {
    sniffer_trace("ENTERING: remove_old");
  }
  remove_old_pairs(time_stamp);
  if (0) {
    sniffer_trace("LEAVING: remove_old");
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<remove_old>:
  endbr64
  jmp    1050 <remove_old_pairs@plt>
```

assistant: ```c
void remove_old(long long time_stamp) {
  if (0) {
    sniffer_trace("ENTERING: remove_old");
  }
  remove_old_pairs(time_stamp);
  if (0) {
    sniffer_trace("LEAVING: remove_old");
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<remove_old>:
  endbr64
  jmp    1050 <remove_old_pairs@plt>
```

assistant: ```c
void remove_old(long long time_stamp) {
  if (0) {
    sniffer_trace("ENTERING: remove_old");
  }
  remove_old_pairs(time_stamp);
  if (0) {
    sniffer_trace("LEAVING: remove_old");
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  and    $0xfffffffffffffff0,%rsp
  mov    $0x2a,%edi
  call   <_Exit@plt>
```

assistant: ```c
int main(int artc, char *argv[]) {
  asm volatile("andq  $0xfffffffffffffff0, %rsp\n");
  _Exit(42);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  and    $0xfffffffffffffff0,%rsp
  mov    $0x2a,%edi
  call   <_Exit@plt>
```

assistant: ```c
int main(int artc, char *argv[]) {
  asm volatile("andq  $0xfffffffffffffff0, %rsp\n");
  _Exit(42);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  and    $0xfffffffffffffff0,%rsp
  mov    $0x2a,%edi
  call   <_Exit@plt>
```

assistant: ```c
int main(int artc, char *argv[]) {
  asm volatile("andq  $0xfffffffffffffff0, %rsp\n");
  _Exit(42);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  and    $0xfffffffffffffff0,%rsp
  mov    $0x2a,%edi
  call   <_Exit@plt>
```

assistant: ```c
int main(int artc, char *argv[]) {
  asm volatile("andq  $0xfffffffffffffff0, %rsp\n");
  _Exit(42);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<__assert>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,-0x8(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L8
  mov    -0x10(%rbp),%rcx
  mov    -0x8(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <FAIL@plt>
L8:
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D7
datatype: string

tool: D7: %s:%d %s

assistant: ```c
void __assert(int x, char *ln, char *file, int line) {
  if (!x) {
    FAIL("%s:%d %s", file, line, ln);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<__assert>:
  endbr64
  test   %edi,%edi
  je     L4
  ret
L4:
  sub    $0x8,%rsp
  mov    %rsi,%rax
  mov    %rdx,%rsi
  mov    %ecx,%edx
  mov    %rax,%rcx
  lea    D6(%rip),%rdi
  call   <FAIL@plt>
  add    $0x8,%rsp
  ret
```

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

tool: D6: %s:%d %s

assistant: ```c
void __assert(int x, char *ln, char *file, int line) {
  if (!x) {
    FAIL("%s:%d %s", file, line, ln);
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<__assert>:
  endbr64
  mov    %rsi,%r8
  mov    %rdx,%rsi
  mov    %ecx,%edx
  test   %edi,%edi
  je     L6
  ret
  nopl   0x0(%rax)
L6:
  mov    %r8,%rcx
  lea    D1(%rip),%rdi
  jmp    1050 <FAIL@plt>
```

tool_calls: name: parse_data
arguments: tag: D1
type_guessed: string

tool: D1: %s:%d %s

assistant: ```c
void __assert(int x, char *ln, char *file, int line) {
  if (!x) {
    FAIL("%s:%d %s", file, line, ln);
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<__assert>:
  endbr64
  mov    %rsi,%r8
  mov    %rdx,%rsi
  mov    %ecx,%edx
  test   %edi,%edi
  je     L6
  ret
  nopl   0x0(%rax)
L6:
  mov    %r8,%rcx
  lea    D1(%rip),%rdi
  jmp    1050 <FAIL@plt>
```

tool_calls: name: parse_data
arguments: data_label: D1
type_guessed: string

tool: D1: %s:%d %s

assistant: ```c
void __assert(int x, char *ln, char *file, int line) {
  if (!x) {
    FAIL("%s:%d %s", file, line, ln);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<makethread>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x14(%rbp),%rax
  mov    %rax,%rdi
  call   <pthread_attr_init@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L24
  mov    -0xc(%rbp),%eax
  jmp    L51
L24:
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  lea    -0x14(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <pthread_attr_setdetachstate@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L37
  mov    -0xc(%rbp),%eax
  jmp    L51
L37:
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  lea    -0x14(%rbp),%rsi
  lea    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <pthread_create@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L46
  mov    -0xc(%rbp),%eax
  jmp    L51
L46:
  lea    -0x14(%rbp),%rax
  mov    %rax,%rdi
  call   <pthread_attr_destroy@plt>
  mov    $0x0,%eax
L51:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L58
  call   <__stack_chk_fail@plt>
L58:
  leave
  ret
```

assistant: ```c
int makethread(void *(*thr_fn)(void *), void *arg) {
  pthread_attr_t attr;
  pthread_t tid;
  int err;
  err = pthread_attr_init(&attr);
  if (err)
    return err;
  err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  if (err)
    return err;
  err = pthread_create(&tid, &attr, thr_fn, arg);
  if (err)
    return err;
  pthread_attr_destroy(&attr);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<makethread>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <pthread_attr_init@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L48
L27:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  mov    %ebx,%eax
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L48:
  mov    %rsp,%rdi
  mov    D6(%rip),%rax
  mov    (%rax),%esi
  call   <pthread_attr_setdetachstate@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L27
  mov    %rsp,%rsi
  lea    0x4(%rsp),%rdi
  mov    %r12,%rcx
  mov    %rbp,%rdx
  call   <pthread_create@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L27
  mov    %rsp,%rdi
  call   <pthread_attr_destroy@plt>
  jmp    L27
L29:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int makethread(void *(*thr_fn)(void *), void *arg) {
  pthread_attr_t attr;
  pthread_t tid;
  int err;
  err = pthread_attr_init(&attr);
  if (err)
    return err;
  err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  if (err)
    return err;
  err = pthread_create(&tid, &attr, thr_fn, arg);
  if (err)
    return err;
  pthread_attr_destroy(&attr);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<makethread>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  call   <pthread_attr_init@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L2
L16:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  cs nopw 0x0(%rax,%rax,1)
L2:
  mov    D8(%rip),%rax
  mov    %rbp,%rdi
  mov    (%rax),%esi
  call   <pthread_attr_setdetachstate@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L16
  lea    0x4(%rsp),%rdi
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  call   <pthread_create@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L16
  mov    %rbp,%rdi
  call   <pthread_attr_destroy@plt>
  jmp    L16
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int makethread(void *(*thr_fn)(void *), void *arg) {
  pthread_attr_t attr;
  pthread_t tid;
  int err;
  err = pthread_attr_init(&attr);
  if (err)
    return err;
  err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  if (err)
    return err;
  err = pthread_create(&tid, &attr, thr_fn, arg);
  if (err)
    return err;
  pthread_attr_destroy(&attr);
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<makethread>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  call   <pthread_attr_init@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L49
L34:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L28
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  cs nopw 0x0(%rax,%rax,1)
L49:
  mov    D1(%rip),%rax
  mov    %rbp,%rdi
  mov    (%rax),%esi
  call   <pthread_attr_setdetachstate@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L34
  lea    0x4(%rsp),%rdi
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  call   <pthread_create@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L34
  mov    %rbp,%rdi
  call   <pthread_attr_destroy@plt>
  jmp    L34
L28:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int makethread(void *(*thr_fn)(void *), void *arg) {
  pthread_attr_t attr;
  pthread_t tid;
  int err;
  err = pthread_attr_init(&attr);
  if (err)
    return err;
  err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  if (err)
    return err;
  err = pthread_create(&tid, &attr, thr_fn, arg);
  if (err)
    return err;
  pthread_attr_destroy(&attr);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<printf_d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L35
  mov    $0x2d,%edi
  call   <printf_c@plt>
  negl   -0x34(%rbp)
  jmp    L35
L55:
  mov    -0x34(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %ecx,%eax
  lea    0x30(%rax),%ecx
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x34(%rbp)
L35:
  cmpl   $0x0,-0x34(%rbp)
  jg     L55
  lea    -0x20(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  je     L55
  jmp    L64
L53:
  subq   $0x1,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <printf_c@plt>
L64:
  lea    -0x20(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  jne    L53
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L26
  call   <__stack_chk_fail@plt>
L26:
  leave
  ret
```

assistant: ```c
void printf_d(int i) {
  char buf[16];
  char *p = buf;
  if (i < 0) {
    printf_c('-');
    i *= -1;
  }
  while (i > 0 || p == buf) {
    *(p++) = (char)('0' + (i % 10));
    i /= 10;
  }
  while (p != buf) {
    printf_c(*(--p));
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<printf_d>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L21
L7:
  mov    %rsp,%rbx
  mov    %rsp,%rsi
L14:
  add    $0x1,%rbx
  movslq %ebp,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %ebp,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%ecx
  add    %ecx,%ecx
  mov    %ebp,%edx
  sub    %ecx,%edx
  add    $0x30,%edx
  mov    %dl,-0x1(%rbx)
  mov    %ebp,%edx
  mov    %eax,%ebp
  cmp    %rsi,%rbx
  je     L14
  cmp    $0x9,%edx
  jg     L14
  mov    %rsp,%rbp
L55:
  sub    $0x1,%rbx
  movsbl (%rbx),%edi
  call   <printf_c@plt>
  cmp    %rbp,%rbx
  jne    L55
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  ret
L21:
  mov    $0x2d,%edi
  call   <printf_c@plt>
  neg    %ebp
  jmp    L7
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void printf_d(int i) {
  char buf[16];
  char *p = buf;
  if (i < 0) {
    printf_c('-');
    i *= -1;
  }
  while (i > 0 || p == buf) {
    *(p++) = (char)('0' + (i % 10));
    i /= 10;
  }
  while (p != buf) {
    printf_c(*(--p));
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<printf_d>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L15
L51:
  mov    %rsp,%r8
  mov    $0xcccccccd,%r9d
  mov    %r8,%rdx
  nopl   0x0(%rax)
L65:
  mov    %ebx,%eax
  mov    %rdx,%rsi
  add    $0x1,%rdx
  imul   %r9,%rax
  shr    $0x23,%rax
  lea    (%rax,%rax,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%ebx
  lea    0x30(%rbx),%edi
  mov    %eax,%ebx
  mov    %dil,-0x1(%rdx)
  cmp    %r8,%rdx
  je     L65
  test   %eax,%eax
  jne    L65
  lea    -0x1(%rsi),%rbx
  lea    -0x1(%rsp),%rbp
  jmp    L55
  nopl   (%rax)
L19:
  movzbl (%rbx),%edi
  sub    $0x1,%rbx
L55:
  movsbl %dil,%edi
  call   <printf_c@plt>
  cmp    %rbx,%rbp
  jne    L19
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L15:
  mov    $0x2d,%edi
  neg    %ebx
  call   <printf_c@plt>
  jmp    L51
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void printf_d(int i) {
  char buf[16];
  char *p = buf;
  if (i < 0) {
    printf_c('-');
    i *= -1;
  }
  while (i > 0 || p == buf) {
    *(p++) = (char)('0' + (i % 10));
    i /= 10;
  }
  while (p != buf) {
    printf_c(*(--p));
  }
}
```