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

```asm
<array_of_segments>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movq   $0x0,-0x28(%rbp)
  movl   $0x0,-0x2c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strtok@plt>
  mov    %rax,-0x28(%rbp)
L24:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jge    L2
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,(%rbx)
L2:
  addl   $0x1,-0x2c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L24
  cmpq   $0x0,-0x20(%rbp)
  je     L3
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L3:
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
char **array_of_segments(char *buf, char *dl, int i) {
  char *sg = NULL;
  char **a;
  int j = 0;
  char *cbuf = strdup(buf);
  a = malloc(i * sizeof(char *));
  sg = strtok(cbuf, dl);
  do {
    if (j < i) {
      a[j] = strdup(sg);
    }
    ++j;
  } while (sg = strtok(NULL, dl));
  if (cbuf)
    free(cbuf);
  return a;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<array_of_segments>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbp
  mov    %edx,%r12d
  call   <strdup@plt>
  mov    %rax,%r14
  lea    0x0(,%r12,8),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <strtok@plt>
  mov    $0x0,%ebx
  jmp    L11
L35:
  mov    %rbp,%rsi
  mov    $0x0,%edi
  call   <strtok@plt>
  add    $0x1,%rbx
  test   %rax,%rax
  je     L40
L11:
  cmp    %ebx,%r12d
  jle    L35
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,0x0(%r13,%rbx,8)
  jmp    L35
L40:
  test   %r14,%r14
  je     L45
  mov    %r14,%rdi
  call   <free@plt>
L45:
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char **array_of_segments(char *buf, char *dl, int i) {
  char *sg = NULL;
  char **a;
  int j = 0;
  char *cbuf = strdup(buf);
  a = malloc(i * sizeof(char *));
  sg = strtok(cbuf, dl);
  do {
    if (j < i) {
      a[j] = strdup(sg);
    }
    ++j;
  } while (sg = strtok(NULL, dl));
  if (cbuf)
    free(cbuf);
  return a;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<array_of_segments>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rsi,%rbx
  call   <strdup@plt>
  lea    0x0(,%rbp,8),%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %r13,%rdi
  mov    %rbx,%rsi
  mov    %rax,%r12
  call   <strtok@plt>
  mov    %rax,%rdi
  nopl   0x0(%rax)
L6:
  cmp    %r14d,%ebp
  jle    L12
  call   <strdup@plt>
  mov    %rax,(%r12,%r14,8)
L12:
  xor    %edi,%edi
  mov    %rbx,%rsi
  add    $0x1,%r14
  call   <strtok@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  jne    L6
  test   %r13,%r13
  je     L0
  mov    %r13,%rdi
  call   <free@plt>
L0:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char **array_of_segments(char *buf, char *dl, int i) {
  char *sg = NULL;
  char **a;
  int j = 0;
  char *cbuf = strdup(buf);
  a = malloc(i * sizeof(char *));
  sg = strtok(cbuf, dl);
  do {
    if (j < i) {
      a[j] = strdup(sg);
    }
    ++j;
  } while (sg = strtok(NULL, dl));
  if (cbuf)
    free(cbuf);
  return a;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<array_of_segments>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  call   <strdup@plt>
  lea    0x0(,%rbx,8),%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %r13,%rdi
  mov    %rbp,%rsi
  mov    %rax,%r12
  call   <strtok@plt>
  mov    %rax,%rdi
  nopl   0x0(%rax)
L23:
  cmp    %r14d,%ebx
  jle    L5
  call   <strdup@plt>
  mov    %rax,(%r12,%r14,8)
L5:
  xor    %edi,%edi
  mov    %rbp,%rsi
  add    $0x1,%r14
  call   <strtok@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  jne    L23
  test   %r13,%r13
  je     L25
  mov    %r13,%rdi
  call   <free@plt>
L25:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char **array_of_segments(char *buf, char *dl, int i) {
  char *sg = NULL;
  char **a;
  int j = 0;
  char *cbuf = strdup(buf);
  a = malloc(i * sizeof(char *));
  sg = strtok(cbuf, dl);
  do {
    if (j < i) {
      a[j] = strdup(sg);
    }
    ++j;
  } while (sg = strtok(NULL, dl));
  if (cbuf)
    free(cbuf);
  return a;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<info_worker>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <bitis_GetModules@plt>
  mov    %rax,-0x20(%rbp)
  mov    $0x0,%eax
  call   <bitis_GetVersion@plt>
  mov    %rax,%rsi
  lea    D65(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <bitis_GetBuildDate@plt>
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1000000,-0xc(%rbp)
  lea    -0xc(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L21
  lea    D46(%rip),%rax
  jmp    L31
L21:
  lea    D6(%rip),%rax
L31:
  mov    %rax,%rsi
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x28(%rbp),%rax
  test   %rax,%rax
  je     L17
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L17:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D65
type_infered: string
name: extract_symbolic_data
arguments: data_label: D9
type_infered: string
name: extract_symbolic_data
arguments: data_label: D46
type_infered: string
name: extract_symbolic_data
arguments: data_label: D6
type_infered: string
name: extract_symbolic_data
arguments: data_label: D23
type_infered: string
name: extract_symbolic_data
arguments: data_label: D11
type_infered: string
name: extract_symbolic_data
arguments: data_label: D7
type_infered: string

tool: D65: Lib Version: %s


tool: D9: Lib Build Date: %s


tool: D46: Big Endian

tool: D6: Little Endian

tool: D23: Architecture: %s


tool: D11: Modules:

tool: D7: Orphans:

assistant: ```c
int info_worker(int argc, char *argv[]) {
  struct bitis_fileTypeModuleLE *orphans;
  struct bitis_fileTypeModuleLE *list = bitis_GetModules(&orphans);
  printf("Lib Version: %s\n", bitis_GetVersion());
  printf("Lib Build Date: %s\n", bitis_GetBuildDate());
  unsigned char charVal[] = {0x00, 0x00, 0x00, 0x01};
  unsigned int *intVal = (unsigned int *)charVal;
  printf("Architecture: %s\n", (*intVal == 1) ? "Big Endian" : "Little Endian");
  printf("Modules:\n");
  if (orphans) {
    printf("Orphans:\n");
    free(orphans);
  }
  free(list);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<info_worker>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <bitis_GetModules@plt>
  mov    %rax,%rbx
  mov    $0x0,%eax
  call   <bitis_GetVersion@plt>
  mov    %rax,%rsi
  lea    D30(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <bitis_GetBuildDate@plt>
  mov    %rax,%rsi
  lea    D57(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D11(%rip),%rsi
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D10(%rip),%rdi
  call   <puts@plt>
  cmpq   $0x0,(%rsp)
  je     L10
  lea    D51(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
L10:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  mov    $0x0,%eax
  add    $0x10,%rsp
  pop    %rbx
  ret
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D30
type_infered: string
name: disassemble_data
arguments: data_tag: D57
type_infered: string
name: disassemble_data
arguments: data_tag: D11
type_infered: string
name: disassemble_data
arguments: data_tag: D4
type_infered: string
name: disassemble_data
arguments: data_tag: D10
type_infered: string
name: disassemble_data
arguments: data_tag: D51
type_infered: string

tool: D30: Lib Version: %s


tool: D57: Lib Build Date: %s


tool: D11: Little Endian

tool: D4: Architecture: %s


tool: D10: Modules:

tool: D51: Orphans:

assistant: ```c
int info_worker(int argc, char *argv[]) {
  struct bitis_fileTypeModuleLE *orphans;
  struct bitis_fileTypeModuleLE *list = bitis_GetModules(&orphans);
  printf("Lib Version: %s\n", bitis_GetVersion());
  printf("Lib Build Date: %s\n", bitis_GetBuildDate());
  unsigned char charVal[] = {0x00, 0x00, 0x00, 0x01};
  unsigned int *intVal = (unsigned int *)charVal;
  printf("Architecture: %s\n", (*intVal == 1) ? "Big Endian" : "Little Endian");
  printf("Modules:\n");
  if (orphans) {
    printf("Orphans:\n");
    free(orphans);
  }
  free(list);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<info_worker>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <bitis_GetModules@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <bitis_GetVersion@plt>
  lea    D20(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  call   <bitis_GetBuildDate@plt>
  lea    D9(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D2(%rip),%rsi
  lea    D10(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D38(%rip),%rdi
  call   <puts@plt>
  cmpq   $0x0,(%rsp)
  je     L9
  lea    D48(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
L9:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbp
  ret
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D20
type_guessed: string
name: retrieve_data
arguments: tag: D9
type_guessed: string
name: retrieve_data
arguments: tag: D2
type_guessed: string
name: retrieve_data
arguments: tag: D10
type_guessed: string
name: retrieve_data
arguments: tag: D38
type_guessed: string
name: retrieve_data
arguments: tag: D48
type_guessed: string

tool: D20: Lib Version: %s


tool: D9: Lib Build Date: %s


tool: D2: Little Endian

tool: D10: Architecture: %s


tool: D38: Modules:

tool: D48: Orphans:

assistant: ```c
int info_worker(int argc, char *argv[]) {
  struct bitis_fileTypeModuleLE *orphans;
  struct bitis_fileTypeModuleLE *list = bitis_GetModules(&orphans);
  printf("Lib Version: %s\n", bitis_GetVersion());
  printf("Lib Build Date: %s\n", bitis_GetBuildDate());
  unsigned char charVal[] = {0x00, 0x00, 0x00, 0x01};
  unsigned int *intVal = (unsigned int *)charVal;
  printf("Architecture: %s\n", (*intVal == 1) ? "Big Endian" : "Little Endian");
  printf("Modules:\n");
  if (orphans) {
    printf("Orphans:\n");
    free(orphans);
  }
  free(list);
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<info_worker>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <bitis_GetModules@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <bitis_GetVersion@plt>
  lea    D25(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  call   <bitis_GetBuildDate@plt>
  lea    D7(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D1(%rip),%rsi
  lea    D2(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D53(%rip),%rdi
  call   <puts@plt>
  cmpq   $0x0,(%rsp)
  je     L8
  lea    D35(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
L8:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D25
data_type: string
name: unpack_data
arguments: data_tag: D7
data_type: string
name: unpack_data
arguments: data_tag: D1
data_type: string
name: unpack_data
arguments: data_tag: D2
data_type: string
name: unpack_data
arguments: data_tag: D53
data_type: string
name: unpack_data
arguments: data_tag: D35
data_type: string

tool: D25: Lib Version: %s


tool: D7: Lib Build Date: %s


tool: D1: Little Endian

tool: D2: Architecture: %s


tool: D53: Modules:

tool: D35: Orphans:

assistant: ```c
int info_worker(int argc, char *argv[]) {
  struct bitis_fileTypeModuleLE *orphans;
  struct bitis_fileTypeModuleLE *list = bitis_GetModules(&orphans);
  printf("Lib Version: %s\n", bitis_GetVersion());
  printf("Lib Build Date: %s\n", bitis_GetBuildDate());
  unsigned char charVal[] = {0x00, 0x00, 0x00, 0x01};
  unsigned int *intVal = (unsigned int *)charVal;
  printf("Architecture: %s\n", (*intVal == 1) ? "Big Endian" : "Little Endian");
  printf("Modules:\n");
  if (orphans) {
    printf("Orphans:\n");
    free(orphans);
  }
  free(list);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<vfb_putstr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L14
L10:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <vfb_putchar@plt>
  addl   $0x1,-0x4(%rbp)
L14:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L10
  nop
  nop
  leave
  ret
```

assistant: ```c
void vfb_putstr(const char *str, const int size) {
  int ite;
  for (ite = 0; ite < size; ++ite)
    vfb_putchar(str[ite]);
}
```
user: What is the c source code of the assembly code below:

```asm
<vfb_putstr>:
  endbr64
  test   %esi,%esi
  jle    L12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  lea    -0x1(%rsi),%eax
  lea    0x1(%rdi,%rax,1),%rbp
L1:
  movsbl (%rbx),%edi
  call   <vfb_putchar@plt>
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L1
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L12:
  ret
```

assistant: ```c
void vfb_putstr(const char *str, const int size) {
  int ite;
  for (ite = 0; ite < size; ++ite)
    vfb_putchar(str[ite]);
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<vfb_putstr>:
  endbr64
  test   %esi,%esi
  jle    L15
  push   %rbp
  lea    -0x1(%rsi),%eax
  push   %rbx
  lea    0x1(%rdi,%rax,1),%rbp
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  nopl   0x0(%rax)
L5:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  call   <vfb_putchar@plt>
  cmp    %rbp,%rbx
  jne    L5
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L15:
  ret
```

assistant: ```c
void vfb_putstr(const char *str, const int size) {
  int ite;
  for (ite = 0; ite < size; ++ite)
    vfb_putchar(str[ite]);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<vfb_putstr>:
  endbr64
  test   %esi,%esi
  jle    L15
  push   %rbp
  lea    -0x1(%rsi),%eax
  push   %rbx
  lea    0x1(%rdi,%rax,1),%rbp
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  nopl   0x0(%rax)
L17:
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  call   <vfb_putchar@plt>
  cmp    %rbp,%rbx
  jne    L17
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L15:
  ret
```

assistant: ```c
void vfb_putstr(const char *str, const int size) {
  int ite;
  for (ite = 0; ite < size; ++ite)
    vfb_putchar(str[ite]);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<marc_findgenre>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x300,%rsp
  mov    %rdi,-0x2f8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x2e0(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    $0x5a,%ecx
  mov    %rax,%rdi
  mov    %rdx,%rsi
  rep movsq %ds:(%rsi),%es:(%rdi)
  movl   $0x5a,-0x2e4(%rbp)
  movl   $0x0,-0x2e8(%rbp)
  jmp    L43
L33:
  mov    -0x2e8(%rbp),%eax
  cltq
  mov    -0x2e0(%rbp,%rax,8),%rdx
  mov    -0x2f8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  jne    L5
  mov    -0x2e8(%rbp),%eax
  jmp    L15
L5:
  addl   $0x1,-0x2e8(%rbp)
L43:
  mov    -0x2e8(%rbp),%eax
  cmp    -0x2e4(%rbp),%eax
  jl     L33
  mov    $0xffffffff,%eax
L15:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L34
  call   <__stack_chk_fail@plt>
L34:
  leave
  ret
```

assistant: ```c
int marc_findgenre(char *query) {
  char *marc[] = {
      "abstract or summary", "art original", "art reproduction", "article", "atlas", "autobiography", "bibliography", "biography", "book", "calendar", "catalog", "chart", "comic or graphic novel", "comic strip", "conference publication", "database", "dictionary", "diorama", "directory", "discography", "drama", "encyclopedia", "essay", "festschrift", "fiction", "filmography", "filmstrip", "finding aid", "flash card", "folktale", "font", "game", "government publication", "graphic", "globe", "handbook", "history", "humor, satire", "hymnal", "index", "instruction", "interview", "issue", "journal", "kit", "language instruction", "law report or digest", "legal article", "legal case and case notes", "legislation", "letter", "loose-leaf", "map", "memoir", "microscope slide", "model", "motion picture", "multivolume monograph", "newspaper", "novel", "numeric data", "offprint", "online system or service", "patent", "periodical", "picture", "poetry", "programmed text", "realia", "rehearsal", "remote sensing image", "reporting", "review", "series", "short story", "slide", "sound", "speech", "standard or specification", "statistics", "survey of literature", "technical drawing", "technical report", "thesis", "toy", "transparency", "treaty", "videorecording", "web site", "yearbook",
  };
  int nmarc = sizeof(marc) / sizeof(char *);
  int i;
  for (i = 0; i < nmarc; ++i) {
    if (!strcasecmp(query, marc[i]))
      return i;
  }
  return -1;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<marc_findgenre>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x2e0,%rsp
  mov    %rdi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x2d8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  lea    D7(%rip),%rsi
  mov    $0x5a,%ecx
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    $0x0,%ebx
L15:
  mov    %ebx,%r12d
  mov    (%rsp,%rbx,8),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  je     L21
  add    $0x1,%rbx
  cmp    $0x5a,%rbx
  jne    L15
  mov    $0xffffffff,%r12d
L21:
  mov    0x2d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    %r12d,%eax
  add    $0x2e0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int marc_findgenre(char *query) {
  char *marc[] = {
      "abstract or summary", "art original", "art reproduction", "article", "atlas", "autobiography", "bibliography", "biography", "book", "calendar", "catalog", "chart", "comic or graphic novel", "comic strip", "conference publication", "database", "dictionary", "diorama", "directory", "discography", "drama", "encyclopedia", "essay", "festschrift", "fiction", "filmography", "filmstrip", "finding aid", "flash card", "folktale", "font", "game", "government publication", "graphic", "globe", "handbook", "history", "humor, satire", "hymnal", "index", "instruction", "interview", "issue", "journal", "kit", "language instruction", "law report or digest", "legal article", "legal case and case notes", "legislation", "letter", "loose-leaf", "map", "memoir", "microscope slide", "model", "motion picture", "multivolume monograph", "newspaper", "novel", "numeric data", "offprint", "online system or service", "patent", "periodical", "picture", "poetry", "programmed text", "realia", "rehearsal", "remote sensing image", "reporting", "review", "series", "short story", "slide", "sound", "speech", "standard or specification", "statistics", "survey of literature", "technical drawing", "technical report", "thesis", "toy", "transparency", "treaty", "videorecording", "web site", "yearbook",
  };
  int nmarc = sizeof(marc) / sizeof(char *);
  int i;
  for (i = 0; i < nmarc; ++i) {
    if (!strcasecmp(query, marc[i]))
      return i;
  }
  return -1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<marc_findgenre>:
  endbr64
  push   %r13
  lea    D1(%rip),%rsi
  mov    $0x5a,%ecx
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x2e8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2d8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  rep movsq %ds:(%rsi),%es:(%rdi)
  jmp    L27
L32:
  add    $0x1,%rbx
  cmp    $0x5a,%rbx
  je     L8
L27:
  mov    0x0(%rbp,%rbx,8),%rsi
  mov    %r12,%rdi
  mov    %ebx,%r13d
  call   <strcasecmp@plt>
  test   %eax,%eax
  jne    L32
L36:
  mov    0x2d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x2e8,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  mov    $0xffffffff,%r13d
  jmp    L36
L41:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int marc_findgenre(char *query) {
  char *marc[] = {
      "abstract or summary", "art original", "art reproduction", "article", "atlas", "autobiography", "bibliography", "biography", "book", "calendar", "catalog", "chart", "comic or graphic novel", "comic strip", "conference publication", "database", "dictionary", "diorama", "directory", "discography", "drama", "encyclopedia", "essay", "festschrift", "fiction", "filmography", "filmstrip", "finding aid", "flash card", "folktale", "font", "game", "government publication", "graphic", "globe", "handbook", "history", "humor, satire", "hymnal", "index", "instruction", "interview", "issue", "journal", "kit", "language instruction", "law report or digest", "legal article", "legal case and case notes", "legislation", "letter", "loose-leaf", "map", "memoir", "microscope slide", "model", "motion picture", "multivolume monograph", "newspaper", "novel", "numeric data", "offprint", "online system or service", "patent", "periodical", "picture", "poetry", "programmed text", "realia", "rehearsal", "remote sensing image", "reporting", "review", "series", "short story", "slide", "sound", "speech", "standard or specification", "statistics", "survey of literature", "technical drawing", "technical report", "thesis", "toy", "transparency", "treaty", "videorecording", "web site", "yearbook",
  };
  int nmarc = sizeof(marc) / sizeof(char *);
  int i;
  for (i = 0; i < nmarc; ++i) {
    if (!strcasecmp(query, marc[i]))
      return i;
  }
  return -1;
}
```