ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  addq   $0x8,-0x20(%rbp)
  mov    $0x4000,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L4
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L4:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%eax
  mov    $0x4000,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D20
type: string
name: parse_data
arguments: data_label: D14
type: string
name: parse_data
arguments: data_label: D2
type: string
name: parse_data
arguments: data_label: D31
type: string

tool: D20: failed to malloc memory

tool: D14: opening %s...


tool: D2: read %d bytes
Contents:
______________________________
%s

tool: D31: 
_______________________________

assistant: ```c
int main(int argc, char **argv) {
  char *p;
  int fd, readsz;
  ++argv;
  if (!(p = malloc(1024 * 16))) {
    printf("failed to malloc memory\n");
    exit(1);
  }
  printf("opening %s...\n", *argv);
  fd = open(*argv, 0);
  readsz = read(fd, p, 1024 * 16);
  printf("read %d bytes\nContents:\n______________________________\n%s", readsz, p);
  printf("\n_______________________________\n");
  exit(0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  mov    $0x4000,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L10
L3:
  mov    0x8(%rbp),%rsi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rbp),%rdi
  mov    $0x0,%esi
  call   <open@plt>
  mov    %eax,%edi
  mov    $0x4000,%edx
  mov    %rbx,%rsi
  call   <read@plt>
  mov    %eax,%esi
  mov    %rbx,%rdx
  lea    D26(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L10:
  lea    D1(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L3
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D24
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D26
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D4
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D1
type_infered: string

tool: D24: opening %s...


tool: D26: read %d bytes
Contents:
______________________________
%s

tool: D4: 
_______________________________

tool: D1: failed to malloc memory

assistant: ```c
int main(int argc, char **argv) {
  char *p;
  int fd, readsz;
  ++argv;
  if (!(p = malloc(1024 * 16))) {
    printf("failed to malloc memory\n");
    exit(1);
  }
  printf("opening %s...\n", *argv);
  fd = open(*argv, 0);
  readsz = read(fd, p, 1024 * 16);
  printf("read %d bytes\nContents:\n______________________________\n%s", readsz, p);
  printf("\n_______________________________\n");
  exit(0);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x4000,%edi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L12
L3:
  mov    0x8(%rbx),%rsi
  lea    D23(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rbx),%rdi
  xor    %esi,%esi
  call   <open@plt>
  mov    %r12,%rsi
  mov    $0x4000,%edx
  mov    %eax,%edi
  call   <read@plt>
  mov    %r12,%rdx
  lea    D18(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D34(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  ret
L12:
  lea    D32(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L3
```

tool_calls: name: parse_data
arguments: data_tag: D23
datatype: string
name: parse_data
arguments: data_tag: D18
datatype: string
name: parse_data
arguments: data_tag: D34
datatype: string
name: parse_data
arguments: data_tag: D32
datatype: string

tool: D23: opening %s...


tool: D18: read %d bytes
Contents:
______________________________
%s

tool: D34: 
_______________________________

tool: D32: failed to malloc memory

assistant: ```c
int main(int argc, char **argv) {
  char *p;
  int fd, readsz;
  ++argv;
  if (!(p = malloc(1024 * 16))) {
    printf("failed to malloc memory\n");
    exit(1);
  }
  printf("opening %s...\n", *argv);
  fd = open(*argv, 0);
  readsz = read(fd, p, 1024 * 16);
  printf("read %d bytes\nContents:\n______________________________\n%s", readsz, p);
  printf("\n_______________________________\n");
  exit(0);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x4000,%edi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L3
L4:
  mov    0x8(%rbx),%rsi
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rbx),%rdi
  xor    %esi,%esi
  call   <open@plt>
  mov    %r12,%rsi
  mov    $0x4000,%edx
  mov    %eax,%edi
  call   <read@plt>
  mov    %r12,%rdx
  lea    D20(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D2(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  ret
L3:
  lea    D16(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L4
```

tool_calls: name: unpack_data
arguments: data_tag: D1
type_infered: string
name: unpack_data
arguments: data_tag: D20
type_infered: string
name: unpack_data
arguments: data_tag: D2
type_infered: string
name: unpack_data
arguments: data_tag: D16
type_infered: string

tool: D1: opening %s...


tool: D20: read %d bytes
Contents:
______________________________
%s

tool: D2: 
_______________________________

tool: D16: failed to malloc memory

assistant: ```c
int main(int argc, char **argv) {
  char *p;
  int fd, readsz;
  ++argv;
  if (!(p = malloc(1024 * 16))) {
    printf("failed to malloc memory\n");
    exit(1);
  }
  printf("opening %s...\n", *argv);
  fd = open(*argv, 0);
  readsz = read(fd, p, 1024 * 16);
  printf("read %d bytes\nContents:\n______________________________\n%s", readsz, p);
  printf("\n_______________________________\n");
  exit(0);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<fun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x24,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L8
L10:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  mov    -0x14(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x10(%rbp)
  subq   $0x4,-0x8(%rbp)
L8:
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L10
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void fun(int a[]) {
  int *p = a, *q = a + 9, temp;
  while (p < q) {
    temp = *q;
    *q = *p;
    *p = temp;
    p++;
    q--;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<fun>:
  endbr64
  lea    0x24(%rdi),%rax
  lea    0x10(%rdi),%rsi
L7:
  mov    (%rax),%edx
  mov    (%rdi),%ecx
  mov    %ecx,(%rax)
  mov    %edx,(%rdi)
  add    $0x4,%rdi
  sub    $0x4,%rax
  cmp    %rax,%rsi
  jne    L7
  ret
```

assistant: ```c
void fun(int a[]) {
  int *p = a, *q = a + 9, temp;
  while (p < q) {
    temp = *q;
    *q = *p;
    *p = temp;
    p++;
    q--;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fun>:
  endbr64
  lea    0x24(%rdi),%rax
  lea    0x10(%rdi),%rsi
  nopl   0x0(%rax)
L4:
  mov    (%rdi),%ecx
  mov    (%rax),%edx
  sub    $0x4,%rax
  add    $0x4,%rdi
  mov    %ecx,0x4(%rax)
  mov    %edx,-0x4(%rdi)
  cmp    %rax,%rsi
  jne    L4
  ret
```

assistant: ```c
void fun(int a[]) {
  int *p = a, *q = a + 9, temp;
  while (p < q) {
    temp = *q;
    *q = *p;
    *p = temp;
    p++;
    q--;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<fun>:
  endbr64
  movdqu 0x18(%rdi),%xmm0
  movdqu (%rdi),%xmm2
  rolq   $0x20,0x10(%rdi)
  pshufd $0x1b,%xmm2,%xmm1
  pshufd $0x1b,%xmm0,%xmm0
  movups %xmm1,0x18(%rdi)
  movups %xmm0,(%rdi)
  ret
```

assistant: ```c
void fun(int a[]) {
  int *p = a, *q = a + 9, temp;
  while (p < q) {
    temp = *q;
    *q = *p;
    *p = temp;
    p++;
    q--;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<MatrixVectorMult>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x3c(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L1
L10:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dot@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x14(%rbp)
L1:
  mov    -0x14(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L10
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void MatrixVectorMult(double *c, double **A, double *b, int n) {
  int i;
  for (i = 0; i < n; i++) {
    c[i] = dot(A[i], b, n);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<MatrixVectorMult>:
  endbr64
  test   %ecx,%ecx
  jle    L15
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %ecx,%ebp
  mov    %ecx,%r15d
  mov    $0x0,%ebx
L3:
  mov    0x0(%r13,%rbx,8),%rdi
  mov    %ebp,%edx
  mov    %r14,%rsi
  call   <dot@plt>
  movsd  %xmm0,(%r12,%rbx,8)
  add    $0x1,%rbx
  cmp    %r15,%rbx
  jne    L3
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L15:
  ret
```

assistant: ```c
void MatrixVectorMult(double *c, double **A, double *b, int n) {
  int i;
  for (i = 0; i < n; i++) {
    c[i] = dot(A[i], b, n);
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<MatrixVectorMult>:
  endbr64
  test   %ecx,%ecx
  jle    L12
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  movslq %ecx,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L16:
  mov    (%r15,%rbx,8),%rdi
  mov    %r14d,%edx
  mov    %r12,%rsi
  call   <dot@plt>
  movsd  %xmm0,0x0(%rbp,%rbx,8)
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L16
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L12:
  ret
```

assistant: ```c
void MatrixVectorMult(double *c, double **A, double *b, int n) {
  int i;
  for (i = 0; i < n; i++) {
    c[i] = dot(A[i], b, n);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<MatrixVectorMult>:
  endbr64
  test   %ecx,%ecx
  jle    L16
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  movslq %ecx,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L13:
  mov    (%r15,%rbx,8),%rdi
  mov    %r14d,%edx
  mov    %r12,%rsi
  call   <dot@plt>
  movsd  %xmm0,0x0(%rbp,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbx,%r13
  jne    L13
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L16:
  ret
```

assistant: ```c
void MatrixVectorMult(double *c, double **A, double *b, int n) {
  int i;
  for (i = 0; i < n; i++) {
    c[i] = dot(A[i], b, n);
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<getpid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    D6(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <syscall_0@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
pid_t getpid(void) {
  pid_t ret;
  ret = syscall_0(SYS_getpid);
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<getpid>:
  endbr64
  sub    $0x8,%rsp
  mov    D6(%rip),%rax
  mov    (%rax),%edi
  call   <syscall_0@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
pid_t getpid(void) {
  pid_t ret;
  ret = syscall_0(SYS_getpid);
  return ret;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<getpid>:
  endbr64
  mov    D9(%rip),%rax
  mov    (%rax),%edi
  jmp    1050 <syscall_0@plt>
```

assistant: ```c
pid_t getpid(void) {
  pid_t ret;
  ret = syscall_0(SYS_getpid);
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<getpid>:
  endbr64
  mov    D6(%rip),%rax
  mov    (%rax),%edi
  jmp    1050 <syscall_0@plt>
```

assistant: ```c
pid_t getpid(void) {
  pid_t ret;
  ret = syscall_0(SYS_getpid);
  return ret;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<GetGenomeLen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L26
L41:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4c,%al
  jne    L83
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L83
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L83
  addl   $0x3,-0x30(%rbp)
  movl   $0x1,-0x28(%rbp)
L83:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L2
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  je     L2
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L63
L2:
  movl   $0x0,-0x28(%rbp)
L63:
  cmpl   $0x1,-0x28(%rbp)
  jne    L38
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x2c(%rbp)
  movzbl (%rcx),%edx
  cltq
  mov    %dl,-0x20(%rbp,%rax,1)
L38:
  addl   $0x1,-0x30(%rbp)
L26:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x30(%rbp)
  jl     L41
  mov    -0x2c(%rbp),%eax
  cltq
  movb   $0x0,-0x20(%rbp,%rax,1)
  lea    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L66
  call   <__stack_chk_fail@plt>
L66:
  leave
  ret
```

assistant: ```c
int GetGenomeLen(char *String) {
  int x = 0, y = 0, flag = 0, genome_size = 0;
  char temp_loc[20];
  for (x = 0; x < strlen(String); x++) {
    if (String[x] == 'L' && String[x + 1] == 'N' && String[x + 2] == ':') {
      x += 3;
      flag = 1;
    }
    if (String[x] == ' ' || String[x] == ':' || String[x] == '\n')
      flag = 0;
    if (flag == 1)
      temp_loc[y++] = String[x];
  }
  temp_loc[y] = '\0';
  genome_size = atoi(temp_loc);
  return genome_size;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<GetGenomeLen>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0x0,%r12d
  mov    $0x0,%r13d
  mov    $0x0,%ebx
  movabs $0x400000100000400,%r14
  jmp    L63
L9:
  cmpb   $0x4e,0x1(%rbp,%rdx,1)
  jne    L118
  cmpb   $0x3a,0x2(%rbp,%rdx,1)
  jne    L118
  add    $0x3,%ebx
  movslq %ebx,%rax
  movzbl 0x0(%rbp,%rax,1),%eax
  cmp    $0x3a,%al
  ja     L129
  bt     %rax,%r14
  jae    L129
  mov    $0x0,%r12d
  jmp    L108
L127:
  bt     %rax,%r14
  jae    L118
  mov    $0x0,%r12d
L108:
  add    $0x1,%ebx
L63:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L77
  movslq %ebx,%rdx
  movzbl 0x0(%rbp,%rdx,1),%eax
  cmp    $0x4c,%al
  je     L9
  cmp    $0x3a,%al
  jbe    L127
L118:
  cmp    $0x1,%r12d
  jne    L108
L129:
  movslq %r13d,%rdx
  mov    %al,(%rsp,%rdx,1)
  lea    0x1(%r13),%r13d
  mov    $0x1,%r12d
  jmp    L108
L77:
  movslq %r13d,%r13
  movb   $0x0,(%rsp,%r13,1)
  mov    %rsp,%rdi
  call   <atoi@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L19
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L19:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int GetGenomeLen(char *String) {
  int x = 0, y = 0, flag = 0, genome_size = 0;
  char temp_loc[20];
  for (x = 0; x < strlen(String); x++) {
    if (String[x] == 'L' && String[x + 1] == 'N' && String[x + 2] == ':') {
      x += 3;
      flag = 1;
    }
    if (String[x] == ' ' || String[x] == ':' || String[x] == '\n')
      flag = 0;
    if (flag == 1)
      temp_loc[y++] = String[x];
  }
  temp_loc[y] = '\0';
  genome_size = atoi(temp_loc);
  return genome_size;
}
```
user: Translate the below assembly code into C programming language:

```asm
<GetGenomeLen>:
  endbr64
  push   %r14
  movabs $0xfbfffffefffffbff,%r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  jmp    L28
  nopw   0x0(%rax,%rax,1)
L95:
  mov    %r12d,%eax
  and    $0x1,%eax
  cmp    $0x3a,%cl
  ja     L69
L107:
  mov    %r14,%rdx
  sar    %cl,%rdx
  and    %edx,%eax
L69:
  xor    %r12d,%r12d
  test   %al,%al
  jne    L26
L43:
  add    $0x1,%ebx
L28:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L68
  movslq %ebx,%rax
  movzbl 0x0(%rbp,%rax,1),%ecx
  cmp    $0x4c,%cl
  jne    L95
  cmpb   $0x4e,0x1(%rbp,%rax,1)
  je     L42
L8:
  mov    %r12d,%eax
  xor    %r12d,%r12d
  and    $0x1,%eax
  test   %al,%al
  je     L43
L26:
  movslq %r13d,%rax
  mov    $0x1,%r12d
  add    $0x1,%r13d
  mov    %cl,(%rsp,%rax,1)
  jmp    L43
  nopl   0x0(%rax)
L68:
  movslq %r13d,%r13
  mov    %rsp,%rdi
  movb   $0x0,(%rsp,%r13,1)
  call   <atoi@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L31
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L42:
  cmpb   $0x3a,0x2(%rbp,%rax,1)
  jne    L8
  add    $0x3,%ebx
  movslq %ebx,%rax
  movzbl 0x0(%rbp,%rax,1),%ecx
  cmp    $0x3a,%cl
  ja     L26
  mov    $0x1,%eax
  jmp    L107
L31:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int GetGenomeLen(char *String) {
  int x = 0, y = 0, flag = 0, genome_size = 0;
  char temp_loc[20];
  for (x = 0; x < strlen(String); x++) {
    if (String[x] == 'L' && String[x + 1] == 'N' && String[x + 2] == ':') {
      x += 3;
      flag = 1;
    }
    if (String[x] == ' ' || String[x] == ':' || String[x] == '\n')
      flag = 0;
    if (flag == 1)
      temp_loc[y++] = String[x];
  }
  temp_loc[y] = '\0';
  genome_size = atoi(temp_loc);
  return genome_size;
}
```
user: What is the c source code of the assembly code below?

```asm
<GetGenomeLen>:
  endbr64
  push   %r14
  movabs $0xfbfffffefffffbff,%r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L83:
  mov    %r12d,%eax
  and    $0x1,%eax
  cmp    $0x3a,%cl
  ja     L114
L10:
  mov    %r14,%rdx
  sar    %cl,%rdx
  and    %edx,%eax
L114:
  xor    %r12d,%r12d
  test   %al,%al
  jne    L93
L63:
  add    $0x1,%ebx
L7:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L99
  movslq %ebx,%rax
  movzbl 0x0(%rbp,%rax,1),%ecx
  cmp    $0x4c,%cl
  jne    L83
  cmpb   $0x4e,0x1(%rbp,%rax,1)
  je     L80
L14:
  mov    %r12d,%eax
  xor    %r12d,%r12d
  and    $0x1,%eax
  test   %al,%al
  je     L63
L93:
  movslq %r13d,%rax
  mov    $0x1,%r12d
  add    $0x1,%r13d
  mov    %cl,(%rsp,%rax,1)
  jmp    L63
  nopl   0x0(%rax)
L99:
  movslq %r13d,%r13
  mov    %rsp,%rdi
  movb   $0x0,(%rsp,%r13,1)
  call   <atoi@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L82
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L80:
  cmpb   $0x3a,0x2(%rbp,%rax,1)
  jne    L14
  add    $0x3,%ebx
  movslq %ebx,%rax
  movzbl 0x0(%rbp,%rax,1),%ecx
  cmp    $0x3a,%cl
  ja     L93
  mov    $0x1,%eax
  jmp    L10
L82:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int GetGenomeLen(char *String) {
  int x = 0, y = 0, flag = 0, genome_size = 0;
  char temp_loc[20];
  for (x = 0; x < strlen(String); x++) {
    if (String[x] == 'L' && String[x + 1] == 'N' && String[x + 2] == ':') {
      x += 3;
      flag = 1;
    }
    if (String[x] == ' ' || String[x] == ':' || String[x] == '\n')
      flag = 0;
    if (flag == 1)
      temp_loc[y++] = String[x];
  }
  temp_loc[y] = '\0';
  genome_size = atoi(temp_loc);
  return genome_size;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<parse_assem1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2c,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L3
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  shl    $0x10,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cltq
  jmp    L8
L3:
  mov    $0x0,%eax
L8:
  leave
  ret
```

assistant: ```c
unsigned long long parse_assem1(char *str) {
  int highval, lowval;
  highval = atoi(str);
  str = strchr(str, ',');
  if (str)
    lowval = atoi(str + 1);
  else {
    return 0;
  }
  return (unsigned long long)((highval << 16) + lowval);
}
```
user: Translate the below assembly code into C programming language:

```asm
<parse_assem1>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  call   <atoi@plt>
  mov    %eax,%ebp
  mov    $0x2c,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  mov    $0x0,%edx
  test   %rax,%rax
  je     L0
  lea    0x1(%rax),%rdi
  call   <atoi@plt>
  mov    %eax,%edx
  mov    %ebp,%eax
  shl    $0x10,%eax
  add    %edx,%eax
  movslq %eax,%rdx
L0:
  mov    %rdx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
unsigned long long parse_assem1(char *str) {
  int highval, lowval;
  highval = atoi(str);
  str = strchr(str, ',');
  if (str)
    lowval = atoi(str + 1);
  else {
    return 0;
  }
  return (unsigned long long)((highval << 16) + lowval);
}
```