ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below?

```asm
<c64WriteBit>:
  endbr64
  sub    $0x8,%rsp
  mov    %edx,%ecx
  movslq %esi,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x27,%rax
  mov    %esi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  mov    %eax,%r8d
  lea    (%rax,%rax,4),%edx
  shl    $0x6,%edx
  mov    %esi,%eax
  sub    %edx,%eax
  lea    0x7(%rax),%edx
  cmovns %eax,%edx
  sar    $0x3,%edx
  shl    $0x6,%edx
  mov    %eax,%esi
  sar    $0x1f,%esi
  shr    $0x1d,%esi
  add    %esi,%eax
  and    $0x7,%eax
  sub    %esi,%eax
  add    %edx,%eax
  mov    %r8d,%esi
  sar    $0x1f,%esi
  shr    $0x1d,%esi
  lea    (%r8,%rsi,1),%edx
  and    $0x7,%edx
  sub    %esi,%edx
  lea    (%rax,%rdx,8),%esi
  lea    0x7(%r8),%eax
  test   %r8d,%r8d
  cmovns %r8d,%eax
  sar    $0x3,%eax
  lea    (%rax,%rax,4),%eax
  shl    $0x9,%eax
  add    %eax,%esi
  mov    %ecx,%edx
  call   <writeBit@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void c64WriteBit(int8_t *buf, int x, int8_t val) {
  int m = x % 320;
  int xl = m % 8 + ((m / 8) * 64);
  int yl = x / 320;
  int r = yl / 8;
  int idx = ((yl % 8) * 8) + xl + (r * 320 * 8);
  writeBit(buf, idx, val);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<c64WriteBit>:
  endbr64
  movslq %esi,%rax
  mov    %edx,%r8d
  mov    %esi,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x27,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  mov    %eax,%ecx
  mov    %esi,%eax
  shl    $0x6,%edx
  sub    %edx,%eax
  lea    0x7(%rax),%edx
  mov    %eax,%esi
  cmovns %eax,%edx
  sar    $0x1f,%esi
  shr    $0x1d,%esi
  add    %esi,%eax
  sar    $0x3,%edx
  and    $0x7,%eax
  shl    $0x6,%edx
  sub    %esi,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  add    %edx,%eax
  shr    $0x1d,%esi
  lea    (%rcx,%rsi,1),%edx
  and    $0x7,%edx
  sub    %esi,%edx
  test   %ecx,%ecx
  lea    (%rax,%rdx,8),%esi
  lea    0x7(%rcx),%eax
  mov    %r8d,%edx
  cmovns %ecx,%eax
  sar    $0x3,%eax
  lea    (%rax,%rax,4),%eax
  shl    $0x9,%eax
  add    %eax,%esi
  jmp    1050 <writeBit@plt>
```

assistant: ```c
void c64WriteBit(int8_t *buf, int x, int8_t val) {
  int m = x % 320;
  int xl = m % 8 + ((m / 8) * 64);
  int yl = x / 320;
  int r = yl / 8;
  int idx = ((yl % 8) * 8) + xl + (r * 320 * 8);
  writeBit(buf, idx, val);
}
```
user: What is the c source code of the assembly code below?

```asm
<c64WriteBit>:
  endbr64
  movslq %esi,%rax
  mov    %edx,%r8d
  mov    %esi,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x27,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  mov    %eax,%ecx
  mov    %esi,%eax
  shl    $0x6,%edx
  sub    %edx,%eax
  lea    0x7(%rax),%edx
  mov    %eax,%esi
  cmovns %eax,%edx
  sar    $0x1f,%esi
  shr    $0x1d,%esi
  add    %esi,%eax
  sar    $0x3,%edx
  and    $0x7,%eax
  shl    $0x6,%edx
  sub    %esi,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  add    %edx,%eax
  shr    $0x1d,%esi
  lea    (%rcx,%rsi,1),%edx
  and    $0x7,%edx
  sub    %esi,%edx
  test   %ecx,%ecx
  lea    (%rax,%rdx,8),%esi
  lea    0x7(%rcx),%eax
  mov    %r8d,%edx
  cmovns %ecx,%eax
  sar    $0x3,%eax
  lea    (%rax,%rax,4),%eax
  shl    $0x9,%eax
  add    %eax,%esi
  jmp    1050 <writeBit@plt>
```

assistant: ```c
void c64WriteBit(int8_t *buf, int x, int8_t val) {
  int m = x % 320;
  int xl = m % 8 + ((m / 8) * 64);
  int yl = x / 320;
  int r = yl / 8;
  int idx = ((yl % 8) * 8) + xl + (r * 320 * 8);
  writeBit(buf, idx, val);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<NS_GetNameForClass>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  cmpl   $0x7,-0x14(%rbp)
  ja     L68
  mov    -0x14(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D27(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D27(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D100(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D97(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D94(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D77(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D13(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D80(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D6(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
  lea    D5(%rip),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L9
L68:
  lea    D65(%rip),%rax
  mov    %rax,-0x8(%rbp)
  nop
L9:
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D100
datatype: string
name: read_data
arguments: data_tag: D97
datatype: string
name: read_data
arguments: data_tag: D94
datatype: string
name: read_data
arguments: data_tag: D77
datatype: string
name: read_data
arguments: data_tag: D13
datatype: string
name: read_data
arguments: data_tag: D80
datatype: string
name: read_data
arguments: data_tag: D6
datatype: string
name: read_data
arguments: data_tag: D5
datatype: string
name: read_data
arguments: data_tag: D65
datatype: string

tool: D100: Recon

tool: D97: Assault

tool: D94: Commander

tool: D77: Heavy Support

tool: D13: Sniper

tool: D80: Demolishions Expert

tool: D6: Custom Class

tool: D5: no class

tool: D65: UNKNOWN

assistant: ```c
char *NS_GetNameForClass(int class_num) {
  char *classname;
  switch (class_num) {
  case 1:
    classname = "Recon";
    break;
  case 2:
    classname = "Assault";
    break;
  case 3:
    classname = "Commander";
    break;
  case 4:
    classname = "Heavy Support";
    break;
  case 5:
    classname = "Sniper";
    break;
  case 6:
    classname = "Demolishions Expert";
    break;
  case 7:
    classname = "Custom Class";
    break;
  case 0:
    classname = "no class";
    break;
  default:
    classname = "UNKNOWN";
    break;
  }
  return classname;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<NS_GetNameForClass>:
  endbr64
  cmp    $0x7,%edi
  ja     L7
  mov    %edi,%edi
  lea    D3(%rip),%rdx
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D11(%rip),%rax
  ret
  lea    D25(%rip),%rax
  ret
  lea    D45(%rip),%rax
  ret
  lea    D33(%rip),%rax
  ret
  lea    D86(%rip),%rax
  ret
  lea    D93(%rip),%rax
  ret
  lea    D14(%rip),%rax
  ret
L7:
  lea    D32(%rip),%rax
  ret
  lea    D1(%rip),%rax
  ret
```

tool_calls: name: read_data
arguments: tag: D11
data_type: string
name: read_data
arguments: tag: D25
data_type: string
name: read_data
arguments: tag: D45
data_type: string
name: read_data
arguments: tag: D33
data_type: string
name: read_data
arguments: tag: D86
data_type: string
name: read_data
arguments: tag: D93
data_type: string
name: read_data
arguments: tag: D14
data_type: string
name: read_data
arguments: tag: D32
data_type: string
name: read_data
arguments: tag: D1
data_type: string

tool: D11: Assault

tool: D25: Commander

tool: D45: Heavy Support

tool: D33: Sniper

tool: D86: Demolishions Expert

tool: D93: Custom Class

tool: D14: no class

tool: D32: UNKNOWN

tool: D1: Recon

assistant: ```c
char *NS_GetNameForClass(int class_num) {
  char *classname;
  switch (class_num) {
  case 1:
    classname = "Recon";
    break;
  case 2:
    classname = "Assault";
    break;
  case 3:
    classname = "Commander";
    break;
  case 4:
    classname = "Heavy Support";
    break;
  case 5:
    classname = "Sniper";
    break;
  case 6:
    classname = "Demolishions Expert";
    break;
  case 7:
    classname = "Custom Class";
    break;
  case 0:
    classname = "no class";
    break;
  default:
    classname = "UNKNOWN";
    break;
  }
  return classname;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<dtree_open>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <dtree_procfs_open@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L19
  mov    $0x0,%eax
  call   <dtree_error_clear@plt>
  mov    $0x0,%eax
  jmp    L2
L19:
  mov    $0x0,%eax
  call   <dtree_procfs_close@plt>
  mov    -0x4(%rbp),%eax
L2:
  leave
  ret
```

assistant: ```c
int dtree_open(const char *rootd) {
  int err = dtree_procfs_open(rootd);
  if (err == 0) {
    dtree_error_clear();
    return 0;
  }
  dtree_procfs_close();
  return err;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<dtree_open>:
  endbr64
  push   %rbx
  call   <dtree_procfs_open@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L13
  mov    $0x0,%eax
  call   <dtree_procfs_close@plt>
L9:
  mov    %ebx,%eax
  pop    %rbx
  ret
L13:
  mov    $0x0,%eax
  call   <dtree_error_clear@plt>
  jmp    L9
```

assistant: ```c
int dtree_open(const char *rootd) {
  int err = dtree_procfs_open(rootd);
  if (err == 0) {
    dtree_error_clear();
    return 0;
  }
  dtree_procfs_close();
  return err;
}
```
user: What is the c source code of the assembly code below?

```asm
<dtree_open>:
  endbr64
  push   %r12
  call   <dtree_procfs_open@plt>
  test   %eax,%eax
  mov    %eax,%r12d
  mov    $0x0,%eax
  je     L6
  call   <dtree_procfs_close@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L6:
  call   <dtree_error_clear@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
```

assistant: ```c
int dtree_open(const char *rootd) {
  int err = dtree_procfs_open(rootd);
  if (err == 0) {
    dtree_error_clear();
    return 0;
  }
  dtree_procfs_close();
  return err;
}
```
user: Translate the below assembly code into C programming language:

```asm
<dtree_open>:
  endbr64
  push   %r12
  call   <dtree_procfs_open@plt>
  test   %eax,%eax
  mov    %eax,%r12d
  mov    $0x0,%eax
  je     L2
  call   <dtree_procfs_close@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L2:
  call   <dtree_error_clear@plt>
  mov    %r12d,%eax
  pop    %r12
  ret
```

assistant: ```c
int dtree_open(const char *rootd) {
  int err = dtree_procfs_open(rootd);
  if (err == 0) {
    dtree_error_clear();
    return 0;
  }
  dtree_procfs_close();
  return err;
}
```
user: Translate the below assembly code into C programming language:

```asm
<strnstr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x8(%rbp)
  jmp    L28
L21:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L47
  mov    -0x18(%rbp),%rax
  jmp    L8
L47:
  addq   $0x1,-0x18(%rbp)
L28:
  mov    -0x10(%rbp),%rax
  sub    -0x18(%rbp),%rax
  cmp    %rax,-0x8(%rbp)
  ja     L39
  mov    -0x10(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L21
L39:
  mov    $0x0,%eax
L8:
  leave
  ret
```

assistant: ```c
const char *strnstr(const char *haystack, const char *needle, size_t len) {
  const char *eohs = haystack + len;
  size_t nl = strlen(needle);
  while (eohs - haystack >= nl && (haystack = memchr(haystack, needle[0], eohs - haystack)))
    if (!memcmp(haystack, needle, nl))
      return haystack;
    else
      haystack++;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strnstr>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r14
  lea    (%rdi,%rdx,1),%r13
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %rax,%r12
  mov    %r14,%rdx
  cmp    %rax,%r14
  jb     L22
L35:
  movsbl 0x0(%rbp),%esi
  mov    %rbx,%rdi
  call   <memchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L47
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L47
  add    $0x1,%rbx
  mov    %r13,%rdx
  sub    %rbx,%rdx
  cmp    %r12,%rdx
  jae    L35
  mov    $0x0,%ebx
L47:
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L22:
  mov    $0x0,%ebx
  jmp    L47
```

assistant: ```c
const char *strnstr(const char *haystack, const char *needle, size_t len) {
  const char *eohs = haystack + len;
  size_t nl = strlen(needle);
  while (eohs - haystack >= nl && (haystack = memchr(haystack, needle[0], eohs - haystack)))
    if (!memcmp(haystack, needle, nl))
      return haystack;
    else
      haystack++;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<strnstr>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  lea    (%rdi,%rdx,1),%r13
  push   %r12
  mov    %rdi,%r12
  mov    %rsi,%rdi
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  call   <strlen@plt>
  mov    %r14,%rdx
  mov    %rax,%rbp
  cmp    %rax,%r14
  jae    L22
  jmp    L25
  xchg   %ax,%ax
L40:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L42
  add    $0x1,%r12
  mov    %r13,%rdx
  sub    %r12,%rdx
  cmp    %rbp,%rdx
  jb     L25
L22:
  movsbl (%rbx),%esi
  mov    %r12,%rdi
  call   <memchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L40
L25:
  xor    %r12d,%r12d
L42:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
const char *strnstr(const char *haystack, const char *needle, size_t len) {
  const char *eohs = haystack + len;
  size_t nl = strlen(needle);
  while (eohs - haystack >= nl && (haystack = memchr(haystack, needle[0], eohs - haystack)))
    if (!memcmp(haystack, needle, nl))
      return haystack;
    else
      haystack++;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strnstr>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  lea    (%rdi,%rdx,1),%r13
  push   %r12
  mov    %rdi,%r12
  mov    %rsi,%rdi
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  call   <strlen@plt>
  mov    %r14,%rdx
  mov    %rax,%rbp
  cmp    %rax,%r14
  jae    L32
  jmp    L24
  xchg   %ax,%ax
L11:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L47
  add    $0x1,%r12
  mov    %r13,%rdx
  sub    %r12,%rdx
  cmp    %rbp,%rdx
  jb     L24
L32:
  movsbl (%rbx),%esi
  mov    %r12,%rdi
  call   <memchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L11
L24:
  xor    %r12d,%r12d
L47:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
const char *strnstr(const char *haystack, const char *needle, size_t len) {
  const char *eohs = haystack + len;
  size_t nl = strlen(needle);
  while (eohs - haystack >= nl && (haystack = memchr(haystack, needle[0], eohs - haystack)))
    if (!memcmp(haystack, needle, nl))
      return haystack;
    else
      haystack++;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<UnCompressSrc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L49
L63:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  jne    L29
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %eax,-0x24(%rbp)
  jmp    L58
L29:
  addl   $0x1,-0x24(%rbp)
L58:
  addq   $0x1,-0x18(%rbp)
L49:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L63
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <egmalloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L19
L42:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  jne    L97
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L40
L88:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x20,(%rax)
  addl   $0x1,-0x20(%rbp)
L40:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L88
  jmp    L4
L97:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x18(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L4:
  addq   $0x1,-0x18(%rbp)
L19:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L42
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *UnCompressSrc(char *pszSrc) {
  char *p1 = pszSrc;
  int iLen = 0;
  char *p2;
  char *pszExpanded;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      iLen += *(++p1);
    } else {
      ++iLen;
    }
    ++p1;
  }
  pszExpanded = (char *)egmalloc(iLen + 1);
  p2 = pszExpanded;
  p1 = pszSrc;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      int iSpaces = (unsigned)*(++p1);
      int i;
      for (i = 0; i < iSpaces; i++) {
        *p2++ = ' ';
      }
    } else {
      *p2++ = *p1;
    }
    ++p1;
  }
  *p2 = 0;
  return (pszExpanded);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<UnCompressSrc>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L27
  mov    %rdi,%rdx
  mov    $0x0,%edi
  jmp    L98
L4:
  lea    0x1(%rdx),%rax
  movsbl 0x1(%rdx),%edx
  add    %edx,%edi
L0:
  lea    0x1(%rax),%rdx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L96
L98:
  cmp    $0xff,%al
  je     L4
  add    $0x1,%edi
  mov    %rdx,%rax
  jmp    L0
L27:
  mov    $0x0,%edi
L96:
  add    $0x1,%edi
  call   <egmalloc@plt>
  movzbl (%rbx),%ecx
  test   %cl,%cl
  je     L5
  mov    %rax,%rdx
  jmp    L41
L81:
  lea    0x1(%rbx),%rcx
  movzbl 0x1(%rbx),%esi
  test   %sil,%sil
  jle    L65
  movsbl %sil,%esi
  add    %rdx,%rsi
L66:
  add    $0x1,%rdx
  movb   $0x20,-0x1(%rdx)
  cmp    %rdx,%rsi
  jne    L66
  mov    %rsi,%rdx
L65:
  lea    0x1(%rcx),%rbx
  movzbl 0x1(%rcx),%ecx
  test   %cl,%cl
  je     L103
L41:
  cmp    $0xff,%cl
  je     L81
  mov    %cl,(%rdx)
  lea    0x1(%rdx),%rdx
  mov    %rbx,%rcx
  jmp    L65
L5:
  mov    %rax,%rdx
L103:
  movb   $0x0,(%rdx)
  pop    %rbx
  ret
```

assistant: ```c
char *UnCompressSrc(char *pszSrc) {
  char *p1 = pszSrc;
  int iLen = 0;
  char *p2;
  char *pszExpanded;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      iLen += *(++p1);
    } else {
      ++iLen;
    }
    ++p1;
  }
  pszExpanded = (char *)egmalloc(iLen + 1);
  p2 = pszExpanded;
  p1 = pszSrc;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      int iSpaces = (unsigned)*(++p1);
      int i;
      for (i = 0; i < iSpaces; i++) {
        *p2++ = ' ';
      }
    } else {
      *p2++ = *p1;
    }
    ++p1;
  }
  *p2 = 0;
  return (pszExpanded);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<UnCompressSrc>:
  endbr64
  push   %rbx
  movzbl (%rdi),%eax
  mov    %rdi,%rbx
  test   %al,%al
  je     L156
  mov    %rdi,%rdx
  xor    %edi,%edi
  jmp    L103
  nopw   0x0(%rax,%rax,1)
L75:
  mov    %rdx,%rax
  add    $0x1,%edi
  lea    0x1(%rax),%rdx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L72
L103:
  cmp    $0xff,%al
  jne    L75
  lea    0x1(%rdx),%rax
  movsbl 0x1(%rdx),%edx
  add    %edx,%edi
  lea    0x1(%rax),%rdx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  jne    L103
L72:
  add    $0x1,%edi
L2:
  call   <egmalloc@plt>
  movzbl (%rbx),%edx
  mov    %rax,%r9
  mov    %rax,%r8
  test   %dl,%dl
  je     L66
  movabs $0x2020202020202020,%rax
  jmp    L0
  nopl   (%rax)
L109:
  mov    %dl,(%r8)
  mov    %rbx,%rsi
  add    $0x1,%r8
L94:
  movzbl 0x1(%rsi),%edx
  lea    0x1(%rsi),%rbx
  test   %dl,%dl
  je     L66
L0:
  lea    0x1(%rbx),%rsi
  cmp    $0xff,%dl
  jne    L109
  movsbq 0x1(%rbx),%rdx
  test   %dl,%dl
  jle    L94
  cmp    $0x8,%edx
  jae    L186
  test   $0x4,%dl
  jne    L14
  test   %edx,%edx
  jne    L82
L18:
  add    %rdx,%r8
L13:
  movzbl 0x1(%rsi),%edx
  lea    0x1(%rsi),%rbx
  test   %dl,%dl
  jne    L0
L66:
  movb   $0x0,(%r8)
  mov    %r9,%rax
  pop    %rbx
  ret
  xchg   %ax,%ax
L186:
  mov    %edx,%ecx
  lea    0x8(%r8),%rdi
  mov    %rax,(%r8)
  and    $0xfffffffffffffff8,%rdi
  mov    %rax,-0x8(%r8,%rcx,1)
  mov    %r8,%rcx
  add    %rdx,%r8
  sub    %rdi,%rcx
  add    %edx,%ecx
  shr    $0x3,%ecx
  rep stos %rax,%es:(%rdi)
  jmp    L13
  nopl   (%rax)
L82:
  movb   $0x20,(%r8)
  test   $0x2,%dl
  je     L18
  mov    %edx,%ecx
  mov    $0x2020,%edi
  mov    %di,-0x2(%r8,%rcx,1)
  jmp    L18
L156:
  mov    $0x1,%edi
  jmp    L2
L14:
  mov    %edx,%ecx
  movl   $0x20202020,(%r8)
  movl   $0x20202020,-0x4(%r8,%rcx,1)
  jmp    L18
```

assistant: ```c
char *UnCompressSrc(char *pszSrc) {
  char *p1 = pszSrc;
  int iLen = 0;
  char *p2;
  char *pszExpanded;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      iLen += *(++p1);
    } else {
      ++iLen;
    }
    ++p1;
  }
  pszExpanded = (char *)egmalloc(iLen + 1);
  p2 = pszExpanded;
  p1 = pszSrc;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      int iSpaces = (unsigned)*(++p1);
      int i;
      for (i = 0; i < iSpaces; i++) {
        *p2++ = ' ';
      }
    } else {
      *p2++ = *p1;
    }
    ++p1;
  }
  *p2 = 0;
  return (pszExpanded);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<UnCompressSrc>:
  endbr64
  push   %rbx
  movzbl (%rdi),%edx
  mov    %rdi,%rbx
  test   %dl,%dl
  je     L50
  mov    %rdi,%rax
  xor    %edi,%edi
  jmp    L145
  nopw   0x0(%rax,%rax,1)
L76:
  movzbl 0x1(%rax),%edx
  add    $0x1,%edi
  lea    0x1(%rax),%rcx
  test   %dl,%dl
  je     L75
L126:
  mov    %rcx,%rax
L145:
  cmp    $0xff,%dl
  jne    L76
  movsbl 0x1(%rax),%edx
  lea    0x2(%rax),%rcx
  add    %edx,%edi
  movzbl 0x2(%rax),%edx
  test   %dl,%dl
  jne    L126
L75:
  add    $0x1,%edi
L155:
  call   <egmalloc@plt>
  movzbl (%rbx),%edx
  mov    %rax,%r9
  mov    %rax,%r8
  test   %dl,%dl
  je     L189
  movabs $0x2020202020202020,%rax
  jmp    L113
  nopw   0x0(%rax,%rax,1)
L166:
  mov    %dl,(%r8)
  mov    %rbx,%rsi
  add    $0x1,%r8
L78:
  movzbl 0x1(%rsi),%edx
  lea    0x1(%rsi),%rbx
  test   %dl,%dl
  je     L189
L113:
  lea    0x1(%rbx),%rsi
  cmp    $0xff,%dl
  jne    L166
  movsbq 0x1(%rbx),%rdx
  test   %dl,%dl
  jle    L78
  cmp    $0x8,%edx
  jae    L154
  test   $0x4,%dl
  jne    L88
  test   %edx,%edx
  jne    L87
L96:
  add    %rdx,%r8
L118:
  movzbl 0x1(%rsi),%edx
  lea    0x1(%rsi),%rbx
  test   %dl,%dl
  jne    L113
L189:
  movb   $0x0,(%r8)
  mov    %r9,%rax
  pop    %rbx
  ret
  xchg   %ax,%ax
L154:
  mov    %edx,%ecx
  lea    0x8(%r8),%rdi
  mov    %rax,(%r8)
  and    $0xfffffffffffffff8,%rdi
  mov    %rax,-0x8(%r8,%rcx,1)
  mov    %r8,%rcx
  add    %rdx,%r8
  sub    %rdi,%rcx
  add    %edx,%ecx
  shr    $0x3,%ecx
  rep stos %rax,%es:(%rdi)
  jmp    L118
  nopl   (%rax)
L87:
  movb   $0x20,(%r8)
  test   $0x2,%dl
  je     L96
  mov    %edx,%ecx
  mov    $0x2020,%edi
  mov    %di,-0x2(%r8,%rcx,1)
  jmp    L96
L50:
  mov    $0x1,%edi
  jmp    L155
L88:
  mov    %edx,%ecx
  movl   $0x20202020,(%r8)
  movl   $0x20202020,-0x4(%r8,%rcx,1)
  jmp    L96
```

assistant: ```c
char *UnCompressSrc(char *pszSrc) {
  char *p1 = pszSrc;
  int iLen = 0;
  char *p2;
  char *pszExpanded;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      iLen += *(++p1);
    } else {
      ++iLen;
    }
    ++p1;
  }
  pszExpanded = (char *)egmalloc(iLen + 1);
  p2 = pszExpanded;
  p1 = pszSrc;
  while (*p1) {
    if (*p1 == (char)0xFF) {
      int iSpaces = (unsigned)*(++p1);
      int i;
      for (i = 0; i < iSpaces; i++) {
        *p2++ = ' ';
      }
    } else {
      *p2++ = *p1;
    }
    ++p1;
  }
  *p2 = 0;
  return (pszExpanded);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<nc_inq_base_pe>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movl   $0x0,(%rax)
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int nc_inq_base_pe(int ncid, int *pe) {
  *pe = 0;
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<nc_inq_base_pe>:
  endbr64
  movl   $0x0,(%rsi)
  mov    $0x0,%eax
  ret
```

assistant: ```c
int nc_inq_base_pe(int ncid, int *pe) {
  *pe = 0;
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<nc_inq_base_pe>:
  endbr64
  movl   $0x0,(%rsi)
  xor    %eax,%eax
  ret
```

assistant: ```c
int nc_inq_base_pe(int ncid, int *pe) {
  *pe = 0;
  return 0;
}
```