ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<get_host_by_addr>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  mov    %r9,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  xor    %edi,%edi
  test   %rbx,%rbx
  setne  %dil
  call   <assert@plt>
  mov    %r15d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <gethostbyaddr@plt>
  test   %rax,%rax
  je     L32
  mov    %r13d,%edx
  mov    %rbx,%rsi
  mov    %rax,%rdi
  call   <copy_hostent@plt>
  mov    %eax,%edx
  test   %r12,%r12
  je     L27
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,(%r12)
L27:
  mov    %rbx,%rax
  test   %edx,%edx
  js     L14
L2:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L32:
  test   %r12,%r12
  je     L2
  mov    D29(%rip),%rdx
  mov    (%rdx),%edx
  mov    %edx,(%r12)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L14:
  mov    D6(%rip),%rax
  mov    (%rax),%edx
  mov    D16(%rip),%rax
  mov    %edx,(%rax)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
struct hostent *get_host_by_addr(const char *addr, int len, int type, void *buf, int buflen, int *h_err) {
  struct hostent *hptr;
  int n = 0;
  assert(addr != NULL);
  assert(buf != NULL);
  ;
  if ((hptr = gethostbyaddr(addr, len, type)))
    n = copy_hostent(hptr, buf, buflen);
  if (h_err)
    *h_err = h_errno;
  ;
  if (n < 0) {
    errno = ERANGE;
    return (NULL);
  }
  return (hptr ? (struct hostent *)buf : NULL);
}
```
user: Translate the below assembly code into C programming language:

```asm
<snprintf_vms>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xe0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %rsi,-0xd0(%rbp)
  mov    %rdx,-0xd8(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L2
  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)
L2:
  mov    -0xd8(%rbp),%rdx
  mov    -0xb8(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xb8(%rbp),%edx
  mov    -0xd8(%rbp),%rcx
  mov    -0xc8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <vsprintf@plt>
  mov    %eax,-0xb4(%rbp)
  mov    -0xb8(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0xb4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int snprintf_vms(char *str, size_t len, const char *fmt, ...) {
  va_list ap;
  int n;
  va_start(ap, fmt);
  n = vsprintf(str, fmt, ap);
  va_end(ap);
  return n;
}
```
user: Translate the below assembly code into C programming language:

```asm
<snprintf_vms>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rdx,%rbx
  mov    %rdx,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <vsprintf@plt>
  mov    %eax,%ebx
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int snprintf_vms(char *str, size_t len, const char *fmt, ...) {
  va_list ap;
  int n;
  va_start(ap, fmt);
  n = vsprintf(str, fmt, ap);
  va_end(ap);
  return n;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<snprintf_vms>:
  endbr64
  push   %r13
  xor    %r13d,%r13d
  mov    %rdx,%rsi
  push   %r12
  mov    %rdi,%r12
  mov    %r13d,%edi
  push   %rbp
  mov    %rdx,%rbp
  call   <va_start@plt>
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <vsprintf@plt>
  mov    %r13d,%edi
  mov    %eax,%r12d
  call   <va_end@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int snprintf_vms(char *str, size_t len, const char *fmt, ...) {
  va_list ap;
  int n;
  va_start(ap, fmt);
  n = vsprintf(str, fmt, ap);
  va_end(ap);
  return n;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<snprintf_vms>:
  endbr64
  push   %r13
  xor    %r13d,%r13d
  mov    %rdx,%rsi
  push   %r12
  mov    %rdi,%r12
  mov    %r13d,%edi
  push   %rbp
  mov    %rdx,%rbp
  call   <va_start@plt>
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <vsprintf@plt>
  mov    %r13d,%edi
  mov    %eax,%r12d
  call   <va_end@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int snprintf_vms(char *str, size_t len, const char *fmt, ...) {
  va_list ap;
  int n;
  va_start(ap, fmt);
  n = vsprintf(str, fmt, ap);
  va_end(ap);
  return n;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<print_spaces>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  jmp    L10
L19:
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L10:
  mov    -0x4(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  test   %eax,%eax
  jne    L19
  nop
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D8
type_infered: string

tool: D8:  

assistant: ```c
void print_spaces(int num) {
  while (num--)
    printf(" ");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<print_spaces>:
  endbr64
  test   %edi,%edi
  je     L7
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  lea    D4(%rip),%rbp
L15:
  mov    %rbp,%rdi
  call   <printf@plt>
  sub    $0x1,%ebx
  jne    L15
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L7:
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D4
datatype: string

tool: D4:  

assistant: ```c
void print_spaces(int num) {
  while (num--)
    printf(" ");
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<print_spaces>:
  endbr64
  test   %edi,%edi
  je     L9
  push   %rbp
  lea    D0(%rip),%rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L11:
  mov    %rbp,%rdi
  call   <printf@plt>
  sub    $0x1,%ebx
  jne    L11
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L9:
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D0
datatype: string

tool: D0:  

assistant: ```c
void print_spaces(int num) {
  while (num--)
    printf(" ");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<print_spaces>:
  endbr64
  test   %edi,%edi
  je     L18
  push   %rbp
  lea    D8(%rip),%rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L5:
  mov    %rbp,%rdi
  call   <printf@plt>
  sub    $0x1,%ebx
  jne    L5
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L18:
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D8
type: string

tool: D8:  

assistant: ```c
void print_spaces(int num) {
  while (num--)
    printf(" ");
}
```
user: Translate the below assembly code into C programming language:

```asm
<getgrnam_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  lea    D0(%rip),%rax
  mov    %rax,%rsi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L44
  mov    -0x38(%rbp),%rax
  movq   $0x0,(%rax)
  mov    $0xffffffff,%eax
  jmp    L8
L44:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L33:
  mov    -0x10(%rbp),%rdx
  mov    -0x30(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %eax,%eax
  je     L39
  mov    -0x20(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <parseGroupLine@plt>
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L33
  mov    -0x38(%rbp),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  jmp    L8
L39:
  nop
  mov    -0x38(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%eax
L8:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D0
datatype: string
name: unpack_data
arguments: label: D3
datatype: string

tool: D0: r

tool: D3: /etc/group

assistant: ```c
int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result) {
  FILE *groupFile = fopen("/etc/group", "r");
  if (!groupFile) {
    *result = NULL;
    return -1;
  }
  char *line = buf;
  while (1) {
    if (!fgets(line, buflen, groupFile)) {
      break;
    }
    parseGroupLine(line, grp);
    if (!strcmp(grp->gr_name, name)) {
      *result = grp;
      fclose(groupFile);
      return 0;
    }
  }
  *result = NULL;
  fclose(groupFile);
  return -1;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<getgrnam_r>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rsi,%r12
  mov    %rdx,%rbp
  mov    %rcx,%r14
  mov    %r8,0x8(%rsp)
  lea    D19(%rip),%rsi
  lea    D1(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L49
L8:
  mov    %r13,%rdx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <fgets@plt>
  test   %eax,%eax
  je     L41
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <parseGroupLine@plt>
  mov    %r15,%rsi
  mov    (%r12),%edi
  call   <strcmp@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L8
  mov    0x8(%rsp),%rax
  mov    %r12,(%rax)
  mov    %r13,%rdi
  call   <fclose@plt>
  jmp    L28
L49:
  mov    0x8(%rsp),%rax
  movq   $0x0,(%rax)
  mov    $0xffffffff,%ebx
  jmp    L28
L41:
  mov    0x8(%rsp),%rax
  movq   $0x0,(%rax)
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%ebx
L28:
  mov    %ebx,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D19
type_infered: string
name: unpack_data
arguments: data_label: D1
type_infered: string

tool: D19: r

tool: D1: /etc/group

assistant: ```c
int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result) {
  FILE *groupFile = fopen("/etc/group", "r");
  if (!groupFile) {
    *result = NULL;
    return -1;
  }
  char *line = buf;
  while (1) {
    if (!fgets(line, buflen, groupFile)) {
      break;
    }
    parseGroupLine(line, grp);
    if (!strcmp(grp->gr_name, name)) {
      *result = grp;
      fclose(groupFile);
      return 0;
    }
  }
  *result = NULL;
  fclose(groupFile);
  return -1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<getgrnam_r>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rdi,%r14
  lea    D7(%rip),%rdi
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  lea    D3(%rip),%rsi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  call   <fopen@plt>
  test   %rax,%rax
  je     L24
  mov    %rax,%r12
  jmp    L51
  xchg   %ax,%ax
L53:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <parseGroupLine@plt>
  mov    0x0(%rbp),%edi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L36
L51:
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %eax,%eax
  jne    L53
  movq   $0x0,(%r15)
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%r8d
L37:
  add    $0x18,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L36:
  mov    %rbp,(%r15)
  mov    %r12,%rdi
  mov    %eax,0xc(%rsp)
  call   <fclose@plt>
  mov    0xc(%rsp),%r8d
  jmp    L37
L24:
  movq   $0x0,(%r15)
  mov    $0xffffffff,%r8d
  jmp    L37
```

tool_calls: name: read_data
arguments: data_label: D7
type_guessed: string
name: read_data
arguments: data_label: D3
type_guessed: string

tool: D7: /etc/group

tool: D3: r

assistant: ```c
int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result) {
  FILE *groupFile = fopen("/etc/group", "r");
  if (!groupFile) {
    *result = NULL;
    return -1;
  }
  char *line = buf;
  while (1) {
    if (!fgets(line, buflen, groupFile)) {
      break;
    }
    parseGroupLine(line, grp);
    if (!strcmp(grp->gr_name, name)) {
      *result = grp;
      fclose(groupFile);
      return 0;
    }
  }
  *result = NULL;
  fclose(groupFile);
  return -1;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<getgrnam_r>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rdi,%r14
  lea    D13(%rip),%rdi
  push   %r13
  mov    %rcx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  lea    D12(%rip),%rsi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  call   <fopen@plt>
  test   %rax,%rax
  je     L15
  mov    %rax,%r12
  jmp    L40
  xchg   %ax,%ax
L32:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <parseGroupLine@plt>
  mov    0x0(%rbp),%edi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L29
L40:
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %eax,%eax
  jne    L32
  movq   $0x0,(%r15)
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    $0xffffffff,%r8d
L22:
  add    $0x18,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L29:
  mov    %rbp,(%r15)
  mov    %r12,%rdi
  mov    %eax,0xc(%rsp)
  call   <fclose@plt>
  mov    0xc(%rsp),%r8d
  jmp    L22
L15:
  movq   $0x0,(%r15)
  mov    $0xffffffff,%r8d
  jmp    L22
```

tool_calls: name: disassemble_data
arguments: tag: D13
data_type: string
name: disassemble_data
arguments: tag: D12
data_type: string

tool: D13: /etc/group

tool: D12: r

assistant: ```c
int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result) {
  FILE *groupFile = fopen("/etc/group", "r");
  if (!groupFile) {
    *result = NULL;
    return -1;
  }
  char *line = buf;
  while (1) {
    if (!fgets(line, buflen, groupFile)) {
      break;
    }
    parseGroupLine(line, grp);
    if (!strcmp(grp->gr_name, name)) {
      *result = grp;
      fclose(groupFile);
      return 0;
    }
  }
  *result = NULL;
  fclose(groupFile);
  return -1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<Plot>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %rcx,-0x20(%rbp)
  mov    %r8,-0x28(%rbp)
  mov    %r9,-0x30(%rbp)
  mov    0x18(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  jne    L33
  mov    0x18(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L32
L33:
  mov    $0x13,%ecx
  mov    $0x41,%edx
  mov    $0x16,%esi
  mov    $0x9,%edi
  call   <SetViewPort@plt>
  test   %rax,%rax
  je     L3
  mov    0x18(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L58
  andl   $0xffffff3f,0x18(%rbp)
L58:
  mov    0x18(%rbp),%ecx
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <SetScales@plt>
  mov    0x18(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L40
  mov    $0x0,%eax
  call   <DrawGrid@plt>
  jmp    L13
L40:
  mov    $0x0,%eax
  call   <DrawAxis@plt>
L13:
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <PrintText@plt>
L32:
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    -0x4(%rbp),%eax
  mov    0x10(%rbp),%ecx
  mov    %eax,%edi
  call   <DoPlot@plt>
  jmp    L30
L3:
  nop
L30:
  leave
  ret
```

assistant: ```c
void Plot(int npts, float *x, float *y, char *mt, char *xt, char *yt, int col, int flags) {
  if ((flags & 0x00000002) || (flags & 0x00000001)) {
    if (SetViewPort(9, 22, 65, 19) == 0)
      return;
    if (flags & 0x00000001)
      flags &= ~(0x00000040 | 0x00000080);
    SetScales(npts, x, y, flags);
    if (flags & 0x00000004)
      DrawGrid();
    else
      DrawAxis();
    PrintText(mt, xt, yt);
  }
  DoPlot(npts, x, y, col);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Plot>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  mov    %rcx,0x8(%rsp)
  mov    0x58(%rsp),%r13d
  test   $0x3,%r13b
  je     L35
  mov    %r8,%r14
  mov    %r9,%r15
  mov    $0x13,%ecx
  mov    $0x41,%edx
  mov    $0x16,%esi
  mov    $0x9,%edi
  call   <SetViewPort@plt>
  test   %rax,%rax
  je     L33
  mov    %r13d,%eax
  and    $0x3f,%al
  test   $0x1,%r13b
  cmovne %eax,%r13d
  mov    %r13d,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <SetScales@plt>
  test   $0x4,%r13b
  je     L18
  mov    $0x0,%eax
  call   <DrawGrid@plt>
L19:
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    0x8(%rsp),%rdi
  call   <PrintText@plt>
L35:
  mov    0x50(%rsp),%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <DoPlot@plt>
L33:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  mov    $0x0,%eax
  call   <DrawAxis@plt>
  jmp    L19
```

assistant: ```c
void Plot(int npts, float *x, float *y, char *mt, char *xt, char *yt, int col, int flags) {
  if ((flags & 0x00000002) || (flags & 0x00000001)) {
    if (SetViewPort(9, 22, 65, 19) == 0)
      return;
    if (flags & 0x00000001)
      flags &= ~(0x00000040 | 0x00000080);
    SetScales(npts, x, y, flags);
    if (flags & 0x00000004)
      DrawGrid();
    else
      DrawAxis();
    PrintText(mt, xt, yt);
  }
  DoPlot(npts, x, y, col);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<Plot>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x18,%rsp
  mov    0x58(%rsp),%r14d
  mov    0x50(%rsp),%ebx
  mov    %rcx,(%rsp)
  mov    %r8,0x8(%rsp)
  test   $0x3,%r14b
  je     L39
  mov    $0x13,%ecx
  mov    $0x41,%edx
  mov    $0x16,%esi
  mov    %r9,%r15
  mov    $0x9,%edi
  call   <SetViewPort@plt>
  test   %rax,%rax
  je     L27
  mov    %r14d,%eax
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  and    $0x3f,%al
  test   $0x1,%r14b
  cmovne %eax,%r14d
  mov    %r14d,%ecx
  call   <SetScales@plt>
  xor    %eax,%eax
  and    $0x4,%r14d
  jne    L29
  call   <DrawAxis@plt>
L24:
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  mov    %r15,%rdx
  call   <PrintText@plt>
L39:
  add    $0x18,%rsp
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    %r12,%rsi
  pop    %rbx
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10f0 <DoPlot@plt>
  nopl   0x0(%rax,%rax,1)
L27:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L29:
  call   <DrawGrid@plt>
  jmp    L24
```

assistant: ```c
void Plot(int npts, float *x, float *y, char *mt, char *xt, char *yt, int col, int flags) {
  if ((flags & 0x00000002) || (flags & 0x00000001)) {
    if (SetViewPort(9, 22, 65, 19) == 0)
      return;
    if (flags & 0x00000001)
      flags &= ~(0x00000040 | 0x00000080);
    SetScales(npts, x, y, flags);
    if (flags & 0x00000004)
      DrawGrid();
    else
      DrawAxis();
    PrintText(mt, xt, yt);
  }
  DoPlot(npts, x, y, col);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<Plot>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x18,%rsp
  mov    0x58(%rsp),%r14d
  mov    0x50(%rsp),%ebx
  mov    %rcx,(%rsp)
  mov    %r8,0x8(%rsp)
  test   $0x3,%r14b
  je     L35
  mov    $0x13,%ecx
  mov    $0x41,%edx
  mov    $0x16,%esi
  mov    %r9,%r15
  mov    $0x9,%edi
  call   <SetViewPort@plt>
  test   %rax,%rax
  je     L30
  mov    %r14d,%eax
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %ebp,%edi
  and    $0x3f,%al
  test   $0x1,%r14b
  cmovne %eax,%r14d
  mov    %r14d,%ecx
  call   <SetScales@plt>
  xor    %eax,%eax
  and    $0x4,%r14d
  jne    L11
  call   <DrawAxis@plt>
L14:
  mov    0x8(%rsp),%rsi
  mov    (%rsp),%rdi
  mov    %r15,%rdx
  call   <PrintText@plt>
L35:
  add    $0x18,%rsp
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    %r12,%rsi
  pop    %rbx
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10f0 <DoPlot@plt>
  nopl   0x0(%rax,%rax,1)
L30:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L11:
  call   <DrawGrid@plt>
  jmp    L14
```

assistant: ```c
void Plot(int npts, float *x, float *y, char *mt, char *xt, char *yt, int col, int flags) {
  if ((flags & 0x00000002) || (flags & 0x00000001)) {
    if (SetViewPort(9, 22, 65, 19) == 0)
      return;
    if (flags & 0x00000001)
      flags &= ~(0x00000040 | 0x00000080);
    SetScales(npts, x, y, flags);
    if (flags & 0x00000004)
      DrawGrid();
    else
      DrawAxis();
    PrintText(mt, xt, yt);
  }
  DoPlot(npts, x, y, col);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<ps2_host_init>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <clock_init@plt>
  mov    $0x0,%eax
  call   <data_init@plt>
  mov    $0x9c4,%edi
  call   <wait_ms@plt>
  mov    $0x0,%eax
  call   <inhibit@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void ps2_host_init(void) {
  clock_init();
  data_init();
  wait_ms(2500);
  inhibit();
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<ps2_host_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <clock_init@plt>
  mov    $0x0,%eax
  call   <data_init@plt>
  mov    $0x9c4,%edi
  call   <wait_ms@plt>
  mov    $0x0,%eax
  call   <inhibit@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void ps2_host_init(void) {
  clock_init();
  data_init();
  wait_ms(2500);
  inhibit();
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ps2_host_init>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <clock_init@plt>
  xor    %eax,%eax
  call   <data_init@plt>
  mov    $0x9c4,%edi
  call   <wait_ms@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1080 <inhibit@plt>
```

assistant: ```c
void ps2_host_init(void) {
  clock_init();
  data_init();
  wait_ms(2500);
  inhibit();
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ps2_host_init>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <clock_init@plt>
  xor    %eax,%eax
  call   <data_init@plt>
  mov    $0x9c4,%edi
  call   <wait_ms@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1080 <inhibit@plt>
```

assistant: ```c
void ps2_host_init(void) {
  clock_init();
  data_init();
  wait_ms(2500);
  inhibit();
}
```