ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么:

```asm
<STS_CorrectTimeStep>:
  endbr64
  pxor   %xmm3,%xmm3
  sub    $0x18,%rsp
  cvtsi2sd %edi,%xmm3
  movsd  %xmm0,0x8(%rsp)
  movsd  D24(%rip),%xmm0
  movapd %xmm3,%xmm1
  movsd  %xmm3,(%rsp)
  addsd  %xmm3,%xmm1
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm2
  movsd  (%rsp),%xmm3
  movsd  D20(%rip),%xmm4
  movapd %xmm0,%xmm1
  addsd  %xmm2,%xmm2
  mulsd  D19(%rip),%xmm2
  add    $0x18,%rsp
  movapd %xmm2,%xmm0
  movapd %xmm4,%xmm2
  subsd  %xmm1,%xmm2
  addsd  %xmm4,%xmm1
  divsd  %xmm1,%xmm2
  movapd %xmm2,%xmm1
  mulsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: tag: D24
datatype: byte[8]
name: parse_data
arguments: tag: D20
datatype: f64
name: parse_data
arguments: tag: D19
datatype: byte[8]

tool: {"D24": [0x2e,0xba,0xe8,0xa2,0x8b,0x2e,0xea,0x3f]}

tool: D20: 1

tool: {"D19": [0x9a,0x99,0x99,0x99,0x99,0x99,0xb9,0x3f]}

assistant: ```c
double STS_CorrectTimeStep(int n0, double dta) {
  double a, b, c;
  double dtr;
  a = (1.0 - sqrt(0.01)) / (1.0 + sqrt(0.01));
  b = pow(a, 2.0 * n0);
  c = (1.0 - b) / (1.0 + b);
  dtr = dta * 2.0 * sqrt(0.01) / (n0 * c);
  return (dtr);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<STS_CorrectTimeStep>:
  endbr64
  pxor   %xmm3,%xmm3
  sub    $0x18,%rsp
  cvtsi2sd %edi,%xmm3
  movsd  %xmm0,0x8(%rsp)
  movsd  D8(%rip),%xmm0
  movapd %xmm3,%xmm1
  movsd  %xmm3,(%rsp)
  addsd  %xmm3,%xmm1
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm2
  movsd  (%rsp),%xmm3
  movsd  D17(%rip),%xmm4
  movapd %xmm0,%xmm1
  addsd  %xmm2,%xmm2
  mulsd  D16(%rip),%xmm2
  add    $0x18,%rsp
  movapd %xmm2,%xmm0
  movapd %xmm4,%xmm2
  subsd  %xmm1,%xmm2
  addsd  %xmm4,%xmm1
  divsd  %xmm1,%xmm2
  movapd %xmm2,%xmm1
  mulsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: tag: D8
datatype: byte[8]
name: parse_data
arguments: tag: D17
datatype: f64
name: parse_data
arguments: tag: D16
datatype: byte[8]

tool: {"D8": [0x2e,0xba,0xe8,0xa2,0x8b,0x2e,0xea,0x3f]}

tool: D17: 1

tool: {"D16": [0x9a,0x99,0x99,0x99,0x99,0x99,0xb9,0x3f]}

assistant: ```c
double STS_CorrectTimeStep(int n0, double dta) {
  double a, b, c;
  double dtr;
  a = (1.0 - sqrt(0.01)) / (1.0 + sqrt(0.01));
  b = pow(a, 2.0 * n0);
  c = (1.0 - b) / (1.0 + b);
  dtr = dta * 2.0 * sqrt(0.01) / (n0 * c);
  return (dtr);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<getDValue>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  jmp    L3
L21:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x4(%rbp)
  subl   $0x1,-0x8(%rbp)
L3:
  cmpl   $0x0,-0x8(%rbp)
  jle    L0
  cmpl   $0x0,-0x4(%rbp)
  jg     L21
L0:
  mov    -0x4(%rbp),%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    %edx,%eax
  pop    %rbp
  ret
```

assistant: ```c
int getDValue(int value, int d) {
  for (; d > 0 && value > 0; d--) {
    value = value / 10;
  }
  return value % 10;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<getDValue>:
  endbr64
  mov    %edi,%edx
  test   %esi,%esi
  jle    L23
  test   %edi,%edi
  jle    L23
L10:
  mov    %edx,%edi
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  sub    $0x1,%esi
  test   %esi,%esi
  jle    L23
  cmp    $0x9,%edi
  jg     L10
L23:
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  lea    (%rax,%rax,4),%ecx
  add    %ecx,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  ret
```

assistant: ```c
int getDValue(int value, int d) {
  for (; d > 0 && value > 0; d--) {
    value = value / 10;
  }
  return value % 10;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<getDValue>:
  endbr64
  test   %esi,%esi
  jle    L23
  test   %edi,%edi
  jle    L23
  mov    $0xcccccccd,%edx
  nopl   0x0(%rax)
L19:
  mov    %edi,%edi
  sub    $0x1,%esi
  mov    %rdi,%rax
  imul   %rdx,%rdi
  shr    $0x23,%rdi
  test   %esi,%esi
  jle    L23
  cmp    $0x9,%eax
  jg     L19
L23:
  movslq %edi,%rax
  mov    %edi,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  mov    %edi,%eax
  add    %edx,%edx
  sub    %edx,%eax
  ret
```

assistant: ```c
int getDValue(int value, int d) {
  for (; d > 0 && value > 0; d--) {
    value = value / 10;
  }
  return value % 10;
}
```
user: What is the c source code of the assembly code below:

```asm
<getDValue>:
  endbr64
  test   %esi,%esi
  jle    L0
  test   %edi,%edi
  jle    L0
  mov    $0xcccccccd,%edx
  nopl   0x0(%rax)
L26:
  mov    %edi,%edi
  sub    $0x1,%esi
  mov    %rdi,%rax
  imul   %rdx,%rdi
  shr    $0x23,%rdi
  test   %esi,%esi
  jle    L0
  cmp    $0x9,%eax
  jg     L26
L0:
  movslq %edi,%rax
  mov    %edi,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  mov    %edi,%eax
  add    %edx,%edx
  sub    %edx,%eax
  ret
```

assistant: ```c
int getDValue(int value, int d) {
  for (; d > 0 && value > 0; d--) {
    value = value / 10;
  }
  return value % 10;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<htoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L27
L89:
  addl   $0x1,-0xc(%rbp)
L27:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L89
  cmpl   $0x2,-0xc(%rbp)
  jle    L32
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L32
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L71
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L32
L71:
  movl   $0x2,-0x10(%rbp)
L32:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L25
L10:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <hexToDec@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L24
  mov    $0xffffffff,%eax
  jmp    L17
L24:
  mov    -0xc(%rbp),%eax
  sub    -0x8(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  imul   -0x4(%rbp),%eax
  add    %eax,-0x14(%rbp)
  subl   $0x1,-0x8(%rbp)
L25:
  mov    -0x8(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jge    L10
  mov    -0x14(%rbp),%eax
L17:
  leave
  ret
```

assistant: ```c
int htoi(char s[]) {
  int n = 0;
  int start = 0;
  int len = 0;
  while (s[len])
    len++;
  if (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
    start = 2;
  int i, k;
  for (i = len - 1; i >= start; i--) {
    if ((k = hexToDec(s[i])) == -1)
      return -1;
    n += k * pow(16, len - i - 1);
  }
  return n;
}
```
user: What is the c source code of the assembly code below:

```asm
<htoi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L8
  mov    %rdi,%r14
  lea    0x1(%rdi),%rdx
  mov    $0x0,%eax
L20:
  mov    %eax,%r13d
  add    $0x1,%eax
  add    $0x1,%rdx
  cmpb   $0x0,-0x1(%rdx)
  jne    L20
  cmp    $0x2,%eax
  jle    L75
  mov    $0x0,%r15d
  cmp    $0x30,%cl
  jne    L27
  movzbl 0x1(%r14),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  sete   %r15b
  movzbl %r15b,%r15d
  add    %r15d,%r15d
  jmp    L27
L75:
  test   %r13d,%r13d
  js     L79
  mov    $0x0,%r15d
L27:
  movslq %r13d,%rbp
  mov    $0x0,%r12d
L41:
  movsbl (%r14,%rbp,1),%edi
  call   <hexToDec@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L9
  mov    %r13d,%esi
  sub    %ebp,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  imul   %ebx,%eax
  add    %eax,%r12d
  sub    $0x1,%rbp
  cmp    %ebp,%r15d
  jle    L41
  mov    %r12d,%ebx
L9:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L8:
  mov    $0x0,%ebx
  jmp    L9
L79:
  mov    $0x0,%ebx
  jmp    L9
```

assistant: ```c
int htoi(char s[]) {
  int n = 0;
  int start = 0;
  int len = 0;
  while (s[len])
    len++;
  if (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
    start = 2;
  int i, k;
  for (i = len - 1; i >= start; i--) {
    if ((k = hexToDec(s[i])) == -1)
      return -1;
    n += k * pow(16, len - i - 1);
  }
  return n;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<htoi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L92
  mov    %rdi,%r13
  lea    0x1(%rdi),%rax
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L41:
  add    $0x1,%rax
  mov    %edx,%ebx
  lea    0x1(%rdx),%edx
  cmpb   $0x0,-0x1(%rax)
  jne    L41
  xor    %r14d,%r14d
  cmp    $0x2,%edx
  jle    L79
  cmp    $0x30,%cl
  je     L4
L79:
  movslq %ebx,%r15
  xor    %ebp,%ebp
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L49:
  mov    %ebx,%esi
  mov    $0x10,%edi
  sub    %r15d,%esi
  sub    $0x1,%r15
  call   <pow@plt>
  imul   %r12d,%eax
  add    %eax,%ebp
  cmp    %r15d,%r14d
  jg     L39
L22:
  movsbl 0x0(%r13,%r15,1),%edi
  call   <hexToDec@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  jne    L49
L45:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L39:
  mov    %ebp,%r12d
  jmp    L45
  nopl   (%rax)
L4:
  movzbl 0x1(%r13),%eax
  xor    %r14d,%r14d
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  sete   %r14b
  add    %r14d,%r14d
  jmp    L79
  xchg   %ax,%ax
L92:
  xor    %r12d,%r12d
  jmp    L45
```

assistant: ```c
int htoi(char s[]) {
  int n = 0;
  int start = 0;
  int len = 0;
  while (s[len])
    len++;
  if (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
    start = 2;
  int i, k;
  for (i = len - 1; i >= start; i--) {
    if ((k = hexToDec(s[i])) == -1)
      return -1;
    n += k * pow(16, len - i - 1);
  }
  return n;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<htoi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L24
  mov    %rdi,%r13
  lea    0x1(%rdi),%rax
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L83:
  add    $0x1,%rax
  mov    %edx,%ebx
  lea    0x1(%rdx),%edx
  cmpb   $0x0,-0x1(%rax)
  jne    L83
  xor    %r14d,%r14d
  cmp    $0x2,%edx
  jle    L9
  cmp    $0x30,%cl
  je     L84
L9:
  movslq %ebx,%r15
  xor    %ebp,%ebp
  jmp    L38
  nopl   0x0(%rax,%rax,1)
L80:
  mov    %ebx,%esi
  mov    $0x10,%edi
  sub    %r15d,%esi
  sub    $0x1,%r15
  call   <pow@plt>
  imul   %r12d,%eax
  add    %eax,%ebp
  cmp    %r15d,%r14d
  jg     L23
L38:
  movsbl 0x0(%r13,%r15,1),%edi
  call   <hexToDec@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  jne    L80
L26:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L23:
  mov    %ebp,%r12d
  jmp    L26
  nopl   (%rax)
L84:
  movzbl 0x1(%r13),%eax
  xor    %r14d,%r14d
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  sete   %r14b
  add    %r14d,%r14d
  jmp    L9
  xchg   %ax,%ax
L24:
  xor    %r12d,%r12d
  jmp    L26
```

assistant: ```c
int htoi(char s[]) {
  int n = 0;
  int start = 0;
  int len = 0;
  while (s[len])
    len++;
  if (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
    start = 2;
  int i, k;
  for (i = len - 1; i >= start; i--) {
    if ((k = hexToDec(s[i])) == -1)
      return -1;
    n += k * pow(16, len - i - 1);
  }
  return n;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<check_password>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L0
L6:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
L0:
  cmpl   $0x4,-0x10(%rbp)
  jle    L6
  mov    -0xc(%rbp),%eax
  cltq
  pop    %rbp
  ret
```

assistant: ```c
unsigned long check_password(const char *p) {
  int *ip = (int *)p;
  int i;
  int res = 0;
  for (i = 0; i < 5; i++) {
    res += ip[i];
  }
  return res;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<check_password>:
  endbr64
  lea    0x14(%rdi),%rdx
  mov    $0x0,%eax
L2:
  add    (%rdi),%eax
  add    $0x4,%rdi
  cmp    %rdx,%rdi
  jne    L2
  cltq
  ret
```

assistant: ```c
unsigned long check_password(const char *p) {
  int *ip = (int *)p;
  int i;
  int res = 0;
  for (i = 0; i < 5; i++) {
    res += ip[i];
  }
  return res;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<check_password>:
  endbr64
  lea    0x14(%rdi),%rdx
  xor    %eax,%eax
L3:
  add    (%rdi),%eax
  add    $0x4,%rdi
  cmp    %rdx,%rdi
  jne    L3
  cltq
  ret
```

assistant: ```c
unsigned long check_password(const char *p) {
  int *ip = (int *)p;
  int i;
  int res = 0;
  for (i = 0; i < 5; i++) {
    res += ip[i];
  }
  return res;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<check_password>:
  endbr64
  movdqu (%rdi),%xmm0
  movdqu (%rdi),%xmm2
  psrldq $0x8,%xmm0
  paddd  %xmm2,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%eax
  add    0x10(%rdi),%eax
  cltq
  ret
```

assistant: ```c
unsigned long check_password(const char *p) {
  int *ip = (int *)p;
  int i;
  int res = 0;
  for (i = 0; i < 5; i++) {
    res += ip[i];
  }
  return res;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<hash_str>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L10
L9:
  mov    -0x4(%rbp),%eax
  imul   $0xfb,%eax,%ecx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %ecx,%eax
  mov    %eax,-0x4(%rbp)
L10:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L9
  mov    -0x4(%rbp),%eax
  and    $0xfff,%eax
  pop    %rbp
  ret
```

assistant: ```c
int hash_str(char *s) {
  int i;
  i = 0;
  while (*s)
    i = i * 251 + (*s++);
  return (i & 0xFFF);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<hash_str>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L14
  mov    $0x0,%eax
L4:
  imul   $0xfb,%eax,%eax
  add    $0x1,%rdi
  movsbl %dl,%edx
  add    %edx,%eax
  movzbl (%rdi),%edx
  test   %dl,%dl
  jne    L4
L20:
  and    $0xfff,%eax
  ret
L14:
  mov    $0x0,%eax
  jmp    L20
```

assistant: ```c
int hash_str(char *s) {
  int i;
  i = 0;
  while (*s)
    i = i * 251 + (*s++);
  return (i & 0xFFF);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<hash_str>:
  endbr64
  movsbl (%rdi),%edx
  xor    %eax,%eax
  test   %dl,%dl
  je     L6
  nopl   (%rax)
L4:
  imul   $0xfb,%eax,%eax
  add    $0x1,%rdi
  add    %edx,%eax
  movsbl (%rdi),%edx
  test   %dl,%dl
  jne    L4
  and    $0xfff,%eax
  ret
  nopl   0x0(%rax)
L6:
  ret
```

assistant: ```c
int hash_str(char *s) {
  int i;
  i = 0;
  while (*s)
    i = i * 251 + (*s++);
  return (i & 0xFFF);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<hash_str>:
  endbr64
  movsbl (%rdi),%edx
  xor    %eax,%eax
  test   %dl,%dl
  je     L12
  nopl   (%rax)
L13:
  imul   $0xfb,%eax,%eax
  add    $0x1,%rdi
  add    %edx,%eax
  movsbl (%rdi),%edx
  test   %dl,%dl
  jne    L13
  and    $0xfff,%eax
  ret
  nopl   0x0(%rax)
L12:
  ret
```

assistant: ```c
int hash_str(char *s) {
  int i;
  i = 0;
  while (*s)
    i = i * 251 + (*s++);
  return (i & 0xFFF);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<scale2x>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %rdx,0x20(%rsp)
  mov    %ecx,%ebp
  mov    %r8d,%r13d
  mov    %r9d,%r14d
  mov    0x78(%rsp),%r15d
  cmpl   $0x1,0x70(%rsp)
  seta   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    %ebp,%edi
  mov    %rdi,(%rsp)
  mov    %ebx,%ecx
  mov    %rcx,0x8(%rsp)
  lea    (%r12,%rcx,1),%rsi
  push   %r15
  push   %r14
  mov    %r13d,%r9d
  mov    0x30(%rsp),%rax
  lea    (%rax,%rdi,1),%r8
  mov    %rax,%rcx
  mov    %rax,%rdx
  mov    %r12,%rdi
  call   <stage_scale2x@plt>
  add    %ebx,%ebx
  mov    %ebx,%edi
  mov    %rdi,0x20(%rsp)
  mov    %r12,%rcx
  add    %rdi,%rcx
  mov    %rcx,0x38(%rsp)
  add    $0x10,%rsp
  mov    0x70(%rsp),%r12d
  sub    $0x2,%r12d
  je     L0
  add    %ebp,%ebp
  mov    %ebp,%edi
  mov    %rdi,0x18(%rsp)
  mov    0x20(%rsp),%rbx
  mov    %rcx,%rbp
L5:
  mov    0x18(%rsp),%rax
  lea    (%rbx,%rax,1),%r8
  mov    %rbx,%rdx
  add    (%rsp),%rbx
  mov    0x8(%rsp),%rax
  lea    0x0(%rbp,%rax,1),%rsi
  push   %r15
  push   %r14
  mov    %r13d,%r9d
  mov    %rbx,%rcx
  mov    %rbp,%rdi
  call   <stage_scale2x@plt>
  add    0x20(%rsp),%rbp
  add    $0x10,%rsp
  sub    $0x1,%r12d
  jne    L5
  mov    0x70(%rsp),%eax
  lea    -0x2(%rax),%eax
  mov    (%rsp),%rdx
  imul   %rax,%rdx
  add    %rdx,0x20(%rsp)
  imul   0x10(%rsp),%rax
  add    %rax,0x28(%rsp)
L0:
  mov    (%rsp),%rcx
  mov    0x20(%rsp),%rdx
  add    %rdx,%rcx
  mov    0x8(%rsp),%rsi
  mov    0x28(%rsp),%rdi
  add    %rdi,%rsi
  push   %r15
  push   %r14
  mov    %r13d,%r9d
  mov    %rcx,%r8
  call   <stage_scale2x@plt>
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void scale2x(void *void_dst, unsigned dst_slice, const void *void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height, unsigned opt) {
  unsigned char *dst = (unsigned char *)void_dst;
  const unsigned char *src = (const unsigned char *)void_src;
  unsigned count;
  assert(height >= 2);
  count = height;
  stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (0) * src_slice), (src + (1) * src_slice), pixel, width, opt);
  dst = (dst + (2) * dst_slice);
  count -= 2;
  while (count) {
    stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (1) * src_slice), (src + (2) * src_slice), pixel, width, opt);
    dst = (dst + (2) * dst_slice);
    src = (src + (1) * src_slice);
    --count;
  }
  stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (1) * src_slice), (src + (1) * src_slice), pixel, width, opt);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<scale2x>:
  endbr64
  push   %r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    0x70(%rsp),%r15d
  mov    0x78(%rsp),%edi
  mov    %rdx,0x18(%rsp)
  mov    %r9d,0x4(%rsp)
  mov    %edi,0x28(%rsp)
  xor    %edi,%edi
  cmp    $0x1,%r15d
  seta   %dil
  call   <assert@plt>
  mov    0x28(%rsp),%edi
  mov    %ebp,%ecx
  mov    0x18(%rsp),%rax
  mov    %rcx,0x8(%rsp)
  lea    (%rbx,%rcx,1),%rsi
  mov    %r13d,%r9d
  add    %ebp,%ebp
  push   %rdi
  mov    0xc(%rsp),%edi
  lea    (%rax,%r14,1),%r8
  mov    %rax,%rcx
  mov    %rax,%rdx
  push   %rdi
  mov    %rbx,%rdi
  mov    %r8,0x20(%rsp)
  mov    %rax,0x28(%rsp)
  call   <stage_scale2x@plt>
  lea    -0x2(%r15),%ecx
  lea    (%rbx,%rbp,1),%rdi
  test   %ecx,%ecx
  mov    %rdi,0x30(%rsp)
  mov    %ecx,0x3c(%rsp)
  pop    %rsi
  pop    %r8
  mov    0x10(%rsp),%r8
  je     L5
  mov    %ecx,%ebx
  lea    (%r14,%r14,1),%ecx
  mov    0x18(%rsp),%r15
  mov    %r13d,%eax
  mov    %rcx,0x10(%rsp)
  mov    %eax,%r12d
  mov    %r15,%r13
  mov    %rdi,%r15
  nopl   0x0(%rax,%rax,1)
L15:
  mov    0x10(%rsp),%rax
  mov    %r13,%rdx
  mov    %r15,%rdi
  mov    %r12d,%r9d
  lea    0x0(%r13,%rax,1),%r8
  mov    0x8(%rsp),%rax
  add    %r14,%r13
  mov    %r13,%rcx
  lea    (%r15,%rax,1),%rsi
  mov    0x28(%rsp),%eax
  add    %rbp,%r15
  push   %rax
  mov    0xc(%rsp),%eax
  push   %rax
  call   <stage_scale2x@plt>
  pop    %rax
  pop    %rdx
  sub    $0x1,%ebx
  jne    L15
  mov    0x2c(%rsp),%eax
  mov    %r14,%rdx
  mov    %r12d,%r13d
  imul   %rax,%rbp
  add    %rbp,0x20(%rsp)
  imul   %rax,%rdx
  add    %rdx,0x18(%rsp)
  mov    0x18(%rsp),%rbx
  lea    (%rbx,%r14,1),%r8
L5:
  mov    0x28(%rsp),%eax
  mov    0x8(%rsp),%rsi
  mov    %r13d,%r9d
  mov    %r8,%rcx
  mov    0x20(%rsp),%rdi
  mov    0x18(%rsp),%rdx
  mov    %eax,0x78(%rsp)
  mov    0x4(%rsp),%eax
  add    %rdi,%rsi
  mov    %eax,0x70(%rsp)
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <stage_scale2x@plt>
```

assistant: ```c
void scale2x(void *void_dst, unsigned dst_slice, const void *void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height, unsigned opt) {
  unsigned char *dst = (unsigned char *)void_dst;
  const unsigned char *src = (const unsigned char *)void_src;
  unsigned count;
  assert(height >= 2);
  count = height;
  stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (0) * src_slice), (src + (1) * src_slice), pixel, width, opt);
  dst = (dst + (2) * dst_slice);
  count -= 2;
  while (count) {
    stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (1) * src_slice), (src + (2) * src_slice), pixel, width, opt);
    dst = (dst + (2) * dst_slice);
    src = (src + (1) * src_slice);
    --count;
  }
  stage_scale2x((dst + (0) * dst_slice), (dst + (1) * dst_slice), (src + (0) * src_slice), (src + (1) * src_slice), (src + (1) * src_slice), pixel, width, opt);
}
```