ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么:

```asm
<get_wight>:
  endbr64
  pxor   %xmm1,%xmm1
  cvtsi2sd %edi,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  divsd  %xmm0,%xmm1
  mulsd  D13(%rip),%xmm1
  movsd  D11(%rip),%xmm0
  subsd  %xmm1,%xmm0
  ret
```

tool_calls: name: disassemble_data
arguments: label: D13
data_type: f64
name: disassemble_data
arguments: label: D11
data_type: f64

tool: D13: 0.5

tool: D11: 0.9

assistant: ```c
double get_wight(int current_gen, int max_gen) {
  double temp = 0.9 - ((double)current_gen / (double)max_gen) * 0.5;
  return temp;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_wight>:
  endbr64
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  cvtsi2sd %edi,%xmm1
  divsd  %xmm0,%xmm1
  movsd  D7(%rip),%xmm0
  mulsd  D15(%rip),%xmm1
  subsd  %xmm1,%xmm0
  ret
```

tool_calls: name: read_data
arguments: data_label: D7
datatype: f64
name: read_data
arguments: data_label: D15
datatype: f64

tool: D7: 0.9

tool: D15: 0.5

assistant: ```c
double get_wight(int current_gen, int max_gen) {
  double temp = 0.9 - ((double)current_gen / (double)max_gen) * 0.5;
  return temp;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_wight>:
  endbr64
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm0
  cvtsi2sd %edi,%xmm1
  divsd  %xmm0,%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  D10(%rip),%xmm1
  subsd  %xmm1,%xmm0
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D4
type_guessed: f64
name: retrieve_data
arguments: tag: D10
type_guessed: f64

tool: D4: 0.9

tool: D10: 0.5

assistant: ```c
double get_wight(int current_gen, int max_gen) {
  double temp = 0.9 - ((double)current_gen / (double)max_gen) * 0.5;
  return temp;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x3039,%edi
  call   <my_putnbr@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  char *dest;
  my_putnbr(12345);
  return (0);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x3039,%edi
  call   <my_putnbr@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  char *dest;
  my_putnbr(12345);
  return (0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x3039,%edi
  call   <my_putnbr@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  char *dest;
  my_putnbr(12345);
  return (0);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x3039,%edi
  call   <my_putnbr@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  char *dest;
  my_putnbr(12345);
  return (0);
}
```
user: What is the c source code of the assembly code below?

```asm
<str_blank_out>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L74
  cmpq   $0x0,-0x20(%rbp)
  je     L74
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L74
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
  jmp    L29
L39:
  movl   $0x0,-0x10(%rbp)
  jmp    L41
L77:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  addl   $0x1,-0x10(%rbp)
L41:
  mov    -0x10(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L77
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
L29:
  cmpq   $0x0,-0x8(%rbp)
  jne    L39
  jmp    L16
L74:
  nop
L16:
  leave
  ret
```

assistant: ```c
void str_blank_out(char *s, const char *target) {
  char *p;
  int i, n;
  if (s == NULL || target == NULL || *target == '\0')
    return;
  n = strlen(target);
  p = strstr(s, target);
  while (p) {
    for (i = 0; i < n; i++)
      p[i] = ' ';
    p = strstr(p + n, target);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<str_blank_out>:
  endbr64
  test   %rdi,%rdi
  je     L38
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  test   %rsi,%rsi
  je     L81
  cmpb   $0x0,(%rsi)
  jne    L18
L81:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L18:
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  mov    %ebp,%r13d
  movslq %ebp,%r12
  test   %rax,%rax
  jne    L50
  jmp    L81
L16:
  movb   $0x20,(%rdx)
  add    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L16
L22:
  lea    (%rax,%r12,1),%rdi
  mov    %rbx,%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L81
L50:
  mov    %rax,%rdx
  lea    0x0(%r13,%rax,1),%rcx
  test   %ebp,%ebp
  jg     L16
  jmp    L22
L38:
  ret
```

assistant: ```c
void str_blank_out(char *s, const char *target) {
  char *p;
  int i, n;
  if (s == NULL || target == NULL || *target == '\0')
    return;
  n = strlen(target);
  p = strstr(s, target);
  while (p) {
    for (i = 0; i < n; i++)
      p[i] = ' ';
    p = strstr(p + n, target);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<str_blank_out>:
  endbr64
  test   %rdi,%rdi
  je     L26
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  test   %rsi,%rsi
  je     L59
  cmpb   $0x0,(%rsi)
  jne    L1
L59:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nop
L1:
  mov    %rdi,%r12
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rbx,%rsi
  mov    %eax,%ebp
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L59
  movslq %ebp,%r12
  nopl   0x0(%rax,%rax,1)
L19:
  test   %ebp,%ebp
  jle    L4
  mov    %r12,%rdx
  mov    $0x20,%esi
  call   <memset@plt>
  mov    %rax,%rdi
L4:
  add    %r12,%rdi
  mov    %rbx,%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  jne    L19
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L26:
  ret
```

assistant: ```c
void str_blank_out(char *s, const char *target) {
  char *p;
  int i, n;
  if (s == NULL || target == NULL || *target == '\0')
    return;
  n = strlen(target);
  p = strstr(s, target);
  while (p) {
    for (i = 0; i < n; i++)
      p[i] = ' ';
    p = strstr(p + n, target);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<str_blank_out>:
  endbr64
  test   %rdi,%rdi
  je     L11
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  test   %rsi,%rsi
  je     L32
  cmpb   $0x0,(%rsi)
  jne    L55
L32:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nop
L55:
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rbx,%rsi
  mov    %eax,%r12d
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L32
  movslq %r12d,%rbp
  test   %r12d,%r12d
  jle    L32
  nopl   0x0(%rax)
L1:
  mov    %rbp,%rdx
  mov    $0x20,%esi
  call   <memset@plt>
  mov    %rbx,%rsi
  mov    %rax,%rdi
  add    %rbp,%rdi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L11:
  ret
```

assistant: ```c
void str_blank_out(char *s, const char *target) {
  char *p;
  int i, n;
  if (s == NULL || target == NULL || *target == '\0')
    return;
  n = strlen(target);
  p = strstr(s, target);
  while (p) {
    for (i = 0; i < n; i++)
      p[i] = ' ';
    p = strstr(p + n, target);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<_readlines>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x420,%rsp
  mov    %rdi,-0x408(%rbp)
  mov    %esi,-0x40c(%rbp)
  mov    %rdx,-0x418(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x3f8(%rbp)
  movl   $0x0,-0x400(%rbp)
  jmp    L49
L29:
  mov    -0x400(%rbp),%eax
  cmp    -0x40c(%rbp),%eax
  jge    L46
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x3fc(%rbp),%edx
  add    %edx,%eax
  cmp    $0x2710,%eax
  jle    L52
L46:
  mov    $0xffffffff,%eax
  jmp    L13
L52:
  mov    -0x3fc(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,-0x3f0(%rbp,%rax,1)
  lea    -0x3f0(%rbp),%rdx
  mov    -0x3f8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x400(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x400(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x408(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3f8(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x3fc(%rbp),%eax
  cltq
  add    %rax,-0x3f8(%rbp)
L49:
  lea    -0x3f0(%rbp),%rax
  mov    $0x3e8,%esi
  mov    %rax,%rdi
  call   <_getline_ptr@plt>
  mov    %eax,-0x3fc(%rbp)
  cmpl   $0x0,-0x3fc(%rbp)
  jg     L29
  mov    -0x400(%rbp),%eax
L13:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L47
  call   <__stack_chk_fail@plt>
L47:
  leave
  ret
```

assistant: ```c
int _readlines(char *lineptr[], int maxlines, char *cache) {
  int len, nlines;
  char *p, line[1000];
  p = cache + strlen(cache);
  nlines = 0;
  while ((len = _getline_ptr(line, 1000)) > 0)
    if (nlines >= maxlines || (strlen(cache) + len) > 10000)
      return -1;
    else {
      line[len - 1] = '\0';
      strcpy(p, line);
      lineptr[nlines++] = p;
      p += len;
    }
  return nlines;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<_readlines>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x408,%rsp
  mov    %rdi,%r15
  mov    %esi,%r14d
  mov    %rdx,%rbx
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x3f8(%rsp)
  xor    %eax,%eax
  mov    %rdx,%rdi
  call   <strlen@plt>
  movslq %eax,%r12
  add    %rbx,%r12
  mov    $0x0,%ebp
  lea    0x10(%rsp),%r13
  jmp    L51
L43:
  lea    -0x1(%rbx),%eax
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  mov    %r12,(%r15,%rbp,8)
  movslq %ebx,%rbx
  add    %rbx,%r12
  add    $0x1,%rbp
L51:
  mov    %ebp,0x4(%rsp)
  mov    $0x3e8,%esi
  mov    %r13,%rdi
  call   <_getline_ptr@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L18
  cmp    %ebp,%r14d
  jle    L14
  mov    0x8(%rsp),%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  cmp    $0x2710,%eax
  jle    L43
  movl   $0xffffffff,0x4(%rsp)
  jmp    L18
L14:
  movl   $0xffffffff,0x4(%rsp)
L18:
  mov    0x3f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    0x4(%rsp),%eax
  add    $0x408,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int _readlines(char *lineptr[], int maxlines, char *cache) {
  int len, nlines;
  char *p, line[1000];
  p = cache + strlen(cache);
  nlines = 0;
  while ((len = _getline_ptr(line, 1000)) > 0)
    if (nlines >= maxlines || (strlen(cache) + len) > 10000)
      return -1;
    else {
      line[len - 1] = '\0';
      strcpy(p, line);
      lineptr[nlines++] = p;
      p += len;
    }
  return nlines;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<_readlines>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x408,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rdx,%rdi
  lea    0x10(%rsp),%r12
  mov    %esi,0x4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x3f8(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  movslq %eax,%rbp
  add    %r13,%rbp
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L24:
  cmp    %ebx,0x4(%rsp)
  jle    L20
  mov    %r13,%rdi
  call   <strlen@plt>
  add    %r14d,%eax
  cmp    $0x2710,%eax
  jg     L20
  lea    -0x1(%r14),%eax
  mov    %rbp,%rdi
  mov    %r12,%rsi
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  call   <strcpy@plt>
  mov    0x8(%rsp),%rax
  movslq %r14d,%rdx
  mov    %rbp,(%rax,%rbx,8)
  add    %rdx,%rbp
  add    $0x1,%rbx
L45:
  mov    $0x3e8,%esi
  mov    %r12,%rdi
  mov    %ebx,%r15d
  call   <_getline_ptr@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  jg     L24
L48:
  mov    0x3f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  add    $0x408,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L20:
  mov    $0xffffffff,%r15d
  jmp    L48
L31:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int _readlines(char *lineptr[], int maxlines, char *cache) {
  int len, nlines;
  char *p, line[1000];
  p = cache + strlen(cache);
  nlines = 0;
  while ((len = _getline_ptr(line, 1000)) > 0)
    if (nlines >= maxlines || (strlen(cache) + len) > 10000)
      return -1;
    else {
      line[len - 1] = '\0';
      strcpy(p, line);
      lineptr[nlines++] = p;
      p += len;
    }
  return nlines;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<_readlines>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x408,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rdx,%rdi
  lea    0x10(%rsp),%r12
  mov    %esi,0x4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x3f8(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  movslq %eax,%rbp
  add    %r13,%rbp
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L40:
  cmp    %ebx,0x4(%rsp)
  jle    L54
  mov    %r13,%rdi
  call   <strlen@plt>
  add    %r14d,%eax
  cmp    $0x2710,%eax
  jg     L54
  lea    -0x1(%r14),%eax
  mov    %rbp,%rdi
  mov    %r12,%rsi
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  call   <strcpy@plt>
  mov    0x8(%rsp),%rax
  movslq %r14d,%rdx
  mov    %rbp,(%rax,%rbx,8)
  add    %rdx,%rbp
  add    $0x1,%rbx
L3:
  mov    $0x3e8,%esi
  mov    %r12,%rdi
  mov    %ebx,%r15d
  call   <_getline_ptr@plt>
  mov    %eax,%r14d
  test   %eax,%eax
  jg     L40
L38:
  mov    0x3f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  add    $0x408,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  mov    $0xffffffff,%r15d
  jmp    L38
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int _readlines(char *lineptr[], int maxlines, char *cache) {
  int len, nlines;
  char *p, line[1000];
  p = cache + strlen(cache);
  nlines = 0;
  while ((len = _getline_ptr(line, 1000)) > 0)
    if (nlines >= maxlines || (strlen(cache) + len) > 10000)
      return -1;
    else {
      line[len - 1] = '\0';
      strcpy(p, line);
      lineptr[nlines++] = p;
      p += len;
    }
  return nlines;
}
```
user: Translate the below assembly code into C programming language:

```asm
<pty_setup_child>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,%ecx
  mov    %edx,%eax
  mov    %ecx,%edx
  mov    %dx,-0x38(%rbp)
  mov    %ax,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <tcgetattr@plt>
  test   %rax,%rax
  jns    L58
  mov    D102(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L73
L58:
  mov    -0x20(%rbp),%rdx
  mov    D137(%rip),%rax
  mov    (%rax),%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  movl   $0x8,(%rax)
  mov    -0x18(%rbp),%edx
  mov    D120(%rip),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    D48(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x20(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <tcsetattr@plt>
  test   %rax,%rax
  jns    L60
  mov    D102(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L73
L60:
  lea    -0x24(%rbp),%rax
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movzwl -0x38(%rbp),%eax
  mov    %ax,-0x24(%rbp)
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x22(%rbp)
  mov    D135(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x24(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
  test   %rax,%rax
  jns    L92
  mov    D102(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L73
L92:
  mov    D49(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    D49(%rip),%rdx
  mov    (%rdx),%rdx
  cmp    %rdx,%rax
  jne    L96
  mov    D139(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    D139(%rip),%rdx
  mov    (%rdx),%rdx
  cmp    %rdx,%rax
  jne    L96
  mov    D29(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    D29(%rip),%rdx
  mov    (%rdx),%rdx
  cmp    %rdx,%rax
  je     L67
L96:
  mov    D102(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L73
L67:
  mov    $0x0,%eax
L73:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L80
  call   <__stack_chk_fail@plt>
L80:
  leave
  ret
```

assistant: ```c
int pty_setup_child(int slave, unsigned short term_width, unsigned short term_height) {
  struct termios attr;
  struct winsize ws;
  if (tcgetattr(slave, &attr) < 0)
    return -errno;
  attr.c_cc[VERASE] = 010;
  attr.c_iflag |= IUTF8;
  if (tcsetattr(slave, TCSANOW, &attr) < 0)
    return -errno;
  memset(&ws, 0, sizeof(ws));
  ws.ws_col = term_width;
  ws.ws_row = term_height;
  if (ioctl(slave, TIOCSWINSZ, &ws) < 0)
    return -errno;
  if (dup2(slave, STDIN_FILENO) != STDIN_FILENO || dup2(slave, STDOUT_FILENO) != STDOUT_FILENO || dup2(slave, STDERR_FILENO) != STDERR_FILENO)
    return -errno;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<pty_setup_child>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,%ebx
  mov    %esi,%r12d
  mov    %edx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  call   <tcgetattr@plt>
  test   %rax,%rax
  js     L57
  mov    D14(%rip),%rax
  mov    (%rax),%rdx
  mov    0x10(%rsp),%rax
  movl   $0x8,(%rax,%rdx,4)
  mov    D104(%rip),%rax
  mov    (%rax),%eax
  or     %eax,0x18(%rsp)
  lea    0x10(%rsp),%rdx
  mov    D23(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <tcsetattr@plt>
  test   %rax,%rax
  js     L9
  lea    0xc(%rsp),%r13
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r12w,0xc(%rsp)
  mov    %bp,0xe(%rsp)
  mov    %r13,%rdx
  mov    D73(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <ioctl@plt>
  test   %rax,%rax
  js     L101
  mov    D42(%rip),%rbp
  mov    0x0(%rbp),%rsi
  mov    %ebx,%edi
  call   <dup2@plt>
  cmp    0x0(%rbp),%rax
  je     L54
L23:
  mov    D83(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L80
L57:
  mov    D83(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L80:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L66
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L9:
  mov    D83(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L80
L101:
  mov    D83(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L80
L54:
  mov    D99(%rip),%rbp
  mov    0x0(%rbp),%rsi
  mov    %ebx,%edi
  call   <dup2@plt>
  cmp    0x0(%rbp),%rax
  jne    L23
  mov    D37(%rip),%rbp
  mov    0x0(%rbp),%rsi
  mov    %ebx,%edi
  call   <dup2@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  cmp    0x0(%rbp),%rdx
  je     L80
  jmp    L23
L66:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int pty_setup_child(int slave, unsigned short term_width, unsigned short term_height) {
  struct termios attr;
  struct winsize ws;
  if (tcgetattr(slave, &attr) < 0)
    return -errno;
  attr.c_cc[VERASE] = 010;
  attr.c_iflag |= IUTF8;
  if (tcsetattr(slave, TCSANOW, &attr) < 0)
    return -errno;
  memset(&ws, 0, sizeof(ws));
  ws.ws_col = term_width;
  ws.ws_row = term_height;
  if (ioctl(slave, TIOCSWINSZ, &ws) < 0)
    return -errno;
  if (dup2(slave, STDIN_FILENO) != STDIN_FILENO || dup2(slave, STDOUT_FILENO) != STDOUT_FILENO || dup2(slave, STDERR_FILENO) != STDERR_FILENO)
    return -errno;
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<pty_setup_child>:
  endbr64
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  mov    %r12,%rsi
  call   <tcgetattr@plt>
  test   %rax,%rax
  js     L18
  mov    D26(%rip),%rax
  mov    %ebp,%edi
  mov    (%rax),%rdx
  mov    0x10(%rsp),%rax
  movl   $0x8,(%rax,%rdx,4)
  mov    D13(%rip),%rax
  mov    %r12,%rdx
  mov    (%rax),%eax
  or     %eax,0x18(%rsp)
  mov    D39(%rip),%rax
  mov    (%rax),%esi
  call   <tcsetattr@plt>
  test   %rax,%rax
  js     L18
  lea    0xc(%rsp),%r12
  xor    %esi,%esi
  mov    $0x4,%edx
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %r12,%rdx
  mov    %ebp,%edi
  mov    %r13w,0xc(%rsp)
  mov    D73(%rip),%rax
  mov    %bx,0xe(%rsp)
  mov    (%rax),%esi
  call   <ioctl@plt>
  test   %rax,%rax
  js     L18
  mov    D52(%rip),%rbx
  mov    %ebp,%edi
  mov    (%rbx),%rsi
  call   <dup2@plt>
  cmp    (%rbx),%rax
  jne    L18
  mov    D4(%rip),%rbx
  mov    %ebp,%edi
  mov    (%rbx),%rsi
  call   <dup2@plt>
  cmp    (%rbx),%rax
  je     L13
  nopl   0x0(%rax)
L18:
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L69:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L53
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L13:
  mov    D1(%rip),%rbx
  mov    %ebp,%edi
  mov    (%rbx),%rsi
  call   <dup2@plt>
  cmp    (%rbx),%rax
  jne    L18
  xor    %eax,%eax
  jmp    L69
L53:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int pty_setup_child(int slave, unsigned short term_width, unsigned short term_height) {
  struct termios attr;
  struct winsize ws;
  if (tcgetattr(slave, &attr) < 0)
    return -errno;
  attr.c_cc[VERASE] = 010;
  attr.c_iflag |= IUTF8;
  if (tcsetattr(slave, TCSANOW, &attr) < 0)
    return -errno;
  memset(&ws, 0, sizeof(ws));
  ws.ws_col = term_width;
  ws.ws_row = term_height;
  if (ioctl(slave, TIOCSWINSZ, &ws) < 0)
    return -errno;
  if (dup2(slave, STDIN_FILENO) != STDIN_FILENO || dup2(slave, STDOUT_FILENO) != STDOUT_FILENO || dup2(slave, STDERR_FILENO) != STDERR_FILENO)
    return -errno;
  return 0;
}
```