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

```asm
<__rawmemchr>:
  endbr64
  mov    %rdi,%rax
  mov    %esi,%ecx
  test   $0x7,%al
  jne    L75
  jmp    L27
  nop
L56:
  add    $0x1,%rax
  test   $0x7,%al
  je     L27
L75:
  cmp    %cl,(%rax)
  jne    L56
  mov    %rax,%r8
L77:
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L27:
  movzbl %sil,%esi
  mov    %esi,%edx
  shl    $0x8,%edx
  or     %esi,%edx
  movslq %edx,%rdx
  mov    %rdx,%rdi
  shl    $0x10,%rdi
  or     %rdx,%rdi
L48:
  mov    %rax,%r8
  lea    0x8(%rax),%rax
  mov    (%r8),%rsi
  xor    %rdi,%rsi
  lea    0x7efefeff(%rsi),%rdx
  xor    %rsi,%rdx
  or     $0x7efefeff,%rdx
  cmp    $0xffffffffffffffff,%rdx
  je     L48
  cmp    %cl,-0x8(%rax)
  je     L77
  cmp    %cl,-0x7(%rax)
  je     L44
  cmp    %cl,-0x6(%rax)
  je     L22
  cmp    %cl,-0x5(%rax)
  jne    L48
  add    $0x3,%r8
  mov    %r8,%rax
  ret
L44:
  add    $0x1,%r8
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L22:
  add    $0x2,%r8
  mov    %r8,%rax
  ret
```

assistant: ```c
void *__rawmemchr(s, c_in) const void *s;
int c_in;
{
  const unsigned char *char_ptr;
  const unsigned long int *longword_ptr;
  unsigned long int longword, magic_bits, charmask;
  unsigned char c;
  c = (unsigned char)c_in;
  for (char_ptr = (const unsigned char *)s; ((unsigned long int)char_ptr & (sizeof(longword) - 1)) != 0; ++char_ptr)
    if (*char_ptr == c)
      return (void *)char_ptr;
  longword_ptr = (unsigned long int *)char_ptr;
  if (sizeof(longword) != 4 && sizeof(longword) != 8)
    abort();
  magic_bits = 0x7efefeff;
  charmask = c | (c << 8);
  charmask |= charmask << 16;
  while (1) {
    longword = *longword_ptr++ ^ charmask;
    if ((((longword + magic_bits) ^ ~longword) & ~magic_bits) != 0) {
      const unsigned char *cp = (const unsigned char *)(longword_ptr - 1);
      if (cp[0] == c)
        return (void *)cp;
      if (cp[1] == c)
        return (void *)&cp[1];
      if (cp[2] == c)
        return (void *)&cp[2];
      if (cp[3] == c)
        return (void *)&cp[3];
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__rawmemchr>:
  endbr64
  mov    %rdi,%rax
  mov    %esi,%ecx
  test   $0x7,%al
  jne    L65
  jmp    L74
  nop
L81:
  add    $0x1,%rax
  test   $0x7,%al
  je     L74
L65:
  cmp    %cl,(%rax)
  jne    L81
  mov    %rax,%r8
L2:
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L74:
  movzbl %sil,%esi
  mov    %esi,%edx
  shl    $0x8,%edx
  or     %esi,%edx
  movslq %edx,%rdx
  mov    %rdx,%rdi
  shl    $0x10,%rdi
  or     %rdx,%rdi
L6:
  mov    %rax,%r8
  lea    0x8(%rax),%rax
  mov    (%r8),%rsi
  xor    %rdi,%rsi
  lea    0x7efefeff(%rsi),%rdx
  xor    %rsi,%rdx
  or     $0x7efefeff,%rdx
  cmp    $0xffffffffffffffff,%rdx
  je     L6
  cmp    %cl,-0x8(%rax)
  je     L2
  cmp    %cl,-0x7(%rax)
  je     L40
  cmp    %cl,-0x6(%rax)
  je     L71
  cmp    %cl,-0x5(%rax)
  jne    L6
  add    $0x3,%r8
  mov    %r8,%rax
  ret
L40:
  add    $0x1,%r8
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L71:
  add    $0x2,%r8
  mov    %r8,%rax
  ret
```

assistant: ```c
void *__rawmemchr(s, c_in) const void *s;
int c_in;
{
  const unsigned char *char_ptr;
  const unsigned long int *longword_ptr;
  unsigned long int longword, magic_bits, charmask;
  unsigned char c;
  c = (unsigned char)c_in;
  for (char_ptr = (const unsigned char *)s; ((unsigned long int)char_ptr & (sizeof(longword) - 1)) != 0; ++char_ptr)
    if (*char_ptr == c)
      return (void *)char_ptr;
  longword_ptr = (unsigned long int *)char_ptr;
  if (sizeof(longword) != 4 && sizeof(longword) != 8)
    abort();
  magic_bits = 0x7efefeff;
  charmask = c | (c << 8);
  charmask |= charmask << 16;
  while (1) {
    longword = *longword_ptr++ ^ charmask;
    if ((((longword + magic_bits) ^ ~longword) & ~magic_bits) != 0) {
      const unsigned char *cp = (const unsigned char *)(longword_ptr - 1);
      if (cp[0] == c)
        return (void *)cp;
      if (cp[1] == c)
        return (void *)&cp[1];
      if (cp[2] == c)
        return (void *)&cp[2];
      if (cp[3] == c)
        return (void *)&cp[3];
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<free_contiguous_mem3>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void free_contiguous_mem3(void ***mem) {
  free(mem[0][0]);
  free(mem[0]);
  free(mem);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<free_contiguous_mem3>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rax
  mov    (%rax),%rdi
  call   <free@plt>
  mov    (%rbx),%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  pop    %rbx
  ret
```

assistant: ```c
void free_contiguous_mem3(void ***mem) {
  free(mem[0][0]);
  free(mem[0]);
  free(mem);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<free_contiguous_mem3>:
  endbr64
  push   %rbp
  mov    (%rdi),%rax
  mov    %rdi,%rbp
  mov    (%rax),%rdi
  call   <free@plt>
  mov    0x0(%rbp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1050 <free@plt>
```

assistant: ```c
void free_contiguous_mem3(void ***mem) {
  free(mem[0][0]);
  free(mem[0]);
  free(mem);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<free_contiguous_mem3>:
  endbr64
  push   %rbp
  mov    (%rdi),%rax
  mov    %rdi,%rbp
  mov    (%rax),%rdi
  call   <free@plt>
  mov    0x0(%rbp),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1050 <free@plt>
```

assistant: ```c
void free_contiguous_mem3(void ***mem) {
  free(mem[0][0]);
  free(mem[0]);
  free(mem);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<compare>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  jmp    L63
L18:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L50
  mov    $0x0,%eax
  jmp    L16
L50:
  addq   $0x1,-0x8(%rbp)
  addq   $0x1,-0x10(%rbp)
L63:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L18
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L43
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L78
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jge    L4
  mov    $0xfffffffe,%eax
  jmp    L16
L4:
  mov    $0x2,%eax
  jmp    L16
L78:
  mov    $0x1,%eax
  jmp    L16
L43:
  mov    $0xffffffff,%eax
L16:
  pop    %rbp
  ret
```

assistant: ```c
int compare(char *s, char *t) {
  for (; *s == *t; s++, t++)
    if (*s == 0)
      return (0);
  return (*s == 0 ? -1 : *t == 0 ? 1 : *s < *t ? -2 : 2);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<compare>:
  endbr64
  movzbl (%rdi),%edx
  movzbl (%rsi),%ecx
  cmp    %cl,%dl
  jne    L22
  mov    $0x1,%eax
L39:
  test   %dl,%dl
  je     L46
  movzbl (%rdi,%rax,1),%edx
  add    $0x1,%rax
  movzbl -0x1(%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L39
L22:
  test   %dl,%dl
  je     L10
  mov    $0x1,%eax
  test   %cl,%cl
  je     L28
  cmp    %cl,%dl
  setge  %al
  movzbl %al,%eax
  lea    -0x2(,%rax,4),%eax
  ret
L46:
  mov    $0x0,%eax
  ret
L10:
  mov    $0xffffffff,%eax
L28:
  ret
```

assistant: ```c
int compare(char *s, char *t) {
  for (; *s == *t; s++, t++)
    if (*s == 0)
      return (0);
  return (*s == 0 ? -1 : *t == 0 ? 1 : *s < *t ? -2 : 2);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<compare>:
  endbr64
  movzbl (%rdi),%edx
  movzbl (%rsi),%ecx
  cmp    %dl,%cl
  jne    L36
  mov    $0x1,%eax
  jmp    L28
  nopl   (%rax)
L14:
  movzbl (%rdi,%rax,1),%edx
  add    $0x1,%rax
  movzbl -0x1(%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  jne    L36
L28:
  test   %dl,%dl
  jne    L14
  xor    %eax,%eax
  ret
L36:
  test   %dl,%dl
  je     L4
  mov    $0x1,%eax
  test   %cl,%cl
  je     L5
  xor    %eax,%eax
  cmp    %cl,%dl
  setge  %al
  lea    -0x2(,%rax,4),%eax
  ret
L4:
  mov    $0xffffffff,%eax
L5:
  ret
```

assistant: ```c
int compare(char *s, char *t) {
  for (; *s == *t; s++, t++)
    if (*s == 0)
      return (0);
  return (*s == 0 ? -1 : *t == 0 ? 1 : *s < *t ? -2 : 2);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<compare>:
  endbr64
  movzbl (%rdi),%edx
  movzbl (%rsi),%ecx
  cmp    %dl,%cl
  jne    L32
  mov    $0x1,%eax
  jmp    L49
  nopl   (%rax)
L33:
  movzbl (%rdi,%rax,1),%edx
  add    $0x1,%rax
  movzbl -0x1(%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  jne    L32
L49:
  test   %dl,%dl
  jne    L33
  xor    %eax,%eax
  ret
L32:
  test   %dl,%dl
  je     L23
  mov    $0x1,%eax
  test   %cl,%cl
  je     L10
  xor    %eax,%eax
  cmp    %cl,%dl
  setge  %al
  lea    -0x2(,%rax,4),%eax
  ret
L23:
  mov    $0xffffffff,%eax
L10:
  ret
```

assistant: ```c
int compare(char *s, char *t) {
  for (; *s == *t; s++, t++)
    if (*s == 0)
      return (0);
  return (*s == 0 ? -1 : *t == 0 ? 1 : *s < *t ? -2 : 2);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<transform>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %rcx,-0x40(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L16
L4:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x30(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    -0x40(%rbp),%rdx
  movq   %rax,%xmm0
  call   *%rdx
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x14(%rbp)
L16:
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L4
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void transform(double source[], double target[], int size, double (*func)(double)) {
  int i;
  for (i = 0; i < size; i++) {
    target[i] = func(source[i]);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<transform>:
  endbr64
  test   %edx,%edx
  jle    L10
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rcx,%r14
  mov    %edx,%ebp
  mov    $0x0,%ebx
L19:
  movsd  (%r12,%rbx,8),%xmm0
  call   *%r14
  movsd  %xmm0,0x0(%r13,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L19
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L10:
  ret
```

assistant: ```c
void transform(double source[], double target[], int size, double (*func)(double)) {
  int i;
  for (i = 0; i < size; i++) {
    target[i] = func(source[i]);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<transform>:
  endbr64
  test   %edx,%edx
  jle    L1
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  movslq %edx,%rbp
  push   %rbx
  xor    %ebx,%ebx
  xchg   %ax,%ax
L6:
  movsd  (%r14,%rbx,8),%xmm0
  call   *%r13
  movsd  %xmm0,(%r12,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L6
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L1:
  ret
```

assistant: ```c
void transform(double source[], double target[], int size, double (*func)(double)) {
  int i;
  for (i = 0; i < size; i++) {
    target[i] = func(source[i]);
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<transform>:
  endbr64
  test   %edx,%edx
  jle    L12
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  movslq %edx,%rbp
  push   %rbx
  xor    %ebx,%ebx
  xchg   %ax,%ax
L17:
  movsd  (%r14,%rbx,8),%xmm0
  call   *%r13
  movsd  %xmm0,(%r12,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  jne    L17
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L12:
  ret
```

assistant: ```c
void transform(double source[], double target[], int size, double (*func)(double)) {
  int i;
  for (i = 0; i < size; i++) {
    target[i] = func(source[i]);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<pragerror>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x210,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x210(%rbp),%rax
  mov    $0x1,%edx
  mov    $0x1fe,%esi
  mov    %rax,%rdi
  call   <readline@plt>
  mov    %eax,%edx
  lea    D5(%rip),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <non_fatal@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L3
  call   <__stack_chk_fail@plt>
L3:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D5
type_infered: string

tool: 

assistant: ```c
void pragerror() {
  char msgbuf[510];
  non_fatal(readline(msgbuf, 510, 0x0001), "");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<pragerror>:
  endbr64
  sub    $0x218,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x1,%edx
  mov    $0x1fe,%esi
  call   <readline@plt>
  mov    %eax,%edi
  lea    D0(%rip),%rsi
  call   <non_fatal@plt>
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x218,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D0
type_guessed: string

tool: 

assistant: ```c
void pragerror() {
  char msgbuf[510];
  non_fatal(readline(msgbuf, 510, 0x0001), "");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<pragerror>:
  endbr64
  sub    $0x218,%rsp
  mov    $0x1fe,%esi
  mov    $0x1,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <readline@plt>
  lea    D4(%rip),%rsi
  mov    %eax,%edi
  call   <non_fatal@plt>
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x218,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D4
type: string

tool: 

assistant: ```c
void pragerror() {
  char msgbuf[510];
  non_fatal(readline(msgbuf, 510, 0x0001), "");
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<pragerror>:
  endbr64
  sub    $0x218,%rsp
  mov    $0x1fe,%esi
  mov    $0x1,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <readline@plt>
  lea    D7(%rip),%rsi
  mov    %eax,%edi
  call   <non_fatal@plt>
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x218,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D7
type: string

tool: 

assistant: ```c
void pragerror() {
  char msgbuf[510];
  non_fatal(readline(msgbuf, 510, 0x0001), "");
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<get_good_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L109
  mov    $0x0,%eax
  call   <error@plt>
L109:
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L58
L26:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L42
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jle    L83
L42:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L107
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jle    L83
L107:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L46
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L83
L46:
  mov    -0x10(%rbp),%rax
  movb   $0x5f,(%rax)
L83:
  addq   $0x1,-0x10(%rbp)
L58:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L26
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L19
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L19
  mov    -0x10(%rbp),%rax
  movb   $0x5f,(%rax)
L19:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *get_good_name(const char *filename) {
  char *new;
  char *save;
  if ((new = strdup(filename)) == NULL)
    error();
  save = new;
  while (*new) {
    if (!((*new >= 'a' && *new <= 'z') || (*new >= 'A' && *new <= 'Z') || (*new >= '0' && *new <= '9')))
      *new = '_';
    ++new;
  }
  if (*new >= '0' && *new <= '9')
    *new = '_';
  return (save);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<get_good_name>:
  endbr64
  push   %rbx
  call   <strdup@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L49
L74:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L12
  mov    %rbx,%rcx
  jmp    L69
L49:
  mov    $0x0,%eax
  call   <error@plt>
  jmp    L74
L15:
  add    $0x1,%rcx
  movzbl (%rcx),%eax
  test   %al,%al
  je     L12
L69:
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  sub    $0x41,%edx
  cmp    $0x19,%dl
  jbe    L15
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L15
  movb   $0x5f,(%rcx)
  jmp    L15
L12:
  mov    %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *get_good_name(const char *filename) {
  char *new;
  char *save;
  if ((new = strdup(filename)) == NULL)
    error();
  save = new;
  while (*new) {
    if (!((*new >= 'a' && *new <= 'z') || (*new >= 'A' && *new <= 'Z') || (*new >= '0' && *new <= '9')))
      *new = '_';
    ++new;
  }
  if (*new >= '0' && *new <= '9')
    *new = '_';
  return (save);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<get_good_name>:
  endbr64
  sub    $0x8,%rsp
  call   <strdup@plt>
  test   %rax,%rax
  je     1080 <get_good_name.cold>
  movzbl (%rax),%edx
  mov    %rax,%rsi
  test   %dl,%dl
  je     L10
L20:
  mov    %edx,%ecx
  and    $0xffffffdf,%ecx
  sub    $0x41,%ecx
  cmp    $0x19,%cl
  jbe    L27
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L27
  movb   $0x5f,(%rsi)
L27:
  movzbl 0x1(%rsi),%edx
  add    $0x1,%rsi
  test   %dl,%dl
  jne    L20
L10:
  add    $0x8,%rsp
  ret
```

assistant: ```c
char *get_good_name(const char *filename) {
  char *new;
  char *save;
  if ((new = strdup(filename)) == NULL)
    error();
  save = new;
  while (*new) {
    if (!((*new >= 'a' && *new <= 'z') || (*new >= 'A' && *new <= 'Z') || (*new >= '0' && *new <= '9')))
      *new = '_';
    ++new;
  }
  if (*new >= '0' && *new <= '9')
    *new = '_';
  return (save);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<get_good_name>:
  endbr64
  sub    $0x8,%rsp
  call   <strdup@plt>
  test   %rax,%rax
  je     1080 <get_good_name.cold>
  movzbl (%rax),%edx
  mov    %rax,%rsi
  test   %dl,%dl
  je     L11
L7:
  mov    %edx,%ecx
  and    $0xffffffdf,%ecx
  sub    $0x41,%ecx
  cmp    $0x19,%cl
  jbe    L4
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L4
  movb   $0x5f,(%rsi)
L4:
  movzbl 0x1(%rsi),%edx
  add    $0x1,%rsi
  test   %dl,%dl
  jne    L7
L11:
  add    $0x8,%rsp
  ret
```

assistant: ```c
char *get_good_name(const char *filename) {
  char *new;
  char *save;
  if ((new = strdup(filename)) == NULL)
    error();
  save = new;
  while (*new) {
    if (!((*new >= 'a' && *new <= 'z') || (*new >= 'A' && *new <= 'Z') || (*new >= '0' && *new <= '9')))
      *new = '_';
    ++new;
  }
  if (*new >= '0' && *new <= '9')
    *new = '_';
  return (save);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<is_literal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L42
L81:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x5d,%eax
  je     L157
  cmp    $0x5d,%eax
  jg     L117
  cmp    $0x5c,%eax
  je     L58
  cmp    $0x5c,%eax
  jg     L117
  cmp    $0x5b,%eax
  je     L62
  cmp    $0x5b,%eax
  jg     L117
  cmp    $0x2a,%eax
  je     L48
  cmp    $0x3f,%eax
  je     L48
  jmp    L117
L58:
  cmpl   $0x0,-0x1c(%rbp)
  je     L21
L48:
  mov    $0x0,%eax
  jmp    L116
L62:
  movl   $0x1,-0x4(%rbp)
  jmp    L117
L157:
  cmpl   $0x0,-0x4(%rbp)
  je     L57
  mov    $0x0,%eax
  jmp    L116
L21:
  nop
  jmp    L117
L57:
  nop
L117:
  addq   $0x1,-0x18(%rbp)
L42:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L81
  mov    $0x1,%eax
L116:
  pop    %rbp
  ret
```

assistant: ```c
int is_literal(const char *p, int useesc) {
  int bracket = 0;
  for (; *p; p++) {
    switch (*p) {
    case '\\':
      if (!useesc)
        break;
    case '?':
    case '*':
      return 0;
    case '[':
      bracket = 1;
      break;
    case ']':
      if (bracket)
        return 0;
      break;
    }
  }
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<is_literal>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L49
  mov    $0x0,%edx
  mov    $0x1,%ecx
  jmp    L63
L82:
  cmp    $0x5d,%al
  jne    L66
  test   %edx,%edx
  je     L66
  mov    $0x0,%eax
  ret
L108:
  test   %esi,%esi
  je     L66
  mov    $0x0,%eax
  ret
L32:
  mov    %ecx,%edx
L66:
  add    $0x1,%rdi
  movzbl (%rdi),%eax
  test   %al,%al
  je     L71
L63:
  cmp    $0x5c,%al
  je     L108
  jg     L82
  cmp    $0x5b,%al
  je     L32
  cmp    $0x2a,%al
  je     L21
  cmp    $0x3f,%al
  jne    L66
  mov    $0x0,%eax
  ret
L71:
  mov    $0x1,%eax
  ret
L49:
  mov    $0x1,%eax
  ret
L21:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int is_literal(const char *p, int useesc) {
  int bracket = 0;
  for (; *p; p++) {
    switch (*p) {
    case '\\':
      if (!useesc)
        break;
    case '?':
    case '*':
      return 0;
    case '[':
      bracket = 1;
      break;
    case ']':
      if (bracket)
        return 0;
      break;
    }
  }
  return 1;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<is_literal>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L26
  xor    %edx,%edx
L3:
  cmp    $0x5c,%al
  je     L93
  jg     L20
  cmp    $0x5b,%al
  je     L39
  cmp    $0x2a,%al
  je     L56
  cmp    $0x3f,%al
  jne    L11
L56:
  xor    %eax,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L20:
  cmp    $0x5d,%al
  jne    L11
  test   %edx,%edx
  jne    L56
L11:
  movzbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  jne    L3
L26:
  mov    $0x1,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L39:
  mov    $0x1,%edx
  jmp    L11
  nop
L93:
  test   %esi,%esi
  je     L11
  jmp    L56
```

assistant: ```c
int is_literal(const char *p, int useesc) {
  int bracket = 0;
  for (; *p; p++) {
    switch (*p) {
    case '\\':
      if (!useesc)
        break;
    case '?':
    case '*':
      return 0;
    case '[':
      bracket = 1;
      break;
    case ']':
      if (bracket)
        return 0;
      break;
    }
  }
  return 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<is_literal>:
  endbr64
  movzbl (%rdi),%edx
  mov    %esi,%eax
  test   %dl,%dl
  je     L8
  xor    %ecx,%ecx
  test   %esi,%esi
  jne    L193
L150:
  cmp    $0x5c,%dl
  je     L199
  jg     L26
  cmp    $0x5b,%dl
  je     L114
  cmp    $0x2a,%dl
  je     L173
  cmp    $0x3f,%dl
  jne    L199
L173:
  ret
  nopw   0x0(%rax,%rax,1)
L26:
  cmp    $0x5d,%dl
  jne    L199
  test   %ecx,%ecx
  jne    L90
  nopl   0x0(%rax)
L199:
  movzbl 0x1(%rdi),%edx
  add    $0x1,%rdi
  test   %dl,%dl
  jne    L150
L8:
  mov    $0x1,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L114:
  mov    $0x1,%ecx
  jmp    L199
L193:
  xor    %eax,%eax
L203:
  cmp    $0x5b,%dl
  je     L41
  jle    L111
  cmp    $0x5c,%dl
  je     L22
  cmp    $0x5d,%dl
  jne    L80
  test   %eax,%eax
  jne    L22
L80:
  movzbl 0x1(%rdi),%edx
  add    $0x1,%rdi
  test   %dl,%dl
  jne    L203
  jmp    L8
  nopl   0x0(%rax)
L111:
  cmp    $0x2a,%dl
  je     L22
  cmp    $0x3f,%dl
  jne    L80
L22:
  xor    %eax,%eax
  ret
L41:
  mov    $0x1,%eax
  jmp    L80
L90:
  ret
```

assistant: ```c
int is_literal(const char *p, int useesc) {
  int bracket = 0;
  for (; *p; p++) {
    switch (*p) {
    case '\\':
      if (!useesc)
        break;
    case '?':
    case '*':
      return 0;
    case '[':
      bracket = 1;
      break;
    case ']':
      if (bracket)
        return 0;
      break;
    }
  }
  return 1;
}
```