ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码：

```asm
<strtoul>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x10(%rbp)
  jmp    L136
L24:
  addq   $0x1,-0x28(%rbp)
L136:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L24
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L123
  movl   $0x1,-0x14(%rbp)
  addq   $0x1,-0x28(%rbp)
  jmp    L64
L123:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L104
  movl   $0xffffffff,-0x14(%rbp)
  addq   $0x1,-0x28(%rbp)
  jmp    L64
L104:
  movl   $0x1,-0x14(%rbp)
L64:
  cmpl   $0x0,-0x34(%rbp)
  je     L1
  cmpl   $0x10,-0x34(%rbp)
  jne    L25
L1:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L162
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  je     L68
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x58,%al
  jne    L162
L68:
  addq   $0x2,-0x28(%rbp)
  movl   $0x10,-0x34(%rbp)
  jmp    L55
L162:
  cmpl   $0x0,-0x34(%rbp)
  jne    L25
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L36
  addq   $0x1,-0x28(%rbp)
  movl   $0x8,-0x34(%rbp)
  jmp    L25
L36:
  movl   $0xa,-0x34(%rbp)
L55:
  jmp    L25
L56:
  mov    -0x34(%rbp),%eax
  cltq
  mov    -0x10(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addq   $0x1,-0x28(%rbp)
L25:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x18(%rbp),%rdx
  mov    -0x34(%rbp),%ecx
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <checkDigit@plt>
  test   %eax,%eax
  jne    L56
  cmpq   $0x0,-0x30(%rbp)
  je     L19
  mov    -0x30(%rbp),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,(%rax)
L19:
  mov    -0x14(%rbp),%eax
  cltq
  imul   -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L45
  call   <__stack_chk_fail@plt>
L45:
  leave
  ret
```

assistant: ```c
unsigned long strtoul(const char *s, char **endp, int base) {
  unsigned long res;
  int sign;
  int digit;
  res = 0;
  while (isspace(*s)) {
    s++;
  }
  if (*s == '+') {
    sign = 1;
    s++;
  } else if (*s == '-') {
    sign = -1;
    s++;
  } else {
    sign = 1;
  }
  if (base == 0 || base == 16) {
    if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
      s += 2;
      base = 16;
    } else {
      if (base == 0) {
        if (*s == '0') {
          s++;
          base = 8;
        } else {
          base = 10;
        }
      } else {
      }
    }
  } else {
  }
  while (checkDigit(*s, base, &digit)) {
    res *= base;
    res += digit;
    s++;
  }
  if (endp != ((void *)0)) {
    *endp = (char *)s;
  }
  return sign * res;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r15
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  jmp    L81
L134:
  add    $0x1,%rbx
L81:
  movzbl (%rbx),%ebp
  movsbl %bpl,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L134
  cmp    $0x2b,%bpl
  je     L123
  mov    $0x1,%r14d
  cmp    $0x2d,%bpl
  je     L77
L85:
  test   $0xffffffef,%r12d
  jne    L89
  cmpb   $0x30,(%rbx)
  je     L28
  test   %r12d,%r12d
  mov    $0xa,%eax
  cmove  %eax,%r12d
L89:
  mov    $0x0,%ebp
  lea    0x4(%rsp),%r13
  jmp    L150
L123:
  add    $0x1,%rbx
  mov    $0x1,%r14d
  jmp    L85
L77:
  add    $0x1,%rbx
  mov    $0xffffffff,%r14d
  jmp    L85
L28:
  movzbl 0x1(%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L140
  add    $0x2,%rbx
  mov    $0x10,%r12d
  jmp    L89
L142:
  movslq %r12d,%rax
  imul   %rbp,%rax
  movslq 0x4(%rsp),%rbp
  add    %rax,%rbp
  add    $0x1,%rbx
L150:
  movsbl (%rbx),%edi
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    $0x0,%eax
  call   <checkDigit@plt>
  test   %eax,%eax
  jne    L142
  test   %r15,%r15
  je     L23
  mov    %rbx,(%r15)
L23:
  movslq %r14d,%rax
  imul   %rbp,%rax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L84
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L140:
  test   %r12d,%r12d
  jne    L89
  add    $0x1,%rbx
  mov    $0x8,%r12d
  jmp    L89
L84:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long strtoul(const char *s, char **endp, int base) {
  unsigned long res;
  int sign;
  int digit;
  res = 0;
  while (isspace(*s)) {
    s++;
  }
  if (*s == '+') {
    sign = 1;
    s++;
  } else if (*s == '-') {
    sign = -1;
    s++;
  } else {
    sign = 1;
  }
  if (base == 0 || base == 16) {
    if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
      s += 2;
      base = 16;
    } else {
      if (base == 0) {
        if (*s == '0') {
          s++;
          base = 8;
        } else {
          base = 10;
        }
      } else {
      }
    }
  } else {
  }
  while (checkDigit(*s, base, &digit)) {
    res *= base;
    res += digit;
    s++;
  }
  if (endp != ((void *)0)) {
    *endp = (char *)s;
  }
  return sign * res;
}
```
user: Translate the below assembly code into C programming language:

```asm
<strtoul>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  jmp    L13
  xchg   %ax,%ax
L45:
  add    $0x1,%r14
L13:
  movsbl (%r14),%edi
  mov    %edi,%r15d
  call   <isspace@plt>
  test   %eax,%eax
  jne    L45
  cmp    $0x2b,%r15b
  je     L143
  movq   $0x1,(%rsp)
  cmp    $0x2d,%r15b
  je     L34
L89:
  test   $0xffffffef,%ebp
  jne    L94
  cmp    $0x30,%r15b
  je     L35
  cmp    $0x1,%ebp
  sbb    %ebp,%ebp
  and    $0xfffffffa,%ebp
  add    $0x10,%ebp
L94:
  xor    %ebx,%ebx
  lea    0x14(%rsp),%r12
  movslq %ebp,%r13
  jmp    L16
  nopl   0x0(%rax)
L121:
  imul   %r13,%rbx
  movslq 0x14(%rsp),%rax
  movzbl 0x1(%r14),%r15d
  add    $0x1,%r14
  add    %rax,%rbx
L16:
  xor    %eax,%eax
  movsbl %r15b,%edi
  mov    %r12,%rdx
  mov    %ebp,%esi
  call   <checkDigit@plt>
  test   %eax,%eax
  jne    L121
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L22
  mov    %r14,(%rax)
L22:
  mov    (%rsp),%rax
  imul   %rbx,%rax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L31
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L34:
  movzbl 0x1(%r14),%r15d
  movq   $0xffffffffffffffff,(%rsp)
  add    $0x1,%r14
  jmp    L89
  xchg   %ax,%ax
L143:
  movzbl 0x1(%r14),%r15d
  movq   $0x1,(%rsp)
  add    $0x1,%r14
  jmp    L89
  cs nopw 0x0(%rax,%rax,1)
L35:
  movzbl 0x1(%r14),%eax
  mov    %eax,%esi
  and    $0xffffffdf,%esi
  cmp    $0x58,%sil
  jne    L68
  movzbl 0x2(%r14),%r15d
  mov    $0x10,%ebp
  add    $0x2,%r14
  jmp    L94
L68:
  test   %ebp,%ebp
  jne    L39
  add    $0x1,%r14
  mov    %eax,%r15d
  mov    $0x8,%ebp
  jmp    L94
L39:
  mov    $0x10,%ebp
  jmp    L94
L31:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long strtoul(const char *s, char **endp, int base) {
  unsigned long res;
  int sign;
  int digit;
  res = 0;
  while (isspace(*s)) {
    s++;
  }
  if (*s == '+') {
    sign = 1;
    s++;
  } else if (*s == '-') {
    sign = -1;
    s++;
  } else {
    sign = 1;
  }
  if (base == 0 || base == 16) {
    if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
      s += 2;
      base = 16;
    } else {
      if (base == 0) {
        if (*s == '0') {
          s++;
          base = 8;
        } else {
          base = 10;
        }
      } else {
      }
    }
  } else {
  }
  while (checkDigit(*s, base, &digit)) {
    res *= base;
    res += digit;
    s++;
  }
  if (endp != ((void *)0)) {
    *endp = (char *)s;
  }
  return sign * res;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<strtoul>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  jmp    L43
  nopl   0x0(%rax)
L93:
  add    $0x1,%r15
L43:
  movsbl (%r15),%edi
  mov    %edi,%ebx
  call   <isspace@plt>
  test   %eax,%eax
  jne    L93
  cmp    $0x2b,%bl
  je     L102
  movq   $0x1,0x8(%rsp)
  cmp    $0x2d,%bl
  je     L11
L24:
  test   $0xffffffef,%ebp
  jne    L94
  cmp    $0x30,%bl
  je     L54
  cmp    $0x1,%ebp
  sbb    %ebp,%ebp
  and    $0xfffffffa,%ebp
  add    $0x10,%ebp
L94:
  xor    %ebx,%ebx
  lea    0x14(%rsp),%r12
  movslq %ebp,%r13
  jmp    L15
  cs nopw 0x0(%rax,%rax,1)
L148:
  imul   %r13,%rbx
  movslq 0x14(%rsp),%rax
  add    $0x1,%r15
  add    %rax,%rbx
L15:
  movsbl (%r15),%edi
  xor    %eax,%eax
  mov    %r12,%rdx
  mov    %ebp,%esi
  call   <checkDigit@plt>
  test   %eax,%eax
  jne    L148
  test   %r14,%r14
  je     L140
  mov    %r15,(%r14)
L140:
  mov    0x8(%rsp),%rax
  imul   %rbx,%rax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L84
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L11:
  movzbl 0x1(%r15),%ebx
  add    $0x1,%r15
  movq   $0xffffffffffffffff,0x8(%rsp)
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L102:
  movzbl 0x1(%r15),%ebx
  add    $0x1,%r15
  movq   $0x1,0x8(%rsp)
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L54:
  movzbl 0x1(%r15),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L98
  add    $0x2,%r15
  mov    $0x10,%ebp
  jmp    L94
L98:
  test   %ebp,%ebp
  jne    L46
  add    $0x1,%r15
  mov    $0x8,%ebp
  jmp    L94
L46:
  mov    $0x10,%ebp
  jmp    L94
L84:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long strtoul(const char *s, char **endp, int base) {
  unsigned long res;
  int sign;
  int digit;
  res = 0;
  while (isspace(*s)) {
    s++;
  }
  if (*s == '+') {
    sign = 1;
    s++;
  } else if (*s == '-') {
    sign = -1;
    s++;
  } else {
    sign = 1;
  }
  if (base == 0 || base == 16) {
    if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
      s += 2;
      base = 16;
    } else {
      if (base == 0) {
        if (*s == '0') {
          s++;
          base = 8;
        } else {
          base = 10;
        }
      } else {
      }
    }
  } else {
  }
  while (checkDigit(*s, base, &digit)) {
    res *= base;
    res += digit;
    s++;
  }
  if (endp != ((void *)0)) {
    *endp = (char *)s;
  }
  return sign * res;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<get_token>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x3c(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L12
L7:
  addq   $0x1,-0x10(%rbp)
L12:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L36
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L7
  jmp    L36
L3:
  mov    -0x10(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x14(%rbp)
L36:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L52
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L52
  mov    -0x14(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L3
L52:
  mov    -0x30(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *get_token(char *target, char **nextpp, char *delim, int maxlen) {
  char *sp, *tp;
  int count = 0;
  sp = *nextpp;
  tp = target;
  while (*sp && strchr(delim, *sp)) {
    sp++;
  }
  while (*sp && !strchr(delim, *sp) && count < maxlen) {
    *tp++ = *sp++;
    count++;
  }
  *nextpp = sp;
  *tp = '\0';
  return target;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<get_token>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%r15
  mov    %rdx,%r13
  mov    %ecx,%r14d
  mov    (%rsi),%rbx
  movzbl (%rbx),%esi
  test   %sil,%sil
  je     L71
L28:
  movsbl %sil,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L6
  add    $0x1,%rbx
  movzbl (%rbx),%esi
  test   %sil,%sil
  jne    L28
L71:
  mov    0x8(%rsp),%rbp
  jmp    L57
L6:
  movzbl (%rbx),%esi
  test   %sil,%sil
  je     L25
  mov    0x8(%rsp),%rbp
  mov    $0x0,%r12d
L42:
  movsbl %sil,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  cmp    %r12d,%r14d
  jle    L57
  test   %rax,%rax
  jne    L57
  add    $0x1,%rbx
  add    $0x1,%rbp
  movzbl -0x1(%rbx),%eax
  mov    %al,-0x1(%rbp)
  add    $0x1,%r12d
  movzbl (%rbx),%esi
  test   %sil,%sil
  jne    L42
L57:
  mov    %rbx,(%r15)
  movb   $0x0,0x0(%rbp)
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L25:
  mov    0x8(%rsp),%rbp
  jmp    L57
```

assistant: ```c
char *get_token(char *target, char **nextpp, char *delim, int maxlen) {
  char *sp, *tp;
  int count = 0;
  sp = *nextpp;
  tp = target;
  while (*sp && strchr(delim, *sp)) {
    sp++;
  }
  while (*sp && !strchr(delim, *sp) && count < maxlen) {
    *tp++ = *sp++;
    count++;
  }
  *nextpp = sp;
  *tp = '\0';
  return target;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<get_token>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    (%rsi),%rbx
  mov    %rsi,0x8(%rsp)
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L10
  jmp    L54
L17:
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  test   %sil,%sil
  je     L54
L10:
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L17
  movsbl (%rbx),%esi
  mov    %r14,%rbp
  test   %sil,%sil
  je     L38
  xor    %r15d,%r15d
  jmp    L81
  nopw   0x0(%rax,%rax,1)
L7:
  cmp    %r15d,%r13d
  jle    L38
  mov    %rbp,%rdi
  mov    %rbx,%rsi
  add    $0x1,%r15d
  movsb  %ds:(%rsi),%es:(%rdi)
  mov    %rsi,%rbx
  movsbl (%rsi),%esi
  mov    %rdi,%rbp
  test   %sil,%sil
  je     L38
L81:
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L7
L38:
  mov    0x8(%rsp),%rax
  mov    %rbx,(%rax)
  mov    %r14,%rax
  movb   $0x0,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L54:
  mov    %r14,%rbp
  jmp    L38
```

assistant: ```c
char *get_token(char *target, char **nextpp, char *delim, int maxlen) {
  char *sp, *tp;
  int count = 0;
  sp = *nextpp;
  tp = target;
  while (*sp && strchr(delim, *sp)) {
    sp++;
  }
  while (*sp && !strchr(delim, *sp) && count < maxlen) {
    *tp++ = *sp++;
    count++;
  }
  *nextpp = sp;
  *tp = '\0';
  return target;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<get_token>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    (%rsi),%rbx
  mov    %rsi,0x8(%rsp)
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L66
  jmp    L40
L12:
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  test   %sil,%sil
  je     L40
L66:
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L12
  movsbl (%rbx),%esi
  mov    %r14,%rbp
  test   %sil,%sil
  je     L62
  xor    %r15d,%r15d
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L38:
  cmp    %r15d,%r13d
  jle    L62
  mov    %rbp,%rdi
  mov    %rbx,%rsi
  add    $0x1,%r15d
  movsb  %ds:(%rsi),%es:(%rdi)
  mov    %rsi,%rbx
  movsbl (%rsi),%esi
  mov    %rdi,%rbp
  test   %sil,%sil
  je     L62
L98:
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L38
L62:
  mov    0x8(%rsp),%rax
  mov    %rbx,(%rax)
  mov    %r14,%rax
  movb   $0x0,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L40:
  mov    %r14,%rbp
  jmp    L62
```

assistant: ```c
char *get_token(char *target, char **nextpp, char *delim, int maxlen) {
  char *sp, *tp;
  int count = 0;
  sp = *nextpp;
  tp = target;
  while (*sp && strchr(delim, *sp)) {
    sp++;
  }
  while (*sp && !strchr(delim, *sp) && count < maxlen) {
    *tp++ = *sp++;
    count++;
  }
  *nextpp = sp;
  *tp = '\0';
  return target;
}
```
user: Translate the below assembly code into C programming language:

```asm
<findPattern>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x18(%rbp)
  movl   $0x1,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x1,-0x1c(%rbp)
  jmp    L62
L10:
  cmpl   $0x1,-0x2c(%rbp)
  jne    L33
  mov    -0x14(%rbp),%edx
  lea    -0x1c(%rbp),%rcx
  mov    -0xc(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <printForDebug@plt>
L33:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <legalChar@plt>
  mov    D25(%rip),%rdx
  mov    (%rdx),%rdx
  cmp    %rdx,%rax
  jne    L1
  mov    -0x10(%rbp),%edi
  mov    -0x14(%rbp),%ecx
  mov    -0x28(%rbp),%edx
  mov    -0xc(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <evaluateMatch@plt>
  mov    D25(%rip),%rdx
  mov    (%rdx),%rdx
  cmp    %rdx,%rax
  je     L14
  addl   $0x1,-0x18(%rbp)
  movl   $0x1,-0x10(%rbp)
  jmp    L62
L14:
  addl   $0x1,-0x14(%rbp)
  jmp    L62
L1:
  movl   $0x0,-0x10(%rbp)
  movl   $0x1,-0x14(%rbp)
L62:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,-0xc(%rbp)
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jne    L10
  mov    -0x18(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L41
  call   <__stack_chk_fail@plt>
L41:
  leave
  ret
```

assistant: ```c
int findPattern(int pattern, int index, int debugMode) {
  int counterFound = 0;
  int counterPosition = 1;
  int letter;
  int wasItCounted = 0;
  int stateEnter = 1;
  while ((letter = getchar()) != EOF) {
    if (debugMode == 1) {
      printForDebug(letter, &stateEnter, counterPosition);
    }
    if (legalChar(letter) == EXIT_SUCCESS) {
      if (evaluateMatch(pattern, letter, index, counterPosition, wasItCounted) != EXIT_SUCCESS) {
        counterFound++;
        wasItCounted = 1;
      } else {
        counterPosition++;
      }
    } else {
      wasItCounted = 0;
      counterPosition = 1;
    }
  }
  return counterFound;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<findPattern>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x8(%rsp)
  mov    %esi,0xc(%rsp)
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x14(%rsp)
  mov    $0x0,%r13d
  mov    $0x1,%ebp
  mov    $0x0,%r15d
  lea    0x14(%rsp),%r14
  jmp    L86
L45:
  mov    %ebx,%edi
  call   <legalChar@plt>
  mov    D6(%rip),%rdx
  cmp    (%rdx),%rax
  je     L26
  mov    $0x0,%r13d
  mov    $0x1,%ebp
L86:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%ebx
  mov    D21(%rip),%rax
  cmp    %ebx,(%rax)
  je     L14
  cmp    $0x1,%r12d
  jne    L45
  mov    %ebp,%edx
  mov    %r14,%rsi
  mov    %ebx,%edi
  call   <printForDebug@plt>
  jmp    L45
L26:
  mov    %r13d,%r8d
  mov    %ebp,%ecx
  mov    0xc(%rsp),%edx
  mov    %ebx,%esi
  mov    0x8(%rsp),%edi
  call   <evaluateMatch@plt>
  mov    D6(%rip),%rdx
  cmp    (%rdx),%rax
  je     L31
  add    $0x1,%r15d
  mov    $0x1,%r13d
  jmp    L86
L31:
  add    $0x1,%ebp
  jmp    L86
L14:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  mov    %r15d,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int findPattern(int pattern, int index, int debugMode) {
  int counterFound = 0;
  int counterPosition = 1;
  int letter;
  int wasItCounted = 0;
  int stateEnter = 1;
  while ((letter = getchar()) != EOF) {
    if (debugMode == 1) {
      printForDebug(letter, &stateEnter, counterPosition);
    }
    if (legalChar(letter) == EXIT_SUCCESS) {
      if (evaluateMatch(pattern, letter, index, counterPosition, wasItCounted) != EXIT_SUCCESS) {
        counterFound++;
        wasItCounted = 1;
      } else {
        counterPosition++;
      }
    } else {
      wasItCounted = 0;
      counterPosition = 1;
    }
  }
  return counterFound;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<findPattern>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x28,%rsp
  mov    D23(%rip),%r12
  mov    %edi,0x8(%rsp)
  lea    0x14(%rsp),%r14
  mov    %esi,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x14(%rsp)
  movl   $0x0,0x4(%rsp)
  jmp    L5
  nopw   0x0(%rax,%rax,1)
L87:
  mov    %r15d,%edi
  call   <legalChar@plt>
  mov    D4(%rip),%rcx
  cmp    (%rcx),%rax
  je     L65
  xor    %r13d,%r13d
  mov    $0x1,%ebx
L5:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    %eax,%r15d
  cmp    %eax,(%r12)
  je     L85
  cmp    $0x1,%ebp
  jne    L87
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    %r15d,%edi
  call   <printForDebug@plt>
  jmp    L87
  nopl   0x0(%rax,%rax,1)
L85:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  mov    0x4(%rsp),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L65:
  mov    0xc(%rsp),%edx
  mov    0x8(%rsp),%edi
  mov    %r13d,%r8d
  mov    %ebx,%ecx
  mov    %r15d,%esi
  call   <evaluateMatch@plt>
  mov    D4(%rip),%rdx
  cmp    (%rdx),%rax
  je     L64
  addl   $0x1,0x4(%rsp)
  mov    $0x1,%r13d
  jmp    L5
  nopl   0x0(%rax)
L64:
  add    $0x1,%ebx
  jmp    L5
L10:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int findPattern(int pattern, int index, int debugMode) {
  int counterFound = 0;
  int counterPosition = 1;
  int letter;
  int wasItCounted = 0;
  int stateEnter = 1;
  while ((letter = getchar()) != EOF) {
    if (debugMode == 1) {
      printForDebug(letter, &stateEnter, counterPosition);
    }
    if (legalChar(letter) == EXIT_SUCCESS) {
      if (evaluateMatch(pattern, letter, index, counterPosition, wasItCounted) != EXIT_SUCCESS) {
        counterFound++;
        wasItCounted = 1;
      } else {
        counterPosition++;
      }
    } else {
      wasItCounted = 0;
      counterPosition = 1;
    }
  }
  return counterFound;
}
```