ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<affirm>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L24
  call   <strlen@plt>
  test   %eax,%eax
  jg     L120
L24:
  lea    D8(%rip),%r15
  lea    D12(%rip),%r14
  movabs $0x40800000408,%r12
  movabs $0x100000001,%r13
  nopl   0x0(%rax)
L60:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    %eax,%edi
  mov    %eax,%ebx
  call   <isspace@plt>
  test   %rax,%rax
  jne    L60
  mov    %ebx,%eax
  and    $0xffffffdf,%eax
  cmp    $0x59,%eax
  je     L72
  lea    -0x4e(%rbx),%ecx
  cmp    $0x2a,%ecx
  ja     L150
  mov    $0x1,%eax
  shl    %cl,%rax
  test   %r12,%rax
  jne    L43
  test   %r13,%rax
  jne    L27
  mov    %r14,%rdi
  call   <puts@plt>
  test   %rbp,%rbp
  je     L121
L106:
  mov    %rbp,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <printf@plt>
L56:
  cmp    $0xa,%ebx
  je     L60
L121:
  xor    %eax,%eax
  call   <getchar@plt>
  cmp    $0xa,%eax
  je     L60
  xor    %eax,%eax
  call   <getchar@plt>
  cmp    $0xa,%eax
  jne    L121
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L120:
  mov    %rbp,%rsi
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L24
L43:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <bail@plt>
  mov    $0x1,%eax
L95:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  xor    %eax,%eax
  jmp    L95
L72:
  mov    $0x1,%eax
  jmp    L95
L150:
  mov    %r14,%rdi
  call   <puts@plt>
  test   %rbp,%rbp
  jne    L106
  jmp    L56
```

tool_calls: name: parse_data
arguments: data_label: D8
type_guessed: string
name: parse_data
arguments: data_label: D12
type_guessed: string

tool: D8: %s? 

tool: D12: Valid responses begin with: y Y n N q Q x X

assistant: ```c
int affirm(char *prompt) {
  int reply;
  int done;
  void bail(char *msg, int status);
  if (prompt != NULL && (int)strlen(prompt) > 0) {
    printf("%s? ", prompt);
  }
  done = 0;
  while (!done) {
    reply = getchar();
    while (isspace(reply)) {
      reply = getchar();
    }
    if (reply == 'y' || reply == 'Y') {
      done = 1;
    } else if (reply == 'n' || reply == 'N') {
      done = 2;
    } else if (reply == 'q' || reply == 'Q') {
      done = 3;
    } else if (reply == 'x' || reply == 'X') {
      done = 3;
    } else {
      printf("Valid responses begin with: y Y n N q Q x X\n");
      if (prompt != NULL) {
        printf("%s? ", prompt);
      }
      while (reply != '\n') {
        reply = getchar();
      }
    }
  }
  if (done > 2) {
    bail(NULL, 0);
  } else if (done == 2) {
    return (0);
  }
  return (1);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<lev2gr>:
  endbr64
  mov    %rdi,%rcx
  movsd  D8(%rip),%xmm1
  addsd  (%rdi),%xmm1
  cvttsd2si %xmm1,%r8d
  cmp    $0x1,%r8d
  jle    L74
  mov    %r8d,%edi
  mov    $0x1,%eax
  jmp    L19
L60:
  add    $0x1,%edx
  add    $0x1,%rax
  cmp    %rdi,%rax
  je     L15
L19:
  mov    %eax,%edx
  mov    %eax,%esi
  movsd  (%rcx,%rax,8),%xmm1
  comisd %xmm1,%xmm0
  jb     L71
  movsd  0x8(%rcx,%rax,8),%xmm2
  comisd %xmm0,%xmm2
  jae    L6
L71:
  comisd %xmm0,%xmm1
  jb     L60
  comisd 0x8(%rcx,%rax,8),%xmm0
  jb     L60
L6:
  subsd  %xmm1,%xmm0
  movsd  0x8(%rcx,%rax,8),%xmm2
  subsd  %xmm1,%xmm2
  divsd  %xmm2,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %esi,%xmm1
  addsd  %xmm1,%xmm0
  ret
L74:
  mov    $0x1,%edx
L15:
  movsd  0x8(%rcx),%xmm1
  movslq %r8d,%r8
  movsd  (%rcx,%r8,8),%xmm2
  comisd %xmm1,%xmm2
  jbe    L53
  comisd %xmm0,%xmm1
  jbe    L21
  subsd  %xmm1,%xmm0
  movsd  0x10(%rcx),%xmm2
  subsd  %xmm1,%xmm2
  divsd  %xmm2,%xmm0
  addsd  D7(%rip),%xmm0
  ret
L21:
  movslq %edx,%rax
  movsd  (%rcx,%rax,8),%xmm1
  subsd  %xmm1,%xmm0
  subsd  -0x8(%rcx,%rax,8),%xmm1
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  addsd  %xmm1,%xmm0
  ret
L53:
  comisd %xmm1,%xmm0
  jbe    L44
  subsd  %xmm1,%xmm0
  movsd  0x10(%rcx),%xmm2
  subsd  %xmm1,%xmm2
  divsd  %xmm2,%xmm0
  addsd  D7(%rip),%xmm0
  ret
L44:
  movslq %edx,%rax
  movsd  (%rcx,%rax,8),%xmm1
  subsd  %xmm1,%xmm0
  subsd  -0x8(%rcx,%rax,8),%xmm1
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  addsd  %xmm1,%xmm0
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
data_type: f64
name: extract_symbolic_data
arguments: label: D7
data_type: f64

tool: D8: 0.1

tool: D7: 1

assistant: ```c
double lev2gr(double *vals, double lev) {
  int i, num;
  double gr;
  num = (int)(*vals + 0.1);
  for (i = 1; i < num; i++) {
    if ((lev >= *(vals + i) && lev <= *(vals + i + 1)) || (lev <= *(vals + i) && lev >= *(vals + i + 1))) {
      gr = (double)i + (lev - *(vals + i)) / (*(vals + i + 1) - *(vals + i));
      return (gr);
    }
  }
  if (*(vals + 1) < *(vals + num)) {
    if (lev < *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  } else {
    if (lev > *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<lev2gr>:
  endbr64
  movsd  D13(%rip),%xmm1
  addsd  (%rdi),%xmm1
  cvttsd2si %xmm1,%ecx
  cmp    $0x1,%ecx
  jle    L10
  lea    0x10(%rdi),%rax
  mov    $0x1,%edx
  cs nopw 0x0(%rax,%rax,1)
L69:
  movsd  -0x8(%rax),%xmm1
  comisd %xmm1,%xmm0
  jb     L53
  movsd  (%rax),%xmm2
  comisd %xmm0,%xmm2
  jae    L57
L53:
  comisd %xmm0,%xmm1
  jb     L82
  movsd  (%rax),%xmm2
  comisd %xmm2,%xmm0
  jae    L57
L82:
  add    $0x1,%edx
  add    $0x8,%rax
  cmp    %edx,%ecx
  jne    L69
  mov    %ecx,%eax
L62:
  movslq %ecx,%rcx
  movsd  0x8(%rdi),%xmm1
  movsd  (%rdi,%rcx,8),%xmm2
  comisd %xmm1,%xmm2
  jbe    L1
  comisd %xmm0,%xmm1
  jbe    L32
L18:
  movsd  0x10(%rdi),%xmm2
  subsd  %xmm1,%xmm0
  subsd  %xmm1,%xmm2
  divsd  %xmm2,%xmm0
  addsd  D14(%rip),%xmm0
  ret
  nopl   0x0(%rax)
L1:
  comisd %xmm1,%xmm0
  ja     L18
L32:
  movslq %eax,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  subsd  %xmm1,%xmm0
  subsd  -0x8(%rdi,%rdx,8),%xmm1
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  addsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L57:
  subsd  %xmm1,%xmm2
  subsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  divsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  ret
L10:
  mov    $0x1,%eax
  jmp    L62
```

tool_calls: name: extract_symbolic_data
arguments: tag: D13
type_guessed: f64
name: extract_symbolic_data
arguments: tag: D14
type_guessed: f64

tool: D13: 0.1

tool: D14: 1

assistant: ```c
double lev2gr(double *vals, double lev) {
  int i, num;
  double gr;
  num = (int)(*vals + 0.1);
  for (i = 1; i < num; i++) {
    if ((lev >= *(vals + i) && lev <= *(vals + i + 1)) || (lev <= *(vals + i) && lev >= *(vals + i + 1))) {
      gr = (double)i + (lev - *(vals + i)) / (*(vals + i + 1) - *(vals + i));
      return (gr);
    }
  }
  if (*(vals + 1) < *(vals + num)) {
    if (lev < *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  } else {
    if (lev > *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<lev2gr>:
  endbr64
  movsd  D4(%rip),%xmm1
  addsd  (%rdi),%xmm1
  cvttsd2si %xmm1,%ecx
  cmp    $0x1,%ecx
  jle    L74
  lea    0x10(%rdi),%rax
  mov    $0x1,%edx
  cs nopw 0x0(%rax,%rax,1)
L34:
  movsd  -0x8(%rax),%xmm1
  comisd %xmm1,%xmm0
  jb     L43
  movsd  (%rax),%xmm2
  comisd %xmm0,%xmm2
  jae    L97
L43:
  comisd %xmm0,%xmm1
  jb     L61
  movsd  (%rax),%xmm2
  comisd %xmm2,%xmm0
  jae    L97
L61:
  add    $0x1,%edx
  add    $0x8,%rax
  cmp    %edx,%ecx
  jne    L34
  mov    %ecx,%eax
L38:
  movslq %ecx,%rcx
  movsd  0x8(%rdi),%xmm1
  movsd  (%rdi,%rcx,8),%xmm2
  comisd %xmm1,%xmm2
  jbe    L82
  comisd %xmm0,%xmm1
  jbe    L58
L35:
  movsd  0x10(%rdi),%xmm2
  subsd  %xmm1,%xmm0
  subsd  %xmm1,%xmm2
  divsd  %xmm2,%xmm0
  addsd  D7(%rip),%xmm0
  ret
  nopl   0x0(%rax)
L82:
  comisd %xmm1,%xmm0
  ja     L35
L58:
  movslq %eax,%rdx
  movsd  (%rdi,%rdx,8),%xmm1
  subsd  %xmm1,%xmm0
  subsd  -0x8(%rdi,%rdx,8),%xmm1
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  addsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L97:
  subsd  %xmm1,%xmm2
  subsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %edx,%xmm1
  divsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  ret
L74:
  mov    $0x1,%eax
  jmp    L38
```

tool_calls: name: unpack_data
arguments: label: D4
type: f64
name: unpack_data
arguments: label: D7
type: f64

tool: D4: 0.1

tool: D7: 1

assistant: ```c
double lev2gr(double *vals, double lev) {
  int i, num;
  double gr;
  num = (int)(*vals + 0.1);
  for (i = 1; i < num; i++) {
    if ((lev >= *(vals + i) && lev <= *(vals + i + 1)) || (lev <= *(vals + i) && lev >= *(vals + i + 1))) {
      gr = (double)i + (lev - *(vals + i)) / (*(vals + i + 1) - *(vals + i));
      return (gr);
    }
  }
  if (*(vals + 1) < *(vals + num)) {
    if (lev < *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  } else {
    if (lev > *(vals + 1)) {
      gr = 1.0 + ((lev - *(vals + 1)) / (*(vals + 2) - *(vals + 1)));
      return (gr);
    }
    gr = (double)i + ((lev - *(vals + i)) / (*(vals + i) - *(vals + i - 1)));
    return (gr);
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<check_prime>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  cmpl   $0x1,-0x14(%rbp)
  jg     L8
  mov    $0x0,%eax
  jmp    L30
L8:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <sqrt@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x2,-0x8(%rbp)
  jmp    L2
L23:
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x8(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L52
  mov    $0x0,%eax
  jmp    L30
L52:
  addl   $0x1,-0x8(%rbp)
L2:
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L23
  mov    $0x1,%eax
L30:
  leave
  ret
```

assistant: ```c
int check_prime(int num) {
  int temp, i;
  if (num < 2)
    return 0;
  temp = sqrt(num);
  for (i = 2; i <= temp; i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<check_prime>:
  endbr64
  mov    $0x0,%eax
  cmp    $0x1,%edi
  jle    L74
  push   %rbx
  mov    %edi,%ebx
  call   <sqrt@plt>
  mov    %eax,%esi
  cmp    $0x1,%eax
  jle    L77
  test   $0x1,%bl
  je     L2
  mov    $0x2,%ecx
L57:
  add    $0x1,%ecx
  cmp    %ecx,%esi
  jl     L14
  mov    %ebx,%eax
  cltd
  idiv   %ecx
  mov    %edx,%eax
  test   %edx,%edx
  jne    L57
  jmp    L12
L14:
  mov    $0x1,%eax
L12:
  pop    %rbx
  ret
L77:
  mov    $0x1,%eax
  jmp    L12
L2:
  mov    $0x0,%eax
  jmp    L12
L74:
  ret
```

assistant: ```c
int check_prime(int num) {
  int temp, i;
  if (num < 2)
    return 0;
  temp = sqrt(num);
  for (i = 2; i <= temp; i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<check_prime>:
  endbr64
  cmp    $0x1,%edi
  jle    L8
  push   %r12
  mov    %edi,%r12d
  call   <sqrt@plt>
  mov    %eax,%esi
  cmp    $0x1,%eax
  jle    L5
  test   $0x1,%r12b
  je     L10
  mov    $0x2,%ecx
  jmp    L39
  nopw   0x0(%rax,%rax,1)
L51:
  mov    %r12d,%eax
  cltd
  idiv   %ecx
  test   %edx,%edx
  je     L10
L39:
  add    $0x1,%ecx
  cmp    %ecx,%esi
  jge    L51
L5:
  mov    $0x1,%eax
  pop    %r12
  ret
  nopl   0x0(%rax)
L10:
  xor    %eax,%eax
  pop    %r12
  ret
  nopl   (%rax)
L8:
  xor    %eax,%eax
  ret
```

assistant: ```c
int check_prime(int num) {
  int temp, i;
  if (num < 2)
    return 0;
  temp = sqrt(num);
  for (i = 2; i <= temp; i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<check_prime>:
  endbr64
  cmp    $0x1,%edi
  jle    L8
  push   %r12
  mov    %edi,%r12d
  call   <sqrt@plt>
  mov    %eax,%esi
  cmp    $0x1,%eax
  jle    L41
  test   $0x1,%r12b
  je     L50
  mov    $0x2,%ecx
  jmp    L11
  nopw   0x0(%rax,%rax,1)
L39:
  mov    %r12d,%eax
  cltd
  idiv   %ecx
  test   %edx,%edx
  je     L50
L11:
  add    $0x1,%ecx
  cmp    %ecx,%esi
  jge    L39
L41:
  mov    $0x1,%eax
  pop    %r12
  ret
  nopl   0x0(%rax)
L50:
  xor    %eax,%eax
  pop    %r12
  ret
  nopl   (%rax)
L8:
  xor    %eax,%eax
  ret
```

assistant: ```c
int check_prime(int num) {
  int temp, i;
  if (num < 2)
    return 0;
  temp = sqrt(num);
  for (i = 2; i <= temp; i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<unalignedwordread>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%eax
  call   <POP@plt>
  mov    %eax,%edi
  call   <cell2pointer@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <unaligned_read_word@plt>
  mov    %eax,%edi
  call   <PUSH@plt>
  nop
  leave
  ret
```

assistant: ```c
void unalignedwordread(void) {
  const unsigned char *addr = (const unsigned char *)cell2pointer(POP());
  PUSH(unaligned_read_word(addr));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<unalignedwordread>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <POP@plt>
  mov    %eax,%edi
  call   <cell2pointer@plt>
  mov    %rax,%rdi
  call   <unaligned_read_word@plt>
  mov    %eax,%edi
  call   <PUSH@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void unalignedwordread(void) {
  const unsigned char *addr = (const unsigned char *)cell2pointer(POP());
  PUSH(unaligned_read_word(addr));
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<unalignedwordread>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <POP@plt>
  mov    %eax,%edi
  call   <cell2pointer@plt>
  mov    %rax,%rdi
  call   <unaligned_read_word@plt>
  add    $0x8,%rsp
  mov    %eax,%edi
  jmp    1080 <PUSH@plt>
```

assistant: ```c
void unalignedwordread(void) {
  const unsigned char *addr = (const unsigned char *)cell2pointer(POP());
  PUSH(unaligned_read_word(addr));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<unalignedwordread>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <POP@plt>
  mov    %eax,%edi
  call   <cell2pointer@plt>
  mov    %rax,%rdi
  call   <unaligned_read_word@plt>
  add    $0x8,%rsp
  mov    %eax,%edi
  jmp    1080 <PUSH@plt>
```

assistant: ```c
void unalignedwordread(void) {
  const unsigned char *addr = (const unsigned char *)cell2pointer(POP());
  PUSH(unaligned_read_word(addr));
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<test_bit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  and    $0x1f,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    -0x14(%rbp),%eax
  shr    $0x5,%eax
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  and    %edx,%eax
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
  pop    %rbp
  ret
```

assistant: ```c
int test_bit(unsigned int nr, const void *addr) {
  const __u32 *p = (const __u32 *)addr;
  nr = nr ^ 0;
  return ((1 << (nr & 31)) & (p[nr >> 5])) != 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<test_bit>:
  endbr64
  mov    %edi,%ecx
  mov    %edi,%edx
  shr    $0x5,%edx
  mov    %edx,%edx
  mov    $0x1,%eax
  shl    %cl,%eax
  and    (%rsi,%rdx,4),%eax
  setne  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int test_bit(unsigned int nr, const void *addr) {
  const __u32 *p = (const __u32 *)addr;
  nr = nr ^ 0;
  return ((1 << (nr & 31)) & (p[nr >> 5])) != 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<test_bit>:
  endbr64
  mov    %edi,%edx
  mov    %edi,%ecx
  mov    $0x1,%eax
  shr    $0x5,%edx
  shl    %cl,%eax
  and    (%rsi,%rdx,4),%eax
  setne  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int test_bit(unsigned int nr, const void *addr) {
  const __u32 *p = (const __u32 *)addr;
  nr = nr ^ 0;
  return ((1 << (nr & 31)) & (p[nr >> 5])) != 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<test_bit>:
  endbr64
  mov    %edi,%edx
  mov    %edi,%ecx
  mov    $0x1,%eax
  shr    $0x5,%edx
  shl    %cl,%eax
  and    (%rsi,%rdx,4),%eax
  setne  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int test_bit(unsigned int nr, const void *addr) {
  const __u32 *p = (const __u32 *)addr;
  nr = nr ^ 0;
  return ((1 << (nr & 31)) & (p[nr >> 5])) != 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<utf8decode>:
  endbr64
  mov    %rdi,%rcx
  movzbl (%rdi),%eax
  test   %al,%al
  jns    L171
  cmp    $0xc1,%al
  jbe    L178
  lea    0x1(%rdi),%rdi
  cmp    %rdi,%rsi
  jbe    L178
  movzbl 0x1(%rcx),%edi
  mov    %edi,%r8d
  and    $0xc0,%r8d
  cmp    $0x80,%r8d
  jne    L178
  cmp    $0xdf,%al
  jbe    L86
  cmp    $0xe0,%al
  je     L28
  cmp    $0xef,%al
  ja     L43
L155:
  lea    0x2(%rcx),%rax
  cmp    %rax,%rsi
  jbe    L178
  movsbl 0x2(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L178
  movl   $0x3,(%rdx)
  movsbl (%rcx),%eax
  shl    $0xc,%eax
  movzwl %ax,%eax
  movsbl 0x1(%rcx),%edx
  shl    $0x6,%edx
  and    $0xfc0,%edx
  add    %edx,%eax
  movzbl 0x2(%rcx),%edx
  and    $0x3f,%edx
  add    %edx,%eax
  ret
L171:
  movl   $0x1,(%rdx)
  movzbl %al,%eax
  ret
L86:
  movl   $0x2,(%rdx)
  movsbl (%rcx),%eax
  shl    $0x6,%eax
  and    $0x7c0,%eax
  movzbl 0x1(%rcx),%edx
  and    $0x3f,%edx
  or     %edx,%eax
  ret
L28:
  cmp    $0x9f,%dil
  ja     L155
L178:
  movl   $0x1,(%rdx)
  mov    $0xfffd,%eax
  ret
L43:
  cmp    $0xf0,%al
  je     L148
  cmp    $0xf3,%al
  ja     L120
L41:
  lea    0x3(%rcx),%rax
  cmp    %rax,%rsi
  jbe    L178
  movsbl 0x2(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L178
  movsbl 0x3(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L178
  movl   $0x4,(%rdx)
  movsbl (%rcx),%eax
  shl    $0x12,%eax
  and    $0x1c0000,%eax
  movsbl 0x1(%rcx),%edx
  shl    $0xc,%edx
  and    $0x3f000,%edx
  or     %edx,%eax
  movsbl 0x2(%rcx),%edx
  shl    $0x6,%edx
  and    $0xfc0,%edx
  add    %edx,%eax
  movzbl 0x3(%rcx),%edx
  and    $0x3f,%edx
  add    %edx,%eax
  ret
L148:
  cmp    $0x8f,%dil
  ja     L41
  jmp    L178
L120:
  cmp    $0xf4,%al
  jne    L178
  cmp    $0x8f,%dil
  jbe    L41
  jmp    L178
```

assistant: ```c
unsigned utf8decode(const char *p, const char *end, int *len) {
  unsigned char c = *(unsigned char *)p;
  if (c < 0x80) {
    *len = 1;
    return c;
  } else if (c < 0xc2) {
    goto FAIL;
  }
  if (p + 1 >= end || (p[1] & 0xc0) != 0x80)
    goto FAIL;
  if (c < 0xe0) {
    *len = 2;
    return ((p[0] & 0x1f) << 6) + ((p[1] & 0x3f));
  } else if (c == 0xe0) {
    if (((unsigned char *)p)[1] < 0xa0)
      goto FAIL;
    goto UTF8_3;
  } else if (c < 0xf0) {
  UTF8_3:
    if (p + 2 >= end || (p[2] & 0xc0) != 0x80)
      goto FAIL;
    *len = 3;
    return ((p[0] & 0x0f) << 12) + ((p[1] & 0x3f) << 6) + ((p[2] & 0x3f));
  } else if (c == 0xf0) {
    if (((unsigned char *)p)[1] < 0x90)
      goto FAIL;
    goto UTF8_4;
  } else if (c < 0xf4) {
  UTF8_4:
    if (p + 3 >= end || (p[2] & 0xc0) != 0x80 || (p[3] & 0xc0) != 0x80)
      goto FAIL;
    *len = 4;
    return ((p[0] & 0x07) << 18) + ((p[1] & 0x3f) << 12) + ((p[2] & 0x3f) << 6) + ((p[3] & 0x3f));
  } else if (c == 0xf4) {
    if (((unsigned char *)p)[1] > 0x8f)
      goto FAIL;
    goto UTF8_4;
  } else {
  FAIL:
    *len = 1;
    return 0xfffd;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<utf8decode>:
  endbr64
  movzbl (%rdi),%eax
  mov    %rdi,%rcx
  test   %al,%al
  jns    L136
  cmp    $0xc1,%al
  jbe    L34
  lea    0x1(%rdi),%rdi
  cmp    %rdi,%rsi
  jbe    L34
  movzbl 0x1(%rcx),%edi
  mov    %edi,%r8d
  and    $0xc0,%r8d
  cmp    $0x80,%r8d
  jne    L34
  cmp    $0xdf,%al
  jbe    L36
  cmp    $0xe0,%al
  je     L100
  cmp    $0xef,%al
  jbe    L121
  cmp    $0xf0,%al
  je     L83
  cmp    $0xf3,%al
  jbe    L33
  cmp    $0xf4,%al
  jne    L34
  cmp    $0x8f,%dil
  ja     L34
L33:
  lea    0x3(%rcx),%rax
  cmp    %rax,%rsi
  jbe    L34
  movsbl 0x2(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L34
  movsbl 0x3(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L34
  movl   $0x4,(%rdx)
  movsbl (%rcx),%eax
  movsbl 0x1(%rcx),%edx
  shl    $0x12,%eax
  shl    $0xc,%edx
  and    $0x1c0000,%eax
  and    $0x3f000,%edx
  or     %edx,%eax
  movsbl 0x2(%rcx),%edx
  shl    $0x6,%edx
  and    $0xfc0,%edx
  add    %edx,%eax
  movzbl 0x3(%rcx),%edx
  and    $0x3f,%edx
  add    %edx,%eax
  ret
  xchg   %ax,%ax
L83:
  cmp    $0x8f,%dil
  ja     L33
L34:
  movl   $0x1,(%rdx)
  mov    $0xfffd,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L136:
  movl   $0x1,(%rdx)
  ret
  nop
L100:
  cmp    $0x9f,%dil
  jbe    L34
L121:
  lea    0x2(%rcx),%rax
  cmp    %rax,%rsi
  jbe    L34
  movsbl 0x2(%rcx),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L34
  movl   $0x3,(%rdx)
  movsbl (%rcx),%eax
  movsbl 0x1(%rcx),%edx
  shl    $0xc,%eax
  shl    $0x6,%edx
  movzwl %ax,%eax
  and    $0xfc0,%edx
  add    %edx,%eax
  movzbl 0x2(%rcx),%edx
  and    $0x3f,%edx
  add    %edx,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L36:
  movl   $0x2,(%rdx)
  movsbl (%rcx),%eax
  movzbl 0x1(%rcx),%edx
  shl    $0x6,%eax
  and    $0x7c0,%eax
  and    $0x3f,%edx
  or     %edx,%eax
  ret
```

assistant: ```c
unsigned utf8decode(const char *p, const char *end, int *len) {
  unsigned char c = *(unsigned char *)p;
  if (c < 0x80) {
    *len = 1;
    return c;
  } else if (c < 0xc2) {
    goto FAIL;
  }
  if (p + 1 >= end || (p[1] & 0xc0) != 0x80)
    goto FAIL;
  if (c < 0xe0) {
    *len = 2;
    return ((p[0] & 0x1f) << 6) + ((p[1] & 0x3f));
  } else if (c == 0xe0) {
    if (((unsigned char *)p)[1] < 0xa0)
      goto FAIL;
    goto UTF8_3;
  } else if (c < 0xf0) {
  UTF8_3:
    if (p + 2 >= end || (p[2] & 0xc0) != 0x80)
      goto FAIL;
    *len = 3;
    return ((p[0] & 0x0f) << 12) + ((p[1] & 0x3f) << 6) + ((p[2] & 0x3f));
  } else if (c == 0xf0) {
    if (((unsigned char *)p)[1] < 0x90)
      goto FAIL;
    goto UTF8_4;
  } else if (c < 0xf4) {
  UTF8_4:
    if (p + 3 >= end || (p[2] & 0xc0) != 0x80 || (p[3] & 0xc0) != 0x80)
      goto FAIL;
    *len = 4;
    return ((p[0] & 0x07) << 18) + ((p[1] & 0x3f) << 12) + ((p[2] & 0x3f) << 6) + ((p[3] & 0x3f));
  } else if (c == 0xf4) {
    if (((unsigned char *)p)[1] > 0x8f)
      goto FAIL;
    goto UTF8_4;
  } else {
  FAIL:
    *len = 1;
    return 0xfffd;
  }
}
```