ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<http_header_str_val>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8d,-0x28(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <nre_strcasestr@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L26
  mov    -0x30(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L155
L26:
  mov    -0x24(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  jmp    L172
L83:
  addq   $0x1,-0x8(%rbp)
L172:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L110
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L83
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L83
L110:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L130
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L130
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L175
L130:
  mov    -0x30(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L155
L175:
  cmpq   $0x0,-0x8(%rbp)
  je     L14
  jmp    L18
L68:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    -0xc(%rbp),%edx
  lea    0x1(%rdx),%ecx
  mov    %ecx,-0xc(%rbp)
  movslq %edx,%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
L18:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L125
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L125
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L125
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jl     L68
L125:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L14:
  cmpl   $0x0,-0xc(%rbp)
  jne    L4
  mov    -0x30(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L155
L4:
  mov    -0x30(%rbp),%rax
L155:
  leave
  ret
```

assistant: ```c
char *http_header_str_val(const char *buf, const char *key, const int keylen, char *value, int value_len) {
  char *temp = nre_strcasestr(buf, key);
  int i = 0;
  if (temp == NULL) {
    *value = 0;
    return NULL;
  }
  temp += keylen;
  while (*temp && ((*temp) == ' ' || (*temp) == '\t'))
    temp++;
  if (*temp == '\0' || ((*temp) == '\r' || (*temp) == '\n')) {
    *value = 0;
    return NULL;
  }
  if (temp) {
    while (*temp && !((*temp) == '\r' || (*temp) == '\n') && i < value_len - 1)
      value[i++] = *temp++;
    value[i] = 0;
  }
  if (i == 0) {
    *value = 0;
    return NULL;
  }
  return value;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<http_header_str_val>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%r12d
  mov    %rcx,%rbx
  mov    %r8d,%ebp
  call   <nre_strcasestr@plt>
  test   %rax,%rax
  je     L98
  movslq %r12d,%r12
  add    %r12,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L151
L159:
  movb   $0x0,(%rbx)
  mov    $0x0,%ebx
  jmp    L61
L98:
  movb   $0x0,(%rbx)
  mov    %rax,%rbx
  jmp    L61
L9:
  add    $0x1,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L159
L151:
  cmp    $0x20,%dl
  je     L9
  cmp    $0x9,%dl
  je     L9
  cmp    $0xd,%dl
  ja     L53
  mov    $0x2401,%ecx
  bt     %rdx,%rcx
  jb     L159
L53:
  test   %rax,%rax
  je     L121
  movzbl (%rax),%ecx
  mov    $0x0,%edx
  sub    $0x1,%ebp
  test   %cl,%cl
  je     L121
L168:
  mov    %edx,%edi
  mov    %edx,%esi
  cmp    $0xd,%cl
  je     L115
  cmp    $0xa,%cl
  je     L115
  cmp    %edx,%ebp
  jle    L115
  lea    0x1(%rdi),%esi
  mov    %cl,(%rbx,%rdx,1)
  add    $0x1,%rdx
  movzbl (%rax,%rdx,1),%ecx
  test   %cl,%cl
  jne    L168
L115:
  movslq %esi,%rax
  movb   $0x0,(%rbx,%rax,1)
  test   %esi,%esi
  je     L121
L61:
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L121:
  movb   $0x0,(%rbx)
  mov    $0x0,%ebx
  jmp    L61
```

assistant: ```c
char *http_header_str_val(const char *buf, const char *key, const int keylen, char *value, int value_len) {
  char *temp = nre_strcasestr(buf, key);
  int i = 0;
  if (temp == NULL) {
    *value = 0;
    return NULL;
  }
  temp += keylen;
  while (*temp && ((*temp) == ' ' || (*temp) == '\t'))
    temp++;
  if (*temp == '\0' || ((*temp) == '\r' || (*temp) == '\n')) {
    *value = 0;
    return NULL;
  }
  if (temp) {
    while (*temp && !((*temp) == '\r' || (*temp) == '\n') && i < value_len - 1)
      value[i++] = *temp++;
    value[i] = 0;
  }
  if (i == 0) {
    *value = 0;
    return NULL;
  }
  return value;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<http_header_str_val>:
  endbr64
  push   %r12
  movslq %edx,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8d,%ebx
  call   <nre_strcasestr@plt>
  test   %rax,%rax
  je     L112
  add    %r12,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L143
  jmp    L112
  nopl   0x0(%rax,%rax,1)
L72:
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  je     L112
L143:
  cmp    $0x20,%dl
  je     L72
  cmp    $0x9,%dl
  je     L72
  cmp    $0xd,%dl
  je     L112
  cmp    $0xa,%dl
  je     L112
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L112
  mov    %rbp,%rsi
  xor    %ecx,%ecx
  sub    $0x1,%ebx
  jmp    L88
  nopl   0x0(%rax)
L87:
  add    $0x1,%rax
  mov    %dl,(%rsi)
  add    $0x1,%ecx
  add    $0x1,%rsi
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L61
L88:
  cmp    $0xd,%dl
  je     L131
  cmp    $0xa,%dl
  je     L131
  cmp    %ecx,%ebx
  jg     L87
L131:
  movb   $0x0,(%rsi)
  test   %ecx,%ecx
  je     L112
L142:
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L112:
  pop    %rbx
  movb   $0x0,0x0(%rbp)
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L61:
  movslq %ecx,%rcx
  movb   $0x0,0x0(%rbp,%rcx,1)
  jmp    L142
```

assistant: ```c
char *http_header_str_val(const char *buf, const char *key, const int keylen, char *value, int value_len) {
  char *temp = nre_strcasestr(buf, key);
  int i = 0;
  if (temp == NULL) {
    *value = 0;
    return NULL;
  }
  temp += keylen;
  while (*temp && ((*temp) == ' ' || (*temp) == '\t'))
    temp++;
  if (*temp == '\0' || ((*temp) == '\r' || (*temp) == '\n')) {
    *value = 0;
    return NULL;
  }
  if (temp) {
    while (*temp && !((*temp) == '\r' || (*temp) == '\n') && i < value_len - 1)
      value[i++] = *temp++;
    value[i] = 0;
  }
  if (i == 0) {
    *value = 0;
    return NULL;
  }
  return value;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<http_header_str_val>:
  endbr64
  push   %r12
  movslq %edx,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8d,%ebx
  call   <nre_strcasestr@plt>
  test   %rax,%rax
  je     L98
  add    %r12,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L63
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L82:
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  je     L98
L63:
  cmp    $0x20,%dl
  je     L82
  cmp    $0x9,%dl
  je     L82
  cmp    $0xd,%dl
  je     L98
  cmp    $0xa,%dl
  je     L98
  mov    %rbp,%rsi
  xor    %ecx,%ecx
  sub    $0x1,%ebx
  jmp    L129
  nopw   0x0(%rax,%rax,1)
L67:
  add    $0x1,%rax
  mov    %dl,(%rsi)
  add    $0x1,%ecx
  add    $0x1,%rsi
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L143
L129:
  cmp    $0xd,%dl
  je     L24
  cmp    $0xa,%dl
  je     L24
  cmp    %ecx,%ebx
  jg     L67
L24:
  movb   $0x0,(%rsi)
  test   %ecx,%ecx
  je     L98
L18:
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L98:
  pop    %rbx
  movb   $0x0,0x0(%rbp)
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L143:
  movslq %ecx,%rcx
  movb   $0x0,0x0(%rbp,%rcx,1)
  jmp    L18
```

assistant: ```c
char *http_header_str_val(const char *buf, const char *key, const int keylen, char *value, int value_len) {
  char *temp = nre_strcasestr(buf, key);
  int i = 0;
  if (temp == NULL) {
    *value = 0;
    return NULL;
  }
  temp += keylen;
  while (*temp && ((*temp) == ' ' || (*temp) == '\t'))
    temp++;
  if (*temp == '\0' || ((*temp) == '\r' || (*temp) == '\n')) {
    *value = 0;
    return NULL;
  }
  if (temp) {
    while (*temp && !((*temp) == '\r' || (*temp) == '\n') && i < value_len - 1)
      value[i++] = *temp++;
    value[i] = 0;
  }
  if (i == 0) {
    *value = 0;
    return NULL;
  }
  return value;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L3
L15:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <FixSampleRate@plt>
  addl   $0x1,-0x4(%rbp)
L3:
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L15
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    FixSampleRate(argv[i]);
  }
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  cmp    $0x1,%edi
  jle    L13
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    0x8(%rsi),%rbx
  lea    -0x2(%rdi),%eax
  lea    0x10(%rsi,%rax,8),%rbp
L19:
  mov    (%rbx),%rdi
  call   <FixSampleRate@plt>
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L19
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L13:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    FixSampleRate(argv[i]);
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  cmp    $0x1,%edi
  jle    L9
  push   %rbp
  lea    -0x2(%rdi),%eax
  push   %rbx
  lea    0x10(%rsi,%rax,8),%rbp
  lea    0x8(%rsi),%rbx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L0:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <FixSampleRate@plt>
  cmp    %rbp,%rbx
  jne    L0
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L9:
  xor    %eax,%eax
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    FixSampleRate(argv[i]);
  }
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  cmp    $0x1,%edi
  jle    L0
  push   %rbp
  lea    -0x2(%rdi),%eax
  push   %rbx
  lea    0x10(%rsi,%rax,8),%rbp
  lea    0x8(%rsi),%rbx
  sub    $0x8,%rsp
  nopl   0x0(%rax,%rax,1)
L9:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <FixSampleRate@plt>
  cmp    %rbp,%rbx
  jne    L9
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L0:
  xor    %eax,%eax
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  for (int i = 1; i < argc; i++) {
    FixSampleRate(argv[i]);
  }
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<list_command>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <na_list_nodes@plt>
  mov    $0x1,%eax
  pop    %rbp
  ret
```

assistant: ```c
bool list_command(void) {
  na_list_nodes();
  return true;
}
```
user: Translate the below assembly code into C programming language:

```asm
<list_command>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <na_list_nodes@plt>
  mov    $0x1,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
bool list_command(void) {
  na_list_nodes();
  return true;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<list_command>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <na_list_nodes@plt>
  mov    $0x1,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
bool list_command(void) {
  na_list_nodes();
  return true;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<list_command>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <na_list_nodes@plt>
  mov    $0x1,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
bool list_command(void) {
  na_list_nodes();
  return true;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ft_strclr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L5
  jmp    L19
L0:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x4(%rbp)
L19:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L0
L5:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void ft_strclr(char *src) {
  int i;
  i = 0;
  if (src) {
    while (src[i]) {
      src[i] = 0;
      i++;
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ft_strclr>:
  endbr64
  test   %rdi,%rdi
  je     L11
  cmpb   $0x0,(%rdi)
  je     L11
L23:
  movb   $0x0,(%rdi)
  add    $0x1,%rdi
  cmpb   $0x0,(%rdi)
  jne    L23
L11:
  ret
```

assistant: ```c
void ft_strclr(char *src) {
  int i;
  i = 0;
  if (src) {
    while (src[i]) {
      src[i] = 0;
      i++;
    }
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<ft_strclr>:
  endbr64
  test   %rdi,%rdi
  jne    L13
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L3:
  movb   $0x0,(%rdi)
  add    $0x1,%rdi
L13:
  cmpb   $0x0,(%rdi)
  jne    L3
L2:
  ret
```

assistant: ```c
void ft_strclr(char *src) {
  int i;
  i = 0;
  if (src) {
    while (src[i]) {
      src[i] = 0;
      i++;
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<ft_strclr>:
  endbr64
  test   %rdi,%rdi
  jne    L7
  jmp    L15
  nopl   0x0(%rax,%rax,1)
L20:
  movb   $0x0,(%rdi)
  add    $0x1,%rdi
L7:
  cmpb   $0x0,(%rdi)
  jne    L20
L15:
  ret
```

assistant: ```c
void ft_strclr(char *src) {
  int i;
  i = 0;
  if (src) {
    while (src[i]) {
      src[i] = 0;
      i++;
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cprop_test4>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x3039,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L6
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    -0x4(%rbp),%edx
  sub    $0x4d1,%edx
  mov    %edx,(%rax)
  jmp    L1
L6:
  mov    -0x18(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    $0x85,%eax
  sub    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
L1:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void cprop_test4(int *data) {
  int j = 12345;
  if (data[0])
    data[1] = 1 + j - 1234;
  else
    data[2] = 123 - j + 10;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<cprop_test4>:
  endbr64
  cmpl   $0x0,(%rdi)
  je     L6
  movl   $0x2b68,0x4(%rdi)
  ret
L6:
  movl   $0xffffd04c,0x8(%rdi)
  ret
```

assistant: ```c
void cprop_test4(int *data) {
  int j = 12345;
  if (data[0])
    data[1] = 1 + j - 1234;
  else
    data[2] = 123 - j + 10;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<cprop_test4>:
  endbr64
  mov    (%rdi),%eax
  test   %eax,%eax
  je     L4
  movl   $0x2b68,0x4(%rdi)
  ret
  nopw   0x0(%rax,%rax,1)
L4:
  movl   $0xffffd04c,0x8(%rdi)
  ret
```

assistant: ```c
void cprop_test4(int *data) {
  int j = 12345;
  if (data[0])
    data[1] = 1 + j - 1234;
  else
    data[2] = 123 - j + 10;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<cprop_test4>:
  endbr64
  mov    (%rdi),%eax
  test   %eax,%eax
  je     L7
  movl   $0x2b68,0x4(%rdi)
  ret
  nopw   0x0(%rax,%rax,1)
L7:
  movl   $0xffffd04c,0x8(%rdi)
  ret
```

assistant: ```c
void cprop_test4(int *data) {
  int j = 12345;
  if (data[0])
    data[1] = 1 + j - 1234;
  else
    data[2] = 123 - j + 10;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<checkCPU>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movl   $0x1,-0x4(%rbp)
  movzbl -0x4(%rbp),%eax
  cmp    $0x1,%al
  sete   %al
  movzbl %al,%eax
  pop    %rbp
  ret
```

assistant: ```c
int checkCPU() {
  union w {
    int a;
    char b;
  } c;
  c.a = 1;
  return (c.b == 1);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<checkCPU>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int checkCPU() {
  union w {
    int a;
    char b;
  } c;
  c.a = 1;
  return (c.b == 1);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<checkCPU>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int checkCPU() {
  union w {
    int a;
    char b;
  } c;
  c.a = 1;
  return (c.b == 1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<checkCPU>:
  endbr64
  mov    $0x1,%eax
  ret
```

assistant: ```c
int checkCPU() {
  union w {
    int a;
    char b;
  } c;
  c.a = 1;
  return (c.b == 1);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rsa_sign>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <RSA_size@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L52
  mov    $0x0,%eax
  jmp    L34
L52:
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    D11(%rip),%rax
  mov    (%rax),%ebx
  mov    -0x3c(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <hash_sha1@plt>
  mov    %eax,%esi
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    -0x48(%rbp),%rdi
  lea    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    %rdi,%r9
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %ebx,%edx
  mov    %eax,%edi
  call   <RSA_sign@plt>
  mov    %eax,-0x24(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  je     L18
  mov    -0x28(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
L18:
  cmpl   $0x0,-0x24(%rbp)
  je     L28
  mov    -0x20(%rbp),%rax
  jmp    L34
L28:
  mov    $0x0,%eax
L34:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
u_char *rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen) {
  u_char *signature;
  int ret, len;
  ret = RSA_size(priv);
  if (!ret)
    return 0;
  signature = (u_char *)xmalloc(ret);
  ret = RSA_sign(NID_sha1, hash_sha1(msg, m_len, 0), SHA_DIGEST_LENGTH, signature, (u_int *)&len, priv);
  if (siglen)
    *siglen = len;
  return !ret ? 0 : signature;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<rsa_sign>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %esi,%r14d
  mov    %rdx,%rbp
  mov    %rcx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rdx,%rdi
  call   <RSA_size@plt>
  mov    $0x0,%ebx
  test   %eax,%eax
  je     L27
  mov    %eax,%edi
  call   <xmalloc@plt>
  mov    %rax,%rbx
  mov    D9(%rip),%rax
  mov    (%rax),%r15d
  mov    $0x0,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <hash_sha1@plt>
  mov    %eax,%esi
  mov    %rbp,%r9
  lea    0x4(%rsp),%r8
  mov    %rbx,%rcx
  mov    %r15d,%edx
  mov    D16(%rip),%rax
  mov    (%rax),%edi
  call   <RSA_sign@plt>
  test   %r12,%r12
  je     L11
  mov    0x4(%rsp),%edx
  mov    %edx,(%r12)
L11:
  test   %eax,%eax
  mov    $0x0,%eax
  cmove  %rax,%rbx
L27:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    %rbx,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
u_char *rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen) {
  u_char *signature;
  int ret, len;
  ret = RSA_size(priv);
  if (!ret)
    return 0;
  signature = (u_char *)xmalloc(ret);
  ret = RSA_sign(NID_sha1, hash_sha1(msg, m_len, 0), SHA_DIGEST_LENGTH, signature, (u_int *)&len, priv);
  if (siglen)
    *siglen = len;
  return !ret ? 0 : signature;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<rsa_sign>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %rdx,%rdi
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <RSA_size@plt>
  test   %eax,%eax
  je     L26
  mov    %eax,%edi
  call   <xmalloc@plt>
  xor    %edx,%edx
  mov    %r13d,%esi
  mov    %r12,%rdi
  mov    %rax,%r14
  mov    D7(%rip),%rax
  mov    (%rax),%r15d
  call   <hash_sha1@plt>
  mov    %rbx,%r9
  lea    0x4(%rsp),%r8
  mov    %r14,%rcx
  mov    %eax,%esi
  mov    D19(%rip),%rax
  mov    %r15d,%edx
  mov    (%rax),%edi
  call   <RSA_sign@plt>
  test   %rbp,%rbp
  je     L25
  mov    0x4(%rsp),%edx
  mov    %edx,0x0(%rbp)
L25:
  test   %eax,%eax
  je     L26
L29:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L46
  add    $0x18,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L26:
  xor    %r14d,%r14d
  jmp    L29
L46:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
u_char *rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen) {
  u_char *signature;
  int ret, len;
  ret = RSA_size(priv);
  if (!ret)
    return 0;
  signature = (u_char *)xmalloc(ret);
  ret = RSA_sign(NID_sha1, hash_sha1(msg, m_len, 0), SHA_DIGEST_LENGTH, signature, (u_int *)&len, priv);
  if (siglen)
    *siglen = len;
  return !ret ? 0 : signature;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rsa_sign>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %rdx,%rdi
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <RSA_size@plt>
  test   %eax,%eax
  je     L45
  mov    %eax,%edi
  call   <xmalloc@plt>
  xor    %edx,%edx
  mov    %r13d,%esi
  mov    %r12,%rdi
  mov    %rax,%r14
  mov    D12(%rip),%rax
  mov    (%rax),%r15d
  call   <hash_sha1@plt>
  mov    %rbx,%r9
  lea    0x4(%rsp),%r8
  mov    %r14,%rcx
  mov    %eax,%esi
  mov    D8(%rip),%rax
  mov    %r15d,%edx
  mov    (%rax),%edi
  call   <RSA_sign@plt>
  test   %rbp,%rbp
  je     L18
  mov    0x4(%rsp),%edx
  mov    %edx,0x0(%rbp)
L18:
  test   %eax,%eax
  je     L45
L10:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  add    $0x18,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L45:
  xor    %r14d,%r14d
  jmp    L10
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
u_char *rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen) {
  u_char *signature;
  int ret, len;
  ret = RSA_size(priv);
  if (!ret)
    return 0;
  signature = (u_char *)xmalloc(ret);
  ret = RSA_sign(NID_sha1, hash_sha1(msg, m_len, 0), SHA_DIGEST_LENGTH, signature, (u_int *)&len, priv);
  if (siglen)
    *siglen = len;
  return !ret ? 0 : signature;
}
```