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

```asm
<getCheckSum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movb   $0x0,-0x9(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L6
L3:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  movsbl -0x9(%rbp),%eax
  add    %edx,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %al,-0x9(%rbp)
  addl   $0x1,-0x4(%rbp)
L6:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L3
  mov    -0x8(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
u_int8_t getCheckSum(char *data, int len) {
  int32_t previous = 0;
  u_int32_t new = 0;
  for (u_int32_t i = 0; i < len; i++) {
    new = (data[i] + previous) % 256;
    previous = new | previous & -256;
  }
  return (u_int8_t) new;
}
```
user: Translate the below assembly code into C programming language:

```asm
<getCheckSum>:
  endbr64
  test   %esi,%esi
  jle    L22
  mov    %rdi,%rcx
  lea    -0x1(%rsi),%eax
  lea    0x1(%rdi,%rax,1),%rsi
  mov    $0x0,%eax
L19:
  movsbl (%rcx),%edx
  movsbl %al,%eax
  add    %edx,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  mov    %eax,%edx
  add    $0x1,%rcx
  cmp    %rsi,%rcx
  jne    L19
L25:
  mov    %edx,%eax
  ret
L22:
  mov    $0x0,%edx
  jmp    L25
```

assistant: ```c
u_int8_t getCheckSum(char *data, int len) {
  int32_t previous = 0;
  u_int32_t new = 0;
  for (u_int32_t i = 0; i < len; i++) {
    new = (data[i] + previous) % 256;
    previous = new | previous & -256;
  }
  return (u_int8_t) new;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<getCheckSum>:
  endbr64
  test   %esi,%esi
  jle    L10
  lea    -0x1(%rsi),%eax
  xor    %edx,%edx
  lea    0x1(%rdi,%rax,1),%rcx
  nopw   0x0(%rax,%rax,1)
L1:
  movsbl (%rdi),%eax
  add    $0x1,%rdi
  add    %edx,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  movsbl %al,%edx
  cmp    %rcx,%rdi
  jne    L1
  ret
  nopl   (%rax)
L10:
  xor    %eax,%eax
  ret
```

assistant: ```c
u_int8_t getCheckSum(char *data, int len) {
  int32_t previous = 0;
  u_int32_t new = 0;
  for (u_int32_t i = 0; i < len; i++) {
    new = (data[i] + previous) % 256;
    previous = new | previous & -256;
  }
  return (u_int8_t) new;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<getCheckSum>:
  endbr64
  test   %esi,%esi
  jle    L12
  lea    -0x1(%rsi),%eax
  xor    %edx,%edx
  lea    0x1(%rdi,%rax,1),%rcx
  nopw   0x0(%rax,%rax,1)
L16:
  movsbl (%rdi),%eax
  add    $0x1,%rdi
  add    %edx,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  movsbl %al,%edx
  cmp    %rdi,%rcx
  jne    L16
  ret
  nopl   (%rax)
L12:
  xor    %eax,%eax
  ret
```

assistant: ```c
u_int8_t getCheckSum(char *data, int len) {
  int32_t previous = 0;
  u_int32_t new = 0;
  for (u_int32_t i = 0; i < len; i++) {
    new = (data[i] + previous) % 256;
    previous = new | previous & -256;
  }
  return (u_int8_t) new;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1b0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x1b0(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  movl   $0x0,-0x1ac(%rbp)
  jmp    L29
L6:
  lea    -0x1a0(%rbp),%rdx
  mov    -0x1ac(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  addl   $0x1,-0x1ac(%rbp)
L29:
  mov    -0x1b0(%rbp),%eax
  cmp    %eax,-0x1ac(%rbp)
  jl     L6
  mov    -0x1b0(%rbp),%edx
  lea    -0x1a0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <calculateSum@plt>
  mov    %rax,-0x1a8(%rbp)
  mov    -0x1a8(%rbp),%rax
  mov    %rax,%rsi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L5
  call   <__stack_chk_fail@plt>
L5:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D13
type_infered: string
name: extract_symbolic_data
arguments: data_label: D27
type_infered: string

tool: D13: %d

tool: D27: Sum = %ld


assistant: ```c
int main() {
  int n, c, array[100];
  long result;
  scanf("%d", &n);
  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);
  result = calculateSum(array, n);
  printf("Sum = %ld\n", result);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1b0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    D12(%rip),%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jle    L9
  lea    0x10(%rsp),%rbp
  mov    $0x0,%ebx
  lea    D12(%rip),%r12
L15:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    0xc(%rsp),%esi
  add    $0x4,%rbp
  cmp    %ebx,%esi
  jg     L15
L9:
  lea    0x10(%rsp),%rdi
  call   <calculateSum@plt>
  mov    %rax,%rsi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    $0x0,%eax
  add    $0x1b0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D12
type_guessed: string
name: disassemble_data
arguments: data_tag: D8
type_guessed: string

tool: D12: %d

tool: D8: Sum = %ld


assistant: ```c
int main() {
  int n, c, array[100];
  long result;
  scanf("%d", &n);
  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);
  result = calculateSum(array, n);
  printf("Sum = %ld\n", result);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  lea    D6(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x1b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%r13
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  mov    %r13,%rbp
  test   %esi,%esi
  jle    L7
  nopw   0x0(%rax,%rax,1)
L18:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  cmp    %ebx,%esi
  jg     L18
L7:
  mov    %r13,%rdi
  call   <calculateSum@plt>
  lea    D4(%rip),%rdi
  mov    %rax,%rsi
  call   <printf@plt>
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L28
  add    $0x1b8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L28:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D6
type_infered: string
name: read_data
arguments: data_label: D4
type_infered: string

tool: D6: %d

tool: D4: Sum = %ld


assistant: ```c
int main() {
  int n, c, array[100];
  long result;
  scanf("%d", &n);
  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);
  result = calculateSum(array, n);
  printf("Sum = %ld\n", result);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  lea    D4(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x1b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%r13
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  mov    %r13,%rbp
  test   %esi,%esi
  jle    L6
  nopw   0x0(%rax,%rax,1)
L2:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  cmp    %ebx,%esi
  jg     L2
L6:
  mov    %r13,%rdi
  call   <calculateSum@plt>
  lea    D0(%rip),%rdi
  mov    %rax,%rsi
  call   <printf@plt>
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x1b8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D4
type_infered: string
name: extract_symbolic_data
arguments: tag: D0
type_infered: string

tool: D4: %d

tool: D0: Sum = %ld


assistant: ```c
int main() {
  int n, c, array[100];
  long result;
  scanf("%d", &n);
  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);
  result = calculateSum(array, n);
  printf("Sum = %ld\n", result);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<CopyArray>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L9
L18:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x4(%rbp)
L9:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L18
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void CopyArray(unsigned int B[], int iBegin, int iEnd, unsigned int A[]) {
  int k;
  for (k = iBegin; k < iEnd; k++)
    A[k] = B[k];
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<CopyArray>:
  endbr64
  cmp    %edx,%esi
  jge    L10
  movslq %esi,%rsi
L16:
  mov    (%rdi,%rsi,4),%eax
  mov    %eax,(%rcx,%rsi,4)
  add    $0x1,%rsi
  cmp    %esi,%edx
  jg     L16
L10:
  ret
```

assistant: ```c
void CopyArray(unsigned int B[], int iBegin, int iEnd, unsigned int A[]) {
  int k;
  for (k = iBegin; k < iEnd; k++)
    A[k] = B[k];
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<CopyArray>:
  endbr64
  cmp    %edx,%esi
  jge    L2
  movslq %esi,%rsi
  nopl   0x0(%rax,%rax,1)
L0:
  mov    (%rdi,%rsi,4),%eax
  mov    %eax,(%rcx,%rsi,4)
  add    $0x1,%rsi
  cmp    %esi,%edx
  jg     L0
L2:
  ret
```

assistant: ```c
void CopyArray(unsigned int B[], int iBegin, int iEnd, unsigned int A[]) {
  int k;
  for (k = iBegin; k < iEnd; k++)
    A[k] = B[k];
}
```
user: Translate the below assembly code into C programming language:

```asm
<CopyArray>:
  endbr64
  cmp    %edx,%esi
  jge    L57
  movslq %esi,%rax
  mov    %edx,%r11d
  mov    %edx,%r8d
  push   %rbx
  lea    0x0(,%rax,4),%rdx
  mov    %rcx,%r9
  sub    %esi,%r11d
  lea    (%rcx,%rdx,1),%r10
  lea    0x4(%rdi,%rdx,1),%rbx
  mov    %r10,%rcx
  sub    %rbx,%rcx
  cmp    $0x8,%rcx
  jbe    L36
  lea    -0x1(%r11),%ecx
  cmp    $0x2,%ecx
  jbe    L36
  mov    %r11d,%ecx
  add    %rdi,%rdx
  xor    %eax,%eax
  shr    $0x2,%ecx
  shl    $0x4,%rcx
  nopl   0x0(%rax)
L93:
  movdqu (%rdx,%rax,1),%xmm0
  movups %xmm0,(%r10,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rcx
  jne    L93
  mov    %r11d,%eax
  and    $0xfffffffc,%eax
  add    %eax,%esi
  cmp    %eax,%r11d
  je     L91
  movslq %esi,%rax
  mov    (%rdi,%rax,4),%edx
  mov    %edx,(%r9,%rax,4)
  lea    0x1(%rsi),%eax
  cmp    %eax,%r8d
  jle    L91
  cltq
  add    $0x2,%esi
  mov    (%rdi,%rax,4),%ecx
  lea    0x0(,%rax,4),%rdx
  mov    %ecx,(%r9,%rax,4)
  cmp    %esi,%r8d
  jle    L91
  mov    0x4(%rdi,%rdx,1),%eax
  mov    %eax,0x4(%r9,%rdx,1)
L91:
  pop    %rbx
  ret
  xchg   %ax,%ax
L36:
  mov    (%rdi,%rax,4),%edx
  mov    %edx,(%r9,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r8d
  jle    L91
  mov    (%rdi,%rax,4),%edx
  mov    %edx,(%r9,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r8d
  jg     L36
  jmp    L91
  nopw   0x0(%rax,%rax,1)
L57:
  ret
```

assistant: ```c
void CopyArray(unsigned int B[], int iBegin, int iEnd, unsigned int A[]) {
  int k;
  for (k = iBegin; k < iEnd; k++)
    A[k] = B[k];
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<caf_shash_js>:
  endbr64
  mov    %esi,%ecx
  test   %rdi,%rdi
  je     L49
  test   %esi,%esi
  jle    L49
  cmp    $0x3,%esi
  jle    L2
  lea    0x3(%rsi),%r8d
  test   %esi,%esi
  cmovns %esi,%r8d
  sar    $0x2,%r8d
  mov    $0x0,%esi
  mov    $0x4e67c6a7,%eax
L1:
  mov    %eax,%edx
  shl    $0x5,%edx
  add    (%rdi,%rsi,4),%edx
  mov    %eax,%r9d
  sar    $0x2,%r9d
  add    %r9d,%edx
  xor    %edx,%eax
  add    $0x1,%rsi
  cmp    %esi,%r8d
  jg     L1
  mov    %ecx,%esi
  sar    $0x1f,%esi
  shr    $0x1e,%esi
  lea    (%rcx,%rsi,1),%edx
  and    $0x3,%edx
  sub    %esi,%edx
  test   %edx,%edx
  jle    L76
  shl    $0x2,%r8d
  movslq %r8d,%r8
  add    %rdi,%r8
  mov    %r8,%rsi
  mov    %ecx,%edi
  sub    %edx,%edi
  cmp    %edi,%ecx
  jle    L76
  sub    $0x1,%ecx
  sub    %edi,%ecx
  lea    0x1(%r8,%rcx,1),%rdi
L24:
  mov    %eax,%edx
  shl    $0x5,%edx
  movsbl (%rsi),%ecx
  add    %ecx,%edx
  mov    %eax,%ecx
  sar    $0x2,%ecx
  add    %ecx,%edx
  xor    %edx,%eax
  add    $0x1,%rsi
  cmp    %rsi,%rdi
  jne    L24
  ret
L2:
  mov    $0x0,%esi
  mov    $0x4e67c6a7,%eax
L35:
  mov    %eax,%edx
  shl    $0x5,%edx
  movsbl (%rdi,%rsi,1),%r8d
  add    %r8d,%edx
  mov    %eax,%r8d
  sar    $0x2,%r8d
  add    %r8d,%edx
  xor    %edx,%eax
  add    $0x1,%rsi
  cmp    %esi,%ecx
  jg     L35
  ret
L49:
  mov    $0x0,%eax
L76:
  ret
```

assistant: ```c
u_int caf_shash_js(const char *str, const u_int len) {
  u_int32_t hash = 1315423911;
  u_int32_t i = 0;
  u_int32_t i32b = 0;
  u_int32_t *i32p = (u_int32_t *)NULL;
  char *ptr = (char *)str;
  if (ptr != (const char *)NULL && len > 0) {
    i32b = len / 4;
    if (i32b > 0) {
      i32p = (u_int32_t *)ptr;
      for (i = 0; i < i32b; i32p++, i++) {
        hash ^= ((hash << 5) + (*i32p) + (hash >> 2));
      }
      if ((len % 4) > 0) {
        i32b *= 4;
        ptr = (char *)((size_t)i32b + (size_t)ptr);
        for (i = (len - (len % 4)); i < len; ptr++, i++) {
          hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
        }
      }
    } else {
      for (i = 0; i < len; ptr++, i++) {
        hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
      }
    }
    return hash;
  }
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<caf_shash_js>:
  endbr64
  test   %rdi,%rdi
  je     L29
  test   %esi,%esi
  jle    L29
  cmp    $0x3,%esi
  jle    L47
  mov    %esi,%r8d
  mov    %rdi,%rcx
  sar    $0x2,%r8d
  movslq %r8d,%rax
  lea    (%rdi,%rax,4),%r10
  mov    $0x4e67c6a7,%eax
  nopl   0x0(%rax)
L35:
  mov    %eax,%edx
  mov    %eax,%r9d
  add    $0x4,%rcx
  shl    $0x5,%edx
  sar    $0x2,%r9d
  add    -0x4(%rcx),%edx
  add    %r9d,%edx
  xor    %edx,%eax
  cmp    %r10,%rcx
  jne    L35
  mov    %esi,%edx
  and    $0x3,%edx
  je     L23
  lea    0x0(,%r8,4),%ecx
  movslq %ecx,%rcx
  add    %rdi,%rcx
  mov    %esi,%edi
  sub    %edx,%edi
  cmp    %edi,%esi
  jle    L23
  sub    $0x1,%esi
  sub    %edi,%esi
  lea    0x1(%rcx,%rsi,1),%rdi
  nopl   0x0(%rax)
L55:
  movsbl (%rcx),%esi
  mov    %eax,%edx
  add    $0x1,%rcx
  shl    $0x5,%edx
  add    %esi,%edx
  mov    %eax,%esi
  sar    $0x2,%esi
  add    %esi,%edx
  xor    %edx,%eax
  cmp    %rdi,%rcx
  jne    L55
  ret
  nopl   (%rax)
L29:
  xor    %eax,%eax
L23:
  ret
  nopl   0x0(%rax,%rax,1)
L47:
  xor    %ecx,%ecx
  mov    $0x4e67c6a7,%eax
L25:
  movsbl (%rdi,%rcx,1),%r8d
  mov    %eax,%edx
  add    $0x1,%rcx
  shl    $0x5,%edx
  add    %r8d,%edx
  mov    %eax,%r8d
  sar    $0x2,%r8d
  add    %r8d,%edx
  xor    %edx,%eax
  cmp    %ecx,%esi
  jg     L25
  ret
```

assistant: ```c
u_int caf_shash_js(const char *str, const u_int len) {
  u_int32_t hash = 1315423911;
  u_int32_t i = 0;
  u_int32_t i32b = 0;
  u_int32_t *i32p = (u_int32_t *)NULL;
  char *ptr = (char *)str;
  if (ptr != (const char *)NULL && len > 0) {
    i32b = len / 4;
    if (i32b > 0) {
      i32p = (u_int32_t *)ptr;
      for (i = 0; i < i32b; i32p++, i++) {
        hash ^= ((hash << 5) + (*i32p) + (hash >> 2));
      }
      if ((len % 4) > 0) {
        i32b *= 4;
        ptr = (char *)((size_t)i32b + (size_t)ptr);
        for (i = (len - (len % 4)); i < len; ptr++, i++) {
          hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
        }
      }
    } else {
      for (i = 0; i < len; ptr++, i++) {
        hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
      }
    }
    return hash;
  }
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<caf_shash_js>:
  endbr64
  mov    %rdi,%r9
  test   %rdi,%rdi
  je     L63
  test   %esi,%esi
  jle    L63
  cmp    $0x3,%esi
  jg     L82
  movsbl (%rdi),%eax
  sub    $0x1f6d3977,%eax
  xor    $0x4e67c6a7,%eax
  cmp    $0x1,%esi
  je     L57
  mov    %eax,%ecx
  movsbl 0x1(%rdi),%edx
  shl    $0x5,%ecx
  add    %ecx,%edx
  mov    %eax,%ecx
  sar    $0x2,%ecx
  add    %ecx,%edx
  xor    %edx,%eax
  cmp    $0x3,%esi
  jne    L57
  movsbl 0x2(%rdi),%ecx
  mov    %eax,%edx
  shl    $0x5,%edx
  add    %ecx,%edx
  mov    %eax,%ecx
  sar    $0x2,%ecx
  add    %ecx,%edx
  xor    %edx,%eax
  ret
  nopl   (%rax)
L63:
  xor    %eax,%eax
L57:
  ret
  nopl   0x0(%rax,%rax,1)
L82:
  mov    %esi,%edi
  mov    %r9,%rcx
  sar    $0x2,%edi
  movslq %edi,%rax
  lea    (%r9,%rax,4),%r10
  mov    $0x4e67c6a7,%eax
  nopl   0x0(%rax)
L20:
  mov    %eax,%edx
  mov    %eax,%r8d
  add    $0x4,%rcx
  shl    $0x5,%edx
  sar    $0x2,%r8d
  add    -0x4(%rcx),%edx
  add    %r8d,%edx
  xor    %edx,%eax
  cmp    %rcx,%r10
  jne    L20
  mov    %esi,%edx
  and    $0x3,%edx
  je     L57
  lea    0x0(,%rdi,4),%ecx
  mov    %esi,%edi
  movslq %ecx,%rcx
  sub    %edx,%edi
  add    %r9,%rcx
  cmp    %edi,%esi
  jle    L57
  sub    $0x1,%esi
  sub    %edi,%esi
  lea    0x1(%rcx,%rsi,1),%rdi
  nopl   0x0(%rax,%rax,1)
L0:
  movsbl (%rcx),%esi
  mov    %eax,%edx
  add    $0x1,%rcx
  shl    $0x5,%edx
  add    %esi,%edx
  mov    %eax,%esi
  sar    $0x2,%esi
  add    %esi,%edx
  xor    %edx,%eax
  cmp    %rdi,%rcx
  jne    L0
  ret
```

assistant: ```c
u_int caf_shash_js(const char *str, const u_int len) {
  u_int32_t hash = 1315423911;
  u_int32_t i = 0;
  u_int32_t i32b = 0;
  u_int32_t *i32p = (u_int32_t *)NULL;
  char *ptr = (char *)str;
  if (ptr != (const char *)NULL && len > 0) {
    i32b = len / 4;
    if (i32b > 0) {
      i32p = (u_int32_t *)ptr;
      for (i = 0; i < i32b; i32p++, i++) {
        hash ^= ((hash << 5) + (*i32p) + (hash >> 2));
      }
      if ((len % 4) > 0) {
        i32b *= 4;
        ptr = (char *)((size_t)i32b + (size_t)ptr);
        for (i = (len - (len % 4)); i < len; ptr++, i++) {
          hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
        }
      }
    } else {
      for (i = 0; i < len; ptr++, i++) {
        hash ^= ((hash << 5) + (u_int32_t)(*ptr) + (hash >> 2));
      }
    }
    return hash;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<siftdown>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
L3:
  mov    -0x8(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jg     L9
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L36
  mov    -0x4(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L36
  addl   $0x1,-0x4(%rbp)
L36:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L26
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L3
L9:
  nop
  jmp    L59
L26:
  nop
L59:
  nop
  leave
  ret
```

assistant: ```c
void siftdown(int *head, int head_len, int cur) {
  int i = cur;
  int child = 0;
  while (1) {
    child = i * 2;
    if (child > head_len) {
      break;
    }
    if (child + 1 <= head_len && head[child + 1] < head[child]) {
      child++;
    }
    if (head[i] <= head[child]) {
      break;
    }
    swap(head, i, child);
    i = child;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<siftdown>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %esi,%r12d
  mov    %edx,%esi
  lea    (%rdx,%rdx,1),%eax
  cmp    %eax,%r12d
  jge    L36
L59:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L2:
  movslq %esi,%rax
  movslq %ebx,%rdx
  mov    0x0(%rbp,%rdx,4),%ecx
  cmp    %ecx,0x0(%rbp,%rax,4)
  jle    L59
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <swap@plt>
  lea    (%rbx,%rbx,1),%eax
  cmp    %r12d,%eax
  jg     L59
  mov    %ebx,%esi
L36:
  mov    %eax,%ebx
  cmp    %eax,%r12d
  jle    L2
  movslq %eax,%rdx
  mov    0x0(%rbp,%rdx,4),%edi
  cmp    %edi,0x4(%rbp,%rdx,4)
  jge    L2
  lea    0x1(%rax),%ebx
  jmp    L2
```

assistant: ```c
void siftdown(int *head, int head_len, int cur) {
  int i = cur;
  int child = 0;
  while (1) {
    child = i * 2;
    if (child > head_len) {
      break;
    }
    if (child + 1 <= head_len && head[child + 1] < head[child]) {
      child++;
    }
    if (head[i] <= head[child]) {
      break;
    }
    swap(head, i, child);
    i = child;
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<siftdown>:
  endbr64
  lea    (%rdx,%rdx,1),%eax
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  cmp    %eax,%esi
  jl     L6
  mov    %rdi,%rbp
  mov    %edx,%esi
  jmp    L45
  nopl   0x0(%rax)
L49:
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <swap@plt>
  lea    (%rbx,%rbx,1),%eax
  cmp    %r12d,%eax
  jg     L6
  mov    %ebx,%esi
L45:
  movslq %eax,%rdx
  mov    %eax,%ebx
  lea    0x0(,%rdx,4),%rcx
  mov    0x0(%rbp,%rdx,4),%edx
  cmp    %eax,%r12d
  jle    L42
  mov    0x4(%rbp,%rcx,1),%eax
  cmp    %edx,%eax
  jge    L42
  add    $0x1,%ebx
  mov    %eax,%edx
L42:
  movslq %esi,%rax
  cmp    %edx,0x0(%rbp,%rax,4)
  jg     L49
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void siftdown(int *head, int head_len, int cur) {
  int i = cur;
  int child = 0;
  while (1) {
    child = i * 2;
    if (child > head_len) {
      break;
    }
    if (child + 1 <= head_len && head[child + 1] < head[child]) {
      child++;
    }
    if (head[i] <= head[child]) {
      break;
    }
    swap(head, i, child);
    i = child;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<siftdown>:
  endbr64
  lea    (%rdx,%rdx,1),%eax
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  cmp    %eax,%esi
  jl     L21
  mov    %rdi,%rbp
  mov    %edx,%esi
  jmp    L54
  nopl   0x0(%rax)
L5:
  mov    %ebx,%edx
  mov    %rbp,%rdi
  call   <swap@plt>
  lea    (%rbx,%rbx,1),%eax
  cmp    %r12d,%eax
  jg     L21
  mov    %ebx,%esi
L54:
  movslq %eax,%rdx
  mov    %eax,%ebx
  lea    0x0(,%rdx,4),%rcx
  mov    0x0(%rbp,%rdx,4),%edx
  cmp    %eax,%r12d
  jle    L40
  mov    0x4(%rbp,%rcx,1),%eax
  cmp    %edx,%eax
  jge    L40
  add    $0x1,%ebx
  mov    %eax,%edx
L40:
  movslq %esi,%rax
  cmp    %edx,0x0(%rbp,%rax,4)
  jg     L5
L21:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void siftdown(int *head, int head_len, int cur) {
  int i = cur;
  int child = 0;
  while (1) {
    child = i * 2;
    if (child > head_len) {
      break;
    }
    if (child + 1 <= head_len && head[child + 1] < head[child]) {
      child++;
    }
    if (head[i] <= head[child]) {
      break;
    }
    swap(head, i, child);
    i = child;
  }
}
```