ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码：

```asm
<strcrlfcpy>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%r14
  mov    %rdx,%rbp
  mov    %rcx,%rbx
  lea    (%rcx,%rcx,1),%rax
  mov    %rax,%r13
  cmpq   $0x0,(%rdi)
  je     L157
  mov    (%rsi),%rsi
  cmp    %rsi,%rax
  jbe    L38
  mov    %rcx,%r13
  test   %rcx,%rcx
  je     L164
  lea    (%rdx,%rcx,1),%rcx
  mov    %rdx,%rax
L67:
  add    $0x1,%rax
  cmpb   $0xa,-0x1(%rax)
  sete   %dl
  movzbl %dl,%edx
  add    %rdx,%r13
  cmp    %rcx,%rax
  jne    L67
L38:
  cmp    %r13,%rsi
  jb     L87
L156:
  mov    (%r12),%rdx
  mov    %rdx,%rax
  test   %rbx,%rbx
  jne    L4
L111:
  movb   $0x0,(%rax)
  sub    (%r12),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L87:
  mov    %r12,%rdi
  call   <fs_give@plt>
  cmpq   $0x0,(%r12)
  jne    L156
L157:
  mov    %r13,(%r14)
  lea    0x1(%r13),%rdi
  call   <fs_get@plt>
  mov    %rax,(%r12)
  jmp    L156
L110:
  movb   $0xd,(%rdx)
  lea    0x1(%rdx),%rdx
L82:
  lea    0x1(%rdx),%rax
  mov    %cl,(%rdx)
  sub    $0x1,%rbx
  je     L111
L34:
  mov    %rax,%rdx
  mov    %rsi,%rbp
L4:
  lea    0x1(%rbp),%rsi
  movzbl 0x0(%rbp),%ecx
  cmp    $0xd,%cl
  ja     L82
  cmp    $0xa,%cl
  je     L110
  cmp    $0xd,%cl
  jne    L82
  cmp    $0x1,%rbx
  jbe    L82
  cmpb   $0xa,0x1(%rbp)
  je     L61
  lea    0x1(%rdx),%rax
  movb   $0xd,(%rdx)
  sub    $0x1,%rbx
  jmp    L34
L61:
  movb   $0xd,(%rdx)
  lea    0x2(%rbp),%rsi
  movzbl 0x1(%rbp),%ecx
  sub    $0x1,%rbx
  lea    0x1(%rdx),%rdx
  jmp    L82
L164:
  mov    (%rdi),%rax
  jmp    L111
```

assistant: ```c
unsigned long strcrlfcpy(unsigned char **dst, unsigned long *dstl, unsigned char *src, unsigned long srcl) {
  long i = srcl * 2, j;
  unsigned char c, *d = src;
  if (*dst) {
    if (i > *dstl)
      for (i = j = srcl; j; --j)
        if (*d++ == '\012')
          i++;
    if (i > *dstl)
      fs_give((void **)dst);
  }
  if (!*dst)
    *dst = (unsigned char *)fs_get((*dstl = i) + 1);
  d = *dst;
  if (srcl)
    do {
      if ((c = *src++) < '\016') {
        if (c == '\012')
          *d++ = '\015';
        else if ((c == '\015') && (srcl > 1) && (*src == '\012')) {
          *d++ = c;
          c = *src++;
          --srcl;
        }
      }
      *d++ = c;
    } while (--srcl);
  *d = '\0';
  return d - *dst;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strcrlfcpy>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    (%rcx,%rcx,1),%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    (%rdi),%rdx
  mov    %rcx,%rbx
  test   %rdx,%rdx
  je     L20
  mov    (%rsi),%r8
  cmp    %r8,%r12
  jbe    L186
  mov    %rcx,%rdi
  test   %rcx,%rcx
  je     L48
  lea    0x0(%rbp,%rcx,1),%rsi
  mov    %rbp,%rax
  nopl   0x0(%rax)
L144:
  add    $0x1,%rax
  xor    %ecx,%ecx
  cmpb   $0xa,-0x1(%rax)
  sete   %cl
  add    %rcx,%rdi
  cmp    %rsi,%rax
  jne    L144
  mov    %rdi,%r12
  cmp    %rdi,%r8
  jae    L186
  mov    %r13,%rdi
  call   <fs_give@plt>
  mov    0x0(%r13),%rdx
  test   %rdx,%rdx
  je     L20
L186:
  mov    %rdx,%rax
  test   %rbx,%rbx
  je     L73
  nopw   0x0(%rax,%rax,1)
L31:
  movzbl 0x0(%rbp),%ecx
  lea    0x1(%rbp),%rdi
  lea    0x1(%rdx),%rsi
  cmp    $0xd,%cl
  ja     L71
  cmp    $0xa,%cl
  je     L19
  cmp    $0xd,%cl
  jne    L71
  cmp    $0x1,%rbx
  jbe    L71
  sub    $0x1,%rbx
  cmpb   $0xa,0x1(%rbp)
  movb   $0xd,(%rdx)
  je     L114
  cs nopw 0x0(%rax,%rax,1)
L22:
  mov    %rsi,%rdx
  mov    %rdi,%rbp
  jmp    L31
  nopl   0x0(%rax,%rax,1)
L19:
  movb   $0xd,(%rdx)
  mov    %rsi,%rdx
  lea    0x1(%rsi),%rsi
L71:
  mov    %cl,(%rdx)
  mov    %rsi,%rax
  sub    $0x1,%rbx
  jne    L22
L73:
  movb   $0x0,(%rax)
  pop    %rbx
  sub    0x0(%r13),%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L114:
  movzbl 0x1(%rbp),%ecx
  mov    %rsi,%rdx
  lea    0x1(%rsi),%rsi
  lea    0x2(%rbp),%rdi
  mov    %rsi,%rax
  mov    %cl,(%rdx)
  sub    $0x1,%rbx
  jne    L22
  jmp    L73
  nopl   0x0(%rax)
L20:
  mov    %r12,(%r14)
  lea    0x1(%r12),%rdi
  call   <fs_get@plt>
  mov    %rax,%rdx
  mov    %rax,0x0(%r13)
  mov    %rdx,%rax
  test   %rbx,%rbx
  jne    L31
  jmp    L73
L48:
  mov    %rdx,%rax
  jmp    L73
```

assistant: ```c
unsigned long strcrlfcpy(unsigned char **dst, unsigned long *dstl, unsigned char *src, unsigned long srcl) {
  long i = srcl * 2, j;
  unsigned char c, *d = src;
  if (*dst) {
    if (i > *dstl)
      for (i = j = srcl; j; --j)
        if (*d++ == '\012')
          i++;
    if (i > *dstl)
      fs_give((void **)dst);
  }
  if (!*dst)
    *dst = (unsigned char *)fs_get((*dstl = i) + 1);
  d = *dst;
  if (srcl)
    do {
      if ((c = *src++) < '\016') {
        if (c == '\012')
          *d++ = '\015';
        else if ((c == '\015') && (srcl > 1) && (*src == '\012')) {
          *d++ = c;
          c = *src++;
          --srcl;
        }
      }
      *d++ = c;
    } while (--srcl);
  *d = '\0';
  return d - *dst;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<constructBoard>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L20
L19:
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    %edx,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  movl   $0x0,-0x14(%rbp)
  jmp    L23
L39:
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <set@plt>
  addl   $0x1,-0x14(%rbp)
L23:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L39
  addl   $0x1,-0x18(%rbp)
L20:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L19
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void constructBoard(int **board, int dimension) {
  int i, j;
  for (i = 0; i < dimension; i++) {
    *(board + i) = malloc(sizeof(int) * dimension);
    for (j = 0; j < dimension; j++) {
      set(board, 0, i, j);
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<constructBoard>:
  endbr64
  test   %esi,%esi
  jle    L28
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r13d
  lea    0x0(,%rsi,4),%eax
  mov    %eax,0xc(%rsp)
  mov    %esi,%r15d
  mov    $0x0,%r14d
L8:
  mov    %r14d,%r12d
  mov    0xc(%rsp),%edi
  call   <malloc@plt>
  mov    %rax,0x0(%rbp,%r14,8)
  mov    $0x0,%ebx
L12:
  mov    %ebx,%ecx
  mov    %r12d,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <set@plt>
  add    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L12
  add    $0x1,%r14
  cmp    %r15,%r14
  jne    L8
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L28:
  ret
```

assistant: ```c
void constructBoard(int **board, int dimension) {
  int i, j;
  for (i = 0; i < dimension; i++) {
    *(board + i) = malloc(sizeof(int) * dimension);
    for (j = 0; j < dimension; j++) {
      set(board, 0, i, j);
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<constructBoard>:
  endbr64
  test   %esi,%esi
  jle    L14
  push   %r15
  movslq %esi,%rax
  lea    0x0(,%rsi,4),%r15d
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %rax,0x8(%rsp)
  nop
L15:
  mov    %r15d,%edi
  mov    %r13d,%ebp
  xor    %r14d,%r14d
  call   <malloc@plt>
  mov    %rax,(%rbx,%r13,8)
  nopw   0x0(%rax,%rax,1)
L25:
  mov    %r14d,%ecx
  mov    %ebp,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <set@plt>
  add    $0x1,%r14d
  cmp    %r14d,%r12d
  jne    L25
  add    $0x1,%r13
  cmp    %r13,0x8(%rsp)
  jne    L15
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L14:
  ret
```

assistant: ```c
void constructBoard(int **board, int dimension) {
  int i, j;
  for (i = 0; i < dimension; i++) {
    *(board + i) = malloc(sizeof(int) * dimension);
    for (j = 0; j < dimension; j++) {
      set(board, 0, i, j);
    }
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<constructBoard>:
  endbr64
  test   %esi,%esi
  jle    L12
  push   %r15
  movslq %esi,%rax
  lea    0x0(,%rsi,4),%r15d
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %rax,0x8(%rsp)
  nop
L20:
  mov    %r15d,%edi
  mov    %r13d,%ebp
  xor    %r14d,%r14d
  call   <malloc@plt>
  mov    %rax,(%rbx,%r13,8)
  nopw   0x0(%rax,%rax,1)
L5:
  mov    %r14d,%ecx
  mov    %ebp,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  call   <set@plt>
  add    $0x1,%r14d
  cmp    %r14d,%r12d
  jne    L5
  add    $0x1,%r13
  cmp    %r13,0x8(%rsp)
  jne    L20
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L12:
  ret
```

assistant: ```c
void constructBoard(int **board, int dimension) {
  int i, j;
  for (i = 0; i < dimension; i++) {
    *(board + i) = malloc(sizeof(int) * dimension);
    for (j = 0; j < dimension; j++) {
      set(board, 0, i, j);
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    $0x63,%edi
  call   <singTheSong@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(int argc, const char *argv[]) {
  singTheSong(99);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x63,%edi
  call   <singTheSong@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, const char *argv[]) {
  singTheSong(99);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x63,%edi
  call   <singTheSong@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, const char *argv[]) {
  singTheSong(99);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x63,%edi
  call   <singTheSong@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, const char *argv[]) {
  singTheSong(99);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<decrypt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L4
L10:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  lea    -0x1(%rax),%ecx
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x4(%rbp)
L4:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L10
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int decrypt(char *flag) {
  for (int i = 0; flag[i]; i++) {
    flag[i] = flag[i] - 1;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<decrypt>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L6
L0:
  sub    $0x1,%eax
  mov    %al,(%rdi)
  add    $0x1,%rdi
  movzbl (%rdi),%eax
  test   %al,%al
  jne    L0
L6:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int decrypt(char *flag) {
  for (int i = 0; flag[i]; i++) {
    flag[i] = flag[i] - 1;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<decrypt>:
  endbr64
  jmp    L11
  cs nopw 0x0(%rax,%rax,1)
L1:
  sub    $0x1,%eax
  add    $0x1,%rdi
  mov    %al,-0x1(%rdi)
L11:
  movzbl (%rdi),%eax
  test   %al,%al
  jne    L1
  xor    %eax,%eax
  ret
```

assistant: ```c
int decrypt(char *flag) {
  for (int i = 0; flag[i]; i++) {
    flag[i] = flag[i] - 1;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<decrypt>:
  endbr64
  jmp    L12
  cs nopw 0x0(%rax,%rax,1)
L7:
  sub    $0x1,%eax
  add    $0x1,%rdi
  mov    %al,-0x1(%rdi)
L12:
  movzbl (%rdi),%eax
  test   %al,%al
  jne    L7
  xor    %eax,%eax
  ret
```

assistant: ```c
int decrypt(char *flag) {
  for (int i = 0; flag[i]; i++) {
    flag[i] = flag[i] - 1;
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<ft_strnew>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L13
  mov    $0x0,%eax
  jmp    L14
L13:
  movl   $0x0,-0xc(%rbp)
  jmp    L33
L23:
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L33:
  mov    -0x18(%rbp),%rax
  cmp    %eax,-0xc(%rbp)
  jle    L23
  mov    -0x8(%rbp),%rax
L14:
  leave
  ret
```

assistant: ```c
char *ft_strnew(size_t size) {
  char *tmp;
  int i;
  if (!(tmp = malloc(size + 1)))
    return (NULL);
  i = 0;
  while (i < (int)size + 1)
    *(tmp + i++) = 0;
  return (tmp);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ft_strnew>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  lea    0x1(%rdi),%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L17
  test   %ebx,%ebx
  js     L17
  mov    %rax,%rdx
  mov    %ebx,%ebx
  lea    0x1(%rax,%rbx,1),%rcx
L14:
  movb   $0x0,(%rdx)
  add    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L14
L17:
  pop    %rbx
  ret
```

assistant: ```c
char *ft_strnew(size_t size) {
  char *tmp;
  int i;
  if (!(tmp = malloc(size + 1)))
    return (NULL);
  i = 0;
  while (i < (int)size + 1)
    *(tmp + i++) = 0;
  return (tmp);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ft_strnew>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  add    $0x1,%rdi
  call   <malloc@plt>
  mov    %rax,%r8
  test   %rax,%rax
  je     L12
  test   %ebx,%ebx
  js     L12
  mov    %ebx,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  add    $0x1,%rdx
  call   <memset@plt>
  mov    %rax,%r8
L12:
  mov    %r8,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *ft_strnew(size_t size) {
  char *tmp;
  int i;
  if (!(tmp = malloc(size + 1)))
    return (NULL);
  i = 0;
  while (i < (int)size + 1)
    *(tmp + i++) = 0;
  return (tmp);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ft_strnew>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  add    $0x1,%rdi
  call   <malloc@plt>
  mov    %rax,%r8
  test   %rax,%rax
  je     L5
  test   %ebx,%ebx
  js     L5
  mov    %ebx,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  add    $0x1,%rdx
  call   <memset@plt>
  mov    %rax,%r8
L5:
  mov    %r8,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *ft_strnew(size_t size) {
  char *tmp;
  int i;
  if (!(tmp = malloc(size + 1)))
    return (NULL);
  i = 0;
  while (i < (int)size + 1)
    *(tmp + i++) = 0;
  return (tmp);
}
```
user: What is the c source code of the assembly code below:

```asm
<Productor>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  movl   $0x0,-0x1c(%rbp)
  jmp    L4
L11:
  mov    $0x0,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  pxor   %xmm0,%xmm0
  cvtsi2sd %edx,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm1
  mov    -0x10(%rbp),%rax
  movsd  (%rax),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    D39(%rip),%rax
  mov    %rax,%rdi
  call   <sem_wait@plt>
  mov    D15(%rip),%rax
  mov    %rax,%rdi
  call   <sem_wait@plt>
  mov    D70(%rip),%rax
  mov    (%rax),%edx
  mov    D4(%rip),%rax
  movslq %edx,%rdx
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax,%rdx,8)
  mov    D70(%rip),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%ecx
  movslq %ecx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  mov    D70(%rip),%rax
  mov    %edx,(%rax)
  mov    D15(%rip),%rax
  mov    %rax,%rdi
  call   <sem_post@plt>
  mov    D62(%rip),%rax
  mov    %rax,%rdi
  call   <sem_post@plt>
  addl   $0x1,-0x1c(%rbp)
L4:
  cmpl   $0x63,-0x1c(%rbp)
  jle    L11
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <pthread_exit@plt>
  nop
  leave
  ret
```

assistant: ```c
void *Productor(void *p) {
  extern sem_t mutex, full, empty;
  extern double bufer[10];
  extern int p_index;
  int *it, i;
  double valor, *suma;
  it = (int *)p;
  suma = (double *)malloc(sizeof(double));
  *suma = 0.0;
  for (i = 0; i < 100; i++) {
    *suma += (valor = (double)(rand() % 1000));
    sem_wait(&empty);
    sem_wait(&mutex);
    bufer[p_index] = valor;
    p_index = (p_index + 1) % 10;
    sem_post(&mutex);
    sem_post(&full);
  }
  pthread_exit((void *)suma);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<Productor>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  movq   $0x0,(%rax)
  mov    $0x64,%ebx
L4:
  mov    $0x0,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  sar    $0x26,%rdx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movq   %xmm1,%r13
  movapd %xmm1,%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,(%r12)
  mov    D32(%rip),%rdi
  call   <sem_wait@plt>
  mov    D29(%rip),%rbp
  mov    %rbp,%rdi
  call   <sem_wait@plt>
  mov    D27(%rip),%rcx
  mov    (%rcx),%edx
  movslq %edx,%rsi
  mov    D2(%rip),%rax
  mov    %r13,(%rax,%rsi,8)
  add    $0x1,%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,(%rcx)
  mov    %rbp,%rdi
  call   <sem_post@plt>
  mov    D30(%rip),%rdi
  call   <sem_post@plt>
  sub    $0x1,%ebx
  jne    L4
  mov    %r12,%rdi
  call   <pthread_exit@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void *Productor(void *p) {
  extern sem_t mutex, full, empty;
  extern double bufer[10];
  extern int p_index;
  int *it, i;
  double valor, *suma;
  it = (int *)p;
  suma = (double *)malloc(sizeof(double));
  *suma = 0.0;
  for (i = 0; i < 100; i++) {
    *suma += (valor = (double)(rand() % 1000));
    sem_wait(&empty);
    sem_wait(&mutex);
    bufer[p_index] = valor;
    p_index = (p_index + 1) % 10;
    sem_post(&mutex);
    sem_post(&full);
  }
  pthread_exit((void *)suma);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Productor>:
  endbr64
  push   %r15
  mov    $0x8,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    $0x64,%ebp
  push   %rbx
  sub    $0x18,%rsp
  call   <malloc@plt>
  mov    D10(%rip),%r15
  mov    D20(%rip),%r13
  movq   $0x0,(%rax)
  mov    D25(%rip),%rbx
  mov    %rax,%r12
  mov    D3(%rip),%r14
  nopw   0x0(%rax,%rax,1)
L9:
  xor    %eax,%eax
  call   <rand@plt>
  pxor   %xmm0,%xmm0
  mov    %r15,%rdi
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x26,%rdx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  cvtsi2sd %eax,%xmm0
  movapd %xmm0,%xmm1
  addsd  (%r12),%xmm1
  movsd  %xmm0,0x8(%rsp)
  movsd  %xmm1,(%r12)
  call   <sem_wait@plt>
  mov    %r13,%rdi
  call   <sem_wait@plt>
  movslq (%rbx),%rax
  mov    D2(%rip),%rsi
  mov    %r13,%rdi
  movsd  0x8(%rsp),%xmm0
  mov    %rax,%rdx
  add    $0x1,%edx
  movsd  %xmm0,(%rsi,%rax,8)
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x22,%rax
  sub    %ecx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,(%rbx)
  call   <sem_post@plt>
  mov    %r14,%rdi
  call   <sem_post@plt>
  sub    $0x1,%ebp
  jne    L9
  mov    %r12,%rdi
  call   <pthread_exit@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void *Productor(void *p) {
  extern sem_t mutex, full, empty;
  extern double bufer[10];
  extern int p_index;
  int *it, i;
  double valor, *suma;
  it = (int *)p;
  suma = (double *)malloc(sizeof(double));
  *suma = 0.0;
  for (i = 0; i < 100; i++) {
    *suma += (valor = (double)(rand() % 1000));
    sem_wait(&empty);
    sem_wait(&mutex);
    bufer[p_index] = valor;
    p_index = (p_index + 1) % 10;
    sem_post(&mutex);
    sem_post(&full);
  }
  pthread_exit((void *)suma);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<Productor>:
  endbr64
  push   %r15
  mov    $0x8,%edi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    $0x64,%ebp
  push   %rbx
  sub    $0x18,%rsp
  call   <malloc@plt>
  mov    D21(%rip),%r15
  mov    D15(%rip),%r13
  movq   $0x0,(%rax)
  mov    D6(%rip),%rbx
  mov    %rax,%r12
  mov    D40(%rip),%r14
  nopw   0x0(%rax,%rax,1)
L6:
  xor    %eax,%eax
  call   <rand@plt>
  pxor   %xmm0,%xmm0
  mov    %r15,%rdi
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0x10624dd3,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x26,%rdx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  cvtsi2sd %eax,%xmm0
  movapd %xmm0,%xmm1
  addsd  (%r12),%xmm1
  movsd  %xmm0,0x8(%rsp)
  movsd  %xmm1,(%r12)
  call   <sem_wait@plt>
  mov    %r13,%rdi
  call   <sem_wait@plt>
  movslq (%rbx),%rax
  mov    D9(%rip),%rsi
  mov    %r13,%rdi
  movsd  0x8(%rsp),%xmm0
  mov    %rax,%rdx
  add    $0x1,%edx
  movsd  %xmm0,(%rsi,%rax,8)
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x22,%rax
  sub    %ecx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,(%rbx)
  call   <sem_post@plt>
  mov    %r14,%rdi
  call   <sem_post@plt>
  sub    $0x1,%ebp
  jne    L6
  mov    %r12,%rdi
  call   <pthread_exit@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void *Productor(void *p) {
  extern sem_t mutex, full, empty;
  extern double bufer[10];
  extern int p_index;
  int *it, i;
  double valor, *suma;
  it = (int *)p;
  suma = (double *)malloc(sizeof(double));
  *suma = 0.0;
  for (i = 0; i < 100; i++) {
    *suma += (valor = (double)(rand() % 1000));
    sem_wait(&empty);
    sem_wait(&mutex);
    bufer[p_index] = valor;
    p_index = (p_index + 1) % 10;
    sem_post(&mutex);
    sem_post(&full);
  }
  pthread_exit((void *)suma);
}
```