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

```asm
<fgets>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %edx,%ebp
  mov    %rdi,%rbx
  mov    $0x0,%eax
  lea    -0x1(%rsi,%rdi,1),%r12d
L39:
  mov    %r12d,%edx
  sub    %ebx,%edx
  test   %edx,%edx
  jle    L22
  mov    %ebp,%edi
  call   <getc@plt>
  test   %eax,%eax
  js     L22
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  cmp    $0xa,%eax
  je     L15
  cmp    $0xd,%eax
  jne    L39
  jmp    L15
L22:
  test   %eax,%eax
  jns    L15
  mov    $0x0,%eax
  cmp    %r13,%rbx
  je     L55
L15:
  movb   $0x0,(%rbx)
  mov    %r13,%rax
L55:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *fgets(char *s, int n, int dev) {
  int c = 0;
  char *cs;
  cs = s;
  while ((--n > 0) && ((c = getc(dev)) >= 0)) {
    *cs++ = c;
    if (('\n' == c) || ('\r' == c)) {
      break;
    }
  }
  if ((c < 0) && (cs == s)) {
    return 0;
  }
  *cs++ = '\0';
  return s;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fgets>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    -0x1(%rsi,%rdi,1),%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  jmp    L44
  nopl   (%rax)
L22:
  mov    %ebp,%edi
  call   <getc@plt>
  test   %eax,%eax
  js     L42
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  cmp    $0xa,%eax
  je     L24
  cmp    $0xd,%eax
  je     L24
L44:
  mov    %r12d,%eax
  sub    %ebx,%eax
  test   %eax,%eax
  jg     L22
L24:
  movb   $0x0,(%rbx)
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L42:
  xor    %eax,%eax
  cmp    %r13,%rbx
  jne    L24
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *fgets(char *s, int n, int dev) {
  int c = 0;
  char *cs;
  cs = s;
  while ((--n > 0) && ((c = getc(dev)) >= 0)) {
    *cs++ = c;
    if (('\n' == c) || ('\r' == c)) {
      break;
    }
  }
  if ((c < 0) && (cs == s)) {
    return 0;
  }
  *cs++ = '\0';
  return s;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fgets>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    -0x1(%rsi,%rdi,1),%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  jmp    L37
  nopl   (%rax)
L59:
  mov    %ebp,%edi
  call   <getc@plt>
  test   %eax,%eax
  js     L58
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  cmp    $0xa,%eax
  je     L3
  cmp    $0xd,%eax
  je     L3
L37:
  mov    %r12d,%eax
  sub    %ebx,%eax
  test   %eax,%eax
  jg     L59
L3:
  movb   $0x0,(%rbx)
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L58:
  xor    %eax,%eax
  cmp    %r13,%rbx
  jne    L3
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *fgets(char *s, int n, int dev) {
  int c = 0;
  char *cs;
  cs = s;
  while ((--n > 0) && ((c = getc(dev)) >= 0)) {
    *cs++ = c;
    if (('\n' == c) || ('\r' == c)) {
      break;
    }
  }
  if ((c < 0) && (cs == s)) {
    return 0;
  }
  *cs++ = '\0';
  return s;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<insort_short>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,%rax
  mov    %esi,%edx
  mov    $0x1,%r12d
  jmp    L39
L16:
  mov    %r12d,%ebx
  movslq %ebx,%rcx
  add    %rcx,%rcx
  add    %rax,%rcx
  movzwl (%rcx),%r13d
  jmp    L4
L17:
  movslq %ebx,%rcx
  add    %rcx,%rcx
  sub    $0x2,%rcx
  add    %rax,%rcx
  movslq %ebx,%rsi
  add    %rsi,%rsi
  add    %rax,%rsi
  movzwl (%rcx),%ecx
  mov    %cx,(%rsi)
  sub    $0x1,%ebx
L4:
  test   %ebx,%ebx
  jle    L1
  movslq %ebx,%rcx
  add    %rcx,%rcx
  sub    $0x2,%rcx
  add    %rax,%rcx
  movzwl (%rcx),%ecx
  cmp    %cx,%r13w
  jl     L17
L1:
  movslq %ebx,%rcx
  add    %rcx,%rcx
  add    %rax,%rcx
  mov    %r13w,(%rcx)
  add    $0x1,%r12d
L39:
  cmp    %edx,%r12d
  jl     L16
  nop
  nop
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
void insort_short(array, len) register short array[];
register int len;
{
  register int i, j;
  register short temp;
  for (i = 1; i < len; i++) {
    j = i;
    temp = array[j];
    while (j > 0 && ((array[j - 1]) > (temp))) {
      array[j] = array[j - 1];
      j--;
    }
    array[j] = temp;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<insort_short>:
  endbr64
  cmp    $0x1,%esi
  jle    L11
  lea    0x2(%rdi),%r10
  mov    $0x1,%r9d
  jmp    L33
L64:
  movslq %edx,%rdx
  mov    %r8w,(%rdi,%rdx,2)
  add    $0x1,%r9d
  add    $0x2,%r10
  cmp    %r9d,%esi
  je     L11
L33:
  movzwl (%r10),%r8d
  mov    %r10,%rax
  mov    %r9d,%edx
  test   %r9d,%r9d
  jle    L64
L47:
  movzwl -0x2(%rax),%ecx
  cmp    %r8w,%cx
  jle    L64
  mov    %cx,(%rax)
  sub    $0x2,%rax
  sub    $0x1,%edx
  jne    L47
  jmp    L64
L11:
  ret
```

assistant: ```c
void insort_short(array, len) register short array[];
register int len;
{
  register int i, j;
  register short temp;
  for (i = 1; i < len; i++) {
    j = i;
    temp = array[j];
    while (j > 0 && ((array[j - 1]) > (temp))) {
      array[j] = array[j - 1];
      j--;
    }
    array[j] = temp;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<insort_short>:
  endbr64
  lea    0x2(%rdi),%r9
  mov    $0x1,%r10d
  cmp    $0x1,%esi
  jle    L31
  nopl   0x0(%rax,%rax,1)
L16:
  movzwl (%r9),%r8d
  mov    %r9,%rax
  nop
L19:
  movzwl -0x2(%rax),%edx
  mov    %rax,%rcx
  cmp    %r8w,%dx
  jle    L15
  mov    %dx,(%rax)
  lea    -0x2(%rcx),%rax
  cmp    %rax,%rdi
  jne    L19
  mov    %rdi,%rcx
L15:
  add    $0x1,%r10d
  mov    %r8w,(%rcx)
  add    $0x2,%r9
  cmp    %r10d,%esi
  jne    L16
L31:
  ret
```

assistant: ```c
void insort_short(array, len) register short array[];
register int len;
{
  register int i, j;
  register short temp;
  for (i = 1; i < len; i++) {
    j = i;
    temp = array[j];
    while (j > 0 && ((array[j - 1]) > (temp))) {
      array[j] = array[j - 1];
      j--;
    }
    array[j] = temp;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<insort_short>:
  endbr64
  lea    0x2(%rdi),%r9
  mov    $0x1,%r10d
  cmp    $0x1,%esi
  jle    L17
  nopl   0x0(%rax,%rax,1)
L15:
  movzwl (%r9),%r8d
  mov    %r9,%rax
  nop
L33:
  movzwl -0x2(%rax),%edx
  mov    %rax,%rcx
  cmp    %r8w,%dx
  jle    L27
  mov    %dx,(%rax)
  lea    -0x2(%rcx),%rax
  cmp    %rdi,%rax
  jne    L33
  mov    %rdi,%rcx
L27:
  add    $0x1,%r10d
  mov    %r8w,(%rcx)
  add    $0x2,%r9
  cmp    %r10d,%esi
  jne    L15
L17:
  ret
```

assistant: ```c
void insort_short(array, len) register short array[];
register int len;
{
  register int i, j;
  register short temp;
  for (i = 1; i < len; i++) {
    j = i;
    temp = array[j];
    while (j > 0 && ((array[j - 1]) > (temp))) {
      array[j] = array[j - 1];
      j--;
    }
    array[j] = temp;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<supprimeCaractere>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,%eax
  mov    %al,-0x1c(%rbp)
  movsbl -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L6
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L4
L6:
  movsbl -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <supprimerSuite@plt>
L4:
  nop
  leave
  ret
```

assistant: ```c
void supprimeCaractere(char *ligne, char caractere) {
  char *saut = strchr(ligne, caractere);
  if (saut)
    *saut = 0;
  else
    supprimerSuite(caractere);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<supprimeCaractere>:
  endbr64
  push   %rbx
  movsbl %sil,%ebx
  mov    %ebx,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L5
  movb   $0x0,(%rax)
L0:
  pop    %rbx
  ret
L5:
  mov    %ebx,%edi
  call   <supprimerSuite@plt>
  jmp    L0
```

assistant: ```c
void supprimeCaractere(char *ligne, char caractere) {
  char *saut = strchr(ligne, caractere);
  if (saut)
    *saut = 0;
  else
    supprimerSuite(caractere);
}
```
user: Translate the below assembly code into C programming language:

```asm
<supprimeCaractere>:
  endbr64
  push   %rbp
  movsbl %sil,%ebp
  mov    %ebp,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L7
  movb   $0x0,(%rax)
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L7:
  mov    %ebp,%edi
  pop    %rbp
  jmp    1070 <supprimerSuite@plt>
```

assistant: ```c
void supprimeCaractere(char *ligne, char caractere) {
  char *saut = strchr(ligne, caractere);
  if (saut)
    *saut = 0;
  else
    supprimerSuite(caractere);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<supprimeCaractere>:
  endbr64
  push   %rbp
  movsbl %sil,%ebp
  mov    %ebp,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L2
  movb   $0x0,(%rax)
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L2:
  mov    %ebp,%edi
  pop    %rbp
  jmp    1070 <supprimerSuite@plt>
```

assistant: ```c
void supprimeCaractere(char *ligne, char caractere) {
  char *saut = strchr(ligne, caractere);
  if (saut)
    *saut = 0;
  else
    supprimerSuite(caractere);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<fmaxl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   0x18(%rbp)
  push   0x10(%rbp)
  call   <isnan@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  je     L26
  fldt   0x20(%rbp)
  jmp    L22
L26:
  push   0x28(%rbp)
  push   0x20(%rbp)
  call   <isnan@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  je     L56
  fldt   0x10(%rbp)
  jmp    L22
L56:
  fldt   0x10(%rbp)
  fldt   0x20(%rbp)
  fcomip %st(1),%st
  fstp   %st(0)
  jbe    L36
  fldt   0x20(%rbp)
  jmp    L22
L36:
  fldt   0x10(%rbp)
L22:
  leave
  ret
```

assistant: ```c
long double fmaxl(long double x, long double y) {
  if (isnan(x))
    return y;
  if (isnan(y))
    return x;
  return x < y ? y : x;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<fmaxl>:
  endbr64
  sub    $0x8,%rsp
  push   0x18(%rsp)
  push   0x18(%rsp)
  call   <isnan@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  je     L15
L26:
  fldt   0x20(%rsp)
  add    $0x8,%rsp
  ret
L15:
  push   0x28(%rsp)
  push   0x28(%rsp)
  call   <isnan@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  jne    L29
  fldt   0x10(%rsp)
  fldt   0x20(%rsp)
  fcomi  %st(1),%st
  fcmovbe %st(1),%st
  fstp   %st(1)
  fstpt  0x20(%rsp)
  jmp    L26
L29:
  fldt   0x10(%rsp)
  fstpt  0x20(%rsp)
  jmp    L26
```

assistant: ```c
long double fmaxl(long double x, long double y) {
  if (isnan(x))
    return y;
  if (isnan(y))
    return x;
  return x < y ? y : x;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<fmaxl>:
  endbr64
  sub    $0x8,%rsp
  push   0x18(%rsp)
  push   0x18(%rsp)
  call   <isnan@plt>
  pop    %rsi
  pop    %rdi
  test   %rax,%rax
  je     L13
  jmp    L20
  xchg   %ax,%ax
L32:
  fstp   %st(0)
L20:
  fldt   0x20(%rsp)
L36:
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  push   0x28(%rsp)
  push   0x28(%rsp)
  call   <isnan@plt>
  pop    %rdx
  pop    %rcx
  fldt   0x10(%rsp)
  test   %rax,%rax
  jne    L36
  fldt   0x20(%rsp)
  fcomip %st(1),%st
  ja     L32
  add    $0x8,%rsp
  ret
```

assistant: ```c
long double fmaxl(long double x, long double y) {
  if (isnan(x))
    return y;
  if (isnan(y))
    return x;
  return x < y ? y : x;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<fmaxl>:
  endbr64
  sub    $0x8,%rsp
  push   0x18(%rsp)
  push   0x18(%rsp)
  call   <isnan@plt>
  pop    %rsi
  pop    %rdi
  test   %rax,%rax
  je     L7
  jmp    L21
  xchg   %ax,%ax
L26:
  fstp   %st(0)
L21:
  fldt   0x20(%rsp)
L31:
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L7:
  push   0x28(%rsp)
  push   0x28(%rsp)
  call   <isnan@plt>
  pop    %rdx
  pop    %rcx
  fldt   0x10(%rsp)
  test   %rax,%rax
  jne    L31
  fldt   0x20(%rsp)
  fcomip %st(1),%st
  ja     L26
  add    $0x8,%rsp
  ret
```

assistant: ```c
long double fmaxl(long double x, long double y) {
  if (isnan(x))
    return y;
  if (isnan(y))
    return x;
  return x < y ? y : x;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<print_syntax>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

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

tool: D9: Usage: blzpack [options] <infile> <outfile>

Options:
  -d, --decompress  Decompress
  -c, --checksum    Use checksums if present
  -h, --help        Print this help and exit
  -v, --version     Print version and exit



assistant: ```c
void print_syntax(void) {
  printf("Usage: blzpack [options] <infile> <outfile>\n"
         "\n"
         "Options:\n"
         "  -d, --decompress  Decompress\n"
         "  -c, --checksum    Use checksums if present\n"
         "  -h, --help        Print this help and exit\n"
         "  -v, --version     Print version and exit\n"
         "\n");
}
```
user: Translate the below assembly code into C programming language:

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

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

tool: D0: Usage: blzpack [options] <infile> <outfile>

Options:
  -d, --decompress  Decompress
  -c, --checksum    Use checksums if present
  -h, --help        Print this help and exit
  -v, --version     Print version and exit



assistant: ```c
void print_syntax(void) {
  printf("Usage: blzpack [options] <infile> <outfile>\n"
         "\n"
         "Options:\n"
         "  -d, --decompress  Decompress\n"
         "  -c, --checksum    Use checksums if present\n"
         "  -h, --help        Print this help and exit\n"
         "  -v, --version     Print version and exit\n"
         "\n");
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<print_syntax>:
  endbr64
  lea    D6(%rip),%rdi
  jmp    1050 <printf@plt>
```

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

tool: D6: Usage: blzpack [options] <infile> <outfile>

Options:
  -d, --decompress  Decompress
  -c, --checksum    Use checksums if present
  -h, --help        Print this help and exit
  -v, --version     Print version and exit



assistant: ```c
void print_syntax(void) {
  printf("Usage: blzpack [options] <infile> <outfile>\n"
         "\n"
         "Options:\n"
         "  -d, --decompress  Decompress\n"
         "  -c, --checksum    Use checksums if present\n"
         "  -h, --help        Print this help and exit\n"
         "  -v, --version     Print version and exit\n"
         "\n");
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<print_syntax>:
  endbr64
  lea    D6(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: read_data
arguments: data_tag: D6
data_type: string

tool: D6: Usage: blzpack [options] <infile> <outfile>

Options:
  -d, --decompress  Decompress
  -c, --checksum    Use checksums if present
  -h, --help        Print this help and exit
  -v, --version     Print version and exit



assistant: ```c
void print_syntax(void) {
  printf("Usage: blzpack [options] <infile> <outfile>\n"
         "\n"
         "Options:\n"
         "  -d, --decompress  Decompress\n"
         "  -c, --checksum    Use checksums if present\n"
         "  -h, --help        Print this help and exit\n"
         "  -v, --version     Print version and exit\n"
         "\n");
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<calc_primes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L46
L42:
  movl   $0x2,-0xc(%rbp)
  jmp    L63
L22:
  mov    -0xc(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0xc(%rbp),%eax
  and    $0x7,%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L20
  mov    -0x4(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  cltd
  idivl  -0xc(%rbp)
  imul   -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  imul   %eax,%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L8
L43:
  mov    -0x8(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%esi
  mov    -0x8(%rbp),%edx
  and    $0x7,%edx
  mov    $0x1,%edi
  mov    %edx,%ecx
  shl    %cl,%edi
  mov    %edi,%edx
  mov    %edx,%ecx
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  or     %ecx,%esi
  mov    %esi,%edx
  mov    %dl,(%rax)
  mov    -0xc(%rbp),%eax
  add    %eax,-0x8(%rbp)
L8:
  mov    -0x4(%rbp),%eax
  add    $0x3ffff,%eax
  cmp    %eax,-0x8(%rbp)
  jle    L43
  jmp    L71
L20:
  nop
L71:
  addl   $0x1,-0xc(%rbp)
L63:
  mov    -0x4(%rbp),%eax
  add    $0x40000,%eax
  mov    %eax,%edi
  call   <sqrtl@plt>
  cmp    %eax,-0xc(%rbp)
  jle    L22
  addl   $0x40000,-0x4(%rbp)
L46:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L42
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  or     $0x3,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  nop
  leave
  ret
```

assistant: ```c
void calc_primes(char *bitmap, uint64_t max) {
  uint64_t a, r, cur;
  for (cur = 0; cur <= max; cur += 32 * 1024 * 8) {
    for (a = 2; a <= sqrtl(cur + 32 * 1024 * 8); a++) {
      if (bitmap[a / 8] & 1 << (a % 8))
        continue;
      for (r = ((a * a) > ((cur + a - 1) / a * a) ? (a * a) : ((cur + a - 1) / a * a)); r < cur + 32 * 1024 * 8; r += a)
        bitmap[r / 8] |= 1 << (r % 8);
    }
  }
  bitmap[0] |= 0x3;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<calc_primes>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %esi,0xc(%rsp)
  mov    $0x3ffff,%r14d
  mov    $0x0,%r15d
  movl   $0x40000,0x8(%rsp)
  mov    $0x1,%r12d
  test   %esi,%esi
  jns    L29
L54:
  orb    $0x3,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L8:
  add    $0x1,%ebx
L45:
  mov    %r13d,%edi
  call   <sqrtl@plt>
  cmp    %ebx,%eax
  jl     L50
  lea    0x7(%rbx),%eax
  test   %ebx,%ebx
  cmovns %ebx,%eax
  sar    $0x3,%eax
  cltq
  movsbl 0x0(%rbp,%rax,1),%edx
  mov    %ebx,%eax
  and    $0x7,%eax
  bt     %eax,%edx
  jb     L8
  lea    -0x1(%rbx,%r15,1),%eax
  cltd
  idiv   %ebx
  imul   %ebx,%eax
  mov    %ebx,%edx
  imul   %ebx,%edx
  cmp    %edx,%eax
  cmovl  %edx,%eax
  mov    %r14d,%esi
  cmp    %r14d,%eax
  jg     L8
L23:
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovns %eax,%edx
  sar    $0x3,%edx
  movslq %edx,%rdx
  mov    %eax,%ecx
  and    $0x7,%ecx
  mov    %r12d,%edi
  shl    %cl,%edi
  or     %dil,0x0(%rbp,%rdx,1)
  add    %ebx,%eax
  cmp    %esi,%eax
  jle    L23
  jmp    L8
L50:
  addl   $0x40000,0x8(%rsp)
  add    $0x40000,%r15d
  add    $0x40000,%r14d
  cmp    0xc(%rsp),%r13d
  jg     L54
L29:
  mov    $0x2,%ebx
  mov    0x8(%rsp),%r13d
  jmp    L45
```

assistant: ```c
void calc_primes(char *bitmap, uint64_t max) {
  uint64_t a, r, cur;
  for (cur = 0; cur <= max; cur += 32 * 1024 * 8) {
    for (a = 2; a <= sqrtl(cur + 32 * 1024 * 8); a++) {
      if (bitmap[a / 8] & 1 << (a % 8))
        continue;
      for (r = ((a * a) > ((cur + a - 1) / a * a) ? (a * a) : ((cur + a - 1) / a * a)); r < cur + 32 * 1024 * 8; r += a)
        bitmap[r / 8] |= 1 << (r % 8);
    }
  }
  bitmap[0] |= 0x3;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<calc_primes>:
  endbr64
  push   %r15
  mov    $0x1,%r15d
  push   %r14
  mov    $0x3ffff,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  test   %esi,%esi
  js     L62
  nop
L55:
  mov    %ebp,%ebx
  mov    $0x2,%r12d
  add    $0x40000,%ebp
  sub    $0x1,%ebx
  jmp    L74
  nopl   0x0(%rax,%rax,1)
L40:
  add    $0x1,%r12d
L74:
  mov    %ebp,%edi
  call   <sqrtl@plt>
  cmp    %r12d,%eax
  jl     L8
  mov    %r12d,%eax
  sar    $0x3,%eax
  cltq
  movsbl 0x0(%r13,%rax,1),%edx
  mov    %r12d,%eax
  and    $0x7,%eax
  bt     %eax,%edx
  jb     L40
  lea    (%rbx,%r12,1),%eax
  cltd
  idiv   %r12d
  mov    %r12d,%edx
  imul   %r12d,%edx
  imul   %r12d,%eax
  cmp    %edx,%eax
  cmovl  %edx,%eax
  cmp    %eax,%r14d
  jl     L40
  xchg   %ax,%ax
L67:
  test   %eax,%eax
  lea    0x7(%rax),%edx
  mov    %eax,%ecx
  mov    %r15d,%esi
  cmovns %eax,%edx
  and    $0x7,%ecx
  add    %r12d,%eax
  shl    %cl,%esi
  sar    $0x3,%edx
  movslq %edx,%rdx
  or     %sil,0x0(%r13,%rdx,1)
  cmp    %eax,%r14d
  jge    L67
  jmp    L40
  nopw   0x0(%rax,%rax,1)
L8:
  add    $0x40000,%r14d
  cmp    %ebp,0xc(%rsp)
  jge    L55
L62:
  orb    $0x3,0x0(%r13)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void calc_primes(char *bitmap, uint64_t max) {
  uint64_t a, r, cur;
  for (cur = 0; cur <= max; cur += 32 * 1024 * 8) {
    for (a = 2; a <= sqrtl(cur + 32 * 1024 * 8); a++) {
      if (bitmap[a / 8] & 1 << (a % 8))
        continue;
      for (r = ((a * a) > ((cur + a - 1) / a * a) ? (a * a) : ((cur + a - 1) / a * a)); r < cur + 32 * 1024 * 8; r += a)
        bitmap[r / 8] |= 1 << (r % 8);
    }
  }
  bitmap[0] |= 0x3;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<calc_primes>:
  endbr64
  push   %r15
  mov    $0x1,%r15d
  push   %r14
  mov    $0x3ffff,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  test   %esi,%esi
  js     L21
  nop
L64:
  mov    %ebp,%ebx
  mov    $0x2,%r12d
  add    $0x40000,%ebp
  sub    $0x1,%ebx
  jmp    L14
  nopl   0x0(%rax,%rax,1)
L24:
  add    $0x1,%r12d
L14:
  mov    %ebp,%edi
  call   <sqrtl@plt>
  cmp    %r12d,%eax
  jl     L66
  mov    %r12d,%eax
  sar    $0x3,%eax
  cltq
  movsbl 0x0(%r13,%rax,1),%edx
  mov    %r12d,%eax
  and    $0x7,%eax
  bt     %eax,%edx
  jb     L24
  lea    (%rbx,%r12,1),%eax
  cltd
  idiv   %r12d
  mov    %r12d,%edx
  imul   %r12d,%edx
  imul   %r12d,%eax
  cmp    %edx,%eax
  cmovl  %edx,%eax
  cmp    %r14d,%eax
  jg     L24
  xchg   %ax,%ax
L6:
  test   %eax,%eax
  lea    0x7(%rax),%edx
  mov    %eax,%ecx
  mov    %r15d,%esi
  cmovns %eax,%edx
  and    $0x7,%ecx
  add    %r12d,%eax
  shl    %cl,%esi
  sar    $0x3,%edx
  movslq %edx,%rdx
  or     %sil,0x0(%r13,%rdx,1)
  cmp    %r14d,%eax
  jle    L6
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L66:
  add    $0x40000,%r14d
  cmp    %ebp,0xc(%rsp)
  jge    L64
L21:
  orb    $0x3,0x0(%r13)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void calc_primes(char *bitmap, uint64_t max) {
  uint64_t a, r, cur;
  for (cur = 0; cur <= max; cur += 32 * 1024 * 8) {
    for (a = 2; a <= sqrtl(cur + 32 * 1024 * 8); a++) {
      if (bitmap[a / 8] & 1 << (a % 8))
        continue;
      for (r = ((a * a) > ((cur + a - 1) / a * a) ? (a * a) : ((cur + a - 1) / a * a)); r < cur + 32 * 1024 * 8; r += a)
        bitmap[r / 8] |= 1 << (r % 8);
    }
  }
  bitmap[0] |= 0x3;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strcmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  jmp    L27
L9:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L16
  mov    $0x0,%eax
  jmp    L25
L16:
  addq   $0x1,-0x8(%rbp)
  addq   $0x1,-0x10(%rbp)
L27:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L9
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
L25:
  pop    %rbp
  ret
```

assistant: ```c
int strcmp(const char *str1, const char *str2) {
  for (; *str1 == *str2; str1++, str2++) {
    if (*str1 == 0) {
      return 0;
    }
  }
  return *str1 - *str2;
}
```