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

```asm
<getStringVector>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movl   $0xc,(%rax)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  movl   $0x0,-0xc(%rbp)
  jmp    L4
L13:
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <calloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D8(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
  addl   $0x1,-0xc(%rbp)
L4:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jl     L13
  nop
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D8
datatype: string

tool: D8: %d

assistant: ```c
void getStringVector(char ***resultVector, int *sizeRes) {
  int i;
  *sizeRes = 12;
  *resultVector = (char **)malloc((*sizeRes) * sizeof(char *));
  for (i = 0; i < *sizeRes; i++) {
    char *pc = (char *)calloc(3, sizeof(char));
    sprintf(pc, "%d", i);
    (*resultVector)[i] = pc;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<getStringVector>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r13
  mov    %rsi,%r12
  movl   $0xc,(%rsi)
  mov    $0x60,%edi
  call   <malloc@plt>
  mov    %rax,0x0(%r13)
  cmpl   $0x0,(%r12)
  jle    L3
  mov    $0x0,%ebx
  lea    D1(%rip),%r14
L0:
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <calloc@plt>
  mov    %rax,%rbp
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    0x0(%r13),%rax
  mov    %rbp,(%rax,%rbx,8)
  add    $0x1,%rbx
  cmp    %ebx,(%r12)
  jg     L0
L3:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D1
type: string

tool: D1: %d

assistant: ```c
void getStringVector(char ***resultVector, int *sizeRes) {
  int i;
  *sizeRes = 12;
  *resultVector = (char **)malloc((*sizeRes) * sizeof(char *));
  for (i = 0; i < *sizeRes; i++) {
    char *pc = (char *)calloc(3, sizeof(char));
    sprintf(pc, "%d", i);
    (*resultVector)[i] = pc;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<getStringVector>:
  endbr64
  push   %r14
  mov    %rdi,%r14
  mov    $0x60,%edi
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  movl   $0xc,(%rsi)
  call   <malloc@plt>
  mov    %rax,(%r14)
  mov    (%r12),%eax
  test   %eax,%eax
  jle    L7
  xor    %ebx,%ebx
  lea    D6(%rip),%r13
  cs nopw 0x0(%rax,%rax,1)
L6:
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <calloc@plt>
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <sprintf@plt>
  mov    (%r14),%rax
  mov    %rbp,(%rax,%rbx,8)
  add    $0x1,%rbx
  cmp    %ebx,(%r12)
  jg     L6
L7:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D6
type_infered: string

tool: D6: %d

assistant: ```c
void getStringVector(char ***resultVector, int *sizeRes) {
  int i;
  *sizeRes = 12;
  *resultVector = (char **)malloc((*sizeRes) * sizeof(char *));
  for (i = 0; i < *sizeRes; i++) {
    char *pc = (char *)calloc(3, sizeof(char));
    sprintf(pc, "%d", i);
    (*resultVector)[i] = pc;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<getStringVector>:
  endbr64
  push   %r14
  mov    %rdi,%r14
  mov    $0x60,%edi
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  movl   $0xc,(%rsi)
  call   <malloc@plt>
  mov    %rax,(%r14)
  mov    (%r12),%eax
  test   %eax,%eax
  jle    L16
  xor    %ebx,%ebx
  lea    D4(%rip),%r13
  cs nopw 0x0(%rax,%rax,1)
L8:
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <calloc@plt>
  mov    %ebx,%edx
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <sprintf@plt>
  mov    (%r14),%rax
  mov    %rbp,(%rax,%rbx,8)
  add    $0x1,%rbx
  cmp    %ebx,(%r12)
  jg     L8
L16:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D4
data_type: string

tool: D4: %d

assistant: ```c
void getStringVector(char ***resultVector, int *sizeRes) {
  int i;
  *sizeRes = 12;
  *resultVector = (char **)malloc((*sizeRes) * sizeof(char *));
  for (i = 0; i < *sizeRes; i++) {
    char *pc = (char *)calloc(3, sizeof(char));
    sprintf(pc, "%d", i);
    (*resultVector)[i] = pc;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<astG3DQch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <Report@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D2
type: string

tool: D2: astG3DQch

assistant: ```c
int astG3DQch(float *ch) {
  Report("astG3DQch");
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的：

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

tool_calls: name: extract_symbolic_data
arguments: label: D7
type_infered: string

tool: D7: astG3DQch

assistant: ```c
int astG3DQch(float *ch) {
  Report("astG3DQch");
  return 0;
}
```
user: Translate the below assembly code into C programming language:

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

tool_calls: name: retrieve_data
arguments: label: D6
type_guessed: string

tool: D6: astG3DQch

assistant: ```c
int astG3DQch(float *ch) {
  Report("astG3DQch");
  return 0;
}
```
user: Translate the below assembly code into C programming language:

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

tool_calls: name: read_data
arguments: data_tag: D5
datatype: string

tool: D5: astG3DQch

assistant: ```c
int astG3DQch(float *ch) {
  Report("astG3DQch");
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<exponencial>:
  endbr64
  movsd  D13(%rip),%xmm1
  movapd %xmm1,%xmm2
  mov    $0x1,%eax
  movsd  D7(%rip),%xmm5
L8:
  pxor   %xmm4,%xmm4
  cvtsi2sd %eax,%xmm4
  movapd %xmm0,%xmm3
  divsd  %xmm4,%xmm3
  mulsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm2
  add    $0x1,%eax
  comisd %xmm5,%xmm1
  ja     L8
  movapd %xmm2,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: tag: D13
type_guessed: f64
name: parse_data
arguments: tag: D7
type_guessed: byte[8]

tool: D13: 1

tool: {"D7": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x7a,0x3e]}

assistant: ```c
double exponencial(double x) {
  int n = 1;
  double exp = 0.0, termino = 1.0;
  exp = termino;
  while (termino > 1e-7) {
    termino *= x / n;
    exp += termino;
    n++;
  }
  return exp;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<exponencial>:
  endbr64
  movsd  D3(%rip),%xmm1
  movsd  D0(%rip),%xmm5
  mov    $0x1,%eax
  movapd %xmm1,%xmm2
  nopl   (%rax)
L5:
  pxor   %xmm4,%xmm4
  movapd %xmm0,%xmm3
  cvtsi2sd %eax,%xmm4
  add    $0x1,%eax
  divsd  %xmm4,%xmm3
  mulsd  %xmm3,%xmm1
  comisd %xmm5,%xmm1
  addsd  %xmm1,%xmm2
  ja     L5
  movapd %xmm2,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D3
type_infered: f64
name: parse_data
arguments: data_tag: D0
type_infered: byte[8]

tool: D3: 1

tool: {"D0": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x7a,0x3e]}

assistant: ```c
double exponencial(double x) {
  int n = 1;
  double exp = 0.0, termino = 1.0;
  exp = termino;
  while (termino > 1e-7) {
    termino *= x / n;
    exp += termino;
    n++;
  }
  return exp;
}
```
user: What is the c source code of the assembly code below?

```asm
<exponencial>:
  endbr64
  movsd  D6(%rip),%xmm1
  movsd  D7(%rip),%xmm5
  mov    $0x1,%eax
  movapd %xmm1,%xmm2
  nopl   (%rax)
L0:
  pxor   %xmm4,%xmm4
  movapd %xmm0,%xmm3
  cvtsi2sd %eax,%xmm4
  add    $0x1,%eax
  divsd  %xmm4,%xmm3
  mulsd  %xmm3,%xmm1
  comisd %xmm5,%xmm1
  addsd  %xmm1,%xmm2
  ja     L0
  movapd %xmm2,%xmm0
  ret
```

tool_calls: name: disassemble_data
arguments: label: D6
type: f64
name: disassemble_data
arguments: label: D7
type: byte[8]

tool: D6: 1

tool: {"D7": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x7a,0x3e]}

assistant: ```c
double exponencial(double x) {
  int n = 1;
  double exp = 0.0, termino = 1.0;
  exp = termino;
  while (termino > 1e-7) {
    termino *= x / n;
    exp += termino;
    n++;
  }
  return exp;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<test_fork>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%eax
  call   <dune_enter@plt>
  test   %rax,%rax
  je     L58
  mov    $0x1,%eax
  jmp    L55
L58:
  mov    $0x0,%eax
  call   <check_dune@plt>
  test   %rax,%rax
  je     L137
  mov    $0x2,%eax
  jmp    L55
L137:
  call   <fork@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0xffffffff,-0xc(%rbp)
  jne    L89
  mov    $0x3,%eax
  jmp    L55
L89:
  cmpl   $0x0,-0xc(%rbp)
  jne    L63
  mov    $0x0,%eax
  call   <dune_enter@plt>
  test   %rax,%rax
  je     L146
  mov    $0x1,%eax
  jmp    L55
L146:
  mov    $0x0,%eax
  call   <check_dune@plt>
  test   %rax,%rax
  je     L111
  mov    $0x1,%edi
  call   <exit@plt>
L111:
  mov    $0x45,%edi
  call   <exit@plt>
  jmp    L65
L63:
  mov    $0x0,%eax
  call   <check_dune@plt>
  test   %rax,%rax
  je     L81
  mov    $0x4,%eax
  jmp    L55
L81:
  lea    -0x10(%rbp),%rcx
  mov    -0xc(%rbp),%eax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <waitpid@plt>
  cmp    $0xffffffff,%eax
  jne    L82
  lea    D9(%rip),%rax
  mov    %rax,%rsi
  mov    $0x5,%edi
  call   <err@plt>
L82:
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <WEXITSTATUS@plt>
  cmp    $0x45,%eax
  je     L65
  mov    $0x6,%eax
  jmp    L55
L65:
  mov    $0xff,%eax
L55:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D9
data_type: string

tool: D9: waitpid()

assistant: ```c
int test_fork(void) {
  int pid;
  int rc;
  if (dune_enter())
    return 1;
  if (check_dune())
    return 2;
  pid = fork();
  if (pid == -1)
    return 3;
  if (pid == 0) {
    if (dune_enter())
      return 1;
    if (check_dune())
      exit(1);
    exit(69);
  } else {
    if (check_dune())
      return 4;
    if (waitpid(pid, &rc, 0) == -1)
      err(5, "waitpid()");
    if (WEXITSTATUS(rc) != 69)
      return 6;
  }
  return 255;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<test_fork>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <dune_enter@plt>
  mov    %rax,%rdx
  mov    $0x1,%eax
  test   %rdx,%rdx
  je     L26
L65:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L69
  add    $0x10,%rsp
  pop    %rbx
  ret
L26:
  mov    $0x0,%eax
  call   <check_dune@plt>
  mov    %rax,%rdx
  mov    $0x2,%eax
  test   %rdx,%rdx
  jne    L65
  call   <fork@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L123
  test   %eax,%eax
  jne    L41
  mov    $0x0,%eax
  call   <dune_enter@plt>
  mov    %rax,%rdx
  mov    $0x1,%eax
  test   %rdx,%rdx
  jne    L65
  mov    $0x0,%eax
  call   <check_dune@plt>
  test   %rax,%rax
  jne    L57
L134:
  mov    $0x45,%edi
  call   <exit@plt>
  mov    $0xff,%eax
  jmp    L65
L57:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L134
L41:
  mov    $0x0,%eax
  call   <check_dune@plt>
  mov    %rax,%rdx
  mov    $0x4,%eax
  test   %rdx,%rdx
  jne    L65
  lea    0x4(%rsp),%rsi
  mov    %ebx,%edi
  call   <waitpid@plt>
  cmp    $0xffffffff,%eax
  je     L88
L3:
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  cmp    $0x45,%eax
  mov    $0xff,%eax
  mov    $0x6,%edx
  cmovne %edx,%eax
  jmp    L65
L88:
  lea    D1(%rip),%rsi
  mov    $0x5,%edi
  call   <err@plt>
  jmp    L3
L123:
  mov    $0x3,%eax
  jmp    L65
L69:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D1
data_type: string

tool: D1: waitpid()

assistant: ```c
int test_fork(void) {
  int pid;
  int rc;
  if (dune_enter())
    return 1;
  if (check_dune())
    return 2;
  pid = fork();
  if (pid == -1)
    return 3;
  if (pid == 0) {
    if (dune_enter())
      return 1;
    if (check_dune())
      exit(1);
    exit(69);
  } else {
    if (check_dune())
      return 4;
    if (waitpid(pid, &rc, 0) == -1)
      err(5, "waitpid()");
    if (WEXITSTATUS(rc) != 69)
      return 6;
  }
  return 255;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<test_fork>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <dune_enter@plt>
  test   %rax,%rax
  je     L57
L86:
  mov    $0x1,%eax
L133:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L60
  add    $0x10,%rsp
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L57:
  xor    %eax,%eax
  call   <check_dune@plt>
  mov    %rax,%r8
  mov    $0x2,%eax
  test   %r8,%r8
  jne    L133
  call   <fork@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L131
  xor    %eax,%eax
  test   %ebp,%ebp
  je     L102
  call   <check_dune@plt>
  mov    %rax,%r8
  mov    $0x4,%eax
  test   %r8,%r8
  jne    L133
  xor    %edx,%edx
  lea    0x4(%rsp),%rsi
  mov    %ebp,%edi
  call   <waitpid@plt>
  cmp    $0xffffffff,%eax
  je     L87
L88:
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  mov    $0x6,%edx
  cmp    $0x45,%eax
  mov    $0xff,%eax
  cmovne %edx,%eax
  jmp    L133
  nopl   (%rax)
L102:
  call   <dune_enter@plt>
  test   %rax,%rax
  jne    L86
  call   <check_dune@plt>
  test   %rax,%rax
  jne    L79
L70:
  mov    $0x45,%edi
  call   <exit@plt>
  mov    $0xff,%eax
  jmp    L133
  nopl   0x0(%rax)
L131:
  mov    $0x3,%eax
  jmp    L133
  nopw   0x0(%rax,%rax,1)
L87:
  lea    D2(%rip),%rsi
  mov    $0x5,%edi
  call   <err@plt>
  jmp    L88
  nopl   0x0(%rax,%rax,1)
L79:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L70
L60:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D2
type: string

tool: D2: waitpid()

assistant: ```c
int test_fork(void) {
  int pid;
  int rc;
  if (dune_enter())
    return 1;
  if (check_dune())
    return 2;
  pid = fork();
  if (pid == -1)
    return 3;
  if (pid == 0) {
    if (dune_enter())
      return 1;
    if (check_dune())
      exit(1);
    exit(69);
  } else {
    if (check_dune())
      return 4;
    if (waitpid(pid, &rc, 0) == -1)
      err(5, "waitpid()");
    if (WEXITSTATUS(rc) != 69)
      return 6;
  }
  return 255;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<test_fork>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <dune_enter@plt>
  test   %rax,%rax
  je     L35
L34:
  mov    $0x1,%eax
L131:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L115
  add    $0x10,%rsp
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L35:
  xor    %eax,%eax
  call   <check_dune@plt>
  mov    %rax,%r8
  mov    $0x2,%eax
  test   %r8,%r8
  jne    L131
  call   <fork@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L117
  xor    %eax,%eax
  test   %ebp,%ebp
  je     L0
  call   <check_dune@plt>
  mov    %rax,%r8
  mov    $0x4,%eax
  test   %r8,%r8
  jne    L131
  xor    %edx,%edx
  lea    0x4(%rsp),%rsi
  mov    %ebp,%edi
  call   <waitpid@plt>
  cmp    $0xffffffff,%eax
  je     L137
L23:
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  mov    $0x6,%edx
  cmp    $0x45,%eax
  mov    $0xff,%eax
  cmovne %edx,%eax
  jmp    L131
  nopl   (%rax)
L0:
  call   <dune_enter@plt>
  test   %rax,%rax
  jne    L34
  call   <check_dune@plt>
  test   %rax,%rax
  jne    L135
L43:
  mov    $0x45,%edi
  call   <exit@plt>
  mov    $0xff,%eax
  jmp    L131
  nopl   0x0(%rax)
L117:
  mov    $0x3,%eax
  jmp    L131
  nopw   0x0(%rax,%rax,1)
L137:
  lea    D4(%rip),%rsi
  mov    $0x5,%edi
  call   <err@plt>
  jmp    L23
  nopl   0x0(%rax,%rax,1)
L135:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L43
L115:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D4
type_infered: string

tool: D4: waitpid()

assistant: ```c
int test_fork(void) {
  int pid;
  int rc;
  if (dune_enter())
    return 1;
  if (check_dune())
    return 2;
  pid = fork();
  if (pid == -1)
    return 3;
  if (pid == 0) {
    if (dune_enter())
      return 1;
    if (check_dune())
      exit(1);
    exit(69);
  } else {
    if (check_dune())
      return 4;
    if (waitpid(pid, &rc, 0) == -1)
      err(5, "waitpid()");
    if (WEXITSTATUS(rc) != 69)
      return 6;
  }
  return 255;
}
```
user: Translate the below assembly code into C programming language:

```asm
<write_fifo>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,0x8(%rsp)
  mov    %edx,%r12d
  mov    %ecx,%r15d
  mov    %r8,%r13
  mov    %edx,%edi
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  mov    %r15d,%edi
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  test   %rbp,%rbp
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  test   %r13,%r13
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x0(%rbp),%ebx
  mov    0x4(%rbp),%eax
  lea    -0x80000000(%rbx),%r14d
  jmp    L56
L63:
  cmp    %r12d,%edx
  jae    L84
L16:
  mov    %r13,%rsi
  mov    $0x0,%edi
  call   <nsleep@plt>
  mov    0x4(%rbp),%eax
L56:
  cmp    %eax,%r14d
  je     L16
  mov    $0x7fffffff,%edx
  mov    %eax,%esi
  xor    %ebx,%esi
  jns    L63
  mov    %ebx,%ecx
  and    $0x7fffffff,%ecx
  and    $0x7fffffff,%eax
  mov    %ecx,%esi
  sub    %eax,%esi
  mov    %eax,%edx
  sub    %ecx,%edx
  cmp    %eax,%ecx
  cmovg  %esi,%edx
  jmp    L63
L84:
  mov    %ebx,%edi
  and    $0x7fffffff,%edi
  test   %r12d,%r12d
  je     L9
  mov    0x8(%rsp),%rsi
  mov    %rsi,%rax
  movslq %edi,%rdx
  lea    0x8(%rbp,%rdx,4),%rdx
  lea    -0x1(%r12),%ecx
  lea    0x4(%rsi,%rcx,4),%rsi
L59:
  mov    (%rax),%ecx
  mov    %ecx,(%rdx)
  add    $0x4,%rax
  add    $0x4,%rdx
  cmp    %rsi,%rax
  jne    L59
L9:
  add    %r12d,%ebx
  mov    %ebx,%eax
  mov    %ebx,%edx
  and    $0x7fffffff,%edx
  cmp    %r15d,%edx
  je     L30
  mov    %ebx,%edx
  and    $0x7fffffff,%edx
  cmp    %edi,%edx
  jge    L60
L30:
  and    $0x80000000,%ebx
  lea    -0x80000000(%rbx),%eax
L60:
  mov    %eax,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void write_fifo(void *fifo, void *value, unsigned int len, unsigned int fifo_size, unsigned long period) {
  assert(len <= 0x7FFFFFFF);
  assert(fifo_size <= 0x7FFFFFFF);
  assert(fifo != NULL);
  assert(period != 0);
  int i = 0;
  volatile int *wfifo = (int *)fifo;
  int w_cnt = wfifo[0];
  int r_cnt = wfifo[1];
  int wc = 0;
  volatile int *v = NULL;
  while (r_cnt == (w_cnt ^ 0x80000000) || ((w_cnt & 0x80000000) == (r_cnt & 0x80000000) ? (unsigned int)(0x7FFFFFFF - wc) : ((w_cnt & 0x7FFFFFFF) > (r_cnt & 0x7FFFFFFF) ? (unsigned int)((w_cnt & 0x7FFFFFFF) - (r_cnt & 0x7FFFFFFF)) : (unsigned int)((r_cnt & 0x7FFFFFFF) - (w_cnt & 0x7FFFFFFF)))) < len) {
    nsleep(0, period);
    r_cnt = wfifo[1];
  }
  wc = (w_cnt & 0x7FFFFFFF);
  v = (volatile int *)value;
  for (i = 0; i < len; i++) {
    wfifo[wc + 2 + i] = v[i];
  }
  wc = (w_cnt & 0x7FFFFFFF);
  w_cnt += len;
  if ((w_cnt & 0x7FFFFFFF) == fifo_size || wc > (w_cnt & 0x7FFFFFFF)) {
    w_cnt &= 0x80000000;
    w_cnt ^= 0x80000000;
  }
  wfifo[0] = w_cnt;
}
```
user: What is the c source code of the assembly code below?

```asm
<write_fifo>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %edx,%edi
  push   %rbx
  not    %edi
  mov    %edx,%ebx
  shr    $0x1f,%edi
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %ecx,0x4(%rsp)
  call   <assert@plt>
  mov    %r15d,%edi
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  xor    %edi,%edi
  test   %rbp,%rbp
  setne  %dil
  call   <assert@plt>
  xor    %edi,%edi
  test   %r12,%r12
  setne  %dil
  call   <assert@plt>
  mov    0x0(%rbp),%r14d
  mov    0x4(%rbp),%eax
  mov    %r14d,%r13d
  lea    -0x80000000(%r14),%r15d
  and    $0x7fffffff,%r13d
  jmp    L73
  nopl   (%rax)
L43:
  mov    %r12,%rsi
  xor    %edi,%edi
  call   <nsleep@plt>
  mov    0x4(%rbp),%eax
L73:
  cmp    %r15d,%eax
  je     L43
  mov    %eax,%esi
  mov    $0x7fffffff,%edx
  xor    %r14d,%esi
  jns    L8
  and    $0x7fffffff,%eax
  mov    %r13d,%ecx
  mov    %eax,%edx
  sub    %eax,%ecx
  sub    %r13d,%edx
  cmp    %r13d,%eax
  cmovl  %ecx,%edx
L8:
  cmp    %ebx,%edx
  jb     L43
  test   %ebx,%ebx
  je     L76
  mov    0x8(%rsp),%rax
  lea    0x2(%r13),%edx
  lea    -0x1(%rbx),%ecx
  movslq %edx,%rdx
  lea    0x0(%rbp,%rdx,4),%rdx
  lea    0x4(%rax,%rcx,4),%rsi
  nopl   0x0(%rax)
L35:
  mov    (%rax),%ecx
  add    $0x4,%rax
  add    $0x4,%rdx
  mov    %ecx,-0x4(%rdx)
  cmp    %rsi,%rax
  jne    L35
L76:
  add    %r14d,%ebx
  mov    %ebx,%edx
  mov    %ebx,%eax
  and    $0x7fffffff,%edx
  cmp    0x4(%rsp),%edx
  je     L41
  cmp    %r13d,%edx
  jge    L23
L41:
  and    $0x80000000,%ebx
  lea    -0x80000000(%rbx),%eax
L23:
  mov    %eax,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void write_fifo(void *fifo, void *value, unsigned int len, unsigned int fifo_size, unsigned long period) {
  assert(len <= 0x7FFFFFFF);
  assert(fifo_size <= 0x7FFFFFFF);
  assert(fifo != NULL);
  assert(period != 0);
  int i = 0;
  volatile int *wfifo = (int *)fifo;
  int w_cnt = wfifo[0];
  int r_cnt = wfifo[1];
  int wc = 0;
  volatile int *v = NULL;
  while (r_cnt == (w_cnt ^ 0x80000000) || ((w_cnt & 0x80000000) == (r_cnt & 0x80000000) ? (unsigned int)(0x7FFFFFFF - wc) : ((w_cnt & 0x7FFFFFFF) > (r_cnt & 0x7FFFFFFF) ? (unsigned int)((w_cnt & 0x7FFFFFFF) - (r_cnt & 0x7FFFFFFF)) : (unsigned int)((r_cnt & 0x7FFFFFFF) - (w_cnt & 0x7FFFFFFF)))) < len) {
    nsleep(0, period);
    r_cnt = wfifo[1];
  }
  wc = (w_cnt & 0x7FFFFFFF);
  v = (volatile int *)value;
  for (i = 0; i < len; i++) {
    wfifo[wc + 2 + i] = v[i];
  }
  wc = (w_cnt & 0x7FFFFFFF);
  w_cnt += len;
  if ((w_cnt & 0x7FFFFFFF) == fifo_size || wc > (w_cnt & 0x7FFFFFFF)) {
    w_cnt &= 0x80000000;
    w_cnt ^= 0x80000000;
  }
  wfifo[0] = w_cnt;
}
```