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

```asm
<is_prime>:
  endbr64
  mov    $0x0,%eax
  test   %edi,%edi
  je     L29
  lea    -0x1(%rdi),%edx
  mov    $0x1,%eax
  cmp    $0x2,%edx
  ja     L9
L29:
  ret
L9:
  mov    %edi,%esi
  shr    %esi
  cmp    $0xb,%edi
  jbe    L4
  mov    %edi,%eax
  mov    $0xcccccccd,%edx
  imul   %rdx,%rax
  shr    $0x22,%rax
  lea    (%rax,%rax,4),%eax
  cmp    %eax,%edi
  je     L44
  mov    $0x5,%ecx
L20:
  add    $0x2,%ecx
  cmp    %esi,%ecx
  jae    L32
  mov    %edi,%eax
  mov    $0x0,%edx
  div    %ecx
  test   %edx,%edx
  jne    L20
  mov    $0x0,%eax
  jmp    L29
L32:
  mov    $0x1,%eax
  ret
L4:
  mov    $0x1,%eax
  ret
L44:
  mov    $0x0,%eax
  ret
```

assistant: ```c
bool is_prime(unsigned int n) {
  if (n == 0) {
    return false;
  }
  if (n == 1) {
    return true;
  }
  if (n == 2) {
    return true;
  }
  if (n == 3) {
    return true;
  }
  for (unsigned int j = 5; j < n / 2; j += 2) {
    if ((n % j) == 0) {
      return false;
    }
  }
  return true;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<is_prime>:
  endbr64
  xor    %eax,%eax
  test   %edi,%edi
  je     L0
  lea    -0x1(%rdi),%edx
  mov    $0x1,%eax
  cmp    $0x2,%edx
  ja     L35
L0:
  ret
  nopl   0x0(%rax,%rax,1)
L35:
  mov    %edi,%esi
  shr    %esi
  cmp    $0xb,%edi
  jbe    L0
  imul   $0xcccccccd,%edi,%eax
  cmp    $0x33333333,%eax
  jbe    L69
  mov    $0x5,%ecx
  jmp    L43
  nopl   (%rax)
L29:
  mov    %edi,%eax
  xor    %edx,%edx
  div    %ecx
  test   %edx,%edx
  je     L69
L43:
  add    $0x2,%ecx
  cmp    %esi,%ecx
  jb     L29
  mov    $0x1,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L69:
  xor    %eax,%eax
  ret
```

assistant: ```c
bool is_prime(unsigned int n) {
  if (n == 0) {
    return false;
  }
  if (n == 1) {
    return true;
  }
  if (n == 2) {
    return true;
  }
  if (n == 3) {
    return true;
  }
  for (unsigned int j = 5; j < n / 2; j += 2) {
    if ((n % j) == 0) {
      return false;
    }
  }
  return true;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<is_prime>:
  endbr64
  xor    %eax,%eax
  test   %edi,%edi
  je     L9
  lea    -0x1(%rdi),%edx
  mov    $0x1,%eax
  cmp    $0x2,%edx
  ja     L26
L9:
  ret
  nopl   0x0(%rax,%rax,1)
L26:
  mov    %edi,%esi
  shr    %esi
  cmp    $0xb,%edi
  jbe    L9
  imul   $0xcccccccd,%edi,%eax
  cmp    $0x33333333,%eax
  jbe    L64
  mov    $0x5,%ecx
  jmp    L53
  nopl   (%rax)
L5:
  mov    %edi,%eax
  xor    %edx,%edx
  div    %ecx
  test   %edx,%edx
  je     L64
L53:
  add    $0x2,%ecx
  cmp    %esi,%ecx
  jb     L5
  mov    $0x1,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L64:
  xor    %eax,%eax
  ret
```

assistant: ```c
bool is_prime(unsigned int n) {
  if (n == 0) {
    return false;
  }
  if (n == 1) {
    return true;
  }
  if (n == 2) {
    return true;
  }
  if (n == 3) {
    return true;
  }
  for (unsigned int j = 5; j < n / 2; j += 2) {
    if ((n % j) == 0) {
      return false;
    }
  }
  return true;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strlen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L12
L14:
  addq   $0x1,-0x8(%rbp)
L12:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L14
  mov    -0x8(%rbp),%rax
  sub    -0x18(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
size_t strlen(const char *s) {
  char *p = (char *)s;
  while (*p)
    p++;
  return (size_t)(p - s);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L4
  mov    %rdi,%rax
L8:
  add    $0x1,%rax
  cmpb   $0x0,(%rax)
  jne    L8
L5:
  sub    %rdi,%rax
  ret
L4:
  mov    %rdi,%rax
  jmp    L5
```

assistant: ```c
size_t strlen(const char *s) {
  char *p = (char *)s;
  while (*p)
    p++;
  return (size_t)(p - s);
}
```
user: Translate the below assembly code into C programming language:

```asm
<strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L14
  mov    %rdi,%rax
  nopl   0x0(%rax)
L13:
  add    $0x1,%rax
  cmpb   $0x0,(%rax)
  jne    L13
  sub    %rdi,%rax
  ret
  nopl   (%rax)
L14:
  xor    %eax,%eax
  ret
```

assistant: ```c
size_t strlen(const char *s) {
  char *p = (char *)s;
  while (*p)
    p++;
  return (size_t)(p - s);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strlen>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L3
  mov    %rdi,%rax
  nopl   0x0(%rax)
L18:
  add    $0x1,%rax
  cmpb   $0x0,(%rax)
  jne    L18
  sub    %rdi,%rax
  ret
  nopl   (%rax)
L3:
  xor    %eax,%eax
  ret
```

assistant: ```c
size_t strlen(const char *s) {
  char *p = (char *)s;
  while (*p)
    p++;
  return (size_t)(p - s);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<match_pattern>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  lea    D5(%rip),%r12
L103:
  lea    0x1(%rbp),%r13
  movzbl 0x0(%rbp),%edx
  lea    -0x80(%rdx),%eax
  cmp    $0x5,%al
  ja     L70
  movzbl %al,%eax
  movslq (%r12,%rax,4),%rax
  add    %r12,%rax
  notrack jmp *%rax
  cmpb   $0x0,(%rbx)
  sete   %al
  movzbl %al,%eax
L21:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cmpb   $0x0,(%rbx)
  jne    L3
  mov    $0x0,%eax
  jmp    L21
L3:
  add    $0x1,%rbx
  mov    %r13,%rbp
  jmp    L103
  movzbl (%rbx),%edx
  lea    0x7(%rdx),%eax
  test   %dl,%dl
  cmovns %edx,%eax
  sar    $0x3,%al
  movsbq %al,%rax
  movzbl 0x0(%r13,%rax,1),%eax
  mov    %edx,%esi
  sar    $0x7,%sil
  shr    $0x5,%sil
  lea    (%rdx,%rsi,1),%ecx
  and    $0x7,%ecx
  sub    %esi,%ecx
  sar    %cl,%eax
  and    $0x1,%eax
  je     L21
  add    $0x11,%rbp
  add    $0x1,%rbx
  jmp    L103
L118:
  add    $0x1,%rbx
  cmpb   $0x0,-0x1(%rbx)
  je     L21
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <match_pattern>
  test   %eax,%eax
  je     L118
  mov    $0x1,%eax
  jmp    L21
  movzbl 0x1(%rbp),%ebp
  add    %r13,%rbp
  jmp    L103
  lea    0x2(%rbp),%rdi
  mov    %rbx,%rsi
  call   <match_pattern>
  test   %eax,%eax
  je     L67
  mov    $0x1,%eax
  jmp    L21
L67:
  movzbl 0x1(%rbp),%ebp
  add    %r13,%rbp
  jmp    L103
L70:
  cmp    %dl,(%rbx)
  je     L15
  mov    $0x0,%eax
  jmp    L21
L15:
  add    $0x1,%rbx
  mov    %r13,%rbp
  jmp    L103
```

assistant: ```c
int match_pattern(unsigned char *p, const char *s) {
  unsigned char c;
  for (;;) {
    switch (c = *p++) {
    case 133:
      return (*s == '\0' ? 1 : 0);
    case 128:
      if (*s == '\0')
        return (0);
      ;
      s++;
      continue;
    case 132:
      if (p[*s / 8] & (1 << (*s % 8))) {
        p += 16;
        s++;
        continue;
      }
      return (0);
      ;
    case 129:
      do {
        if (match_pattern(p, s))
          return (1);
        ;
      } while (*s++);
      return (0);
      ;
    case 131:
      p += *p;
      continue;
    case 130:
      if (match_pattern(p + 1, s))
        return (1);
      ;
      p += *p;
      continue;
    default:
      if (c != (unsigned char)*s)
        return (0);
      ;
      s++;
      continue;
    }
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<match_pattern>:
  endbr64
  push   %r13
  push   %r12
  lea    D5(%rip),%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
L49:
  movzbl 0x0(%rbp),%edx
  lea    0x1(%rbp),%r13
  lea    -0x80(%rdx),%eax
  cmp    $0x5,%al
  ja     L81
  movzbl %al,%eax
  movslq (%r12,%rax,4),%rax
  add    %r12,%rax
  notrack jmp *%rax
  nopl   0x0(%rax,%rax,1)
L6:
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <match_pattern>
  test   %eax,%eax
  jne    L96
  add    $0x1,%rbx
  cmpb   $0x0,-0x1(%rbx)
  jne    L6
L92:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
  lea    0x2(%rbp),%rdi
  mov    %rbx,%rsi
  call   <match_pattern>
  test   %eax,%eax
  jne    L96
  movzbl 0x1(%rbp),%ebp
  add    %r13,%rbp
  jmp    L49
  nopl   (%rax)
  cmpb   $0x0,(%rbx)
  jne    L76
L60:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
  xor    %eax,%eax
  cmpb   $0x0,(%rbx)
  sete   %al
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
  movzbl (%rbx),%edx
  test   %dl,%dl
  lea    0x7(%rdx),%eax
  mov    %edx,%esi
  cmovns %edx,%eax
  sar    $0x7,%sil
  shr    $0x5,%sil
  sar    $0x3,%al
  lea    (%rdx,%rsi,1),%ecx
  movsbq %al,%rax
  and    $0x7,%ecx
  movzbl 0x0(%r13,%rax,1),%eax
  sub    %esi,%ecx
  sar    %cl,%eax
  and    $0x1,%eax
  je     L92
  add    $0x11,%rbp
  add    $0x1,%rbx
  jmp    L49
  nopw   0x0(%rax,%rax,1)
L96:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L81:
  cmp    %dl,(%rbx)
  jne    L60
L76:
  add    $0x1,%rbx
  mov    %r13,%rbp
  jmp    L49
```

assistant: ```c
int match_pattern(unsigned char *p, const char *s) {
  unsigned char c;
  for (;;) {
    switch (c = *p++) {
    case 133:
      return (*s == '\0' ? 1 : 0);
    case 128:
      if (*s == '\0')
        return (0);
      ;
      s++;
      continue;
    case 132:
      if (p[*s / 8] & (1 << (*s % 8))) {
        p += 16;
        s++;
        continue;
      }
      return (0);
      ;
    case 129:
      do {
        if (match_pattern(p, s))
          return (1);
        ;
      } while (*s++);
      return (0);
      ;
    case 131:
      p += *p;
      continue;
    case 130:
      if (match_pattern(p + 1, s))
        return (1);
      ;
      p += *p;
      continue;
    default:
      if (c != (unsigned char)*s)
        return (0);
      ;
      s++;
      continue;
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<vktor_unicode_cp_to_utf8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,%eax
  mov    %rsi,-0x20(%rbp)
  mov    %ax,-0x14(%rbp)
  movw   $0x0,-0x2(%rbp)
  mov    $0x1,%edi
  call   <assert@plt>
  cmpw   $0xd7ff,-0x14(%rbp)
  jbe    L70
  cmpw   $0xdbff,-0x14(%rbp)
  jbe    L95
L70:
  mov    $0x1,%eax
  jmp    L53
L95:
  mov    $0x0,%eax
L53:
  mov    %eax,%edi
  call   <assert@plt>
  cmpw   $0x7f,-0x14(%rbp)
  ja     L97
  movzwl -0x14(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  movw   $0x1,-0x2(%rbp)
  jmp    L36
L97:
  cmpw   $0x7ff,-0x14(%rbp)
  ja     L57
  movzwl -0x14(%rbp),%eax
  shr    $0x6,%ax
  or     $0xffffffc0,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  movzwl -0x14(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  movw   $0x2,-0x2(%rbp)
  jmp    L36
L57:
  cmpw   $0xdc98,-0x14(%rbp)
  jbe    L32
  cmpw   $0xdfff,-0x14(%rbp)
  ja     L32
  mov    $0x0,%eax
  jmp    L80
L32:
  movzwl -0x14(%rbp),%eax
  shr    $0xc,%ax
  or     $0xffffffe0,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  movzwl -0x14(%rbp),%eax
  shr    $0x6,%ax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  movzwl -0x14(%rbp),%eax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  movw   $0x3,-0x2(%rbp)
L36:
  movswq -0x2(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  movzwl -0x2(%rbp),%eax
L80:
  leave
  ret
```

assistant: ```c
short vktor_unicode_cp_to_utf8(unsigned short cp, unsigned char *utf8) {
  short len = 0;
  assert(sizeof(utf8) >= 4);
  assert(!(cp >= 0xd800 && cp <= 0xdbff));
  if (cp <= 0x7f) {
    utf8[0] = (unsigned char)cp;
    len = 1;
  } else if (cp <= 0x7ff) {
    utf8[0] = 0xc0 | (cp >> 6);
    utf8[1] = 0x80 | (cp & 0x3f);
    len = 2;
  } else if ((cp >= 0xdc99 && cp <= 0xdfff)) {
    return 0;
  } else {
    utf8[0] = (unsigned char)0xe0 | (cp >> 12);
    utf8[1] = (unsigned char)0x80 | ((cp >> 6) & 0x3f);
    utf8[2] = (unsigned char)0x80 | (cp & 0x3f);
    len = 3;
  }
  utf8[len] = '\0';
  return len;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<vktor_unicode_cp_to_utf8>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    $0x1,%edi
  call   <assert@plt>
  lea    0x2800(%rbx),%eax
  cmp    $0x3ff,%ax
  seta   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  cmp    $0x7f,%bx
  ja     L15
  mov    %bl,0x0(%rbp)
  mov    $0x1,%eax
L26:
  movswq %ax,%rdx
  movb   $0x0,0x0(%rbp,%rdx,1)
L38:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L15:
  cmp    $0x7ff,%bx
  ja     L41
  mov    %ebx,%eax
  shr    $0x6,%ax
  or     $0xffffffc0,%eax
  mov    %al,0x0(%rbp)
  and    $0x3f,%ebx
  or     $0xffffff80,%ebx
  mov    %bl,0x1(%rbp)
  mov    $0x2,%eax
  jmp    L26
L41:
  lea    0x2367(%rbx),%edx
  mov    $0x0,%eax
  cmp    $0x366,%dx
  jbe    L38
  mov    %ebx,%eax
  shr    $0xc,%ax
  or     $0xffffffe0,%eax
  mov    %al,0x0(%rbp)
  mov    %ebx,%eax
  shr    $0x6,%ax
  and    $0x3f,%eax
  or     $0xffffff80,%eax
  mov    %al,0x1(%rbp)
  and    $0x3f,%ebx
  or     $0xffffff80,%ebx
  mov    %bl,0x2(%rbp)
  mov    $0x3,%eax
  jmp    L26
```

assistant: ```c
short vktor_unicode_cp_to_utf8(unsigned short cp, unsigned char *utf8) {
  short len = 0;
  assert(sizeof(utf8) >= 4);
  assert(!(cp >= 0xd800 && cp <= 0xdbff));
  if (cp <= 0x7f) {
    utf8[0] = (unsigned char)cp;
    len = 1;
  } else if (cp <= 0x7ff) {
    utf8[0] = 0xc0 | (cp >> 6);
    utf8[1] = 0x80 | (cp & 0x3f);
    len = 2;
  } else if ((cp >= 0xdc99 && cp <= 0xdfff)) {
    return 0;
  } else {
    utf8[0] = (unsigned char)0xe0 | (cp >> 12);
    utf8[1] = (unsigned char)0x80 | ((cp >> 6) & 0x3f);
    utf8[2] = (unsigned char)0x80 | (cp & 0x3f);
    len = 3;
  }
  utf8[len] = '\0';
  return len;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<vktor_unicode_cp_to_utf8>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edi,%ebx
  mov    $0x1,%edi
  sub    $0x8,%rsp
  call   <assert@plt>
  lea    0x2800(%rbx),%eax
  xor    %edi,%edi
  cmp    $0x3ff,%ax
  seta   %dil
  call   <assert@plt>
  cmp    $0x7f,%bx
  ja     L44
  mov    %bl,0x0(%rbp)
  mov    $0x1,%edx
  mov    $0x1,%eax
L2:
  movb   $0x0,0x0(%rbp,%rdx,1)
L28:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L44:
  cmp    $0x7ff,%bx
  ja     L46
  mov    %ebx,%eax
  and    $0x3f,%ebx
  mov    $0x2,%edx
  shr    $0x6,%ax
  or     $0xffffff80,%ebx
  or     $0xffffffc0,%eax
  mov    %bl,0x1(%rbp)
  mov    %al,0x0(%rbp)
  mov    $0x2,%eax
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L46:
  lea    0x2367(%rbx),%edx
  xor    %eax,%eax
  cmp    $0x366,%dx
  jbe    L28
  mov    %ebx,%eax
  mov    $0x3,%edx
  shr    $0xc,%ax
  or     $0xffffffe0,%eax
  mov    %al,0x0(%rbp)
  mov    %ebx,%eax
  and    $0x3f,%ebx
  shr    $0x6,%ax
  or     $0xffffff80,%ebx
  and    $0x3f,%eax
  mov    %bl,0x2(%rbp)
  or     $0xffffff80,%eax
  mov    %al,0x1(%rbp)
  mov    $0x3,%eax
  jmp    L2
```

assistant: ```c
short vktor_unicode_cp_to_utf8(unsigned short cp, unsigned char *utf8) {
  short len = 0;
  assert(sizeof(utf8) >= 4);
  assert(!(cp >= 0xd800 && cp <= 0xdbff));
  if (cp <= 0x7f) {
    utf8[0] = (unsigned char)cp;
    len = 1;
  } else if (cp <= 0x7ff) {
    utf8[0] = 0xc0 | (cp >> 6);
    utf8[1] = 0x80 | (cp & 0x3f);
    len = 2;
  } else if ((cp >= 0xdc99 && cp <= 0xdfff)) {
    return 0;
  } else {
    utf8[0] = (unsigned char)0xe0 | (cp >> 12);
    utf8[1] = (unsigned char)0x80 | ((cp >> 6) & 0x3f);
    utf8[2] = (unsigned char)0x80 | (cp & 0x3f);
    len = 3;
  }
  utf8[len] = '\0';
  return len;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<vktor_unicode_cp_to_utf8>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edi,%ebx
  mov    $0x1,%edi
  sub    $0x8,%rsp
  call   <assert@plt>
  lea    0x2800(%rbx),%eax
  xor    %edi,%edi
  cmp    $0x3ff,%ax
  seta   %dil
  call   <assert@plt>
  cmp    $0x7f,%bx
  ja     L5
  mov    %bl,0x0(%rbp)
  mov    $0x1,%edx
  mov    $0x1,%eax
L21:
  movb   $0x0,0x0(%rbp,%rdx,1)
L18:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L5:
  cmp    $0x7ff,%bx
  ja     L31
  mov    %ebx,%eax
  and    $0x3f,%ebx
  mov    $0x2,%edx
  shr    $0x6,%ax
  or     $0xffffff80,%ebx
  or     $0xffffffc0,%eax
  mov    %bl,0x1(%rbp)
  mov    %al,0x0(%rbp)
  mov    $0x2,%eax
  jmp    L21
  nopl   0x0(%rax,%rax,1)
L31:
  lea    0x2367(%rbx),%edx
  xor    %eax,%eax
  cmp    $0x366,%dx
  jbe    L18
  mov    %ebx,%eax
  mov    $0x3,%edx
  shr    $0xc,%ax
  or     $0xffffffe0,%eax
  mov    %al,0x0(%rbp)
  mov    %ebx,%eax
  and    $0x3f,%ebx
  shr    $0x6,%ax
  or     $0xffffff80,%ebx
  and    $0x3f,%eax
  mov    %bl,0x2(%rbp)
  or     $0xffffff80,%eax
  mov    %al,0x1(%rbp)
  mov    $0x3,%eax
  jmp    L21
```

assistant: ```c
short vktor_unicode_cp_to_utf8(unsigned short cp, unsigned char *utf8) {
  short len = 0;
  assert(sizeof(utf8) >= 4);
  assert(!(cp >= 0xd800 && cp <= 0xdbff));
  if (cp <= 0x7f) {
    utf8[0] = (unsigned char)cp;
    len = 1;
  } else if (cp <= 0x7ff) {
    utf8[0] = 0xc0 | (cp >> 6);
    utf8[1] = 0x80 | (cp & 0x3f);
    len = 2;
  } else if ((cp >= 0xdc99 && cp <= 0xdfff)) {
    return 0;
  } else {
    utf8[0] = (unsigned char)0xe0 | (cp >> 12);
    utf8[1] = (unsigned char)0x80 | ((cp >> 6) & 0x3f);
    utf8[2] = (unsigned char)0x80 | (cp & 0x3f);
    len = 3;
  }
  utf8[len] = '\0';
  return len;
}
```
user: Translate the below assembly code into C programming language:

```asm
<traverse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    %r9,-0x38(%rbp)
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L43
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L53
L43:
  movl   $0x0,-0x4(%rbp)
  jmp    L10
L39:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L54
  mov    -0x14(%rbp),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L54
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  sub    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L54
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  sub    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  movl   $0x0,(%rdx)
  mov    -0x14(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rdx),%edx
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x38(%rbp),%r8
  mov    -0x30(%rbp),%rsi
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%eax
  mov    %r8,%r9
  mov    %rsi,%r8
  mov    %eax,%esi
  call   <traverse>
  mov    -0x14(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  sub    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rax,%rdx
  movl   $0x1,(%rdx)
  mov    -0x14(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rdx),%edx
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
L54:
  addl   $0x1,-0x4(%rbp)
L10:
  mov    -0x4(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L39
L53:
  leave
  ret
```

assistant: ```c
void traverse(int row, int size, bool *col, bool *fslash, bool *bslash, int *count) {
  if (row == size) {
    (*count)++;
    return;
  }
  for (int j = 0; j < size; j++) {
    if (col[j] && fslash[row + j] && bslash[row + size - j]) {
      col[j] = fslash[row + j] = bslash[row + size - j] = false;
      traverse(row + 1, size, col, fslash, bslash, count);
      col[j] = fslash[row + j] = bslash[row + size - j] = true;
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<traverse>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rcx,(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %r9,0x10(%rsp)
  cmp    %esi,%edi
  je     L44
  mov    %edi,%r15d
  mov    %rdx,%r12
  lea    -0x1(%rsi),%r13d
  mov    $0x0,%ebx
  lea    (%rsi,%rdi,1),%eax
  mov    %eax,0x18(%rsp)
  test   %esi,%esi
  jle    L37
  mov    %esi,0x1c(%rsp)
  jmp    L61
L44:
  mov    0x10(%rsp),%rax
  addl   $0x1,(%rax)
L37:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L8:
  lea    0x1(%rbx),%rax
  cmp    %r13,%rbx
  je     L37
  mov    %rax,%rbx
L61:
  cmpl   $0x0,(%r12,%rbx,4)
  je     L8
  lea    (%r15,%rbx,1),%eax
  cltq
  mov    (%rsp),%rdx
  lea    (%rdx,%rax,4),%rbp
  cmpl   $0x0,0x0(%rbp)
  je     L8
  mov    0x18(%rsp),%eax
  sub    %ebx,%eax
  cltq
  mov    0x8(%rsp),%rcx
  lea    (%rcx,%rax,4),%r14
  cmpl   $0x0,(%r14)
  je     L8
  movl   $0x0,(%r14)
  movl   $0x0,0x0(%rbp)
  movl   $0x0,(%r12,%rbx,4)
  lea    0x1(%r15),%edi
  mov    0x10(%rsp),%r9
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %r12,%rdx
  mov    0x1c(%rsp),%esi
  call   <traverse>
  movl   $0x1,(%r14)
  movl   $0x1,0x0(%rbp)
  movl   $0x1,(%r12,%rbx,4)
  jmp    L8
```

assistant: ```c
void traverse(int row, int size, bool *col, bool *fslash, bool *bslash, int *count) {
  if (row == size) {
    (*count)++;
    return;
  }
  for (int j = 0; j < size; j++) {
    if (col[j] && fslash[row + j] && bslash[row + size - j]) {
      col[j] = fslash[row + j] = bslash[row + size - j] = false;
      traverse(row + 1, size, col, fslash, bslash, count);
      col[j] = fslash[row + j] = bslash[row + size - j] = true;
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<traverse>:
  endbr64
  cmp    %esi,%edi
  je     L65
  push   %r15
  lea    (%rsi,%rdi,1),%r11d
  movslq %esi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x28,%rsp
  test   %esi,%esi
  jle    L3
  mov    %rdx,%r12
  mov    %rcx,%rax
  mov    %edi,%r14d
L6:
  mov    (%r12,%rbx,4),%edi
  test   %edi,%edi
  je     L33
  lea    (%r14,%rbx,1),%edx
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%rbp
  mov    0x0(%rbp),%ecx
  test   %ecx,%ecx
  je     L33
  mov    %r11d,%edx
  sub    %ebx,%edx
  movslq %edx,%rdx
  lea    (%r8,%rdx,4),%r13
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jne    L12
  xchg   %ax,%ax
L33:
  add    $0x1,%rbx
  cmp    %r15,%rbx
  jne    L6
L3:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L12:
  mov    %rax,%rcx
  lea    0x1(%r14),%edi
  mov    %r12,%rdx
  mov    %r11d,0x1c(%rsp)
  movl   $0x0,0x0(%r13)
  movl   $0x0,0x0(%rbp)
  movl   $0x0,(%r12,%rbx,4)
  mov    %r9,0x10(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %rax,(%rsp)
  mov    %esi,0x18(%rsp)
  call   <traverse>
  mov    0x1c(%rsp),%r11d
  mov    0x10(%rsp),%r9
  movl   $0x1,0x0(%r13)
  mov    0x8(%rsp),%r8
  mov    (%rsp),%rax
  movl   $0x1,0x0(%rbp)
  movl   $0x1,(%r12,%rbx,4)
  add    $0x1,%rbx
  mov    0x18(%rsp),%esi
  cmp    %r15,%rbx
  jne    L6
  jmp    L3
  nopl   (%rax)
L65:
  addl   $0x1,(%r9)
  ret
```

assistant: ```c
void traverse(int row, int size, bool *col, bool *fslash, bool *bslash, int *count) {
  if (row == size) {
    (*count)++;
    return;
  }
  for (int j = 0; j < size; j++) {
    if (col[j] && fslash[row + j] && bslash[row + size - j]) {
      col[j] = fslash[row + j] = bslash[row + size - j] = false;
      traverse(row + 1, size, col, fslash, bslash, count);
      col[j] = fslash[row + j] = bslash[row + size - j] = true;
    }
  }
}
```