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

```asm
<errcatch_unit_num>:
  endbr64
  sub    $0x8,%rsp
  lea    D7(%rip),%rdi
  call   <reiserfs_warning@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D7
type_guessed: string

tool: D7: green-16010: Invalid item type observed, run fsck ASAP


assistant: ```c
int errcatch_unit_num(struct virtual_item *vi) {
  reiserfs_warning("green-16010: Invalid item type observed, run fsck ASAP\n");
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ft_putnchar_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,%eax
  mov    %rsi,-0x10(%rbp)
  mov    %edx,-0x8(%rbp)
  mov    %al,-0x4(%rbp)
  jmp    L18
L9:
  lea    -0x4(%rbp),%rcx
  mov    -0x8(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
L18:
  mov    -0x10(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  test   %rax,%rax
  jne    L9
  nop
  nop
  leave
  ret
```

assistant: ```c
void ft_putnchar_fd(char c, size_t n, int fd) {
  while (n-- > 0)
    write(fd, &c, 1);
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<ft_putnchar_fd>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %dil,0xc(%rsp)
  test   %rsi,%rsi
  je     L6
  mov    %edx,%ebp
  lea    -0x1(%rsi),%rbx
  lea    0xc(%rsp),%r12
L19:
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <write@plt>
  sub    $0x1,%rbx
  cmp    $0xffffffffffffffff,%rbx
  jne    L19
L6:
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void ft_putnchar_fd(char c, size_t n, int fd) {
  while (n-- > 0)
    write(fd, &c, 1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ft_putnchar_fd>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %dil,0xc(%rsp)
  test   %rsi,%rsi
  je     L19
  mov    %edx,%ebp
  lea    -0x1(%rsi),%rbx
  lea    0xc(%rsp),%r12
  nopl   0x0(%rax)
L4:
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <write@plt>
  sub    $0x1,%rbx
  jae    L4
L19:
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void ft_putnchar_fd(char c, size_t n, int fd) {
  while (n-- > 0)
    write(fd, &c, 1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ft_putnchar_fd>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %dil,0xc(%rsp)
  test   %rsi,%rsi
  je     L12
  mov    %edx,%ebp
  lea    -0x1(%rsi),%rbx
  lea    0xc(%rsp),%r12
  nopl   0x0(%rax)
L1:
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <write@plt>
  sub    $0x1,%rbx
  jae    L1
L12:
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void ft_putnchar_fd(char c, size_t n, int fd) {
  while (n-- > 0)
    write(fd, &c, 1);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<FanIntUnregister>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    $0x82,%edi
  call   <IntDisable@plt>
  mov    $0x82,%edi
  call   <IntUnregister@plt>
  nop
  leave
  ret
```

assistant: ```c
void FanIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(130);
  IntUnregister(130);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<FanIntUnregister>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x82,%edi
  call   <IntDisable@plt>
  mov    $0x82,%edi
  call   <IntUnregister@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void FanIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(130);
  IntUnregister(130);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<FanIntUnregister>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x82,%edi
  call   <IntDisable@plt>
  mov    $0x82,%edi
  add    $0x8,%rsp
  jmp    1060 <IntUnregister@plt>
```

assistant: ```c
void FanIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(130);
  IntUnregister(130);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<FanIntUnregister>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x82,%edi
  call   <IntDisable@plt>
  mov    $0x82,%edi
  add    $0x8,%rsp
  jmp    1060 <IntUnregister@plt>
```

assistant: ```c
void FanIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(130);
  IntUnregister(130);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_mod_base>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x460,%rsp
  mov    %edi,-0x454(%rbp)
  mov    %rsi,-0x460(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x448(%rbp)
  cmpl   $0x0,-0x454(%rbp)
  jns    L53
  mov    -0x454(%rbp),%edx
  lea    -0x430(%rbp),%rax
  mov    %edx,%ecx
  lea    D17(%rip),%rdx
  mov    $0x20,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L45
L53:
  mov    -0x454(%rbp),%edx
  lea    -0x430(%rbp),%rax
  mov    %edx,%ecx
  lea    D35(%rip),%rdx
  mov    $0x20,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
L45:
  lea    -0x430(%rbp),%rax
  lea    D14(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x440(%rbp)
  cmpq   $0x0,-0x440(%rbp)
  je     L72
  jmp    L15
L34:
  mov    -0x460(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L15
  lea    -0x410(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strtok@plt>
  mov    %rax,-0x438(%rbp)
  mov    -0x438(%rbp),%rax
  mov    $0x10,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %rax,-0x448(%rbp)
  jmp    L25
L15:
  mov    -0x440(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L34
L25:
  mov    -0x440(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L72:
  mov    -0x448(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L44
  call   <__stack_chk_fail@plt>
L44:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D17
type_guessed: string
name: parse_data
arguments: tag: D35
type_guessed: string
name: parse_data
arguments: tag: D14
type_guessed: string
name: parse_data
arguments: tag: D8
type_guessed: string

tool: D17: /proc/self/maps

tool: D35: /proc/%d/maps

tool: D14: r

tool: D8: -

assistant: ```c
long get_mod_base(pid_t pid, char *mod_name) {
  FILE *fp;
  long addr = 0;
  char *pch;
  char filename[32];
  char line[1024];
  if (pid < 0) {
    snprintf(filename, sizeof(filename), "/proc/self/maps", pid);
  } else {
    snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
  }
  fp = fopen(filename, "r");
  if (fp != NULL) {
    while (fgets(line, sizeof(line), fp)) {
      if (strstr(line, mod_name)) {
        pch = strtok(line, "-");
        addr = strtoul(pch, NULL, 16);
        break;
      }
    }
    fclose(fp);
  }
  return addr;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<get_mod_base>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x438,%rsp
  mov    %edi,%ecx
  mov    %rsi,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L44
  mov    %rsp,%rdi
  lea    D29(%rip),%rdx
  mov    $0x20,%esi
  call   <snprintf@plt>
L6:
  mov    %rsp,%rdi
  lea    D30(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  lea    0x20(%rsp),%rbp
  mov    $0x0,%ebx
  test   %rax,%rax
  je     L12
L32:
  mov    %r12,%rdx
  mov    $0x400,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L24
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L32
  lea    0x20(%rsp),%rdi
  lea    D10(%rip),%rsi
  call   <strtok@plt>
  mov    %rax,%rdi
  mov    $0x10,%edx
  mov    $0x0,%esi
  call   <strtoul@plt>
  mov    %rax,%rbx
L24:
  mov    %r12,%rdi
  call   <fclose@plt>
L12:
  mov    0x428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  mov    %rbx,%rax
  add    $0x438,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L44:
  mov    %rsp,%rdi
  lea    D20(%rip),%rdx
  mov    $0x20,%esi
  call   <snprintf@plt>
  jmp    L6
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D29
type: string
name: extract_symbolic_data
arguments: label: D30
type: string
name: extract_symbolic_data
arguments: label: D10
type: string
name: extract_symbolic_data
arguments: label: D20
type: string

tool: D29: /proc/%d/maps

tool: D30: r

tool: D10: -

tool: D20: /proc/self/maps

assistant: ```c
long get_mod_base(pid_t pid, char *mod_name) {
  FILE *fp;
  long addr = 0;
  char *pch;
  char filename[32];
  char line[1024];
  if (pid < 0) {
    snprintf(filename, sizeof(filename), "/proc/self/maps", pid);
  } else {
    snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
  }
  fp = fopen(filename, "r");
  if (fp != NULL) {
    while (fgets(line, sizeof(line), fp)) {
      if (strstr(line, mod_name)) {
        pch = strtok(line, "-");
        addr = strtoul(pch, NULL, 16);
        break;
      }
    }
    fclose(fp);
  }
  return addr;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<get_mod_base>:
  endbr64
  push   %r13
  mov    %edi,%ecx
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x438,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  test   %edi,%edi
  js     L70
  lea    D0(%rip),%rdx
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <snprintf@plt>
L14:
  mov    %rbp,%rdi
  lea    D30(%rip),%rsi
  lea    0x20(%rsp),%rbp
  xor    %r12d,%r12d
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  jne    L52
  jmp    L73
  nopl   0x0(%rax)
L40:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L46
L52:
  mov    %r13,%rdx
  mov    $0x400,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L40
L68:
  mov    %r13,%rdi
  call   <fclose@plt>
L73:
  mov    0x428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L60
  add    $0x438,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L70:
  lea    D22(%rip),%rdx
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <snprintf@plt>
  jmp    L14
  nopl   0x0(%rax)
L46:
  lea    D23(%rip),%rsi
  mov    %rbp,%rdi
  call   <strtok@plt>
  mov    $0x10,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %rax,%r12
  jmp    L68
L60:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D0
type_infered: string
name: extract_symbolic_data
arguments: tag: D30
type_infered: string
name: extract_symbolic_data
arguments: tag: D22
type_infered: string
name: extract_symbolic_data
arguments: tag: D23
type_infered: string

tool: D0: /proc/%d/maps

tool: D30: r

tool: D22: /proc/self/maps

tool: D23: -

assistant: ```c
long get_mod_base(pid_t pid, char *mod_name) {
  FILE *fp;
  long addr = 0;
  char *pch;
  char filename[32];
  char line[1024];
  if (pid < 0) {
    snprintf(filename, sizeof(filename), "/proc/self/maps", pid);
  } else {
    snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
  }
  fp = fopen(filename, "r");
  if (fp != NULL) {
    while (fgets(line, sizeof(line), fp)) {
      if (strstr(line, mod_name)) {
        pch = strtok(line, "-");
        addr = strtoul(pch, NULL, 16);
        break;
      }
    }
    fclose(fp);
  }
  return addr;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<get_mod_base>:
  endbr64
  push   %r13
  mov    %edi,%ecx
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x438,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  test   %edi,%edi
  js     L24
  lea    D31(%rip),%rdx
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <snprintf@plt>
L42:
  mov    %rbp,%rdi
  lea    D25(%rip),%rsi
  lea    0x20(%rsp),%rbp
  xor    %r12d,%r12d
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  jne    L2
  jmp    L10
  nopl   0x0(%rax)
L55:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L32
L2:
  mov    %r13,%rdx
  mov    $0x400,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L55
L26:
  mov    %r13,%rdi
  call   <fclose@plt>
L10:
  mov    0x428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x438,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L24:
  lea    D0(%rip),%rdx
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <snprintf@plt>
  jmp    L42
  nopl   0x0(%rax)
L32:
  lea    D29(%rip),%rsi
  mov    %rbp,%rdi
  call   <strtok@plt>
  mov    $0x10,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  call   <strtoul@plt>
  mov    %rax,%r12
  jmp    L26
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D31
type_infered: string
name: extract_symbolic_data
arguments: data_label: D25
type_infered: string
name: extract_symbolic_data
arguments: data_label: D0
type_infered: string
name: extract_symbolic_data
arguments: data_label: D29
type_infered: string

tool: D31: /proc/%d/maps

tool: D25: r

tool: D0: /proc/self/maps

tool: D29: -

assistant: ```c
long get_mod_base(pid_t pid, char *mod_name) {
  FILE *fp;
  long addr = 0;
  char *pch;
  char filename[32];
  char line[1024];
  if (pid < 0) {
    snprintf(filename, sizeof(filename), "/proc/self/maps", pid);
  } else {
    snprintf(filename, sizeof(filename), "/proc/%d/maps", pid);
  }
  fp = fopen(filename, "r");
  if (fp != NULL) {
    while (fgets(line, sizeof(line), fp)) {
      if (strstr(line, mod_name)) {
        pch = strtok(line, "-");
        addr = strtoul(pch, NULL, 16);
        break;
      }
    }
    fclose(fp);
  }
  return addr;
}
```
user: Translate the below assembly code into C programming language:

```asm
<trim>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L45
L136:
  addl   $0x1,-0x8(%rbp)
L45:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L136
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L136
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L136
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L136
  cmpl   $0x0,-0x8(%rbp)
  jle    L106
  movl   $0x0,-0x4(%rbp)
  jmp    L55
L97:
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x4(%rbp)
L55:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x4(%rbp)
  jl     L97
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L106:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L63
L0:
  subl   $0x1,-0x8(%rbp)
L63:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L0
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L0
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L0
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L0
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %eax,-0x8(%rbp)
  jge    L10
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L10:
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *trim(char *s) {
  int i = 0, j;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i++;
  }
  if (i > 0) {
    for (j = 0; j < strlen(s); j++) {
      s[j] = s[j + i];
    }
    s[j] = '\0';
  }
  i = strlen(s) - 1;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i--;
  }
  if (i < (strlen(s) - 1)) {
    s[i + 1] = '\0';
  }
  return s;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<trim>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  movzbl (%rdi),%ecx
  cmp    $0x20,%cl
  ja     L50
  movabs $0x100002600,%rax
  shr    %cl,%rax
  and    $0x1,%eax
  je     L50
  movabs $0x100002600,%rsi
  jmp    L104
L89:
  add    $0x1,%rax
  bt     %rdx,%rsi
  jae    L90
L104:
  mov    %eax,%ecx
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    $0x20,%dl
  jbe    L89
L90:
  mov    $0x0,%ebx
  movslq %ecx,%r12
  test   %ecx,%ecx
  jg     L60
  jmp    L50
L34:
  lea    0x0(%rbp,%r12,1),%rax
  movzbl (%rax,%rbx,1),%eax
  mov    %al,0x0(%rbp,%rbx,1)
  add    $0x1,%rbx
L60:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jg     L34
  movslq %ebx,%r13
  movb   $0x0,0x0(%rbp,%r13,1)
L50:
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    -0x1(%rax),%r12d
  movslq %r12d,%rbx
  movzbl 0x0(%rbp,%rbx,1),%edx
  cmp    $0x20,%dl
  ja     L91
  movabs $0x100002600,%rcx
  bt     %rdx,%rcx
  jae    L91
  sub    $0x2,%eax
  movslq %eax,%rbx
  jmp    L92
L73:
  lea    -0x1(%rbx),%rdx
  bt     %rax,%rcx
  jae    L91
  mov    %rdx,%rbx
L92:
  mov    %ebx,%r12d
  movzbl 0x0(%rbp,%rbx,1),%eax
  cmp    $0x20,%al
  jbe    L73
L91:
  mov    %rbp,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %r12d,%eax
  jle    L37
  movb   $0x0,0x1(%rbp,%rbx,1)
L37:
  mov    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *trim(char *s) {
  int i = 0, j;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i++;
  }
  if (i > 0) {
    for (j = 0; j < strlen(s); j++) {
      s[j] = s[j + i];
    }
    s[j] = '\0';
  }
  i = strlen(s) - 1;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i--;
  }
  if (i < (strlen(s) - 1)) {
    s[i + 1] = '\0';
  }
  return s;
}
```
user: What is the c source code of the assembly code below?

```asm
<trim>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movzbl (%rdi),%eax
  cmp    $0x20,%al
  ja     L102
  movabs $0xfffffffeffffd9ff,%rsi
  bt     %rax,%rsi
  jb     L102
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L105:
  movzbl (%r12,%rax,1),%edx
  mov    %eax,%ecx
  cmp    $0x20,%dl
  ja     L9
  add    $0x1,%rax
  bt     %rdx,%rsi
  jae    L105
  cs nopw 0x0(%rax,%rax,1)
L9:
  xor    %ebp,%ebp
  movslq %ecx,%rbx
  jmp    L109
  nopw   0x0(%rax,%rax,1)
L47:
  lea    (%r12,%rbx,1),%rax
  movzbl (%rax,%rbp,1),%eax
  mov    %al,(%r12,%rbp,1)
  add    $0x1,%rbp
L109:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    (%r12,%rbp,1),%rdx
  cmp    %ebp,%eax
  jg     L47
  movb   $0x0,(%rdx)
L102:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    -0x1(%rax),%ebp
  movslq %ebp,%rbx
  movzbl (%r12,%rbx,1),%edx
  cmp    $0x20,%dl
  ja     L97
  movabs $0xfffffffeffffd9ff,%rcx
  bt     %rdx,%rcx
  jb     L97
  sub    $0x2,%eax
  movslq %eax,%rbx
  nopl   0x0(%rax)
L8:
  movzbl (%r12,%rbx,1),%eax
  mov    %ebx,%ebp
  cmp    $0x20,%al
  jbe    L113
L97:
  mov    %r12,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %ebp,%eax
  jle    L100
  movb   $0x0,0x1(%r12,%rbx,1)
L100:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L113:
  bt     %rax,%rcx
  lea    -0x1(%rbx),%rdx
  jb     L97
  mov    %rdx,%rbx
  jmp    L8
```

assistant: ```c
char *trim(char *s) {
  int i = 0, j;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i++;
  }
  if (i > 0) {
    for (j = 0; j < strlen(s); j++) {
      s[j] = s[j + i];
    }
    s[j] = '\0';
  }
  i = strlen(s) - 1;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i--;
  }
  if (i < (strlen(s) - 1)) {
    s[i + 1] = '\0';
  }
  return s;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<trim>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movzbl (%rdi),%eax
  cmp    $0x20,%al
  ja     L101
  movabs $0xfffffffeffffd9ff,%rsi
  bt     %rax,%rsi
  jb     L101
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L116:
  movzbl (%r12,%rax,1),%edx
  mov    %eax,%ecx
  cmp    $0x20,%dl
  ja     L105
  add    $0x1,%rax
  bt     %rdx,%rsi
  jae    L116
  cs nopw 0x0(%rax,%rax,1)
L105:
  xor    %ebp,%ebp
  movslq %ecx,%rbx
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L27:
  lea    (%r12,%rbx,1),%rax
  movzbl (%rax,%rbp,1),%eax
  mov    %al,(%r12,%rbp,1)
  add    $0x1,%rbp
L37:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    (%r12,%rbp,1),%rdx
  cmp    %ebp,%eax
  jg     L27
  movb   $0x0,(%rdx)
L101:
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    -0x1(%rax),%ebp
  movslq %ebp,%rbx
  movzbl (%r12,%rbx,1),%edx
  cmp    $0x20,%dl
  ja     L48
  movabs $0xfffffffeffffd9ff,%rcx
  bt     %rdx,%rcx
  jb     L48
  sub    $0x2,%eax
  movslq %eax,%rbx
  nopl   0x0(%rax)
L58:
  movzbl (%r12,%rbx,1),%eax
  mov    %ebx,%ebp
  cmp    $0x20,%al
  jbe    L43
L48:
  mov    %r12,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cmp    %ebp,%eax
  jle    L11
  movb   $0x0,0x1(%r12,%rbx,1)
L11:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L43:
  bt     %rax,%rcx
  lea    -0x1(%rbx),%rdx
  jb     L48
  mov    %rdx,%rbx
  jmp    L58
```

assistant: ```c
char *trim(char *s) {
  int i = 0, j;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i++;
  }
  if (i > 0) {
    for (j = 0; j < strlen(s); j++) {
      s[j] = s[j + i];
    }
    s[j] = '\0';
  }
  i = strlen(s) - 1;
  while (s[i] == ' ' || s[i] == '\t' || s[i] == '\n' || s[i] == '\r') {
    i--;
  }
  if (i < (strlen(s) - 1)) {
    s[i + 1] = '\0';
  }
  return s;
}
```
user: What is the c source code of the assembly code below?

```asm
<lib_qsort_partition>:
  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
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L11
L14:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  jl     L29
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  addl   $0x1,-0xc(%rbp)
L29:
  addl   $0x1,-0x8(%rbp)
L11:
  mov    -0x8(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L14
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0xc(%rbp),%eax
  leave
  ret
```

assistant: ```c
int lib_qsort_partition(int *array, int start, int end) {
  int pivot, partition_index, i;
  pivot = array[end];
  for (i = partition_index = start; i < end; i++) {
    if (array[i] <= pivot) {
      swap(&array[i], &array[partition_index]);
      partition_index++;
    }
  }
  swap(&array[end], &array[partition_index]);
  return partition_index;
}
```