ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<draw_scrollbar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %esi,%r13d
  mov    %ecx,%ebp
  mov    %r8d,%r12d
  mov    %r9d,%r15d
  test   %ecx,%ecx
  jg     L37
L11:
  mov    %r12d,%r14d
  sub    %ebp,%r14d
  mov    %r14d,%ecx
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    %r13d,%esi
  mov    %ebx,%edi
  call   <mvvline@plt>
  sub    %r12d,%r15d
  test   %r15d,%r15d
  jg     L28
L34:
  mov    $0x0,%eax
  call   <standout@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L37:
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  call   <mvvline@plt>
  add    %ebp,%ebx
  jmp    L11
L28:
  lea    (%rbx,%r14,1),%edi
  mov    %r15d,%ecx
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    %r13d,%esi
  call   <mvvline@plt>
  jmp    L34
```

assistant: ```c
void draw_scrollbar(int sy, int sx, int by1, int by2, int by3, int by4) {
  int x, y;
  int len;
  x = sx;
  y = sy;
  len = by2;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
    y += len;
  }
  len = by3 - by2;
  mvvline(y, x, ACS_CKBOARD, len);
  y += len;
  len = by4 - by3;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
  }
  standout();
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<draw_scrollbar>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  test   %ecx,%ecx
  jle    L7
  mov    D4(%rip),%rax
  add    %ebp,%ebx
  mov    (%rax),%edx
  call   <mvvline@plt>
L7:
  mov    D22(%rip),%rax
  mov    %r12d,%r15d
  mov    %r13d,%esi
  mov    %ebx,%edi
  sub    %ebp,%r15d
  sub    %r12d,%r14d
  mov    (%rax),%edx
  mov    %r15d,%ecx
  call   <mvvline@plt>
  test   %r14d,%r14d
  jle    L10
  mov    D4(%rip),%rax
  lea    (%rbx,%r15,1),%edi
  mov    %r14d,%ecx
  mov    %r13d,%esi
  mov    (%rax),%edx
  call   <mvvline@plt>
L10:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <standout@plt>
```

assistant: ```c
void draw_scrollbar(int sy, int sx, int by1, int by2, int by3, int by4) {
  int x, y;
  int len;
  x = sx;
  y = sy;
  len = by2;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
    y += len;
  }
  len = by3 - by2;
  mvvline(y, x, ACS_CKBOARD, len);
  y += len;
  len = by4 - by3;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
  }
  standout();
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<draw_scrollbar>:
  endbr64
  push   %r15
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  test   %ecx,%ecx
  jle    L17
  mov    D7(%rip),%rax
  add    %ebp,%ebx
  mov    (%rax),%edx
  call   <mvvline@plt>
L17:
  mov    D14(%rip),%rax
  mov    %r12d,%r15d
  mov    %r13d,%esi
  mov    %ebx,%edi
  sub    %ebp,%r15d
  sub    %r12d,%r14d
  mov    (%rax),%edx
  mov    %r15d,%ecx
  call   <mvvline@plt>
  test   %r14d,%r14d
  jle    L15
  mov    D7(%rip),%rax
  lea    (%rbx,%r15,1),%edi
  mov    %r14d,%ecx
  mov    %r13d,%esi
  mov    (%rax),%edx
  call   <mvvline@plt>
L15:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <standout@plt>
```

assistant: ```c
void draw_scrollbar(int sy, int sx, int by1, int by2, int by3, int by4) {
  int x, y;
  int len;
  x = sx;
  y = sy;
  len = by2;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
    y += len;
  }
  len = by3 - by2;
  mvvline(y, x, ACS_CKBOARD, len);
  y += len;
  len = by4 - by3;
  if (len > 0) {
    mvvline(y, x, ACS_VLINE, len);
  }
  standout();
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xf0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  jmp    L11
L29:
  lea    -0x70(%rbp),%rdx
  lea    -0xe0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <any@plt>
  mov    %eax,-0xe4(%rbp)
  mov    -0xe4(%rbp),%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L11:
  lea    -0xe0(%rbp),%rax
  mov    $0x64,%esi
  mov    %rax,%rdi
  call   <get_line@plt>
  mov    %eax,-0xec(%rbp)
  cmpl   $0x0,-0xec(%rbp)
  jle    L6
  lea    -0x70(%rbp),%rax
  mov    $0x64,%esi
  mov    %rax,%rdi
  call   <get_line@plt>
  mov    %eax,-0xe8(%rbp)
  cmpl   $0x0,-0xe8(%rbp)
  jg     L29
L6:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L35
  call   <__stack_chk_fail@plt>
L35:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D6
type_guessed: string

tool: D6: %d


assistant: ```c
int main() {
  char s1[100];
  char s2[100];
  int len1;
  int len2;
  int loc;
  while ((len1 = get_line(s1, 100)) > 0 && (len2 = get_line(s2, 100)) > 0) {
    loc = any(s1, s2);
    printf("%d\n", loc);
  }
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbx
  sub    $0xe0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  lea    D9(%rip),%rbx
  jmp    L23
L15:
  lea    0x70(%rsp),%rsi
  mov    %rsp,%rdi
  call   <any@plt>
  mov    %eax,%esi
  mov    %rbx,%rdi
  call   <printf@plt>
L23:
  mov    %rsp,%rdi
  mov    $0x64,%esi
  call   <get_line@plt>
  test   %eax,%eax
  jle    L37
  lea    0x70(%rsp),%rdi
  mov    $0x64,%esi
  call   <get_line@plt>
  test   %eax,%eax
  jg     L15
L37:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  mov    $0x0,%eax
  add    $0xe0,%rsp
  pop    %rbx
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D9
type: string

tool: D9: %d


assistant: ```c
int main() {
  char s1[100];
  char s2[100];
  int len1;
  int len2;
  int loc;
  while ((len1 = get_line(s1, 100)) > 0 && (len2 = get_line(s2, 100)) > 0) {
    loc = any(s1, s2);
    printf("%d\n", loc);
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %r12
  lea    D5(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0xe0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  jmp    L14
  xchg   %ax,%ax
L0:
  lea    0x70(%rsp),%rbp
  mov    $0x64,%esi
  mov    %rbp,%rdi
  call   <get_line@plt>
  test   %eax,%eax
  jle    L10
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <any@plt>
  mov    %r12,%rdi
  mov    %eax,%esi
  call   <printf@plt>
L14:
  mov    $0x64,%esi
  mov    %rbx,%rdi
  call   <get_line@plt>
  test   %eax,%eax
  jg     L0
L10:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0xe0,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D5
datatype: string

tool: D5: %d


assistant: ```c
int main() {
  char s1[100];
  char s2[100];
  int len1;
  int len2;
  int loc;
  while ((len1 = get_line(s1, 100)) > 0 && (len2 = get_line(s2, 100)) > 0) {
    loc = any(s1, s2);
    printf("%d\n", loc);
  }
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r12
  lea    D8(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0xe0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  jmp    L0
  xchg   %ax,%ax
L25:
  lea    0x70(%rsp),%rbp
  mov    $0x64,%esi
  mov    %rbp,%rdi
  call   <get_line@plt>
  test   %eax,%eax
  jle    L24
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <any@plt>
  mov    %r12,%rdi
  mov    %eax,%esi
  call   <printf@plt>
L0:
  mov    $0x64,%esi
  mov    %rbx,%rdi
  call   <get_line@plt>
  test   %eax,%eax
  jg     L25
L24:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0xe0,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D8
data_type: string

tool: D8: %d


assistant: ```c
int main() {
  char s1[100];
  char s2[100];
  int len1;
  int len2;
  int loc;
  while ((len1 = get_line(s1, 100)) > 0 && (len2 = get_line(s2, 100)) > 0) {
    loc = any(s1, s2);
    printf("%d\n", loc);
  }
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D9
type_infered: string

tool: D9: test5


assistant: ```c
int main(int ac, char **av) {
  printf("test5\n");
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: tag: D4
datatype: string

tool: D4: test5


assistant: ```c
int main(int ac, char **av) {
  printf("test5\n");
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

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

tool_calls: name: parse_data
arguments: data_label: D4
datatype: string

tool: D4: test5


assistant: ```c
int main(int ac, char **av) {
  printf("test5\n");
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: label: D2
datatype: string

tool: D2: test5


assistant: ```c
int main(int ac, char **av) {
  printf("test5\n");
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

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

assistant: ```c
void cgltf_default_free(void *user, void *ptr) {
  (void)user;
  free(ptr);
}
```
user: Translate the below assembly code into C programming language:

```asm
<cgltf_default_free>:
  endbr64
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void cgltf_default_free(void *user, void *ptr) {
  (void)user;
  free(ptr);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cgltf_default_free>:
  endbr64
  mov    %rsi,%rdi
  jmp    1050 <free@plt>
```

assistant: ```c
void cgltf_default_free(void *user, void *ptr) {
  (void)user;
  free(ptr);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cgltf_default_free>:
  endbr64
  mov    %rsi,%rdi
  jmp    1050 <free@plt>
```

assistant: ```c
void cgltf_default_free(void *user, void *ptr) {
  (void)user;
  free(ptr);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<primitive_float_greater>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    $0x0,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  comisd -0x10(%rbp),%xmm0
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <box_boolean@plt>
  nop
  leave
  ret
```

assistant: ```c
void primitive_float_greater(void) {
  double y = untag_float_fast(dpop());
  double x = untag_float_fast(dpop());
  ;
  box_boolean(x > y);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<primitive_float_greater>:
  endbr64
  push   %rbx
  mov    $0x0,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  movq   %xmm0,%rbx
  mov    $0x0,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  movq   %rbx,%xmm1
  comisd %xmm1,%xmm0
  seta   %dil
  movzbl %dil,%edi
  call   <box_boolean@plt>
  pop    %rbx
  ret
```

assistant: ```c
void primitive_float_greater(void) {
  double y = untag_float_fast(dpop());
  double x = untag_float_fast(dpop());
  ;
  box_boolean(x > y);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<primitive_float_greater>:
  endbr64
  sub    $0x18,%rsp
  xor    %eax,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  xor    %edi,%edi
  comisd 0x8(%rsp),%xmm0
  seta   %dil
  add    $0x18,%rsp
  jmp    1080 <box_boolean@plt>
```

assistant: ```c
void primitive_float_greater(void) {
  double y = untag_float_fast(dpop());
  double x = untag_float_fast(dpop());
  ;
  box_boolean(x > y);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<primitive_float_greater>:
  endbr64
  sub    $0x18,%rsp
  xor    %eax,%eax
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <dpop@plt>
  mov    %eax,%edi
  call   <untag_float_fast@plt>
  xor    %edi,%edi
  comisd 0x8(%rsp),%xmm0
  seta   %dil
  add    $0x18,%rsp
  jmp    1080 <box_boolean@plt>
```

assistant: ```c
void primitive_float_greater(void) {
  double y = untag_float_fast(dpop());
  double x = untag_float_fast(dpop());
  ;
  box_boolean(x > y);
}
```
user: Translate the below assembly code into C programming language:

```asm
<CheckIfModuleWanted>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%rbp
  mov    %rdx,%r15
  lea    0x12(%rsi),%rsi
  mov    D27(%rip),%rax
  mov    (%rax),%edx
  call   <fseek@plt>
  mov    %r13,%rdi
  call   <ReadLong@plt>
  mov    %rax,%r12
  mov    %r13,%rdi
  call   <ReadLong@plt>
  mov    %r13,%rdi
  call   <ReadLong@plt>
  mov    %rax,%rbx
  mov    %r13,%rdi
  call   <ReadLong@plt>
  mov    %rax,%r14
  add    $0x8,%rbp
  lea    0x0(%rbp,%r12,1),%rsi
  mov    D27(%rip),%rax
  mov    (%rax),%edx
  mov    %r13,%rdi
  call   <fseek@plt>
  mov    $0x0,%eax
  call   <ReadName@plt>
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,0x8(%rsp)
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L6
  test   %rbx,%rbx
  je     L40
  cmp    $0xffffffffffffffff,%r14
  cmove  %r12,%r14
  lea    0x0(%rbp,%rbx,1),%rsi
  mov    D27(%rip),%rax
  mov    (%rax),%edx
  mov    %r13,%rdi
  call   <fseek@plt>
  cmp    %rbx,%r14
  jg     L24
L40:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  movq   $0x0,0x8(%rsp)
L6:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L61:
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L6
L12:
  cmp    %rbx,%r14
  jle    L40
L24:
  mov    %r13,%rdi
  call   <fgetc@plt>
  mov    %eax,%ebp
  mov    %r13,%rdi
  call   <fgetc@plt>
  mov    %r13,%rdi
  call   <ReadLong@plt>
  add    $0x6,%rbx
  mov    $0x0,%eax
  call   <ReadName@plt>
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rbx,%rax,1),%rbx
  cmp    $0x58,%bpl
  je     L61
  cmp    $0x47,%bpl
  jne    L12
  jmp    L61
```

assistant: ```c
char *CheckIfModuleWanted(FILE *z80asmfile, long currentlibmodule, char *modname) {
  long fptr_mname, fptr_expr, fptr_name, fptr_libname;
  char *mname;
  char *name;
  fseek(z80asmfile, currentlibmodule + 4 + 4 + 8 + 2, SEEK_SET);
  fptr_mname = ReadLong(z80asmfile);
  fptr_expr = ReadLong(z80asmfile);
  fptr_name = ReadLong(z80asmfile);
  fptr_libname = ReadLong(z80asmfile);
  fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_mname, SEEK_SET);
  mname = strdup(ReadName());
  if (strcmp(mname, modname) == 0) {
    return mname;
  }
  if (fptr_name != 0) {
    long end = fptr_libname;
    long red = 0;
    if (fptr_libname == -1) {
      end = fptr_mname;
    }
    fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_name, SEEK_SET);
    red = fptr_name;
    while (red < end) {
      char scope, type;
      long temp;
      scope = fgetc(z80asmfile);
      red++;
      type = fgetc(z80asmfile);
      red++;
      temp = ReadLong(z80asmfile);
      red += 4;
      name = ReadName();
      red += strlen(name);
      red++;
      if ((scope == 'X' || scope == 'G') && strcmp(name, modname) == 0) {
        return mname;
      }
    }
  }
  free(mname);
  return NULL;
}
```
user: Translate the below assembly code into C programming language:

```asm
<CheckIfModuleWanted>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  add    $0x12,%rsi
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    D28(%rip),%rax
  mov    (%rax),%edx
  call   <fseek@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  mov    %rax,%r15
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <ReadLong@plt>
  lea    0x8(%r14),%rcx
  mov    %rbp,%rdi
  mov    %rax,%r12
  mov    D28(%rip),%rax
  lea    (%rcx,%r15,1),%rsi
  mov    %rcx,0x8(%rsp)
  mov    (%rax),%edx
  call   <fseek@plt>
  xor    %eax,%eax
  call   <ReadName@plt>
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  call   <strcmp@plt>
  test   %rax,%rax
  je     L59
  test   %rbx,%rbx
  je     L30
  mov    D28(%rip),%rax
  mov    0x8(%rsp),%rcx
  cmp    $0xffffffffffffffff,%r12
  mov    %rbp,%rdi
  cmove  %r15,%r12
  mov    (%rax),%edx
  lea    (%rcx,%rbx,1),%rsi
  call   <fseek@plt>
  cs nopw 0x0(%rax,%rax,1)
L12:
  cmp    %rbx,%r12
  jle    L30
  mov    %rbp,%rdi
  add    $0x6,%rbx
  call   <fgetc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <fgetc@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  xor    %eax,%eax
  call   <ReadName@plt>
  mov    %rax,%rdi
  mov    %rax,%r14
  call   <strlen@plt>
  lea    0x1(%rbx,%rax,1),%rbx
  cmp    $0x58,%r15b
  je     L50
  cmp    $0x47,%r15b
  jne    L12
L50:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L12
L59:
  mov    (%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L30:
  mov    (%rsp),%rdi
  call   <free@plt>
  movq   $0x0,(%rsp)
  jmp    L59
```

assistant: ```c
char *CheckIfModuleWanted(FILE *z80asmfile, long currentlibmodule, char *modname) {
  long fptr_mname, fptr_expr, fptr_name, fptr_libname;
  char *mname;
  char *name;
  fseek(z80asmfile, currentlibmodule + 4 + 4 + 8 + 2, SEEK_SET);
  fptr_mname = ReadLong(z80asmfile);
  fptr_expr = ReadLong(z80asmfile);
  fptr_name = ReadLong(z80asmfile);
  fptr_libname = ReadLong(z80asmfile);
  fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_mname, SEEK_SET);
  mname = strdup(ReadName());
  if (strcmp(mname, modname) == 0) {
    return mname;
  }
  if (fptr_name != 0) {
    long end = fptr_libname;
    long red = 0;
    if (fptr_libname == -1) {
      end = fptr_mname;
    }
    fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_name, SEEK_SET);
    red = fptr_name;
    while (red < end) {
      char scope, type;
      long temp;
      scope = fgetc(z80asmfile);
      red++;
      type = fgetc(z80asmfile);
      red++;
      temp = ReadLong(z80asmfile);
      red += 4;
      name = ReadName();
      red += strlen(name);
      red++;
      if ((scope == 'X' || scope == 'G') && strcmp(name, modname) == 0) {
        return mname;
      }
    }
  }
  free(mname);
  return NULL;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<CheckIfModuleWanted>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  add    $0x12,%rsi
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  call   <fseek@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  mov    %rax,%r15
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <ReadLong@plt>
  lea    0x8(%r14),%rcx
  mov    %rbp,%rdi
  mov    %rax,%r12
  mov    D5(%rip),%rax
  lea    (%rcx,%r15,1),%rsi
  mov    %rcx,0x8(%rsp)
  mov    (%rax),%edx
  call   <fseek@plt>
  xor    %eax,%eax
  call   <ReadName@plt>
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  call   <strcmp@plt>
  test   %rax,%rax
  je     L43
  test   %rbx,%rbx
  je     L23
  mov    D5(%rip),%rax
  mov    0x8(%rsp),%rcx
  cmp    $0xffffffffffffffff,%r12
  mov    %rbp,%rdi
  cmove  %r15,%r12
  mov    (%rax),%edx
  lea    (%rcx,%rbx,1),%rsi
  call   <fseek@plt>
  cs nopw 0x0(%rax,%rax,1)
L62:
  cmp    %rbx,%r12
  jle    L23
  mov    %rbp,%rdi
  add    $0x6,%rbx
  call   <fgetc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <fgetc@plt>
  mov    %rbp,%rdi
  call   <ReadLong@plt>
  xor    %eax,%eax
  call   <ReadName@plt>
  mov    %rax,%rdi
  mov    %rax,%r14
  call   <strlen@plt>
  lea    0x1(%rbx,%rax,1),%rbx
  cmp    $0x58,%r15b
  je     L49
  cmp    $0x47,%r15b
  jne    L62
L49:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L62
L43:
  mov    (%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L23:
  mov    (%rsp),%rdi
  call   <free@plt>
  movq   $0x0,(%rsp)
  jmp    L43
```

assistant: ```c
char *CheckIfModuleWanted(FILE *z80asmfile, long currentlibmodule, char *modname) {
  long fptr_mname, fptr_expr, fptr_name, fptr_libname;
  char *mname;
  char *name;
  fseek(z80asmfile, currentlibmodule + 4 + 4 + 8 + 2, SEEK_SET);
  fptr_mname = ReadLong(z80asmfile);
  fptr_expr = ReadLong(z80asmfile);
  fptr_name = ReadLong(z80asmfile);
  fptr_libname = ReadLong(z80asmfile);
  fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_mname, SEEK_SET);
  mname = strdup(ReadName());
  if (strcmp(mname, modname) == 0) {
    return mname;
  }
  if (fptr_name != 0) {
    long end = fptr_libname;
    long red = 0;
    if (fptr_libname == -1) {
      end = fptr_mname;
    }
    fseek(z80asmfile, currentlibmodule + 4 + 4 + fptr_name, SEEK_SET);
    red = fptr_name;
    while (red < end) {
      char scope, type;
      long temp;
      scope = fgetc(z80asmfile);
      red++;
      type = fgetc(z80asmfile);
      red++;
      temp = ReadLong(z80asmfile);
      red += 4;
      name = ReadName();
      red += strlen(name);
      red++;
      if ((scope == 'X' || scope == 'G') && strcmp(name, modname) == 0) {
        return mname;
      }
    }
  }
  free(mname);
  return NULL;
}
```