ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<selection_sort>:
  endbr64
  push   %r13
  lea    -0x1(%rsi),%r13d
  push   %r12
  push   %rbp
  push   %rbx
  test   %r13d,%r13d
  jle    L31
  mov    %rdi,%r11
  mov    %rdi,%rbx
  xor    %r10d,%r10d
  nopl   0x0(%rax)
L56:
  mov    %r10d,%r9d
  add    $0x1,%r10d
  mov    (%rbx),%ebp
  cmp    %r10d,%esi
  jle    L74
  lea    0x4(%rbx),%r12
  mov    %ebp,%edi
  mov    %r10d,%edx
  mov    %r12,%rax
  jmp    L1
  nopl   0x0(%rax)
L53:
  movslq %r9d,%rcx
  add    $0x1,%edx
  add    $0x4,%rax
  lea    (%r11,%rcx,4),%r8
  cmp    %edx,%esi
  je     L44
L1:
  mov    (%rax),%ecx
  mov    %rax,%r8
  cmp    %edi,%ecx
  jle    L53
  mov    %edx,%r9d
  add    $0x1,%edx
  mov    %ecx,%edi
  add    $0x4,%rax
  cmp    %edx,%esi
  jne    L1
L44:
  mov    %edi,(%rbx)
  mov    %r12,%rbx
  mov    %ebp,(%r8)
  cmp    %r13d,%r10d
  jne    L56
L31:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L74:
  mov    %rbx,%r8
  mov    %ebp,%edi
  lea    0x4(%rbx),%r12
  mov    %edi,(%rbx)
  mov    %r12,%rbx
  mov    %ebp,(%r8)
  cmp    %r13d,%r10d
  jne    L56
  jmp    L31
```

assistant: ```c
void selection_sort(int *array, int n) {
  int i, j;
  int min;
  int temp;
  for (i = 0; i < n - 1; i++) {
    min = i;
    for (j = i + 1; j < n; j++) {
      if (array[j] > array[min]) {
        min = j;
      }
    }
    temp = array[i];
    array[i] = array[min];
    array[min] = temp;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<selection_sort>:
  endbr64
  push   %r13
  lea    -0x1(%rsi),%r13d
  push   %r12
  push   %rbp
  push   %rbx
  test   %r13d,%r13d
  jle    L43
  mov    %rdi,%r11
  mov    %rdi,%rbx
  xor    %r10d,%r10d
  nopl   0x0(%rax)
L4:
  mov    %r10d,%r9d
  add    $0x1,%r10d
  mov    (%rbx),%ebp
  cmp    %r10d,%esi
  jle    L63
  lea    0x4(%rbx),%r12
  mov    %ebp,%edi
  mov    %r10d,%edx
  mov    %r12,%rax
  jmp    L47
  nopl   0x0(%rax)
L64:
  movslq %r9d,%rcx
  add    $0x1,%edx
  add    $0x4,%rax
  lea    (%r11,%rcx,4),%r8
  cmp    %esi,%edx
  je     L8
L47:
  mov    (%rax),%ecx
  mov    %rax,%r8
  cmp    %edi,%ecx
  jle    L64
  mov    %edx,%r9d
  add    $0x1,%edx
  mov    %ecx,%edi
  add    $0x4,%rax
  cmp    %esi,%edx
  jne    L47
L8:
  mov    %edi,(%rbx)
  mov    %r12,%rbx
  mov    %ebp,(%r8)
  cmp    %r13d,%r10d
  jne    L4
L43:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L63:
  mov    %rbx,%r8
  mov    %ebp,%edi
  lea    0x4(%rbx),%r12
  mov    %edi,(%rbx)
  mov    %r12,%rbx
  mov    %ebp,(%r8)
  cmp    %r13d,%r10d
  jne    L4
  jmp    L43
```

assistant: ```c
void selection_sort(int *array, int n) {
  int i, j;
  int min;
  int temp;
  for (i = 0; i < n - 1; i++) {
    min = i;
    for (j = i + 1; j < n; j++) {
      if (array[j] > array[min]) {
        min = j;
      }
    }
    temp = array[i];
    array[i] = array[min];
    array[min] = temp;
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <acc_init@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <acc_shutdown@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <acc_shutdown@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  acc_device_t devtype = acc_device_host;
  acc_init(devtype);
  acc_shutdown(devtype);
  acc_shutdown(devtype);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbx
  mov    D3(%rip),%rax
  mov    (%rax),%ebx
  mov    %ebx,%edi
  call   <acc_init@plt>
  mov    %ebx,%edi
  call   <acc_shutdown@plt>
  mov    %ebx,%edi
  call   <acc_shutdown@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  acc_device_t devtype = acc_device_host;
  acc_init(devtype);
  acc_shutdown(devtype);
  acc_shutdown(devtype);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  mov    D0(%rip),%rax
  push   %rbp
  mov    (%rax),%ebp
  mov    %ebp,%edi
  call   <acc_init@plt>
  mov    %ebp,%edi
  call   <acc_shutdown@plt>
  mov    %ebp,%edi
  call   <acc_shutdown@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  acc_device_t devtype = acc_device_host;
  acc_init(devtype);
  acc_shutdown(devtype);
  acc_shutdown(devtype);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  mov    D3(%rip),%rax
  push   %rbp
  mov    (%rax),%ebp
  mov    %ebp,%edi
  call   <acc_init@plt>
  mov    %ebp,%edi
  call   <acc_shutdown@plt>
  mov    %ebp,%edi
  call   <acc_shutdown@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  acc_device_t devtype = acc_device_host;
  acc_init(devtype);
  acc_shutdown(devtype);
  acc_shutdown(devtype);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<recF16FromF16>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    -0x14(%rbp),%eax
  sar    $0xf,%eax
  and    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x14(%rbp),%eax
  sar    $0xa,%eax
  and    $0x1f,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x14(%rbp),%eax
  and    $0x3ff,%eax
  mov    %eax,-0x8(%rbp)
  cmpl   $0x1f,-0xc(%rbp)
  jne    L51
  cmpl   $0x0,-0x8(%rbp)
  je     L29
  movl   $0x38,-0xc(%rbp)
  jmp    L138
L29:
  movl   $0x30,-0xc(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L138
  mov    $0x0,%eax
  call   <rand@plt>
  and    $0x3ff,%eax
  mov    %eax,-0x8(%rbp)
L138:
  cmpl   $0x0,-0x18(%rbp)
  je     L100
  mov    $0x0,%eax
  call   <rand@plt>
  and    $0x7,%eax
  or     %eax,-0xc(%rbp)
  jmp    L100
L51:
  cmpl   $0x0,-0xc(%rbp)
  jne    L80
  cmpl   $0x3,-0x8(%rbp)
  jg     L107
  cmpl   $0x0,-0x8(%rbp)
  jne    L150
  cmpl   $0x0,-0x18(%rbp)
  je     L105
  mov    $0x0,%eax
  call   <rand@plt>
  and    $0x7,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L105
L150:
  subl   $0x8,-0xc(%rbp)
  shll   $0x8,-0x8(%rbp)
  jmp    L17
L107:
  cmpl   $0x3f,-0x8(%rbp)
  jg     L17
  subl   $0x4,-0xc(%rbp)
  shll   $0x4,-0x8(%rbp)
L17:
  cmpl   $0xff,-0x8(%rbp)
  jg     L144
  subl   $0x2,-0xc(%rbp)
  shll   $0x2,-0x8(%rbp)
L144:
  mov    -0x8(%rbp),%eax
  and    $0x200,%eax
  test   %eax,%eax
  jne    L12
  subl   $0x1,-0xc(%rbp)
  shll   -0x8(%rbp)
L12:
  mov    -0x8(%rbp),%eax
  add    %eax,%eax
  sub    $0x400,%eax
  mov    %eax,-0x8(%rbp)
L80:
  addl   $0x11,-0xc(%rbp)
  jmp    L100
L105:
  nop
L100:
  mov    -0x4(%rbp),%eax
  shl    $0x10,%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  shl    $0xa,%eax
  or     %edx,%eax
  or     -0x8(%rbp),%eax
  leave
  ret
```

assistant: ```c
int_fast32_t recF16FromF16(uint16_t in, bool addRandomness) {
  bool sign;
  int exp, fract;
  sign = in >> 15 & 1;
  exp = in >> 10 & 0x1F;
  fract = in & 0x3FF;
  if (exp == 0x1F) {
    if (fract) {
      exp = 0x38;
    } else {
      exp = 0x30;
      if (addRandomness)
        fract = rand() & 0x3FF;
    }
    if (addRandomness)
      exp |= rand() & 7;
  } else {
    if (exp == 0) {
      if (fract < 4) {
        if (!fract) {
          if (addRandomness)
            exp = rand() & 7;
          goto done;
        }
        exp -= 8;
        fract <<= 8;
      } else if (fract < 0x40) {
        exp -= 4;
        fract <<= 4;
      }
      if (fract < 0x100) {
        exp -= 2;
        fract <<= 2;
      }
      if (!(fract & 0x200)) {
        --exp;
        fract <<= 1;
      }
      fract = (fract << 1) - 0x400;
    }
    exp += 0x011;
  }
done:
  return (int_fast32_t)sign << 16 | (int_fast32_t)exp << 10 | fract;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<recF16FromF16>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sar    $0xf,%ebx
  mov    %edi,%eax
  sar    $0xa,%eax
  and    $0x1f,%eax
  mov    %edi,%ebp
  and    $0x3ff,%ebp
  cmp    $0x1f,%eax
  je     L152
  test   %eax,%eax
  jne    L1
  test   $0x3fc,%edi
  jne    L150
  test   %ebp,%ebp
  je     L112
  shl    $0x8,%ebp
  mov    $0xfffffff8,%eax
  jmp    L86
L152:
  test   %ebp,%ebp
  jne    L96
  test   %esi,%esi
  jne    L88
  mov    %esi,%ebp
  mov    $0x30,%esi
  jmp    L139
L88:
  mov    $0x0,%eax
  call   <rand@plt>
  and    $0x3ff,%eax
  mov    %eax,%ebp
  mov    $0x30,%r12d
L117:
  mov    $0x0,%eax
  call   <rand@plt>
  and    $0x7,%eax
  mov    %eax,%esi
  or     %r12d,%esi
  jmp    L139
L96:
  test   %esi,%esi
  jne    L137
  mov    $0x38,%esi
  jmp    L139
L137:
  mov    $0x38,%r12d
  jmp    L117
L112:
  test   %esi,%esi
  jne    L23
  mov    %esi,%ebp
  jmp    L139
L23:
  call   <rand@plt>
  and    $0x7,%eax
  mov    %eax,%esi
  jmp    L139
L150:
  test   $0x3c0,%edi
  jne    L34
  shl    $0x4,%ebp
  mov    $0xfffffffc,%eax
L34:
  cmp    $0xff,%ebp
  jg     L86
  sub    $0x2,%eax
  shl    $0x2,%ebp
L86:
  test   $0x200,%ebp
  jne    L43
  sub    $0x1,%eax
  add    %ebp,%ebp
L43:
  lea    -0x400(%rbp,%rbp,1),%ebp
L1:
  lea    0x11(%rax),%esi
L139:
  mov    %ebx,%eax
  shl    $0x10,%eax
  and    $0x10000,%eax
  or     %ebp,%eax
  shl    $0xa,%esi
  or     %esi,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int_fast32_t recF16FromF16(uint16_t in, bool addRandomness) {
  bool sign;
  int exp, fract;
  sign = in >> 15 & 1;
  exp = in >> 10 & 0x1F;
  fract = in & 0x3FF;
  if (exp == 0x1F) {
    if (fract) {
      exp = 0x38;
    } else {
      exp = 0x30;
      if (addRandomness)
        fract = rand() & 0x3FF;
    }
    if (addRandomness)
      exp |= rand() & 7;
  } else {
    if (exp == 0) {
      if (fract < 4) {
        if (!fract) {
          if (addRandomness)
            exp = rand() & 7;
          goto done;
        }
        exp -= 8;
        fract <<= 8;
      } else if (fract < 0x40) {
        exp -= 4;
        fract <<= 4;
      }
      if (fract < 0x100) {
        exp -= 2;
        fract <<= 2;
      }
      if (!(fract & 0x200)) {
        --exp;
        fract <<= 1;
      }
      fract = (fract << 1) - 0x400;
    }
    exp += 0x011;
  }
done:
  return (int_fast32_t)sign << 16 | (int_fast32_t)exp << 10 | fract;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<recF16FromF16>:
  endbr64
  mov    %edi,%eax
  push   %r12
  sar    $0xa,%eax
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  and    $0x1f,%eax
  mov    %edi,%ebx
  and    $0x3ff,%ebp
  sar    $0xf,%ebx
  cmp    $0x1f,%eax
  je     L139
  test   %eax,%eax
  je     L19
L3:
  lea    0x11(%rax),%esi
  shl    $0xa,%esi
L155:
  mov    %ebx,%eax
  or     %esi,%ebp
  pop    %rbx
  shl    $0x10,%eax
  and    $0x10000,%eax
  or     %ebp,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L19:
  test   $0x3fc,%edi
  je     L81
  and    $0x3c0,%edi
  jne    L70
  shl    $0x4,%ebp
  mov    $0xfffffffc,%eax
L70:
  cmp    $0xff,%ebp
  jg     L21
  sub    $0x2,%eax
  shl    $0x2,%ebp
L21:
  test   $0x200,%ebp
  jne    L17
  add    %ebp,%ebp
  sub    $0x1,%eax
L17:
  lea    -0x400(%rbp,%rbp,1),%ebp
  jmp    L3
  nopl   0x0(%rax)
L139:
  test   %ebp,%ebp
  je     L173
  test   %esi,%esi
  jne    L54
  mov    $0xe000,%esi
  jmp    L155
  nop
L173:
  test   %esi,%esi
  jne    L125
  mov    $0xc000,%esi
  jmp    L155
  nopl   0x0(%rax,%rax,1)
L81:
  test   %ebp,%ebp
  je     L172
  shl    $0x8,%ebp
  mov    $0xfffffff8,%eax
  jmp    L21
  xchg   %ax,%ax
L125:
  xor    %eax,%eax
  mov    $0x30,%r12d
  call   <rand@plt>
  and    $0x3ff,%eax
  mov    %eax,%ebp
L104:
  xor    %eax,%eax
  call   <rand@plt>
  and    $0x7,%eax
  mov    %eax,%esi
  or     %r12d,%esi
  shl    $0xa,%esi
  jmp    L155
  nopl   0x0(%rax,%rax,1)
L54:
  mov    $0x38,%r12d
  jmp    L104
  nopl   0x0(%rax,%rax,1)
L172:
  test   %esi,%esi
  je     L155
  call   <rand@plt>
  shl    $0xa,%eax
  mov    %eax,%esi
  and    $0x1c00,%esi
  jmp    L155
```

assistant: ```c
int_fast32_t recF16FromF16(uint16_t in, bool addRandomness) {
  bool sign;
  int exp, fract;
  sign = in >> 15 & 1;
  exp = in >> 10 & 0x1F;
  fract = in & 0x3FF;
  if (exp == 0x1F) {
    if (fract) {
      exp = 0x38;
    } else {
      exp = 0x30;
      if (addRandomness)
        fract = rand() & 0x3FF;
    }
    if (addRandomness)
      exp |= rand() & 7;
  } else {
    if (exp == 0) {
      if (fract < 4) {
        if (!fract) {
          if (addRandomness)
            exp = rand() & 7;
          goto done;
        }
        exp -= 8;
        fract <<= 8;
      } else if (fract < 0x40) {
        exp -= 4;
        fract <<= 4;
      }
      if (fract < 0x100) {
        exp -= 2;
        fract <<= 2;
      }
      if (!(fract & 0x200)) {
        --exp;
        fract <<= 1;
      }
      fract = (fract << 1) - 0x400;
    }
    exp += 0x011;
  }
done:
  return (int_fast32_t)sign << 16 | (int_fast32_t)exp << 10 | fract;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<recF16FromF16>:
  endbr64
  mov    %edi,%eax
  push   %r12
  sar    $0xa,%eax
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  and    $0x1f,%eax
  mov    %edi,%ebx
  and    $0x3ff,%ebp
  sar    $0xf,%ebx
  cmp    $0x1f,%eax
  je     L78
  test   %eax,%eax
  je     L129
L110:
  lea    0x11(%rax),%esi
  shl    $0xa,%esi
L162:
  mov    %ebx,%eax
  or     %esi,%ebp
  pop    %rbx
  shl    $0x10,%eax
  and    $0x10000,%eax
  or     %ebp,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L129:
  test   $0x3fc,%edi
  je     L109
  and    $0x3c0,%edi
  mov    $0xfffffffe,%edx
  jne    L77
  shl    $0x4,%ebp
  mov    $0xfffffffa,%edx
  mov    $0xfffffffc,%eax
L77:
  cmp    $0xff,%ebp
  jg     L80
  shl    $0x2,%ebp
  mov    %edx,%eax
L80:
  test   $0x200,%ebp
  jne    L8
  add    %ebp,%ebp
  sub    $0x1,%eax
L8:
  lea    -0x400(%rbp,%rbp,1),%ebp
  jmp    L110
  nopl   (%rax)
L78:
  test   %ebp,%ebp
  je     L138
  test   %esi,%esi
  jne    L106
  mov    $0xe000,%esi
  jmp    L162
  nopw   0x0(%rax,%rax,1)
L138:
  test   %esi,%esi
  jne    L133
  mov    $0xc000,%esi
  jmp    L162
  nopl   0x0(%rax,%rax,1)
L109:
  test   %ebp,%ebp
  je     L48
  shl    $0x8,%ebp
  mov    $0xfffffff8,%eax
  jmp    L80
  xchg   %ax,%ax
L133:
  xor    %eax,%eax
  mov    $0x30,%r12d
  call   <rand@plt>
  and    $0x3ff,%eax
  mov    %eax,%ebp
L154:
  xor    %eax,%eax
  call   <rand@plt>
  and    $0x7,%eax
  mov    %eax,%esi
  or     %r12d,%esi
  shl    $0xa,%esi
  jmp    L162
  nopl   0x0(%rax,%rax,1)
L106:
  mov    $0x38,%r12d
  jmp    L154
  nopl   0x0(%rax,%rax,1)
L48:
  test   %esi,%esi
  je     L162
  call   <rand@plt>
  shl    $0xa,%eax
  mov    %eax,%esi
  and    $0x1c00,%esi
  jmp    L162
```

assistant: ```c
int_fast32_t recF16FromF16(uint16_t in, bool addRandomness) {
  bool sign;
  int exp, fract;
  sign = in >> 15 & 1;
  exp = in >> 10 & 0x1F;
  fract = in & 0x3FF;
  if (exp == 0x1F) {
    if (fract) {
      exp = 0x38;
    } else {
      exp = 0x30;
      if (addRandomness)
        fract = rand() & 0x3FF;
    }
    if (addRandomness)
      exp |= rand() & 7;
  } else {
    if (exp == 0) {
      if (fract < 4) {
        if (!fract) {
          if (addRandomness)
            exp = rand() & 7;
          goto done;
        }
        exp -= 8;
        fract <<= 8;
      } else if (fract < 0x40) {
        exp -= 4;
        fract <<= 4;
      }
      if (fract < 0x100) {
        exp -= 2;
        fract <<= 2;
      }
      if (!(fract & 0x200)) {
        --exp;
        fract <<= 1;
      }
      fract = (fract << 1) - 0x400;
    }
    exp += 0x011;
  }
done:
  return (int_fast32_t)sign << 16 | (int_fast32_t)exp << 10 | fract;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<nth_champer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  cmpl   $0x9,-0x24(%rbp)
  jg     L23
  mov    -0x24(%rbp),%eax
  jmp    L42
L23:
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <nth_digits@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  sub    %eax,%edx
  mov    %edx,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L2
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  sub    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L24
L2:
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x1c(%rbp)
L24:
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %edx,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L53
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L5
L53:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
L5:
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  mov    $0xa,%edi
  call   <pow@plt>
  mov    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <nth_digit@plt>
L42:
  leave
  ret
```

assistant: ```c
int nth_champer(int i) {
  if (i < 10) {
    return i;
  } else {
    int res = nth_digits(i);
    int fres = res % 10;
    int sres = res / 10;
    int rems = i - sres;
    int prevs, remss, remsss;
    if (0 == rems % fres) {
      prevs = (rems / fres) - 1;
    } else {
      prevs = (rems / fres);
    }
    remss = rems % fres;
    if (0 == remss) {
      remsss = fres - 1;
    } else {
      remsss = remss - 1;
    }
    return nth_digit(pow(10, fres - 1) + prevs, remsss);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<nth_champer>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  cmp    $0x9,%edi
  jg     L37
L23:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L37:
  call   <nth_digits@plt>
  movslq %eax,%rsi
  imul   $0x66666667,%rsi,%rsi
  sar    $0x22,%rsi
  cltd
  sub    %edx,%esi
  mov    %esi,%ecx
  lea    (%rsi,%rsi,4),%edx
  add    %edx,%edx
  sub    %edx,%eax
  mov    %eax,%esi
  sub    %ecx,%ebx
  mov    %ebx,%eax
  cltd
  idiv   %esi
  mov    %edx,%ebp
  test   %edx,%edx
  jne    L9
  mov    %ebx,%eax
  cltd
  idiv   %esi
  mov    %eax,%ebx
  sub    $0x1,%ebx
  lea    -0x1(%rsi),%ebp
L8:
  sub    $0x1,%esi
  mov    $0xa,%edi
  call   <pow@plt>
  mov    %rax,%rdi
  movslq %ebx,%rax
  add    %rax,%rdi
  mov    %ebp,%esi
  call   <nth_digit@plt>
  mov    %eax,%ebx
  jmp    L23
L9:
  mov    %ebx,%eax
  cltd
  idiv   %esi
  mov    %eax,%ebx
  sub    $0x1,%ebp
  jmp    L8
```

assistant: ```c
int nth_champer(int i) {
  if (i < 10) {
    return i;
  } else {
    int res = nth_digits(i);
    int fres = res % 10;
    int sres = res / 10;
    int rems = i - sres;
    int prevs, remss, remsss;
    if (0 == rems % fres) {
      prevs = (rems / fres) - 1;
    } else {
      prevs = (rems / fres);
    }
    remss = rems % fres;
    if (0 == remss) {
      remsss = fres - 1;
    } else {
      remsss = remss - 1;
    }
    return nth_digit(pow(10, fres - 1) + prevs, remsss);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<nth_champer>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  sub    $0x8,%rsp
  cmp    $0x9,%edi
  jg     L28
  add    $0x8,%rsp
  mov    %edi,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L28:
  call   <nth_digits@plt>
  movslq %eax,%rsi
  cltd
  imul   $0x66666667,%rsi,%rsi
  sar    $0x22,%rsi
  sub    %edx,%esi
  lea    (%rsi,%rsi,4),%ecx
  mov    %esi,%edx
  add    %ecx,%ecx
  sub    %ecx,%eax
  mov    %eax,%esi
  mov    %r12d,%eax
  sub    %edx,%eax
  cltd
  idiv   %esi
  test   %edx,%edx
  je     L13
  mov    %eax,%r12d
  lea    -0x1(%rdx),%ebp
  sub    $0x1,%esi
L15:
  mov    $0xa,%edi
  movslq %r12d,%r12
  call   <pow@plt>
  add    $0x8,%rsp
  mov    %ebp,%esi
  lea    (%r12,%rax,1),%rdi
  pop    %rbp
  pop    %r12
  jmp    1070 <nth_digit@plt>
  nopl   (%rax)
L13:
  lea    -0x1(%rsi),%ebp
  lea    -0x1(%rax),%r12d
  mov    %ebp,%esi
  jmp    L15
```

assistant: ```c
int nth_champer(int i) {
  if (i < 10) {
    return i;
  } else {
    int res = nth_digits(i);
    int fres = res % 10;
    int sres = res / 10;
    int rems = i - sres;
    int prevs, remss, remsss;
    if (0 == rems % fres) {
      prevs = (rems / fres) - 1;
    } else {
      prevs = (rems / fres);
    }
    remss = rems % fres;
    if (0 == remss) {
      remsss = fres - 1;
    } else {
      remsss = remss - 1;
    }
    return nth_digit(pow(10, fres - 1) + prevs, remsss);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<nth_champer>:
  endbr64
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  sub    $0x8,%rsp
  cmp    $0x9,%edi
  jg     L25
  add    $0x8,%rsp
  mov    %edi,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L25:
  call   <nth_digits@plt>
  movslq %eax,%rsi
  cltd
  imul   $0x66666667,%rsi,%rsi
  sar    $0x22,%rsi
  sub    %edx,%esi
  lea    (%rsi,%rsi,4),%ecx
  mov    %esi,%edx
  add    %ecx,%ecx
  sub    %ecx,%eax
  mov    %eax,%esi
  mov    %r12d,%eax
  sub    %edx,%eax
  cltd
  idiv   %esi
  test   %edx,%edx
  je     L4
  mov    %eax,%r12d
  lea    -0x1(%rdx),%ebp
  sub    $0x1,%esi
L11:
  mov    $0xa,%edi
  movslq %r12d,%r12
  call   <pow@plt>
  add    $0x8,%rsp
  mov    %ebp,%esi
  lea    (%r12,%rax,1),%rdi
  pop    %rbp
  pop    %r12
  jmp    1070 <nth_digit@plt>
  nopl   (%rax)
L4:
  lea    -0x1(%rsi),%ebp
  lea    -0x1(%rax),%r12d
  mov    %ebp,%esi
  jmp    L11
```

assistant: ```c
int nth_champer(int i) {
  if (i < 10) {
    return i;
  } else {
    int res = nth_digits(i);
    int fres = res % 10;
    int sres = res / 10;
    int rems = i - sres;
    int prevs, remss, remsss;
    if (0 == rems % fres) {
      prevs = (rems / fres) - 1;
    } else {
      prevs = (rems / fres);
    }
    remss = rems % fres;
    if (0 == remss) {
      remsss = fres - 1;
    } else {
      remsss = remss - 1;
    }
    return nth_digit(pow(10, fres - 1) + prevs, remsss);
  }
}
```