ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<strrstr>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L63
  mov    %rsi,%rbp
  test   %rsi,%rsi
  je     L63
  mov    %rdi,%rbx
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  mov    %rax,%r13
  cmp    %rax,%r12
  jb     L63
  sub    %rax,%r12
  add    %rbx,%r12
  jae    L40
  jmp    L63
L48:
  sub    $0x1,%r12
  cmp    %r12,%rbx
  ja     L63
L40:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L48
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L63:
  add    $0x8,%rsp
  xor    %r12d,%r12d
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strrstr(const char *haystack, const char *needle) {
  if (!haystack || !needle)
    return NULL;
  size_t hsize = strlen(haystack), nsize = strlen(needle);
  if (nsize > hsize)
    return NULL;
  union {
    const char *const_charp;
    char *charp;
  } safe_charp;
  safe_charp.const_charp = haystack;
  char *hstk = safe_charp.charp;
  char *pos = hstk + hsize - nsize;
  for (; pos >= hstk; pos--)
    if (!strncmp(pos, needle, nsize))
      return pos;
  return NULL;
}
```
user: Translate the below assembly code into C programming language:

```asm
<strrstr>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L31
  mov    %rsi,%rbp
  test   %rsi,%rsi
  je     L31
  mov    %rdi,%rbx
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <strlen@plt>
  mov    %rax,%r13
  cmp    %rax,%r12
  jb     L31
  sub    %rax,%r12
  add    %rbx,%r12
  jae    L51
  jmp    L31
L5:
  sub    $0x1,%r12
  cmp    %r12,%rbx
  ja     L31
L51:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L5
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L31:
  add    $0x8,%rsp
  xor    %r12d,%r12d
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strrstr(const char *haystack, const char *needle) {
  if (!haystack || !needle)
    return NULL;
  size_t hsize = strlen(haystack), nsize = strlen(needle);
  if (nsize > hsize)
    return NULL;
  union {
    const char *const_charp;
    char *charp;
  } safe_charp;
  safe_charp.const_charp = haystack;
  char *hstk = safe_charp.charp;
  char *pos = hstk + hsize - nsize;
  for (; pos >= hstk; pos--)
    if (!strncmp(pos, needle, nsize))
      return pos;
  return NULL;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<printf_unsigned_base>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x1c(%rbp)
  mov    -0x34(%rbp),%edx
  lea    -0x14(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <print_base@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  setne  %al
  movzbl %al,%eax
  add    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jge    L32
  mov    -0x2c(%rbp),%eax
  sub    -0x18(%rbp),%eax
  cmpl   $0x0,-0x30(%rbp)
  je     L18
  mov    $0x30,%edx
  jmp    L11
L18:
  mov    $0x20,%edx
L11:
  mov    %eax,%esi
  mov    %edx,%edi
  call   <print_multichar@plt>
L32:
  lea    -0x14(%rbp),%rax
  mov    %rax,%rdi
  call   <print_str@plt>
  mov    -0x18(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L28
  call   <__stack_chk_fail@plt>
L28:
  leave
  ret
```

assistant: ```c
int printf_unsigned_base(unsigned long int val, int width, int leading_zeros_p, unsigned int base) {
  int is_signed_p = 0;
  if (val < 0) {
    val = -val;
    is_signed_p = 1;
  }
  char num_array[12];
  int num_width = print_base(val, num_array, base);
  num_width += is_signed_p ? 1 : 0;
  if (num_width < width) {
    print_multichar(leading_zeros_p ? '0' : ' ', width - num_width);
  }
  print_str(num_array);
  return width > num_width ? width : num_width;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<printf_unsigned_base>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %ecx,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  call   <print_base@plt>
  mov    %eax,%ebx
  cmp    %ebp,%eax
  jge    L18
  mov    %ebp,%esi
  sub    %eax,%esi
  cmp    $0x1,%r12d
  sbb    %edi,%edi
  and    $0xfffffff0,%edi
  add    $0x30,%edi
  call   <print_multichar@plt>
L18:
  lea    0xc(%rsp),%rdi
  call   <print_str@plt>
  cmp    %ebp,%ebx
  mov    %ebp,%eax
  cmovge %ebx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L14
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L14:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int printf_unsigned_base(unsigned long int val, int width, int leading_zeros_p, unsigned int base) {
  int is_signed_p = 0;
  if (val < 0) {
    val = -val;
    is_signed_p = 1;
  }
  char num_array[12];
  int num_width = print_base(val, num_array, base);
  num_width += is_signed_p ? 1 : 0;
  if (num_width < width) {
    print_multichar(leading_zeros_p ? '0' : ' ', width - num_width);
  }
  print_str(num_array);
  return width > num_width ? width : num_width;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<printf_unsigned_base>:
  endbr64
  push   %r13
  push   %r12
  mov    %edx,%r12d
  mov    %ecx,%edx
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r13
  mov    %r13,%rsi
  call   <print_base@plt>
  mov    %eax,%ebx
  cmp    %ebp,%eax
  jge    L0
  mov    %ebp,%esi
  sub    %eax,%esi
  cmp    $0x1,%r12d
  sbb    %edi,%edi
  and    $0xfffffff0,%edi
  add    $0x30,%edi
  call   <print_multichar@plt>
L0:
  mov    %r13,%rdi
  call   <print_str@plt>
  cmp    %ebp,%ebx
  mov    %ebp,%eax
  cmovge %ebx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L14
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L14:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int printf_unsigned_base(unsigned long int val, int width, int leading_zeros_p, unsigned int base) {
  int is_signed_p = 0;
  if (val < 0) {
    val = -val;
    is_signed_p = 1;
  }
  char num_array[12];
  int num_width = print_base(val, num_array, base);
  num_width += is_signed_p ? 1 : 0;
  if (num_width < width) {
    print_multichar(leading_zeros_p ? '0' : ' ', width - num_width);
  }
  print_str(num_array);
  return width > num_width ? width : num_width;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<printf_unsigned_base>:
  endbr64
  push   %r13
  push   %r12
  mov    %edx,%r12d
  mov    %ecx,%edx
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r13
  mov    %r13,%rsi
  call   <print_base@plt>
  mov    %eax,%ebx
  cmp    %ebp,%eax
  jge    L9
  mov    %ebp,%esi
  sub    %eax,%esi
  cmp    $0x1,%r12d
  sbb    %edi,%edi
  and    $0xfffffff0,%edi
  add    $0x30,%edi
  call   <print_multichar@plt>
L9:
  mov    %r13,%rdi
  call   <print_str@plt>
  cmp    %ebp,%ebx
  mov    %ebp,%eax
  cmovge %ebx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int printf_unsigned_base(unsigned long int val, int width, int leading_zeros_p, unsigned int base) {
  int is_signed_p = 0;
  if (val < 0) {
    val = -val;
    is_signed_p = 1;
  }
  char num_array[12];
  int num_width = print_base(val, num_array, base);
  num_width += is_signed_p ? 1 : 0;
  if (num_width < width) {
    print_multichar(leading_zeros_p ? '0' : ' ', width - num_width);
  }
  print_str(num_array);
  return width > num_width ? width : num_width;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<putchars>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  jmp    L11
L16:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <putchar@plt>
L11:
  mov    -0x8(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  test   %eax,%eax
  jne    L16
  nop
  nop
  leave
  ret
```

assistant: ```c
void putchars(int c, int q) {
  while (q--)
    putchar(c);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<putchars>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %esi,%ebx
  test   %esi,%esi
  je     L2
L10:
  mov    %ebp,%edi
  call   <putchar@plt>
  sub    $0x1,%ebx
  jne    L10
L2:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void putchars(int c, int q) {
  while (q--)
    putchar(c);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<putchars>:
  endbr64
  test   %esi,%esi
  je     L17
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L12:
  mov    %ebp,%edi
  call   <putchar@plt>
  sub    $0x1,%ebx
  jne    L12
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L17:
  ret
```

assistant: ```c
void putchars(int c, int q) {
  while (q--)
    putchar(c);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<putchars>:
  endbr64
  test   %esi,%esi
  je     L12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L18:
  mov    %ebp,%edi
  call   <putchar@plt>
  sub    $0x1,%ebx
  jne    L18
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L12:
  ret
```

assistant: ```c
void putchars(int c, int q) {
  while (q--)
    putchar(c);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<hal_cc25xx_init>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <hal_spi_init@plt>
  mov    $0x0,%eax
  call   <hal_cc25xx_init_gpio@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void hal_cc25xx_init(void) {
  hal_spi_init();
  hal_cc25xx_init_gpio();
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<hal_cc25xx_init>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <hal_spi_init@plt>
  mov    $0x0,%eax
  call   <hal_cc25xx_init_gpio@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void hal_cc25xx_init(void) {
  hal_spi_init();
  hal_cc25xx_init_gpio();
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<hal_cc25xx_init>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <hal_spi_init@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <hal_cc25xx_init_gpio@plt>
```

assistant: ```c
void hal_cc25xx_init(void) {
  hal_spi_init();
  hal_cc25xx_init_gpio();
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<hal_cc25xx_init>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <hal_spi_init@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1070 <hal_cc25xx_init_gpio@plt>
```

assistant: ```c
void hal_cc25xx_init(void) {
  hal_spi_init();
  hal_cc25xx_init_gpio();
}
```
user: What is the c source code of the assembly code below?

```asm
<ssim_end4>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  test   %edx,%edx
  jle    L1
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  lea    -0x1(%rdx),%eax
  shl    $0x4,%rax
  lea    0x10(%rdi,%rax,1),%r12
  pxor   %xmm2,%xmm2
  movss  %xmm2,0xc(%rsp)
L14:
  mov    0x1c(%rbx),%ecx
  add    0xc(%rbx),%ecx
  add    0xc(%rbp),%ecx
  add    0x1c(%rbp),%ecx
  mov    0x18(%rbx),%edx
  add    0x8(%rbx),%edx
  add    0x8(%rbp),%edx
  add    0x18(%rbp),%edx
  mov    0x14(%rbx),%esi
  add    0x4(%rbx),%esi
  add    0x4(%rbp),%esi
  add    0x14(%rbp),%esi
  mov    0x10(%rbx),%edi
  add    (%rbx),%edi
  add    0x0(%rbp),%edi
  add    0x10(%rbp),%edi
  call   <ssim_end1@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  addss  0xc(%rsp),%xmm0
  movss  %xmm0,0xc(%rsp)
  add    $0x10,%rbx
  add    $0x10,%rbp
  cmp    %r12,%rbx
  jne    L14
L16:
  movss  0xc(%rsp),%xmm0
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  pxor   %xmm3,%xmm3
  movss  %xmm3,0xc(%rsp)
  jmp    L16
```

assistant: ```c
float ssim_end4(int sum0[5][4], int sum1[5][4], int width) {
  float ssim = 0.0;
  for (int i = 0; i < width; i++)
    ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]);
  return ssim;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ssim_end4>:
  endbr64
  test   %edx,%edx
  jle    L10
  push   %r12
  lea    -0x1(%rdx),%eax
  pxor   %xmm0,%xmm0
  push   %rbp
  shl    $0x4,%rax
  mov    %rsi,%rbp
  push   %rbx
  lea    0x10(%rdi,%rax,1),%r12
  mov    %rdi,%rbx
  sub    $0x10,%rsp
  nopw   0x0(%rax,%rax,1)
L19:
  mov    0x1c(%rbx),%ecx
  mov    0x18(%rbx),%edx
  movss  %xmm0,0xc(%rsp)
  add    $0x10,%rbx
  add    -0x4(%rbx),%ecx
  add    -0x8(%rbx),%edx
  add    $0x10,%rbp
  add    -0x4(%rbp),%ecx
  add    -0x8(%rbp),%edx
  mov    0x4(%rbx),%esi
  mov    (%rbx),%edi
  add    -0xc(%rbx),%esi
  add    -0x10(%rbx),%edi
  add    -0xc(%rbp),%esi
  add    -0x10(%rbp),%edi
  add    0xc(%rbp),%ecx
  add    0x8(%rbp),%edx
  add    0x4(%rbp),%esi
  add    0x0(%rbp),%edi
  call   <ssim_end1@plt>
  pxor   %xmm1,%xmm1
  movss  0xc(%rsp),%xmm0
  cvtsi2ss %rax,%xmm1
  addss  %xmm1,%xmm0
  cmp    %rbx,%r12
  jne    L19
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L10:
  pxor   %xmm0,%xmm0
  ret
```

assistant: ```c
float ssim_end4(int sum0[5][4], int sum1[5][4], int width) {
  float ssim = 0.0;
  for (int i = 0; i < width; i++)
    ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]);
  return ssim;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ssim_end4>:
  endbr64
  test   %edx,%edx
  jle    L18
  push   %r12
  lea    -0x1(%rdx),%eax
  pxor   %xmm0,%xmm0
  push   %rbp
  shl    $0x4,%rax
  mov    %rsi,%rbp
  push   %rbx
  lea    0x10(%rdi,%rax,1),%r12
  mov    %rdi,%rbx
  sub    $0x10,%rsp
  nopw   0x0(%rax,%rax,1)
L13:
  mov    0x1c(%rbx),%ecx
  mov    0x18(%rbx),%edx
  movss  %xmm0,0xc(%rsp)
  add    $0x10,%rbx
  add    -0x4(%rbx),%ecx
  add    -0x8(%rbx),%edx
  add    $0x10,%rbp
  add    -0x4(%rbp),%ecx
  add    -0x8(%rbp),%edx
  mov    0x4(%rbx),%esi
  mov    (%rbx),%edi
  add    -0xc(%rbx),%esi
  add    -0x10(%rbx),%edi
  add    -0xc(%rbp),%esi
  add    -0x10(%rbp),%edi
  add    0xc(%rbp),%ecx
  add    0x8(%rbp),%edx
  add    0x4(%rbp),%esi
  add    0x0(%rbp),%edi
  call   <ssim_end1@plt>
  pxor   %xmm1,%xmm1
  movss  0xc(%rsp),%xmm0
  cvtsi2ss %rax,%xmm1
  addss  %xmm1,%xmm0
  cmp    %rbx,%r12
  jne    L13
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L18:
  pxor   %xmm0,%xmm0
  ret
```

assistant: ```c
float ssim_end4(int sum0[5][4], int sum1[5][4], int width) {
  float ssim = 0.0;
  for (int i = 0; i < width; i++)
    ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]);
  return ssim;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<htmldecode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  call   <strlen@plt>
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%rbp
  mov    $0x0,%ebx
  jmp    L61
L80:
  mov    %al,0x0(%rbp)
L45:
  add    $0x1,%ebx
  add    $0x1,%rbp
L61:
  mov    %r12,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L42
  movslq %ebx,%rdx
  movzbl (%r12,%rdx,1),%eax
  cmp    $0x25,%al
  jne    L80
  lea    0x1(%r12,%rdx,1),%r13
  mov    $0x1,%r14d
  mov    $0x0,%r15d
  jmp    L60
L16:
  movsbl 0x0(%r13),%edi
  call   <islower@plt>
  test   %rax,%rax
  je     L95
  mov    (%rsp),%rax
  movsbl (%rax),%eax
  sub    $0x61,%eax
  mov    %eax,(%rsp)
  mov    %r14d,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   (%rsp),%eax
  add    %eax,%r15d
L24:
  sub    $0x1,%r14d
  add    $0x1,%r13
  cmp    $0xffffffff,%r14d
  je     L75
L60:
  mov    %r13,(%rsp)
  movsbl 0x0(%r13),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L16
  movsbl 0x0(%r13),%eax
  sub    $0x41,%eax
  mov    %eax,(%rsp)
  mov    %r14d,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   (%rsp),%eax
  add    %eax,%r15d
  jmp    L24
L95:
  mov    (%rsp),%rax
  movsbl (%rax),%eax
  sub    $0x30,%eax
  mov    %eax,(%rsp)
  mov    %r14d,%esi
  mov    $0x10,%edi
  call   <pow@plt>
  movsbl %al,%eax
  imul   (%rsp),%eax
  add    %eax,%r15d
  jmp    L24
L75:
  mov    %r15b,0x0(%rbp)
  add    $0x2,%ebx
  jmp    L45
L42:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *htmldecode(char *msg) {
  int i, r, j, total = 0;
  char *rtn = (char *)malloc(sizeof(char) * strlen(msg));
  for (i = 0, r = 0; i < strlen(msg); i++, r++) {
    if (msg[i] != '%') {
      rtn[r] = msg[i];
    } else {
      total = 0;
      for (j = 1; j <= 2; j++) {
        if (isupper(msg[i + j])) {
          total += (msg[i + j] - 'A') * pow(16, 2 - j);
        } else if (islower(msg[i + j])) {
          total += (msg[i + j] - 'a') * pow(16, 2 - j);
        } else {
          total += (msg[i + j] - '0') * pow(16, 2 - j);
        }
      }
      rtn[r] = total;
      i += 2;
    }
  }
  return rtn;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<htmldecode>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r13
  jmp    L95
  nopl   (%rax)
L70:
  mov    %r12b,0x0(%r13)
  add    $0x1,%ebp
  add    $0x1,%r13
L95:
  mov    %r14,%rdi
  call   <strlen@plt>
  cmp    %ebp,%eax
  jle    L93
  movslq %ebp,%rbx
  add    %r14,%rbx
  movzbl (%rbx),%r12d
  cmp    $0x25,%r12b
  jne    L70
  mov    $0x1,%r15d
  xor    %r12d,%r12d
L15:
  movsbl 0x1(%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L86
  movsbl 0x1(%rbx),%eax
  sub    $0x41,%eax
L66:
  mov    %r15d,%esi
  mov    $0x10,%edi
  mov    %eax,0x4(%rsp)
  add    $0x1,%rbx
  call   <pow@plt>
  movsbl %al,%eax
  imul   0x4(%rsp),%eax
  add    %eax,%r12d
  test   %r15d,%r15d
  jne    L16
  add    $0x2,%ebp
  jmp    L70
  nopl   0x0(%rax,%rax,1)
L86:
  movsbl 0x1(%rbx),%edi
  call   <islower@plt>
  test   %rax,%rax
  movsbl 0x1(%rbx),%eax
  je     L91
  sub    $0x61,%eax
  jmp    L66
  nop
L16:
  xor    %r15d,%r15d
  jmp    L15
  nopl   (%rax)
L93:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L91:
  sub    $0x30,%eax
  jmp    L66
```

assistant: ```c
char *htmldecode(char *msg) {
  int i, r, j, total = 0;
  char *rtn = (char *)malloc(sizeof(char) * strlen(msg));
  for (i = 0, r = 0; i < strlen(msg); i++, r++) {
    if (msg[i] != '%') {
      rtn[r] = msg[i];
    } else {
      total = 0;
      for (j = 1; j <= 2; j++) {
        if (isupper(msg[i + j])) {
          total += (msg[i + j] - 'A') * pow(16, 2 - j);
        } else if (islower(msg[i + j])) {
          total += (msg[i + j] - 'a') * pow(16, 2 - j);
        } else {
          total += (msg[i + j] - '0') * pow(16, 2 - j);
        }
      }
      rtn[r] = total;
      i += 2;
    }
  }
  return rtn;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<htmldecode>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r13
  jmp    L29
  nopl   (%rax)
L34:
  mov    %r12b,0x0(%r13)
  add    $0x1,%ebp
  add    $0x1,%r13
L29:
  mov    %r14,%rdi
  call   <strlen@plt>
  cmp    %ebp,%eax
  jle    L97
  movslq %ebp,%rbx
  add    %r14,%rbx
  movzbl (%rbx),%r12d
  cmp    $0x25,%r12b
  jne    L34
  mov    $0x1,%r15d
  xor    %r12d,%r12d
L49:
  movsbl 0x1(%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L80
  movsbl 0x1(%rbx),%eax
  sub    $0x41,%eax
L52:
  mov    %r15d,%esi
  mov    $0x10,%edi
  mov    %eax,0x4(%rsp)
  add    $0x1,%rbx
  call   <pow@plt>
  movsbl %al,%eax
  imul   0x4(%rsp),%eax
  add    %eax,%r12d
  test   %r15d,%r15d
  jne    L70
  add    $0x2,%ebp
  jmp    L34
  nopl   0x0(%rax,%rax,1)
L80:
  movsbl 0x1(%rbx),%edi
  call   <islower@plt>
  test   %rax,%rax
  movsbl 0x1(%rbx),%eax
  je     L75
  sub    $0x61,%eax
  jmp    L52
  nop
L70:
  xor    %r15d,%r15d
  jmp    L49
  nopl   (%rax)
L97:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L75:
  sub    $0x30,%eax
  jmp    L52
```

assistant: ```c
char *htmldecode(char *msg) {
  int i, r, j, total = 0;
  char *rtn = (char *)malloc(sizeof(char) * strlen(msg));
  for (i = 0, r = 0; i < strlen(msg); i++, r++) {
    if (msg[i] != '%') {
      rtn[r] = msg[i];
    } else {
      total = 0;
      for (j = 1; j <= 2; j++) {
        if (isupper(msg[i + j])) {
          total += (msg[i + j] - 'A') * pow(16, 2 - j);
        } else if (islower(msg[i + j])) {
          total += (msg[i + j] - 'a') * pow(16, 2 - j);
        } else {
          total += (msg[i + j] - '0') * pow(16, 2 - j);
        }
      }
      rtn[r] = total;
      i += 2;
    }
  }
  return rtn;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<strstr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L88
  cmpq   $0x0,-0x30(%rbp)
  jne    L85
L88:
  mov    $0x0,%eax
  jmp    L61
L85:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L42
  mov    -0x28(%rbp),%rax
  jmp    L61
L42:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L14
L62:
  mov    -0x8(%rbp),%rdx
  mov    -0x30(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L21
  mov    -0x18(%rbp),%rax
  jmp    L61
L21:
  addq   $0x1,-0x18(%rbp)
L14:
  mov    -0x28(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x18(%rbp)
  jb     L62
  mov    $0x0,%eax
L61:
  leave
  ret
```

assistant: ```c
char *strstr(const char *hay, const char *needle) {
  char *pos;
  size_t hlen, nlen;
  if (hay == NULL || needle == NULL)
    return NULL;
  hlen = strlen(hay);
  nlen = strlen(needle);
  if (nlen < 1)
    return (char *)hay;
  for (pos = (char *)hay; pos < hay + hlen; pos++) {
    if (strncmp(pos, needle, nlen) == 0) {
      return pos;
    }
  }
  return NULL;
}
```