ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L10
  add    $0x1,%rdi
L23:
  sub    $0x61,%eax
  cmp    $0x19,%al
  ja     L1
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%eax
  test   %al,%al
  jne    L23
  mov    $0x1,%eax
  ret
L10:
  mov    $0x1,%eax
  ret
L1:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int my_str_islower(char *str) {
  int i;
  char c;
  i = 0;
  while (str[i] != '\0') {
    c = str[i];
    if (c < 'a' || c > 'z') {
      return (0);
    }
    i = i + 1;
  }
  return (1);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L22
  add    $0x1,%rdi
  jmp    L11
  nopl   0x0(%rax)
L16:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L22
L11:
  sub    $0x61,%eax
  cmp    $0x19,%al
  jbe    L16
  xor    %eax,%eax
  ret
  nopl   (%rax)
L22:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int my_str_islower(char *str) {
  int i;
  char c;
  i = 0;
  while (str[i] != '\0') {
    c = str[i];
    if (c < 'a' || c > 'z') {
      return (0);
    }
    i = i + 1;
  }
  return (1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L25
  add    $0x1,%rdi
  jmp    L7
  nopl   0x0(%rax)
L5:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L25
L7:
  sub    $0x61,%eax
  cmp    $0x19,%al
  jbe    L5
  xor    %eax,%eax
  ret
  nopl   (%rax)
L25:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int my_str_islower(char *str) {
  int i;
  char c;
  i = 0;
  while (str[i] != '\0') {
    c = str[i];
    if (c < 'a' || c > 'z') {
      return (0);
    }
    i = i + 1;
  }
  return (1);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<checksum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  mov    %rdi,-0x10(%rbp)
  mov    %esi,-0x14(%rbp)
  mov    $0x0,%ebx
  jmp    L17
L1:
  mov    -0x10(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    %rax,%rbx
L17:
  mov    -0x14(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  test   %eax,%eax
  jne    L1
  mov    %rbx,%rdx
  shr    $0x10,%rdx
  movzwl %bx,%eax
  lea    (%rdx,%rax,1),%rbx
  mov    %rbx,%rax
  shr    $0x10,%rax
  add    %rax,%rbx
  mov    %ebx,%eax
  not    %eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
unsigned short checksum(unsigned short *buf, int len) {
  register unsigned long sum = 0;
  while (len--)
    sum += *buf++;
  sum = (sum >> 16) + (sum & 0xffff);
  sum += (sum >> 16);
  return (unsigned short)(~sum);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<checksum>:
  endbr64
  test   %esi,%esi
  je     L7
  mov    %esi,%esi
  lea    (%rdi,%rsi,2),%rcx
  mov    $0x0,%eax
L10:
  add    $0x2,%rdi
  movzwl -0x2(%rdi),%edx
  add    %rdx,%rax
  cmp    %rcx,%rdi
  jne    L10
L21:
  mov    %rax,%rdx
  shr    $0x10,%rdx
  movzwl %ax,%eax
  add    %rax,%rdx
  mov    %rdx,%rax
  shr    $0x10,%rax
  add    %rdx,%rax
  not    %eax
  ret
L7:
  mov    $0x0,%eax
  jmp    L21
```

assistant: ```c
unsigned short checksum(unsigned short *buf, int len) {
  register unsigned long sum = 0;
  while (len--)
    sum += *buf++;
  sum = (sum >> 16) + (sum & 0xffff);
  sum += (sum >> 16);
  return (unsigned short)(~sum);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<checksum>:
  endbr64
  test   %esi,%esi
  je     L14
  mov    %esi,%esi
  xor    %eax,%eax
  lea    (%rdi,%rsi,2),%rcx
L17:
  movzwl (%rdi),%edx
  add    $0x2,%rdi
  add    %rdx,%rax
  cmp    %rcx,%rdi
  jne    L17
  mov    %rax,%rdx
  movzwl %ax,%eax
  shr    $0x10,%rdx
  add    %rax,%rdx
  mov    %rdx,%rax
  shr    $0x10,%rax
  add    %rdx,%rax
  not    %eax
  ret
  nopl   0x0(%rax)
L14:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
unsigned short checksum(unsigned short *buf, int len) {
  register unsigned long sum = 0;
  while (len--)
    sum += *buf++;
  sum = (sum >> 16) + (sum & 0xffff);
  sum += (sum >> 16);
  return (unsigned short)(~sum);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<checksum>:
  endbr64
  mov    %rdi,%rdx
  lea    -0x1(%rsi),%ecx
  test   %esi,%esi
  je     L40
  cmp    $0x6,%ecx
  jbe    L102
  pxor   %xmm2,%xmm2
  pxor   %xmm4,%xmm4
  pxor   %xmm3,%xmm3
  mov    %rdi,%rax
  mov    %esi,%edi
  shr    $0x3,%edi
  sub    $0x1,%edi
  shl    $0x4,%rdi
  lea    0x10(%rdx,%rdi,1),%rdi
  nopl   0x0(%rax,%rax,1)
L31:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  movdqa %xmm0,%xmm1
  punpckhwd %xmm4,%xmm0
  movdqa %xmm0,%xmm5
  punpcklwd %xmm4,%xmm1
  punpckhdq %xmm3,%xmm0
  punpckldq %xmm3,%xmm5
  paddq  %xmm5,%xmm0
  movdqa %xmm1,%xmm5
  punpckldq %xmm3,%xmm1
  punpckhdq %xmm3,%xmm5
  paddq  %xmm5,%xmm1
  paddq  %xmm1,%xmm0
  paddq  %xmm0,%xmm2
  cmp    %rdi,%rax
  jne    L31
  movdqa %xmm2,%xmm0
  mov    %esi,%edi
  and    $0xfffffff8,%edi
  psrldq $0x8,%xmm0
  paddq  %xmm0,%xmm2
  mov    %edi,%r8d
  sub    %edi,%ecx
  movq   %xmm2,%rax
  lea    (%rdx,%r8,2),%rdx
  cmp    %esi,%edi
  je     L56
L49:
  movzwl (%rdx),%esi
  add    %rsi,%rax
  test   %ecx,%ecx
  je     L56
  movzwl 0x2(%rdx),%esi
  add    %rsi,%rax
  cmp    $0x1,%ecx
  je     L56
  movzwl 0x4(%rdx),%esi
  add    %rsi,%rax
  cmp    $0x2,%ecx
  je     L56
  movzwl 0x6(%rdx),%esi
  add    %rsi,%rax
  cmp    $0x3,%ecx
  je     L56
  movzwl 0x8(%rdx),%esi
  add    %rsi,%rax
  cmp    $0x4,%ecx
  je     L56
  movzwl 0xa(%rdx),%esi
  add    %rsi,%rax
  cmp    $0x5,%ecx
  je     L56
  movzwl 0xc(%rdx),%edx
  add    %rdx,%rax
L56:
  mov    %rax,%rdx
  movzwl %ax,%eax
  shr    $0x10,%rdx
  add    %rax,%rdx
  mov    %rdx,%rax
  shr    $0x10,%rax
  add    %rdx,%rax
  not    %eax
  ret
  nopl   0x0(%rax)
L40:
  mov    $0xffffffff,%eax
  ret
L102:
  xor    %eax,%eax
  jmp    L49
```

assistant: ```c
unsigned short checksum(unsigned short *buf, int len) {
  register unsigned long sum = 0;
  while (len--)
    sum += *buf++;
  sum = (sum >> 16) + (sum & 0xffff);
  sum += (sum >> 16);
  return (unsigned short)(~sum);
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x1,-0x4(%rbp)
  jmp    L9
L17:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <f@plt>
  addl   $0x1,-0x4(%rbp)
L9:
  cmpl   $0x1f,-0x4(%rbp)
  jle    L17
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(void) {
  int i;
  for (i = 1; i < 32; i++)
    f(i);
  exit(0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x1,%ebx
L8:
  mov    %ebx,%edi
  call   <f@plt>
  add    $0x1,%ebx
  cmp    $0x20,%ebx
  jne    L8
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int main(void) {
  int i;
  for (i = 1; i < 32; i++)
    f(i);
  exit(0);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x1,%ebx
  nopw   0x0(%rax,%rax,1)
L9:
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <f@plt>
  cmp    $0x20,%ebx
  jne    L9
  xor    %edi,%edi
  call   <exit@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

assistant: ```c
int main(void) {
  int i;
  for (i = 1; i < 32; i++)
    f(i);
  exit(0);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x1,%ebx
  nopw   0x0(%rax,%rax,1)
L4:
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <f@plt>
  cmp    $0x20,%ebx
  jne    L4
  xor    %edi,%edi
  call   <exit@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

assistant: ```c
int main(void) {
  int i;
  for (i = 1; i < 32; i++)
    f(i);
  exit(0);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<cmd_mvwadd_wch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x4(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <check_arg_count@plt>
  cmp    $0x1,%eax
  je     L10
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <report_error@plt>
  jmp    L2
L10:
  nop
L2:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D4
type_infered: string

tool: D4: UNSUPPORTED

assistant: ```c
void cmd_mvwadd_wch(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cmd_mvwadd_wch>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  call   <check_arg_count@plt>
  cmp    $0x1,%eax
  je     L5
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D4(%rip),%rdi
  call   <report_error@plt>
L5:
  add    $0x8,%rsp
  ret
```

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

tool: D4: UNSUPPORTED

assistant: ```c
void cmd_mvwadd_wch(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<cmd_mvwadd_wch>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  call   <check_arg_count@plt>
  cmp    $0x1,%eax
  je     L7
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D7(%rip),%rdi
  add    $0x8,%rsp
  jmp    1080 <report_error@plt>
  nopl   0x0(%rax)
L7:
  add    $0x8,%rsp
  ret
```

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

tool: D7: UNSUPPORTED

assistant: ```c
void cmd_mvwadd_wch(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<cmd_mvwadd_wch>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  call   <check_arg_count@plt>
  cmp    $0x1,%eax
  je     L1
  mov    $0x1,%edi
  call   <report_count@plt>
  lea    D4(%rip),%rdi
  add    $0x8,%rsp
  jmp    1080 <report_error@plt>
  nopl   0x0(%rax)
L1:
  add    $0x8,%rsp
  ret
```

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

tool: D4: UNSUPPORTED

assistant: ```c
void cmd_mvwadd_wch(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Power>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  movsd  %xmm0,-0x28(%rbp)
  movsd  %xmm1,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  sub    $0x3fef127f,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x30(%rbp),%xmm1
  movsd  D9(%rip),%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x14(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  lea    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    -0x14(%rbp),%edx
  mov    %edx,(%rax)
  movsd  -0x10(%rbp),%xmm0
  movq   %xmm0,%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D9
type_infered: byte[8]

tool: {"D9": [0x00,0x00,0x80,0x3f,0x89,0xf7,0xcf,0x41]}

assistant: ```c
double Power(double a, double b) {
  int tmp = (*(1 + (int *)&a));
  int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
  double p = 0.0;
  *(1 + (int *)&p) = tmp2;
  return p;
}
```
user: What is the c source code of the assembly code below:

```asm
<Power>:
  endbr64
  movq   %xmm0,%rax
  sar    $0x20,%rax
  sub    $0x3fef127f,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  D6(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  shl    $0x20,%rax
  movq   %rax,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: label: D6
type_infered: byte[8]

tool: {"D6": [0x00,0x00,0x80,0x3f,0x89,0xf7,0xcf,0x41]}

assistant: ```c
double Power(double a, double b) {
  int tmp = (*(1 + (int *)&a));
  int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
  double p = 0.0;
  *(1 + (int *)&p) = tmp2;
  return p;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<Power>:
  endbr64
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  sar    $0x20,%rax
  sub    $0x3fef127f,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  D5(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  shl    $0x20,%rax
  movq   %rax,%xmm0
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D5
type_guessed: byte[8]

tool: {"D5": [0x00,0x00,0x80,0x3f,0x89,0xf7,0xcf,0x41]}

assistant: ```c
double Power(double a, double b) {
  int tmp = (*(1 + (int *)&a));
  int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
  double p = 0.0;
  *(1 + (int *)&p) = tmp2;
  return p;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Power>:
  endbr64
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  sar    $0x20,%rax
  sub    $0x3fef127f,%eax
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  D2(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  shl    $0x20,%rax
  movq   %rax,%xmm0
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D2
data_type: byte[8]

tool: {"D2": [0x00,0x00,0x80,0x3f,0x89,0xf7,0xcf,0x41]}

assistant: ```c
double Power(double a, double b) {
  int tmp = (*(1 + (int *)&a));
  int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
  double p = 0.0;
  *(1 + (int *)&p) = tmp2;
  return p;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<perm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %edx,-0x60(%rbp)
  mov    %rcx,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    -0x5c(%rbp),%eax
  cmp    -0x60(%rbp),%eax
  jne    L25
  mov    -0x60(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    -0x68(%rbp),%rcx
  mov    %edx,%esi
  mov    %rax,%rdi
  call   *%rcx
L25:
  mov    -0x5c(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
  jmp    L64
L38:
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x60(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L19:
  cmp    %rdx,%rsp
  je     L40
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L19
L40:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L60
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L60:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x60(%rbp),%edx
  mov    -0x58(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <copy@plt>
  mov    -0x4c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x40(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x5c(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x68(%rbp),%rcx
  mov    -0x60(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <perm>
  mov    %rbx,%rsp
  addl   $0x1,-0x4c(%rbp)
L64:
  mov    -0x4c(%rbp),%eax
  cmp    -0x60(%rbp),%eax
  jle    L38
  nop
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L16
  call   <__stack_chk_fail@plt>
L16:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
void perm(char list[], int left, int right, void (*handle)(char *, int)) {
  if (left == right) {
    handle(list, right);
  }
  int i;
  for (i = left; i <= right; ++i) {
    char tmp[right];
    copy(tmp, list, right);
    swap(&tmp[left], &tmp[i]);
    perm(tmp, left + 1, right, handle);
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<perm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x50(%rbp)
  mov    %esi,%r12d
  mov    %edx,%ebx
  mov    %rcx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmp    %edx,%esi
  je     L0
  jg     L69
L13:
  movslq %r12d,%r15
  mov    %r15,%r13
  movslq %ebx,%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffffff0,%rdx
  mov    %rdx,-0x60(%rbp)
  and    $0xfffffffffffff000,%rax
  mov    %rax,-0x48(%rbp)
  jmp    L47
L0:
  mov    %edx,%esi
  call   *%rcx
  jmp    L13
L83:
  mov    -0x60(%rbp),%rcx
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L48
  mov    %rcx,%rax
  and    $0xfff,%eax
  orq    $0x0,-0x8(%rsp,%rax,1)
L48:
  mov    %ebx,%edx
  mov    -0x50(%rbp),%rsi
  mov    %rsp,%rdi
  call   <copy@plt>
  lea    (%rsp,%r13,1),%rsi
  lea    (%rsp,%r15,1),%rdi
  call   <swap@plt>
  lea    0x1(%r12),%esi
  mov    -0x58(%rbp),%rcx
  mov    %ebx,%edx
  mov    %rsp,%rdi
  call   <perm>
  mov    %r14,%rsp
  add    $0x1,%r13
  mov    %r12d,%eax
  sub    %r15d,%eax
  add    %r13d,%eax
  cmp    %eax,%ebx
  jl     L69
L47:
  mov    %rsp,%r14
  mov    %rsp,%rax
  sub    -0x48(%rbp),%rax
L19:
  cmp    %rax,%rsp
  je     L83
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L19
L69:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void perm(char list[], int left, int right, void (*handle)(char *, int)) {
  if (left == right) {
    handle(list, right);
  }
  int i;
  for (i = left; i <= right; ++i) {
    char tmp[right];
    copy(tmp, list, right);
    swap(&tmp[left], &tmp[i]);
    perm(tmp, left + 1, right, handle);
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<perm>:
  endbr64
  push   %rbp
  mov    %rdi,%r10
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbx
  mov    %esi,%ebx
  sub    $0x48,%rsp
  mov    %rcx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  cmp    %edx,%esi
  je     L9
  jg     L55
L0:
  movslq %r13d,%rax
  lea    0x1(%rbx),%ecx
  movslq %ebx,%r14
  lea    0xf(%rax),%r12
  mov    %ecx,-0x64(%rbp)
  mov    %r14,%r15
  mov    %r12,%r11
  and    $0xff0,%r12d
  lea    -0x8(%r12),%rax
  and    $0xfffffffffffff000,%r11
  mov    %rax,-0x70(%rbp)
L61:
  mov    %rsp,%rax
  mov    %rsp,%r9
  sub    %r11,%rax
  cmp    %rax,%rsp
  je     L25
L1:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rax,%rsp
  jne    L1
L25:
  sub    %r12,%rsp
  test   %r12,%r12
  je     L49
  mov    -0x70(%rbp),%rax
  orq    $0x0,(%rsp,%rax,1)
L49:
  mov    %r10,%rsi
  mov    %r13d,%edx
  mov    %rsp,%rdi
  mov    %r11,-0x60(%rbp)
  mov    %r10,-0x50(%rbp)
  mov    %r9,-0x58(%rbp)
  call   <copy@plt>
  lea    (%rsp,%r15,1),%rsi
  lea    (%rsp,%r14,1),%rdi
  add    $0x1,%r15
  call   <swap@plt>
  mov    -0x48(%rbp),%rcx
  mov    -0x64(%rbp),%esi
  mov    %rsp,%rdi
  mov    %r13d,%edx
  call   <perm>
  mov    %ebx,%eax
  mov    -0x58(%rbp),%rsp
  mov    -0x50(%rbp),%r10
  sub    %r14d,%eax
  mov    -0x60(%rbp),%r11
  add    %r15d,%eax
  cmp    %r13d,%eax
  jle    L61
L55:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L9:
  mov    %rdi,-0x50(%rbp)
  call   *%rcx
  mov    -0x50(%rbp),%r10
  jmp    L0
L43:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void perm(char list[], int left, int right, void (*handle)(char *, int)) {
  if (left == right) {
    handle(list, right);
  }
  int i;
  for (i = left; i <= right; ++i) {
    char tmp[right];
    copy(tmp, list, right);
    swap(&tmp[left], &tmp[i]);
    perm(tmp, left + 1, right, handle);
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<scale_double>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movsd  %xmm0,-0x18(%rbp)
  movsd  D36(%rip),%xmm0
  comisd -0x18(%rbp),%xmm0
  jb     L2
  movsd  -0x18(%rbp),%xmm0
  jmp    L21
L2:
  movsd  D36(%rip),%xmm0
L21:
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x18(%rbp),%xmm1
  movsd  D11(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  comisd D11(%rip),%xmm0
  jbe    L22
  mov    $0xff,%eax
  jmp    L28
L22:
  movsd  -0x8(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
L28:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D36
type_guessed: f64
name: retrieve_data
arguments: tag: D11
type_guessed: f64

tool: D36: 1

tool: D11: 255

assistant: ```c
uint8_t scale_double(double d) {
  d = d <= 1.0 ? d : 1.0;
  double intermediate = floor(d * 255.0);
  return (uint8_t)(intermediate > 255 ? 255 : intermediate);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<scale_double>:
  endbr64
  movsd  D45(%rip),%xmm1
  comisd %xmm0,%xmm1
  jae    L28
  movsd  D24(%rip),%xmm0
L7:
  cvttsd2si %xmm0,%eax
L34:
  ret
L28:
  mulsd  D24(%rip),%xmm0
  movapd %xmm0,%xmm2
  movsd  D57(%rip),%xmm3
  movapd %xmm0,%xmm1
  andpd  %xmm3,%xmm1
  movsd  D14(%rip),%xmm4
  ucomisd %xmm1,%xmm4
  jbe    L32
  cvttsd2si %xmm0,%rax
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  movapd %xmm1,%xmm2
  cmpnlesd %xmm0,%xmm2
  movsd  D45(%rip),%xmm4
  andpd  %xmm4,%xmm2
  subsd  %xmm2,%xmm1
  andnpd %xmm0,%xmm3
  movapd %xmm1,%xmm2
  orpd   %xmm3,%xmm2
L32:
  movapd %xmm2,%xmm0
  mov    $0xff,%eax
  comisd D24(%rip),%xmm2
  ja     L34
  jmp    L7
```

tool_calls: name: unpack_data
arguments: data_tag: D45
type: f64
name: unpack_data
arguments: data_tag: D24
type: f64[2]
name: unpack_data
arguments: data_tag: D57
type: byte[8]
name: unpack_data
arguments: data_tag: D14
type: byte[8]

tool: D45: 1

tool: {"D24": [255.0,1.0]}

tool: {"D57": [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f]}

tool: {"D14": [0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x43]}

assistant: ```c
uint8_t scale_double(double d) {
  d = d <= 1.0 ? d : 1.0;
  double intermediate = floor(d * 255.0);
  return (uint8_t)(intermediate > 255 ? 255 : intermediate);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<scale_double>:
  endbr64
  movsd  D20(%rip),%xmm1
  mov    $0xff,%eax
  comisd %xmm0,%xmm1
  jae    L28
L12:
  ret
  nopl   0x0(%rax,%rax,1)
L28:
  movsd  D39(%rip),%xmm4
  movsd  D6(%rip),%xmm3
  movsd  D24(%rip),%xmm5
  mulsd  %xmm4,%xmm0
  movapd %xmm0,%xmm2
  andpd  %xmm3,%xmm2
  ucomisd %xmm2,%xmm5
  jbe    L16
  cvttsd2si %xmm0,%rax
  pxor   %xmm2,%xmm2
  andnpd %xmm0,%xmm3
  cvtsi2sd %rax,%xmm2
  movapd %xmm2,%xmm5
  cmpnlesd %xmm0,%xmm5
  andpd  %xmm1,%xmm5
  subsd  %xmm5,%xmm2
  orpd   %xmm3,%xmm2
  movapd %xmm2,%xmm0
L16:
  comisd %xmm4,%xmm0
  mov    $0xff,%eax
  ja     L12
  cvttsd2si %xmm0,%eax
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D20
type_infered: f64
name: parse_data
arguments: data_tag: D39
type_infered: f64
name: parse_data
arguments: data_tag: D6
type_infered: byte[8]
name: parse_data
arguments: data_tag: D24
type_infered: byte[8]

tool: D20: 1

tool: D39: 255

tool: {"D6": [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f]}

tool: {"D24": [0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x43]}

assistant: ```c
uint8_t scale_double(double d) {
  d = d <= 1.0 ? d : 1.0;
  double intermediate = floor(d * 255.0);
  return (uint8_t)(intermediate > 255 ? 255 : intermediate);
}
```