ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<wildcmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L21
L27:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L90
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  je     L90
  mov    $0x0,%eax
  jmp    L133
L90:
  addq   $0x1,-0x18(%rbp)
  addq   $0x1,-0x20(%rbp)
L21:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L79
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L27
  jmp    L79
L160:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L40
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L117
  mov    $0x1,%eax
  jmp    L133
L117:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L79
L40:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L92
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3f,%al
  jne    L104
L92:
  addq   $0x1,-0x18(%rbp)
  addq   $0x1,-0x20(%rbp)
  jmp    L79
L104:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    %rax,-0x20(%rbp)
L79:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L160
  jmp    L46
L44:
  addq   $0x1,-0x18(%rbp)
L46:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  je     L44
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  sete   %al
  movzbl %al,%eax
L133:
  pop    %rbp
  ret
```

assistant: ```c
int wildcmp(char *wild, char *string) {
  char *cp, *mp;
  mp = cp = 0;
  while ((*string) && (*wild != '*')) {
    if ((*wild != *string) && (*wild != '?')) {
      return 0;
    }
    wild++;
    string++;
  }
  while (*string) {
    if (*wild == '*') {
      if (!*++wild) {
        return 1;
      }
      mp = wild;
      cp = string + 1;
    } else if ((*wild == *string) || (*wild == '?')) {
      wild++;
      string++;
    } else {
      wild = mp;
      string = cp++;
    }
  }
  while (*wild == '*') {
    wild++;
  }
  return !*wild;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<wildcmp>:
  endbr64
  movzbl (%rsi),%edx
  test   %dl,%dl
  jne    L84
L45:
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  jne    L79
L78:
  add    $0x1,%rdi
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  je     L78
L79:
  test   %al,%al
  sete   %al
  movzbl %al,%eax
  ret
L134:
  add    $0x1,%rdi
  add    $0x1,%rsi
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L45
L84:
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  je     L83
  cmp    $0x3f,%al
  je     L134
  cmp    %dl,%al
  je     L134
  mov    $0x0,%eax
  ret
L83:
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L45
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  jmp    L100
L52:
  lea    0x1(%rdi),%r8
  cmpb   $0x0,0x1(%rdi)
  je     L14
  lea    0x1(%rsi),%rcx
  mov    %r8,%rdi
  jmp    L7
L143:
  add    $0x1,%rdi
  add    $0x1,%rsi
L7:
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L45
L100:
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  je     L52
  cmp    $0x3f,%al
  je     L143
  cmp    %dl,%al
  je     L143
  mov    %rcx,%rsi
  lea    0x1(%rcx),%rcx
  mov    %r8,%rdi
  jmp    L7
L14:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int wildcmp(char *wild, char *string) {
  char *cp, *mp;
  mp = cp = 0;
  while ((*string) && (*wild != '*')) {
    if ((*wild != *string) && (*wild != '?')) {
      return 0;
    }
    wild++;
    string++;
  }
  while (*string) {
    if (*wild == '*') {
      if (!*++wild) {
        return 1;
      }
      mp = wild;
      cp = string + 1;
    } else if ((*wild == *string) || (*wild == '?')) {
      wild++;
      string++;
    } else {
      wild = mp;
      string = cp++;
    }
  }
  while (*wild == '*') {
    wild++;
  }
  return !*wild;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<wildcmp>:
  endbr64
  jmp    L82
  cs nopw 0x0(%rax,%rax,1)
L105:
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  je     L119
  cmp    $0x3f,%al
  je     L10
  cmp    %dl,%al
  jne    L140
L10:
  add    $0x1,%rdi
  add    $0x1,%rsi
L82:
  movzbl (%rsi),%edx
  test   %dl,%dl
  jne    L105
  jmp    L21
  nopl   0x0(%rax)
L111:
  add    $0x1,%rdi
L21:
  movzbl (%rdi),%eax
L129:
  cmp    $0x2a,%al
  je     L111
  test   %al,%al
  sete   %al
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L119:
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L111
  xor    %ecx,%ecx
  xor    %r8d,%r8d
  jmp    L132
  xchg   %ax,%ax
L121:
  cmp    $0x3f,%al
  je     L110
  cmp    %dl,%al
  je     L110
  movzbl (%rcx),%eax
  mov    %r8,%rsi
  mov    %rcx,%rdi
  add    $0x1,%r8
L12:
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L129
L132:
  cmp    $0x2a,%al
  jne    L121
  movzbl 0x1(%rdi),%eax
  lea    0x1(%rdi),%rcx
  test   %al,%al
  je     L124
  lea    0x1(%rsi),%r8
  mov    %rcx,%rdi
  jmp    L12
  nopl   (%rax)
L110:
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rsi
  add    $0x1,%rdi
  jmp    L12
  cs nopw 0x0(%rax,%rax,1)
L140:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L124:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int wildcmp(char *wild, char *string) {
  char *cp, *mp;
  mp = cp = 0;
  while ((*string) && (*wild != '*')) {
    if ((*wild != *string) && (*wild != '?')) {
      return 0;
    }
    wild++;
    string++;
  }
  while (*string) {
    if (*wild == '*') {
      if (!*++wild) {
        return 1;
      }
      mp = wild;
      cp = string + 1;
    } else if ((*wild == *string) || (*wild == '?')) {
      wild++;
      string++;
    } else {
      wild = mp;
      string = cp++;
    }
  }
  while (*wild == '*') {
    wild++;
  }
  return !*wild;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<wildcmp>:
  endbr64
  jmp    L57
  cs nopw 0x0(%rax,%rax,1)
L70:
  movzbl (%rdi),%eax
  cmp    $0x2a,%al
  je     L50
  cmp    $0x3f,%al
  je     L30
  cmp    %dl,%al
  jne    L105
L30:
  add    $0x1,%rdi
  add    $0x1,%rsi
L57:
  movzbl (%rsi),%edx
  test   %dl,%dl
  jne    L70
  nopw   0x0(%rax,%rax,1)
L16:
  movzbl (%rdi),%eax
L53:
  add    $0x1,%rdi
  cmp    $0x2a,%al
  je     L16
  test   %al,%al
  sete   %al
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L50:
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  nopl   (%rax)
L11:
  cmp    $0x2a,%al
  je     L88
L102:
  cmp    $0x3f,%al
  je     L59
  cmp    %dl,%al
  je     L59
  movzbl (%r8),%eax
  movzbl (%rcx),%edx
  mov    %rcx,%rsi
  mov    %r8,%rdi
  add    $0x1,%rcx
L80:
  test   %dl,%dl
  je     L53
  cmp    $0x2a,%al
  jne    L102
L88:
  movzbl 0x1(%rdi),%eax
  lea    0x1(%rdi),%r8
  test   %al,%al
  je     L110
  lea    0x1(%rsi),%rcx
  mov    %r8,%rdi
  jmp    L11
  nopw   0x0(%rax,%rax,1)
L59:
  movzbl 0x1(%rsi),%edx
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rsi
  add    $0x1,%rdi
  jmp    L80
  nopw   0x0(%rax,%rax,1)
L105:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L110:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int wildcmp(char *wild, char *string) {
  char *cp, *mp;
  mp = cp = 0;
  while ((*string) && (*wild != '*')) {
    if ((*wild != *string) && (*wild != '?')) {
      return 0;
    }
    wild++;
    string++;
  }
  while (*string) {
    if (*wild == '*') {
      if (!*++wild) {
        return 1;
      }
      mp = wild;
      cp = string + 1;
    } else if ((*wild == *string) || (*wild == '?')) {
      wild++;
      string++;
    } else {
      wild = mp;
      string = cp++;
    }
  }
  while (*wild == '*') {
    wild++;
  }
  return !*wild;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<stdiolog1int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x1a,%eax
  jg     L16
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  lea    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L0
L16:
  nop
L0:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L29
  call   <__stack_chk_fail@plt>
L29:
  leave
  ret
```

assistant: ```c
void stdiolog1int(char *format, int num) {
  char str[39];
  if (strlen(format) + 6 > 32)
    return;
  sprintf(str, format, num);
  puts(str);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<stdiolog1int>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  cmp    $0x1a,%eax
  jle    L16
L10:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  mov    %rsp,%r12
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <puts@plt>
  jmp    L10
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void stdiolog1int(char *format, int num) {
  char str[39];
  if (strlen(format) + 6 > 32)
    return;
  sprintf(str, format, num);
  puts(str);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<stdiolog1int>:
  endbr64
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  cmp    $0x1a,%eax
  jg     L15
  mov    %rsp,%r13
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  mov    %r13,%rdi
  call   <puts@plt>
L15:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  add    $0x30,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void stdiolog1int(char *format, int num) {
  char str[39];
  if (strlen(format) + 6 > 32)
    return;
  sprintf(str, format, num);
  puts(str);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<stdiolog1int>:
  endbr64
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  cmp    $0x1a,%eax
  jg     L15
  mov    %rsp,%r13
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
  mov    %r13,%rdi
  call   <puts@plt>
L15:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x30,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void stdiolog1int(char *format, int num) {
  char str[39];
  if (strlen(format) + 6 > 32)
    return;
  sprintf(str, format, num);
  puts(str);
}
```
user: What would the C source look like for the assembly code provided here:

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

tool_calls: name: read_data
arguments: label: D10
data_type: string
name: read_data
arguments: label: D1
data_type: string

tool: D10: ucdisasm version 1.0 - 02/04/2013.


tool: D1: Written by Vanya Sergeev - <vsergeev@gmail.com>


assistant: ```c
void print_version(void) {
  printf("ucdisasm version 1.0 - 02/04/2013.\n");
  printf("Written by Vanya Sergeev - <vsergeev@gmail.com>\n");
}
```
user: What is the c source code of the assembly code below?

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

tool_calls: name: disassemble_data
arguments: data_label: D14
datatype: string
name: disassemble_data
arguments: data_label: D11
datatype: string

tool: D14: ucdisasm version 1.0 - 02/04/2013.


tool: D11: Written by Vanya Sergeev - <vsergeev@gmail.com>


assistant: ```c
void print_version(void) {
  printf("ucdisasm version 1.0 - 02/04/2013.\n");
  printf("Written by Vanya Sergeev - <vsergeev@gmail.com>\n");
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<print_version>:
  endbr64
  sub    $0x8,%rsp
  lea    D19(%rip),%rdi
  call   <printf@plt>
  lea    D11(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D19
datatype: string
name: extract_symbolic_data
arguments: data_label: D11
datatype: string

tool: D19: ucdisasm version 1.0 - 02/04/2013.


tool: D11: Written by Vanya Sergeev - <vsergeev@gmail.com>


assistant: ```c
void print_version(void) {
  printf("ucdisasm version 1.0 - 02/04/2013.\n");
  printf("Written by Vanya Sergeev - <vsergeev@gmail.com>\n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_version>:
  endbr64
  sub    $0x8,%rsp
  lea    D14(%rip),%rdi
  call   <printf@plt>
  lea    D10(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D14
type: string
name: unpack_data
arguments: data_label: D10
type: string

tool: D14: ucdisasm version 1.0 - 02/04/2013.


tool: D10: Written by Vanya Sergeev - <vsergeev@gmail.com>


assistant: ```c
void print_version(void) {
  printf("ucdisasm version 1.0 - 02/04/2013.\n");
  printf("Written by Vanya Sergeev - <vsergeev@gmail.com>\n");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  shr    %rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L52
  pxor   %xmm0,%xmm0
  jmp    L59
L52:
  cmpq   $0x1,-0x30(%rbp)
  jne    L50
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  jmp    L59
L50:
  cmpq   $0x3e7,-0x30(%rbp)
  ja     L44
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sum>
  movsd  %xmm0,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <sum>
  addsd  -0x38(%rbp),%xmm0
  jmp    L59
L44:
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sum>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <sum>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x10(%rbp),%xmm0
  addsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x10(%rbp),%xmm0
L59:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

assistant: ```c
double sum(const double *a, size_t n) {
  size_t half = n / 2;
  double res1;
  double res2;
  if (n == 0)
    return 0;
  if (n == 1)
    return *a;
  if (n < 1000) {
    return sum(a, half) + sum(a + half, n - half);
  } else {
#pragma omp task shared(res1)
    res1 = sum(a, half);
#pragma omp task shared(res2)
    res2 = sum(a + half, n - half);
#pragma omp taskwait
    res1 = res1 + res2;
    return res1;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<sum>:
  endbr64
  pxor   %xmm0,%xmm0
  test   %rsi,%rsi
  je     L20
  push   %r14
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  cmp    $0x1,%rsi
  je     L7
  mov    %rsi,%r12
  shr    %r12
  cmp    $0x3e7,%rsi
  ja     L28
  mov    %r12,%rsi
  call   <sum>
  movq   %xmm0,%r14
  sub    %r12,%rbx
  mov    %rbx,%rsi
  lea    0x0(%rbp,%r12,8),%rdi
  call   <sum>
  movq   %r14,%xmm1
  addsd  %xmm1,%xmm0
L14:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r14
  ret
L7:
  movsd  (%rdi),%xmm0
  jmp    L14
L28:
  mov    %r12,%rsi
  call   <sum>
  movq   %xmm0,%r14
  sub    %r12,%rbx
  mov    %rbx,%rsi
  lea    0x0(%rbp,%r12,8),%rdi
  call   <sum>
  movq   %r14,%xmm2
  addsd  %xmm2,%xmm0
  jmp    L14
L20:
  ret
```

assistant: ```c
double sum(const double *a, size_t n) {
  size_t half = n / 2;
  double res1;
  double res2;
  if (n == 0)
    return 0;
  if (n == 1)
    return *a;
  if (n < 1000) {
    return sum(a, half) + sum(a + half, n - half);
  } else {
#pragma omp task shared(res1)
    res1 = sum(a, half);
#pragma omp task shared(res2)
    res2 = sum(a + half, n - half);
#pragma omp taskwait
    res1 = res1 + res2;
    return res1;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sum>:
  endbr64
  pxor   %xmm0,%xmm0
  test   %rsi,%rsi
  je     L11
  cmp    $0x1,%rsi
  je     L6
  push   %r12
  mov    %rsi,%r8
  mov    %rsi,%r12
  push   %rbp
  shr    %r8
  sub    %r8,%r12
  lea    (%rdi,%r8,8),%rbp
  mov    %r8,%rsi
  sub    $0x18,%rsp
  call   <sum>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <sum>
  addsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L11:
  ret
  nopl   0x0(%rax)
L6:
  movsd  (%rdi),%xmm0
  ret
```

assistant: ```c
double sum(const double *a, size_t n) {
  size_t half = n / 2;
  double res1;
  double res2;
  if (n == 0)
    return 0;
  if (n == 1)
    return *a;
  if (n < 1000) {
    return sum(a, half) + sum(a + half, n - half);
  } else {
#pragma omp task shared(res1)
    res1 = sum(a, half);
#pragma omp task shared(res2)
    res2 = sum(a + half, n - half);
#pragma omp taskwait
    res1 = res1 + res2;
    return res1;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sum>:
  endbr64
  pxor   %xmm1,%xmm1
  test   %rsi,%rsi
  je     L25
  cmp    $0x1,%rsi
  je     L81
  mov    %rsi,%rax
  push   %r14
  mov    %rsi,%r8
  push   %r13
  shr    %rax
  shr    $0x2,%r8
  push   %r12
  lea    (%rdi,%rax,8),%r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    %rax,%rbx
  mov    %rbx,%rbp
  sub    $0x10,%rsp
  shr    %rbp
  cmp    $0x3e7,%rsi
  ja     L145
  cmp    $0x1,%rax
  je     L78
  mov    %rax,%r14
  movsd  %xmm1,(%rsp)
  lea    (%rdi,%r8,8),%r13
  mov    %r8,%rsi
  sub    %r8,%r14
  cmp    $0x3e7,%rax
  jbe    L24
  call   <sum>
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  %xmm0,(%rsp)
  call   <sum>
  movsd  (%rsp),%xmm2
  addsd  %xmm0,%xmm2
L42:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  sub    %rbp,%rbx
  movsd  %xmm2,0x8(%rsp)
  call   <sum>
  mov    %rbx,%rsi
  lea    (%r12,%rbp,8),%rdi
  movsd  %xmm0,(%rsp)
  call   <sum>
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm2
  addsd  %xmm0,%xmm1
L137:
  addsd  %xmm2,%xmm1
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  movapd %xmm1,%xmm0
  pop    %r14
  ret
L81:
  movsd  (%rdi),%xmm1
L25:
  movapd %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L145:
  cmp    $0x1,%rax
  je     L70
  mov    %rax,%r14
  lea    (%rdi,%r8,8),%r13
  sub    %r8,%r14
  cmp    $0x3e7,%rax
  ja     L111
  mov    %r8,%rsi
  call   <sum>
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  %xmm0,(%rsp)
  call   <sum>
  movsd  (%rsp),%xmm2
  addsd  %xmm0,%xmm2
L107:
  cmp    $0x1,%rbx
  jne    L75
L126:
  movsd  (%r12),%xmm1
  jmp    L137
  nopl   0x0(%rax,%rax,1)
L70:
  movsd  (%rdi),%xmm2
L75:
  mov    %rbx,%r14
  mov    %rbp,%rsi
  mov    %r12,%rdi
  movsd  %xmm2,0x8(%rsp)
  call   <sum>
  sub    %rbp,%r14
  lea    (%r12,%rbp,8),%r13
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  %xmm0,(%rsp)
  call   <sum>
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm2
  addsd  %xmm0,%xmm1
  jmp    L137
  nopl   0x0(%rax,%rax,1)
L111:
  mov    %r8,%rsi
  movsd  %xmm1,0x8(%rsp)
  call   <sum>
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  %xmm0,(%rsp)
  call   <sum>
  movsd  (%rsp),%xmm2
  test   %rbx,%rbx
  movsd  0x8(%rsp),%xmm1
  addsd  %xmm0,%xmm2
  je     L137
  jmp    L107
  nopl   0x0(%rax,%rax,1)
L24:
  call   <sum>
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <sum>
  movsd  0x8(%rsp),%xmm2
  test   %rbx,%rbx
  movsd  (%rsp),%xmm1
  addsd  %xmm0,%xmm2
  je     L137
  cs nopw 0x0(%rax,%rax,1)
L121:
  cmp    $0x1,%rbx
  je     L126
  jmp    L42
  nop
L78:
  movsd  (%rdi),%xmm2
  jmp    L121
```

assistant: ```c
double sum(const double *a, size_t n) {
  size_t half = n / 2;
  double res1;
  double res2;
  if (n == 0)
    return 0;
  if (n == 1)
    return *a;
  if (n < 1000) {
    return sum(a, half) + sum(a + half, n - half);
  } else {
#pragma omp task shared(res1)
    res1 = sum(a, half);
#pragma omp task shared(res2)
    res2 = sum(a + half, n - half);
#pragma omp taskwait
    res1 = res1 + res2;
    return res1;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<passwd_auth>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <getpwnam@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L35
  mov    $0x0,%eax
  jmp    L2
L35:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <crypt@plt>
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L36
  mov    $0x2,%eax
  jmp    L2
L36:
  mov    $0x1,%eax
L2:
  leave
  ret
```

assistant: ```c
int passwd_auth(char *user, char *passwd) {
  struct passwd *pwd;
  pwd = getpwnam(user);
  if (pwd == NULL) {
    return 0;
  } else {
    if (strcmp(pwd->pw_passwd, (char *)crypt(passwd, pwd->pw_passwd))) {
      return 2;
    } else {
      return 1;
    }
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<passwd_auth>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  call   <getpwnam@plt>
  mov    %rax,%rbx
  mov    $0x0,%eax
  test   %rbx,%rbx
  je     L4
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  call   <crypt@plt>
  mov    %rax,%rsi
  mov    (%rbx),%edi
  call   <strcmp@plt>
  cmp    $0x1,%rax
  mov    $0x1,%eax
  sbb    $0xffffffff,%eax
L4:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int passwd_auth(char *user, char *passwd) {
  struct passwd *pwd;
  pwd = getpwnam(user);
  if (pwd == NULL) {
    return 0;
  } else {
    if (strcmp(pwd->pw_passwd, (char *)crypt(passwd, pwd->pw_passwd))) {
      return 2;
    } else {
      return 1;
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<passwd_auth>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <getpwnam@plt>
  mov    %rax,%rbx
  xor    %eax,%eax
  test   %rbx,%rbx
  je     L7
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  call   <crypt@plt>
  mov    (%rbx),%edi
  mov    %rax,%rsi
  call   <strcmp@plt>
  cmp    $0x1,%rax
  mov    $0x1,%eax
  sbb    $0xffffffff,%eax
L7:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int passwd_auth(char *user, char *passwd) {
  struct passwd *pwd;
  pwd = getpwnam(user);
  if (pwd == NULL) {
    return 0;
  } else {
    if (strcmp(pwd->pw_passwd, (char *)crypt(passwd, pwd->pw_passwd))) {
      return 2;
    } else {
      return 1;
    }
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<passwd_auth>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <getpwnam@plt>
  mov    %rax,%rbx
  xor    %eax,%eax
  test   %rbx,%rbx
  je     L0
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  call   <crypt@plt>
  mov    (%rbx),%edi
  mov    %rax,%rsi
  call   <strcmp@plt>
  cmp    $0x1,%rax
  mov    $0x1,%eax
  sbb    $0xffffffff,%eax
L0:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int passwd_auth(char *user, char *passwd) {
  struct passwd *pwd;
  pwd = getpwnam(user);
  if (pwd == NULL) {
    return 0;
  } else {
    if (strcmp(pwd->pw_passwd, (char *)crypt(passwd, pwd->pw_passwd))) {
      return 2;
    } else {
      return 1;
    }
  }
}
```