ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<Set_Initial_Default_State_After_Power_ON>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <Set_DataBus_to_Initial_Default_State_After_Power_ON@plt>
  mov    $0x0,%eax
  call   <Set_AddressBus_to_Initial_Default_State_After_Power_ON@plt>
  mov    $0x0,%eax
  call   <Set_ControlBus_to_Initial_Default_State_After_Power_ON@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void Set_Initial_Default_State_After_Power_ON(void) {
  Set_DataBus_to_Initial_Default_State_After_Power_ON();
  Set_AddressBus_to_Initial_Default_State_After_Power_ON();
  Set_ControlBus_to_Initial_Default_State_After_Power_ON();
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<Set_Initial_Default_State_After_Power_ON>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <Set_DataBus_to_Initial_Default_State_After_Power_ON@plt>
  mov    $0x0,%eax
  call   <Set_AddressBus_to_Initial_Default_State_After_Power_ON@plt>
  mov    $0x0,%eax
  call   <Set_ControlBus_to_Initial_Default_State_After_Power_ON@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void Set_Initial_Default_State_After_Power_ON(void) {
  Set_DataBus_to_Initial_Default_State_After_Power_ON();
  Set_AddressBus_to_Initial_Default_State_After_Power_ON();
  Set_ControlBus_to_Initial_Default_State_After_Power_ON();
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<Set_Initial_Default_State_After_Power_ON>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <Set_DataBus_to_Initial_Default_State_After_Power_ON@plt>
  xor    %eax,%eax
  call   <Set_AddressBus_to_Initial_Default_State_After_Power_ON@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1080 <Set_ControlBus_to_Initial_Default_State_After_Power_ON@plt>
```

assistant: ```c
void Set_Initial_Default_State_After_Power_ON(void) {
  Set_DataBus_to_Initial_Default_State_After_Power_ON();
  Set_AddressBus_to_Initial_Default_State_After_Power_ON();
  Set_ControlBus_to_Initial_Default_State_After_Power_ON();
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<Set_Initial_Default_State_After_Power_ON>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <Set_DataBus_to_Initial_Default_State_After_Power_ON@plt>
  xor    %eax,%eax
  call   <Set_AddressBus_to_Initial_Default_State_After_Power_ON@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1080 <Set_ControlBus_to_Initial_Default_State_After_Power_ON@plt>
```

assistant: ```c
void Set_Initial_Default_State_After_Power_ON(void) {
  Set_DataBus_to_Initial_Default_State_After_Power_ON();
  Set_AddressBus_to_Initial_Default_State_After_Power_ON();
  Set_ControlBus_to_Initial_Default_State_After_Power_ON();
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fd_block2hts>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %rcx,-0x20(%rbp)
  mov    -0x4(%rbp),%ecx
  movslq %ecx,%rax
  imul   $0x38e38e39,%rax,%rax
  shr    $0x20,%rax
  sar    $0x3,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x3,%eax
  add    %edx,%eax
  shl    $0x2,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  movslq %edx,%rax
  imul   $0x38e38e39,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x38e38e39,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x3,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%ecx
  movslq %ecx,%rax
  imul   $0x38e38e39,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x3,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  add    $0x1,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void fd_block2hts(int block, int *head, int *track, int *sector) {
  *head = (block % (18 * 2)) / (18);
  *track = block / (18 * 2);
  *sector = block % 18 + 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<fd_block2hts>:
  endbr64
  mov    %edi,%eax
  mov    %rsi,%r10
  mov    %rdx,%r11
  mov    %rcx,%r8
  movslq %edi,%rdx
  imul   $0x38e38e39,%rdx,%rdx
  mov    %rdx,%rsi
  sar    $0x23,%rsi
  mov    %edi,%r9d
  sar    $0x1f,%r9d
  sub    %r9d,%esi
  lea    (%rsi,%rsi,8),%ecx
  shl    $0x2,%ecx
  sub    %ecx,%edi
  movslq %edi,%rcx
  imul   $0x38e38e39,%rcx,%rcx
  sar    $0x22,%rcx
  sar    $0x1f,%edi
  sub    %edi,%ecx
  mov    %ecx,(%r10)
  mov    %esi,(%r11)
  sar    $0x22,%rdx
  sub    %r9d,%edx
  lea    (%rdx,%rdx,8),%edx
  add    %edx,%edx
  sub    %edx,%eax
  add    $0x1,%eax
  mov    %eax,(%r8)
  ret
```

assistant: ```c
void fd_block2hts(int block, int *head, int *track, int *sector) {
  *head = (block % (18 * 2)) / (18);
  *track = block / (18 * 2);
  *sector = block % 18 + 1;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<fd_block2hts>:
  endbr64
  mov    %rdx,%r11
  movslq %edi,%rdx
  mov    %rsi,%r10
  mov    %edi,%r9d
  imul   $0x38e38e39,%rdx,%rdx
  sar    $0x1f,%r9d
  mov    %rcx,%r8
  mov    %edi,%eax
  mov    %rdx,%rsi
  sar    $0x22,%rdx
  sar    $0x23,%rsi
  sub    %r9d,%edx
  sub    %r9d,%esi
  lea    (%rdx,%rdx,8),%edx
  lea    (%rsi,%rsi,8),%ecx
  add    %edx,%edx
  shl    $0x2,%ecx
  sub    %edx,%eax
  sub    %ecx,%edi
  add    $0x1,%eax
  movslq %edi,%rcx
  sar    $0x1f,%edi
  imul   $0x38e38e39,%rcx,%rcx
  sar    $0x22,%rcx
  sub    %edi,%ecx
  mov    %ecx,(%r10)
  mov    %esi,(%r11)
  mov    %eax,(%r8)
  ret
```

assistant: ```c
void fd_block2hts(int block, int *head, int *track, int *sector) {
  *head = (block % (18 * 2)) / (18);
  *track = block / (18 * 2);
  *sector = block % 18 + 1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<page52>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x2,%eax
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D18
type_guessed: string
name: disassemble_data
arguments: tag: D0
type_guessed: string

tool: D18: You wisely wait until the instructor returns with a Blue Internal Security


tool: D0: guard.  The guard leads you to an Internal Security self incrimination station.


assistant: ```c
page52() {
  printf("You wisely wait until the instructor returns with a Blue Internal Security\n");
  printf("guard.  The guard leads you to an Internal Security self incrimination station.\n");
  return 2;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<page52>:
  endbr64
  sub    $0x8,%rsp
  lea    D12(%rip),%rdi
  call   <printf@plt>
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    $0x2,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: tag: D12
type_guessed: string
name: unpack_data
arguments: tag: D0
type_guessed: string

tool: D12: You wisely wait until the instructor returns with a Blue Internal Security


tool: D0: guard.  The guard leads you to an Internal Security self incrimination station.


assistant: ```c
page52() {
  printf("You wisely wait until the instructor returns with a Blue Internal Security\n");
  printf("guard.  The guard leads you to an Internal Security self incrimination station.\n");
  return 2;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<page52>:
  endbr64
  sub    $0x8,%rsp
  lea    D8(%rip),%rdi
  call   <printf@plt>
  lea    D14(%rip),%rdi
  call   <printf@plt>
  mov    $0x2,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D8
type: string
name: extract_symbolic_data
arguments: data_label: D14
type: string

tool: D8: You wisely wait until the instructor returns with a Blue Internal Security


tool: D14: guard.  The guard leads you to an Internal Security self incrimination station.


assistant: ```c
page52() {
  printf("You wisely wait until the instructor returns with a Blue Internal Security\n");
  printf("guard.  The guard leads you to an Internal Security self incrimination station.\n");
  return 2;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<page52>:
  endbr64
  sub    $0x8,%rsp
  lea    D15(%rip),%rdi
  call   <printf@plt>
  lea    D19(%rip),%rdi
  call   <printf@plt>
  mov    $0x2,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D15
data_type: string
name: unpack_data
arguments: data_label: D19
data_type: string

tool: D15: You wisely wait until the instructor returns with a Blue Internal Security


tool: D19: guard.  The guard leads you to an Internal Security self incrimination station.


assistant: ```c
page52() {
  printf("You wisely wait until the instructor returns with a Blue Internal Security\n");
  printf("guard.  The guard leads you to an Internal Security self incrimination station.\n");
  return 2;
}
```
user: What is the c source code of the assembly code below?

```asm
<Fread>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L3
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <tprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L3:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D6
type: string
name: extract_symbolic_data
arguments: label: D13
type: string

tool: D6: rb

tool: D13: ERROR: The file %s could not opened to read!


assistant: ```c
FILE *Fread(char *filename) {
  FILE *in;
  if ((in = fopen(filename, "rb")) == NULL) {
    tprintf("ERROR: The file %s could not opened to read!\n", filename);
    exit(0);
  }
  return (in);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<Fread>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  lea    D4(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L15
L1:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L15:
  mov    %rbp,%rsi
  lea    D1(%rip),%rdi
  call   <tprintf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L1
```

tool_calls: name: unpack_data
arguments: data_label: D4
type_guessed: string
name: unpack_data
arguments: data_label: D1
type_guessed: string

tool: D4: rb

tool: D1: ERROR: The file %s could not opened to read!


assistant: ```c
FILE *Fread(char *filename) {
  FILE *in;
  if ((in = fopen(filename, "rb")) == NULL) {
    tprintf("ERROR: The file %s could not opened to read!\n", filename);
    exit(0);
  }
  return (in);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<Fread>:
  endbr64
  push   %r12
  lea    D19(%rip),%rsi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L9
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L9:
  mov    %rbp,%rsi
  lea    D7(%rip),%rdi
  call   <tprintf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D19
datatype: string
name: retrieve_data
arguments: data_tag: D7
datatype: string

tool: D19: rb

tool: D7: ERROR: The file %s could not opened to read!


assistant: ```c
FILE *Fread(char *filename) {
  FILE *in;
  if ((in = fopen(filename, "rb")) == NULL) {
    tprintf("ERROR: The file %s could not opened to read!\n", filename);
    exit(0);
  }
  return (in);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<Fread>:
  endbr64
  push   %r12
  lea    D16(%rip),%rsi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L8
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L8:
  mov    %rbp,%rsi
  lea    D12(%rip),%rdi
  call   <tprintf@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D16
data_type: string
name: unpack_data
arguments: data_tag: D12
data_type: string

tool: D16: rb

tool: D12: ERROR: The file %s could not opened to read!


assistant: ```c
FILE *Fread(char *filename) {
  FILE *in;
  if ((in = fopen(filename, "rb")) == NULL) {
    tprintf("ERROR: The file %s could not opened to read!\n", filename);
    exit(0);
  }
  return (in);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<restoreprivilege>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <setreuid@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L5
  mov    -0x4(%rbp),%eax
  jmp    L15
L5:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <setregid@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L30
  mov    -0x4(%rbp),%eax
  jmp    L15
L30:
  mov    $0x0,%eax
L15:
  leave
  ret
```

assistant: ```c
int restoreprivilege(void) {
  int error;
  error = setreuid((uid_t)0, (uid_t)0);
  if (error)
    return (error);
  error = setregid((gid_t)0, (gid_t)0);
  if (error)
    return (error);
  return (0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<restoreprivilege>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <setreuid@plt>
  test   %eax,%eax
  je     L16
L10:
  add    $0x8,%rsp
  ret
L16:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <setregid@plt>
  jmp    L10
```

assistant: ```c
int restoreprivilege(void) {
  int error;
  error = setreuid((uid_t)0, (uid_t)0);
  if (error)
    return (error);
  error = setregid((gid_t)0, (gid_t)0);
  if (error)
    return (error);
  return (0);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<restoreprivilege>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  xor    %edi,%edi
  call   <setreuid@plt>
  test   %eax,%eax
  je     L6
  add    $0x8,%rsp
  ret
  nopw   0x0(%rax,%rax,1)
L6:
  xor    %esi,%esi
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1070 <setregid@plt>
```

assistant: ```c
int restoreprivilege(void) {
  int error;
  error = setreuid((uid_t)0, (uid_t)0);
  if (error)
    return (error);
  error = setregid((gid_t)0, (gid_t)0);
  if (error)
    return (error);
  return (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<restoreprivilege>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  xor    %edi,%edi
  call   <setreuid@plt>
  test   %eax,%eax
  je     L5
  add    $0x8,%rsp
  ret
  nopw   0x0(%rax,%rax,1)
L5:
  xor    %esi,%esi
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1070 <setregid@plt>
```

assistant: ```c
int restoreprivilege(void) {
  int error;
  error = setreuid((uid_t)0, (uid_t)0);
  if (error)
    return (error);
  error = setregid((gid_t)0, (gid_t)0);
  if (error)
    return (error);
  return (0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<get_line>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L19:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %al,-0x9(%rbp)
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  cmp    %al,-0x9(%rbp)
  jne    L11
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  jmp    L23
L11:
  cmpb   $0xa,-0x9(%rbp)
  jne    L3
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L23
L3:
  mov    -0x8(%rbp),%rax
  movzbl -0x9(%rbp),%edx
  mov    %dl,(%rax)
  addq   $0x1,-0x8(%rbp)
  jmp    L19
L23:
  leave
  ret
```

assistant: ```c
int get_line(char *line) {
  char c;
  char *p = line;
  while (1) {
    c = (char)getchar();
    if (c == (char)EOF)
      return EOF;
    else if (c == '\n') {
      *p = '\0';
      return 0;
    } else {
      *p = c;
      p++;
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<get_line>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  jmp    L2
L15:
  mov    %al,(%rbx)
  add    $0x1,%rbx
L2:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    D0(%rip),%rdx
  mov    (%rdx),%edx
  cmp    %dl,%al
  je     L25
  cmp    $0xa,%al
  jne    L15
  movb   $0x0,(%rbx)
  mov    $0x0,%edx
L25:
  mov    %edx,%eax
  pop    %rbx
  ret
```

assistant: ```c
int get_line(char *line) {
  char c;
  char *p = line;
  while (1) {
    c = (char)getchar();
    if (c == (char)EOF)
      return EOF;
    else if (c == '\n') {
      *p = '\0';
      return 0;
    } else {
      *p = c;
      p++;
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<get_line>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  mov    D2(%rip),%rbp
  jmp    L27
  cs nopw 0x0(%rax,%rax,1)
L8:
  cmp    $0xa,%al
  je     L28
  mov    %al,(%rbx)
  add    $0x1,%rbx
L27:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    0x0(%rbp),%r8d
  cmp    %r8b,%al
  jne    L8
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L28:
  movb   $0x0,(%rbx)
  xor    %r8d,%r8d
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int get_line(char *line) {
  char c;
  char *p = line;
  while (1) {
    c = (char)getchar();
    if (c == (char)EOF)
      return EOF;
    else if (c == '\n') {
      *p = '\0';
      return 0;
    } else {
      *p = c;
      p++;
    }
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<get_line>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  mov    D8(%rip),%rbp
  jmp    L20
  cs nopw 0x0(%rax,%rax,1)
L27:
  cmp    $0xa,%al
  je     L4
  mov    %al,(%rbx)
  add    $0x1,%rbx
L20:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    0x0(%rbp),%r8d
  cmp    %r8b,%al
  jne    L27
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L4:
  movb   $0x0,(%rbx)
  xor    %r8d,%r8d
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int get_line(char *line) {
  char c;
  char *p = line;
  while (1) {
    c = (char)getchar();
    if (c == (char)EOF)
      return EOF;
    else if (c == '\n') {
      *p = '\0';
      return 0;
    } else {
      *p = c;
      p++;
    }
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<initcolor>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x0,%eax
  call   <has_colors@plt>
  test   %eax,%eax
  jne    L5
L8:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L5:
  mov    $0x0,%eax
  call   <initscr@plt>
  mov    $0x0,%eax
  call   <start_color@plt>
  mov    $0x0,%eax
  call   <refresh@plt>
  mov    $0x0,%eax
  call   <noecho@plt>
  mov    D29(%rip),%rbx
  mov    $0x0,%esi
  mov    (%rbx),%edi
  call   <wattrset@plt>
  mov    D6(%rip),%rbp
  mov    0x0(%rbp),%esi
  mov    (%rbx),%edi
  call   <scrollok@plt>
  mov    0x0(%rbp),%esi
  mov    (%rbx),%edi
  call   <leaveok@plt>
  mov    0x0(%rbp),%esi
  mov    (%rbx),%edi
  call   <idlok@plt>
  mov    0x0(%rbp),%esi
  mov    (%rbx),%edi
  call   <nodelay@plt>
  mov    D66(%rip),%rbx
  mov    D16(%rip),%r12
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0x2,%edi
  call   <init_pair@plt>
  mov    D12(%rip),%rbp
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0x5,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    D94(%rip),%rax
  mov    (%rax),%esi
  mov    $0x1,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    D73(%rip),%rax
  mov    (%rax),%esi
  mov    $0x6,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0x7,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0x9,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0x8,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0xb,%edi
  call   <init_pair@plt>
  mov    D14(%rip),%rbp
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0xc,%edi
  call   <init_pair@plt>
  mov    D10(%rip),%r12
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0x3,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0x4,%edi
  call   <init_pair@plt>
  mov    D70(%rip),%r12
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0xa,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    (%r12),%esi
  mov    $0xd,%edi
  call   <init_pair@plt>
  mov    (%rbx),%edx
  mov    0x0(%rbp),%esi
  mov    $0xe,%edi
  call   <init_pair@plt>
  mov    $0x1,%eax
  jmp    L8
```

assistant: ```c
int initcolor(void) {
  if (!has_colors())
    return 0;
  initscr();
  start_color();
  refresh();
  noecho();
  wattrset(stdscr, 0);
  scrollok(stdscr, TRUE);
  leaveok(stdscr, TRUE);
  idlok(stdscr, TRUE);
  nodelay(stdscr, TRUE);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(5, COLOR_WHITE, COLOR_BLACK);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(6, COLOR_CYAN, COLOR_BLACK);
  init_pair(7, COLOR_WHITE, COLOR_BLACK);
  init_pair(9, COLOR_WHITE, COLOR_BLACK);
  init_pair(8, COLOR_GREEN, COLOR_BLACK);
  init_pair(11, COLOR_WHITE, COLOR_BLACK);
  init_pair(12, COLOR_YELLOW, COLOR_BLACK);
  init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(4, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(10, COLOR_BLUE, COLOR_BLACK);
  init_pair(13, COLOR_BLUE, COLOR_BLACK);
  init_pair(14, COLOR_YELLOW, COLOR_BLACK);
  return 1;
}
```