ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的？

```asm
<decodeblock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  shr    $0x4,%al
  or     %edx,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  shr    $0x2,%al
  or     %edx,%eax
  mov    %al,-0xb(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  or     %edx,%eax
  mov    %al,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  lea    -0xc(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

assistant: ```c
void decodeblock(unsigned char in[], char *clrstr) {
  unsigned char out[4];
  out[0] = in[0] << 2 | in[1] >> 4;
  out[1] = in[1] << 4 | in[2] >> 2;
  out[2] = in[2] << 6 | in[3] >> 0;
  out[3] = '\0';
  strncat((char *)clrstr, (char *)out, sizeof(out));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<decodeblock>:
  endbr64
  sub    $0x18,%rsp
  mov    %rsi,%rcx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movzbl 0x1(%rdi),%edx
  movzbl (%rdi),%esi
  shl    $0x2,%esi
  mov    %edx,%eax
  shr    $0x4,%al
  or     %esi,%eax
  mov    %al,0x4(%rsp)
  movzbl 0x2(%rdi),%eax
  mov    %eax,%esi
  shr    $0x2,%sil
  shl    $0x4,%edx
  or     %esi,%edx
  mov    %dl,0x5(%rsp)
  shl    $0x6,%eax
  or     0x3(%rdi),%al
  mov    %al,0x6(%rsp)
  movb   $0x0,0x7(%rsp)
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  mov    %rcx,%rdi
  call   <strncat@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x18,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void decodeblock(unsigned char in[], char *clrstr) {
  unsigned char out[4];
  out[0] = in[0] << 2 | in[1] >> 4;
  out[1] = in[1] << 4 | in[2] >> 2;
  out[2] = in[2] << 6 | in[3] >> 0;
  out[3] = '\0';
  strncat((char *)clrstr, (char *)out, sizeof(out));
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<decodeblock>:
  endbr64
  sub    $0x18,%rsp
  movzbl 0x1(%rdi),%edx
  movzbl (%rdi),%ecx
  mov    %rsi,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  movb   $0x0,0x7(%rsp)
  mov    %edx,%eax
  shl    $0x2,%ecx
  shr    $0x4,%al
  shl    $0x4,%edx
  or     %ecx,%eax
  mov    %al,0x4(%rsp)
  movzbl 0x2(%rdi),%eax
  mov    %eax,%ecx
  shl    $0x6,%eax
  or     0x3(%rdi),%al
  mov    %r8,%rdi
  shr    $0x2,%cl
  mov    %al,0x6(%rsp)
  or     %ecx,%edx
  mov    %dl,0x5(%rsp)
  mov    $0x4,%edx
  call   <strncat@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void decodeblock(unsigned char in[], char *clrstr) {
  unsigned char out[4];
  out[0] = in[0] << 2 | in[1] >> 4;
  out[1] = in[1] << 4 | in[2] >> 2;
  out[2] = in[2] << 6 | in[3] >> 0;
  out[3] = '\0';
  strncat((char *)clrstr, (char *)out, sizeof(out));
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<decodeblock>:
  endbr64
  push   %rbx
  mov    %rdi,%rdx
  mov    %rsi,%rdi
  xor    %ebx,%ebx
  sub    $0x10,%rsp
  movzbl 0x1(%rdx),%ecx
  movzbl (%rdx),%r8d
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movzbl 0x2(%rdx),%eax
  movb   $0x0,0x7(%rsp)
  mov    %ecx,%esi
  shl    $0x2,%r8d
  shr    $0x4,%sil
  shl    $0x4,%ecx
  or     %r8d,%esi
  mov    %sil,%bl
  mov    %eax,%esi
  shl    $0x6,%eax
  or     0x3(%rdx),%al
  shr    $0x2,%sil
  mov    $0x4,%edx
  mov    %al,0x6(%rsp)
  or     %esi,%ecx
  lea    0x4(%rsp),%rsi
  mov    %cl,%bh
  mov    %bx,0x4(%rsp)
  call   <strncat@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x10,%rsp
  pop    %rbx
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void decodeblock(unsigned char in[], char *clrstr) {
  unsigned char out[4];
  out[0] = in[0] << 2 | in[1] >> 4;
  out[1] = in[1] << 4 | in[2] >> 2;
  out[2] = in[2] << 6 | in[3] >> 0;
  out[3] = '\0';
  strncat((char *)clrstr, (char *)out, sizeof(out));
}
```
user: Translate the below assembly code into C programming language:

```asm
<RIPEMD160_Final>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    0x38(%rsi),%r12
  mov    (%rsi),%rdi
  movb   $0x80,(%r12,%rdi,1)
  add    $0x1,%rdi
  mov    D17(%rip),%rax
  mov    (%rax),%edx
  lea    -0x8(%rdx),%eax
  cltq
  cmp    %rdi,%rax
  jb     L7
L18:
  mov    D17(%rip),%r13
  mov    0x0(%r13),%eax
  lea    -0x8(%rax),%edx
  sub    %edi,%edx
  add    %r12,%rdi
  mov    $0x0,%esi
  call   <memset@plt>
  movslq 0x0(%r13),%rax
  lea    -0x8(%r12,%rax,1),%rax
  mov    0x8(%rbx),%edx
  mov    %edx,(%rax)
  mov    0xc(%rbx),%edx
  mov    %edx,0x4(%rax)
  lea    0x8(%rax),%r12
  movslq 0x0(%r13),%rax
  sub    %rax,%r12
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <ripemd160_block_data_order@plt>
  movq   $0x0,(%rbx)
  mov    0x0(%r13),%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    0x10(%rbx),%rax
  mov    %eax,0x0(%rbp)
  mov    0x18(%rbx),%rax
  mov    %eax,0x4(%rbp)
  mov    0x20(%rbx),%rax
  mov    %eax,0x8(%rbp)
  mov    0x28(%rbx),%rax
  mov    %eax,0xc(%rbp)
  mov    0x30(%rbx),%rax
  mov    %eax,0x10(%rbp)
  mov    $0x1,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L7:
  sub    %edi,%edx
  add    %r12,%rdi
  mov    $0x0,%esi
  call   <memset@plt>
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <ripemd160_block_data_order@plt>
  mov    $0x0,%edi
  jmp    L18
```

assistant: ```c
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c) {
  unsigned char *p = (unsigned char *)c->data;
  size_t n = c->num;
  p[n] = 0x80;
  n++;
  if (n > (RIPEMD160_CBLOCK - 8)) {
    memset(p + n, 0, RIPEMD160_CBLOCK - n);
    n = 0;
    ripemd160_block_data_order(c, p, 1);
  }
  memset(p + n, 0, RIPEMD160_CBLOCK - 8 - n);
  p += RIPEMD160_CBLOCK - 8;
  (void)(*((unsigned int *)(p)) = (c->Nl), (p) += 4, c->Nl);
  (void)(*((unsigned int *)(p)) = (c->Nh), (p) += 4, c->Nh);
  p -= RIPEMD160_CBLOCK;
  ripemd160_block_data_order(c, p, 1);
  c->num = 0;
  memset(p, 0, RIPEMD160_CBLOCK);
  do {
    unsigned long ll;
    ll = (c)->A;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->B;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->C;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->D;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->E;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
  } while (0);
  return 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<RIPEMD160_Final>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  mov    0x38(%rsi),%rbp
  mov    (%rsi),%rax
  mov    D0(%rip),%r12
  movb   $0x80,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  mov    (%r12),%edx
  lea    0x0(%rbp,%rax,1),%rdi
  mov    %eax,%esi
  lea    -0x8(%rdx),%ecx
  movslq %ecx,%rcx
  cmp    %rax,%rcx
  jb     L14
L4:
  sub    %esi,%edx
  xor    %esi,%esi
  sub    $0x8,%edx
  call   <memset@plt>
  movslq (%r12),%rax
  mov    0x8(%rbx),%edx
  mov    %rbx,%rdi
  lea    -0x8(%rbp,%rax,1),%rax
  mov    %edx,(%rax)
  mov    0xc(%rbx),%edx
  lea    0x8(%rax),%rbp
  mov    %edx,0x4(%rax)
  movslq (%r12),%rax
  mov    $0x1,%edx
  sub    %rax,%rbp
  mov    %rbp,%rsi
  call   <ripemd160_block_data_order@plt>
  mov    (%r12),%edx
  mov    %rbp,%rdi
  xor    %esi,%esi
  movq   $0x0,(%rbx)
  call   <memset@plt>
  mov    0x10(%rbx),%rax
  mov    %eax,0x0(%r13)
  mov    0x18(%rbx),%rax
  mov    %eax,0x4(%r13)
  mov    0x20(%rbx),%rax
  mov    %eax,0x8(%r13)
  mov    0x28(%rbx),%rax
  mov    %eax,0xc(%r13)
  mov    0x30(%rbx),%rax
  mov    %eax,0x10(%r13)
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L14:
  sub    %eax,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <ripemd160_block_data_order@plt>
  mov    (%r12),%edx
  mov    %rbp,%rdi
  xor    %esi,%esi
  jmp    L4
```

assistant: ```c
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c) {
  unsigned char *p = (unsigned char *)c->data;
  size_t n = c->num;
  p[n] = 0x80;
  n++;
  if (n > (RIPEMD160_CBLOCK - 8)) {
    memset(p + n, 0, RIPEMD160_CBLOCK - n);
    n = 0;
    ripemd160_block_data_order(c, p, 1);
  }
  memset(p + n, 0, RIPEMD160_CBLOCK - 8 - n);
  p += RIPEMD160_CBLOCK - 8;
  (void)(*((unsigned int *)(p)) = (c->Nl), (p) += 4, c->Nl);
  (void)(*((unsigned int *)(p)) = (c->Nh), (p) += 4, c->Nh);
  p -= RIPEMD160_CBLOCK;
  ripemd160_block_data_order(c, p, 1);
  c->num = 0;
  memset(p, 0, RIPEMD160_CBLOCK);
  do {
    unsigned long ll;
    ll = (c)->A;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->B;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->C;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->D;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->E;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
  } while (0);
  return 1;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<RIPEMD160_Final>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  mov    0x38(%rsi),%rbp
  mov    (%rsi),%rax
  mov    D3(%rip),%r12
  movb   $0x80,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  mov    (%r12),%edx
  lea    0x0(%rbp,%rax,1),%rdi
  mov    %eax,%esi
  lea    -0x8(%rdx),%ecx
  movslq %ecx,%rcx
  cmp    %rax,%rcx
  jb     L2
L15:
  sub    %esi,%edx
  xor    %esi,%esi
  sub    $0x8,%edx
  call   <memset@plt>
  movslq (%r12),%rax
  mov    0x8(%rbx),%edx
  mov    %rbx,%rdi
  lea    -0x8(%rbp,%rax,1),%rax
  mov    %edx,(%rax)
  mov    0xc(%rbx),%edx
  lea    0x8(%rax),%rbp
  mov    %edx,0x4(%rax)
  movslq (%r12),%rax
  mov    $0x1,%edx
  sub    %rax,%rbp
  mov    %rbp,%rsi
  call   <ripemd160_block_data_order@plt>
  mov    (%r12),%edx
  mov    %rbp,%rdi
  xor    %esi,%esi
  movq   $0x0,(%rbx)
  call   <memset@plt>
  movdqu 0x10(%rbx),%xmm0
  movdqu 0x20(%rbx),%xmm1
  mov    0x30(%rbx),%rax
  shufps $0x88,%xmm1,%xmm0
  movups %xmm0,0x0(%r13)
  mov    %eax,0x10(%r13)
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L2:
  sub    %eax,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <ripemd160_block_data_order@plt>
  mov    (%r12),%edx
  mov    %rbp,%rdi
  xor    %esi,%esi
  jmp    L15
```

assistant: ```c
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c) {
  unsigned char *p = (unsigned char *)c->data;
  size_t n = c->num;
  p[n] = 0x80;
  n++;
  if (n > (RIPEMD160_CBLOCK - 8)) {
    memset(p + n, 0, RIPEMD160_CBLOCK - n);
    n = 0;
    ripemd160_block_data_order(c, p, 1);
  }
  memset(p + n, 0, RIPEMD160_CBLOCK - 8 - n);
  p += RIPEMD160_CBLOCK - 8;
  (void)(*((unsigned int *)(p)) = (c->Nl), (p) += 4, c->Nl);
  (void)(*((unsigned int *)(p)) = (c->Nh), (p) += 4, c->Nh);
  p -= RIPEMD160_CBLOCK;
  ripemd160_block_data_order(c, p, 1);
  c->num = 0;
  memset(p, 0, RIPEMD160_CBLOCK);
  do {
    unsigned long ll;
    ll = (c)->A;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->B;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->C;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->D;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
    ll = (c)->E;
    (void)(*((unsigned int *)((md))) = (ll), ((md)) += 4, ll);
  } while (0);
  return 1;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<bmhs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x440,%rsp
  mov    %rdi,-0x428(%rbp)
  mov    %esi,-0x42c(%rbp)
  mov    %rdx,-0x438(%rbp)
  mov    %ecx,-0x430(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x418(%rbp)
  jmp    L81
L20:
  mov    -0x430(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x418(%rbp),%eax
  cltq
  mov    %edx,-0x410(%rbp,%rax,4)
  addl   $0x1,-0x418(%rbp)
L81:
  cmpl   $0xff,-0x418(%rbp)
  jle    L20
  movl   $0x0,-0x418(%rbp)
  jmp    L110
L96:
  mov    -0x418(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x438(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x430(%rbp),%eax
  sub    -0x418(%rbp),%eax
  mov    %eax,%edx
  movslq %ecx,%rax
  mov    %edx,-0x410(%rbp,%rax,4)
  addl   $0x1,-0x418(%rbp)
L110:
  mov    -0x418(%rbp),%eax
  cmp    -0x430(%rbp),%eax
  jl     L96
  mov    -0x430(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x41c(%rbp)
  jmp    L89
L33:
  mov    -0x41c(%rbp),%eax
  mov    %eax,-0x414(%rbp)
  mov    -0x430(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x418(%rbp)
  jmp    L73
L59:
  subl   $0x1,-0x418(%rbp)
  subl   $0x1,-0x414(%rbp)
L73:
  cmpl   $0x0,-0x418(%rbp)
  js     L86
  mov    -0x414(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x428(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x418(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x438(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L59
L86:
  cmpl   $0x0,-0x418(%rbp)
  jns    L99
  mov    -0x414(%rbp),%eax
  add    $0x1,%eax
  jmp    L104
L99:
  mov    -0x41c(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x428(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cltq
  mov    -0x410(%rbp,%rax,4),%eax
  add    %eax,-0x41c(%rbp)
L89:
  mov    -0x41c(%rbp),%eax
  cmp    -0x42c(%rbp),%eax
  jl     L33
  mov    $0xffffffff,%eax
L104:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L58
  call   <__stack_chk_fail@plt>
L58:
  leave
  ret
```

assistant: ```c
int bmhs(char *string, int n, char *substr, int m) {
  int d[256];
  int i, j, k;
  for (j = 0; j < 256; j++)
    d[j] = m + 1;
  for (j = 0; j < m; j++)
    d[(int)substr[j]] = m - j;
  i = m - 1;
  while (i < n) {
    k = i;
    j = m - 1;
    while ((j >= 0) && (string[k] == substr[j])) {
      j--;
      k--;
    }
    if (j < 0)
      return k + 1;
    i = i + d[(int)string[i + 1]];
  }
  return -1;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<bmhs>:
  endbr64
  push   %r14
  push   %rbp
  push   %rbx
  sub    $0x410,%rsp
  mov    %rdi,%r9
  mov    %esi,%r10d
  mov    %rdx,%rdi
  mov    %ecx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rax
  lea    0x400(%rsp),%rcx
  lea    0x1(%rbp),%edx
L63:
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L63
  test   %ebp,%ebp
  jle    L68
  lea    -0x1(%rbp),%eax
  lea    0x1(%rdi,%rax,1),%r8
  mov    %rdi,%rax
  lea    0x0(%rbp,%rdi,1),%esi
L122:
  movsbq (%rax),%rdx
  mov    %esi,%ecx
  sub    %eax,%ecx
  mov    %ecx,(%rsp,%rdx,4)
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L122
L68:
  lea    -0x1(%rbp),%ebx
  mov    %ebx,%r8d
  movslq %ebp,%rbp
  mov    $0xffffffff,%eax
  cmp    %r10d,%ebx
  jl     L17
  jmp    L30
L89:
  test   %eax,%eax
  js     L67
  movsbq 0x1(%r9,%r11,1),%rax
  add    (%rsp,%rax,4),%r8d
  cmp    %r8d,%r10d
  jle    L38
L17:
  test   %ebx,%ebx
  js     L46
  movslq %ebx,%rax
  mov    %r8d,%edx
  movslq %r8d,%r11
  mov    %r11,%rcx
  sub    %rbp,%rcx
  add    %r9,%rcx
L53:
  movzbl (%rdi,%rax,1),%r14d
  cmp    %r14b,0x1(%rcx,%rax,1)
  jne    L89
  sub    $0x1,%edx
  sub    $0x1,%rax
  test   %eax,%eax
  jns    L53
L67:
  lea    0x1(%rdx),%eax
L30:
  mov    0x408(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L99
  add    $0x410,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r14
  ret
L38:
  mov    $0xffffffff,%eax
  jmp    L30
L46:
  mov    %r8d,%edx
  jmp    L67
L99:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bmhs(char *string, int n, char *substr, int m) {
  int d[256];
  int i, j, k;
  for (j = 0; j < 256; j++)
    d[j] = m + 1;
  for (j = 0; j < m; j++)
    d[(int)substr[j]] = m - j;
  i = m - 1;
  while (i < n) {
    k = i;
    j = m - 1;
    while ((j >= 0) && (string[k] == substr[j])) {
      j--;
      k--;
    }
    if (j < 0)
      return k + 1;
    i = i + d[(int)string[i + 1]];
  }
  return -1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<bmhs>:
  endbr64
  push   %r13
  mov    %rdx,%r11
  mov    %esi,%r10d
  push   %r12
  movslq %ecx,%r12
  push   %rbp
  lea    0x1(%r12),%ecx
  push   %rbx
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  lea    0x400(%rsp),%rdx
  mov    %rsp,%rax
  nopl   (%rax)
L90:
  mov    %ecx,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L90
  test   %r12d,%r12d
  jle    L105
  lea    -0x1(%r12),%eax
  lea    (%r12,%r11,1),%esi
  mov    %rax,%rbp
  lea    0x1(%r11,%rax,1),%r8
  mov    %r11,%rax
  nopl   0x0(%rax,%rax,1)
L8:
  movsbq (%rax),%rdx
  mov    %esi,%ecx
  sub    %eax,%ecx
  add    $0x1,%rax
  mov    %ecx,(%rsp,%rdx,4)
  cmp    %r8,%rax
  jne    L8
L54:
  mov    %ebp,%ebx
  mov    %ebp,%r13d
  cmp    %r10d,%ebp
  jge    L107
  xchg   %ax,%ax
L27:
  test   %ebp,%ebp
  js     L47
  movslq %ebx,%r9
  mov    %r12,%rcx
  mov    %r9,%rsi
  sub    %r9,%rcx
  mov    %r9,%rax
  sub    %r13,%rsi
  add    %r11,%rcx
  jmp    L25
  nopl   0x0(%rax,%rax,1)
L41:
  lea    -0x1(%rax),%rdx
  cmp    %rsi,%rax
  je     L34
  mov    %rdx,%rax
L25:
  movzbl -0x1(%rax,%rcx,1),%edx
  mov    %eax,%r8d
  cmp    %dl,(%rdi,%rax,1)
  je     L41
  movsbq 0x1(%rdi,%r9,1),%rax
  add    (%rsp,%rax,4),%ebx
  cmp    %ebx,%r10d
  jg     L27
L107:
  mov    $0xffffffff,%r8d
  nopl   (%rax)
L34:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  add    $0x418,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L47:
  lea    0x1(%rbx),%r8d
  jmp    L34
L105:
  lea    -0x1(%r12),%ebp
  jmp    L54
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bmhs(char *string, int n, char *substr, int m) {
  int d[256];
  int i, j, k;
  for (j = 0; j < 256; j++)
    d[j] = m + 1;
  for (j = 0; j < m; j++)
    d[(int)substr[j]] = m - j;
  i = m - 1;
  while (i < n) {
    k = i;
    j = m - 1;
    while ((j >= 0) && (string[k] == substr[j])) {
      j--;
      k--;
    }
    if (j < 0)
      return k + 1;
    i = i + d[(int)string[i + 1]];
  }
  return -1;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<bmhs>:
  endbr64
  push   %r13
  mov    %esi,%r11d
  push   %r12
  movslq %ecx,%r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  lea    0x1(%r12),%eax
  lea    0x400(%rsp),%rdx
  movd   %eax,%xmm0
  mov    %rsp,%rax
  pshufd $0x0,%xmm0,%xmm0
  cs nopw 0x0(%rax,%rax,1)
L117:
  movaps %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L117
  test   %r12d,%r12d
  jle    L1
  lea    -0x1(%r12),%eax
  lea    (%r12,%rbx,1),%esi
  mov    %rax,%rbp
  lea    0x1(%rbx,%rax,1),%r8
  mov    %rbx,%rax
  nopl   0x0(%rax)
L65:
  movsbq (%rax),%rdx
  mov    %esi,%ecx
  sub    %eax,%ecx
  add    $0x1,%rax
  mov    %ecx,(%rsp,%rdx,4)
  cmp    %r8,%rax
  jne    L65
L31:
  mov    %ebp,%r10d
  mov    %ebp,%r13d
  cmp    %r11d,%ebp
  jge    L5
  nop
L29:
  test   %ebp,%ebp
  js     L4
  movslq %r10d,%r9
  mov    %r12,%rcx
  mov    %r9,%rsi
  sub    %r9,%rcx
  mov    %r9,%rax
  sub    %r13,%rsi
  add    %rbx,%rcx
  jmp    L81
  nopl   0x0(%rax,%rax,1)
L109:
  lea    -0x1(%rax),%rdx
  cmp    %rsi,%rax
  je     L59
  mov    %rdx,%rax
L81:
  movzbl -0x1(%rax,%rcx,1),%edx
  mov    %eax,%r8d
  cmp    %dl,(%rdi,%rax,1)
  je     L109
  movsbq 0x1(%rdi,%r9,1),%rax
  add    (%rsp,%rax,4),%r10d
  cmp    %r10d,%r11d
  jg     L29
L5:
  mov    $0xffffffff,%r8d
  xchg   %ax,%ax
L59:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L50
  add    $0x418,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L4:
  lea    0x1(%r10),%r8d
  jmp    L59
L1:
  lea    -0x1(%r12),%ebp
  jmp    L31
L50:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bmhs(char *string, int n, char *substr, int m) {
  int d[256];
  int i, j, k;
  for (j = 0; j < 256; j++)
    d[j] = m + 1;
  for (j = 0; j < m; j++)
    d[(int)substr[j]] = m - j;
  i = m - 1;
  while (i < n) {
    k = i;
    j = m - 1;
    while ((j >= 0) && (string[k] == substr[j])) {
      j--;
      k--;
    }
    if (j < 0)
      return k + 1;
    i = i + d[(int)string[i + 1]];
  }
  return -1;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    -0x10000(%rsp),%r11
L14:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L14
  sub    $0x30,%rsp
  mov    %edi,-0x10024(%rbp)
  mov    %rsi,-0x10030(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x10014(%rbp)
  jmp    L34
L25:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x12,%edx
  add    %edx,%eax
  and    $0x3fff,%eax
  sub    %edx,%eax
  mov    %eax,%edx
  mov    -0x10014(%rbp),%eax
  cltq
  mov    %edx,-0x10010(%rbp,%rax,4)
  addl   $0x1,-0x10014(%rbp)
L34:
  cmpl   $0x3fff,-0x10014(%rbp)
  jle    L25
  lea    -0x10010(%rbp),%rax
  mov    $0x3fff,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <QS@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L4
  call   <__stack_chk_fail@plt>
L4:
  leave
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  int o;
  int a[16384];
  for (o = 0; o < 16384; o++)
    a[o] = rand() % 16384;
  QS(a, 0, 16384 - 1);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  lea    -0x10000(%rsp),%r11
L14:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L14
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x10008(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  lea    0x10000(%rsp),%rbp
L5:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x12,%edx
  add    %edx,%eax
  and    $0x3fff,%eax
  sub    %edx,%eax
  mov    %eax,(%rbx)
  add    $0x4,%rbx
  cmp    %rbp,%rbx
  jne    L5
  mov    %rsp,%rdi
  mov    $0x3fff,%edx
  mov    $0x0,%esi
  call   <QS@plt>
  mov    0x10008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  mov    $0x0,%eax
  add    $0x10018,%rsp
  pop    %rbx
  pop    %rbp
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char *argv[]) {
  int o;
  int a[16384];
  for (o = 0; o < 16384; o++)
    a[o] = rand() % 16384;
  QS(a, 0, 16384 - 1);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x10000(%rsp),%r11
L11:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L11
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x10008(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x10000(%rsp),%rbx
  mov    %rbp,%r12
  cs nopw 0x0(%rax,%rax,1)
L21:
  xor    %eax,%eax
  add    $0x4,%r12
  call   <rand@plt>
  cltd
  shr    $0x12,%edx
  add    %edx,%eax
  and    $0x3fff,%eax
  sub    %edx,%eax
  mov    %eax,-0x4(%r12)
  cmp    %rbx,%r12
  jne    L21
  xor    %esi,%esi
  mov    $0x3fff,%edx
  mov    %rbp,%rdi
  call   <QS@plt>
  mov    0x10008(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0x10010,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char *argv[]) {
  int o;
  int a[16384];
  for (o = 0; o < 16384; o++)
    a[o] = rand() % 16384;
  QS(a, 0, 16384 - 1);
  return 0;
}
```