ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<getresuid_uid>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x14(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    0xc(%rsp),%rdi
  call   <getresuid@plt>
  mov    0x14(%rsp),%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x28,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uid_t getresuid_uid(void) {
  uid_t ruid, euid, suid;
  getresuid(&ruid, &euid, &suid);
  return suid;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<string_output_width>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%r14
  mov    %edx,%r13d
  test   %rdi,%rdi
  je     L155
  mov    %rdi,%rbx
  mov    (%rsi),%ebp
  test   %ecx,%ecx
  je     L12
  test   %ebp,%ebp
  je     L73
  mov    %ebp,%r12d
  mov    $0x0,%ebp
  jmp    L173
L155:
  cmp    %edx,(%rsi)
  jle    L43
  mov    %edx,(%r14)
L43:
  mov    (%r14),%ebp
L73:
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L29:
  sub    %r12d,(%r14)
  mov    %edx,%ebp
  jmp    L73
L135:
  add    %rax,%rbx
  sub    $0x1,%r12d
  je     L73
L173:
  mov    %rbx,%rdi
  call   <utf8char@plt>
  mov    %eax,%edi
  call   <output_width@plt>
  mov    %ebp,%edx
  add    %eax,%ebp
  cmp    %r13d,%ebp
  jg     L29
  movzbl (%rbx),%edx
  mov    $0x1,%eax
  test   %dl,%dl
  jns    L135
  mov    $0xffffffffffffffff,%rax
  cmp    $0xbf,%dl
  jbe    L135
  mov    $0x2,%eax
  cmp    $0xdf,%dl
  jbe    L135
  mov    $0x3,%eax
  cmp    $0xef,%dl
  jbe    L135
  mov    $0x4,%eax
  cmp    $0xf7,%dl
  jbe    L135
  cmp    $0xfb,%dl
  seta   %al
  movzbl %al,%eax
  add    $0x5,%rax
  jmp    L135
L169:
  sub    %r15d,(%r14)
  jmp    L73
L12:
  mov    %ebp,%r12d
  mov    %ecx,%ebp
L119:
  mov    %r12d,%r15d
  test   %r12d,%r12d
  je     L73
  movsbl (%rbx),%edi
  call   <output_width@plt>
  add    %ebp,%eax
  add    $0x1,%rbx
  sub    $0x1,%r12d
  cmp    %r13d,%eax
  jg     L169
  mov    %eax,%ebp
  jmp    L119
```

assistant: ```c
int string_output_width(const char *s, int *len, int maxWidth, bool utf8) {
  if (s == NULL) {
    if (*len > maxWidth)
      *len = maxWidth;
    return *len;
  } else {
    int width = 0, char_width, l = *len;
    if (utf8) {
      while (l-- != 0) {
        char_width = output_width(utf8char(s));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
        s += (((unsigned char)(*s)) < 0x80 ? 1 : ((unsigned char)(*s)) < 0xC0 ? -1 : ((unsigned char)(*s)) < 0xE0 ? 2 : ((unsigned char)(*s)) < 0xF0 ? 3 : ((unsigned char)(*s)) < 0xF8 ? 4 : ((unsigned char)(*s)) < 0xFC ? 5 : 6);
      }
    } else
      while (l-- != 0) {
        char_width = output_width(*(s++));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
      }
    return width;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<string_output_width>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x8,%rsp
  mov    (%rsi),%r12d
  test   %rdi,%rdi
  je     L0
  mov    %rdi,%rbx
  test   %ecx,%ecx
  je     L177
  test   %r12d,%r12d
  je     L122
  mov    %r12d,%r14d
  xor    %r12d,%r12d
  jmp    L11
  nop
L156:
  add    %rax,%rbx
  sub    $0x1,%r14d
  je     L122
L11:
  mov    %rbx,%rdi
  call   <utf8char@plt>
  mov    %eax,%edi
  call   <output_width@plt>
  mov    %r12d,%edx
  add    %eax,%r12d
  cmp    %ebp,%r12d
  jg     L145
  movzbl (%rbx),%edx
  mov    $0x1,%eax
  test   %dl,%dl
  jns    L156
  mov    $0xffffffffffffffff,%rax
  cmp    $0xbf,%dl
  jbe    L156
  mov    $0x2,%eax
  cmp    $0xdf,%dl
  jbe    L156
  mov    $0x3,%eax
  cmp    $0xef,%dl
  jbe    L156
  mov    $0x4,%eax
  cmp    $0xf7,%dl
  jbe    L156
  xor    %eax,%eax
  cmp    $0xfb,%dl
  seta   %al
  add    $0x5,%rax
  jmp    L156
  nop
L177:
  mov    %r12d,%r15d
  xor    %r12d,%r12d
  jmp    L121
  nopl   0x0(%rax,%rax,1)
L66:
  movsbl (%rbx),%edi
  sub    $0x1,%r15d
  add    $0x1,%rbx
  call   <output_width@plt>
  add    %r12d,%eax
  cmp    %ebp,%eax
  jg     L131
  mov    %eax,%r12d
L121:
  mov    %r15d,%r14d
  test   %r15d,%r15d
  jne    L66
L122:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L0:
  cmp    %edx,%r12d
  jle    L122
  mov    %edx,0x0(%r13)
  mov    %edx,%r12d
  jmp    L122
  cs nopw 0x0(%rax,%rax,1)
L145:
  sub    %r14d,0x0(%r13)
  mov    %edx,%r12d
  jmp    L122
  nopl   0x0(%rax)
L131:
  sub    %r14d,0x0(%r13)
  jmp    L122
```

assistant: ```c
int string_output_width(const char *s, int *len, int maxWidth, bool utf8) {
  if (s == NULL) {
    if (*len > maxWidth)
      *len = maxWidth;
    return *len;
  } else {
    int width = 0, char_width, l = *len;
    if (utf8) {
      while (l-- != 0) {
        char_width = output_width(utf8char(s));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
        s += (((unsigned char)(*s)) < 0x80 ? 1 : ((unsigned char)(*s)) < 0xC0 ? -1 : ((unsigned char)(*s)) < 0xE0 ? 2 : ((unsigned char)(*s)) < 0xF0 ? 3 : ((unsigned char)(*s)) < 0xF8 ? 4 : ((unsigned char)(*s)) < 0xFC ? 5 : 6);
      }
    } else
      while (l-- != 0) {
        char_width = output_width(*(s++));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
      }
    return width;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<string_output_width>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0x8,%rsp
  mov    (%rsi),%r12d
  test   %rdi,%rdi
  je     L123
  mov    %rdi,%rbx
  test   %ecx,%ecx
  je     L84
  test   %r12d,%r12d
  je     L43
  mov    %r12d,%r14d
  xor    %r12d,%r12d
  jmp    L60
  nop
L133:
  add    %rax,%rbx
  sub    $0x1,%r14d
  je     L43
L60:
  mov    %rbx,%rdi
  call   <utf8char@plt>
  mov    %eax,%edi
  call   <output_width@plt>
  mov    %r12d,%edx
  add    %eax,%r12d
  cmp    %ebp,%r12d
  jg     L140
  movzbl (%rbx),%edx
  mov    $0x1,%eax
  test   %dl,%dl
  jns    L133
  mov    $0xffffffffffffffff,%rax
  cmp    $0xbf,%dl
  jbe    L133
  mov    $0x2,%eax
  cmp    $0xdf,%dl
  jbe    L133
  mov    $0x3,%eax
  cmp    $0xef,%dl
  jbe    L133
  mov    $0x4,%eax
  cmp    $0xf7,%dl
  jbe    L133
  xor    %eax,%eax
  cmp    $0xfb,%dl
  seta   %al
  add    $0x5,%rax
  jmp    L133
  nop
L84:
  mov    %r12d,%r15d
  xor    %r12d,%r12d
  jmp    L178
  nopl   0x0(%rax,%rax,1)
L56:
  movsbl (%rbx),%edi
  sub    $0x1,%r15d
  add    $0x1,%rbx
  call   <output_width@plt>
  add    %r12d,%eax
  cmp    %ebp,%eax
  jg     L76
  mov    %eax,%r12d
L178:
  mov    %r15d,%r14d
  test   %r15d,%r15d
  jne    L56
L43:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L123:
  cmp    %edx,%r12d
  jle    L43
  mov    %edx,0x0(%r13)
  mov    %edx,%r12d
  jmp    L43
  cs nopw 0x0(%rax,%rax,1)
L140:
  sub    %r14d,0x0(%r13)
  mov    %edx,%r12d
  jmp    L43
  nopl   0x0(%rax)
L76:
  sub    %r14d,0x0(%r13)
  jmp    L43
```

assistant: ```c
int string_output_width(const char *s, int *len, int maxWidth, bool utf8) {
  if (s == NULL) {
    if (*len > maxWidth)
      *len = maxWidth;
    return *len;
  } else {
    int width = 0, char_width, l = *len;
    if (utf8) {
      while (l-- != 0) {
        char_width = output_width(utf8char(s));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
        s += (((unsigned char)(*s)) < 0x80 ? 1 : ((unsigned char)(*s)) < 0xC0 ? -1 : ((unsigned char)(*s)) < 0xE0 ? 2 : ((unsigned char)(*s)) < 0xF0 ? 3 : ((unsigned char)(*s)) < 0xF8 ? 4 : ((unsigned char)(*s)) < 0xFC ? 5 : 6);
      }
    } else
      while (l-- != 0) {
        char_width = output_width(*(s++));
        if (width + char_width > maxWidth) {
          *len -= l + 1;
          break;
        }
        width += char_width;
      }
    return width;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<mu_atoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  mov    %rdi,-0x18(%rbp)
  mov    $0x0,%r12d
  mov    -0x18(%rbp),%rbx
  jmp    L29
L22:
  movzbl (%rbx),%eax
  cmp    $0x2f,%al
  jle    L44
  movzbl (%rbx),%eax
  cmp    $0x39,%al
  jle    L4
L44:
  mov    $0x0,%eax
  jmp    L64
L4:
  mov    %r12d,%eax
  shl    $0x2,%eax
  add    %r12d,%eax
  add    %eax,%eax
  mov    %eax,%r12d
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %eax,%r12d
L29:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L22
  cmp    $0x3e7,%r12d
  jle    L54
  mov    $0x0,%eax
  jmp    L64
L54:
  mov    %r12d,%eax
L64:
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
mu_atoi(str) char *str;
{
  register char *cp;
  register int i;
  i = 0;
  cp = str;
  while (*cp) {
    if (*cp < '0' || *cp > '9')
      return 0;
    i *= 10;
    i += *cp++ - '0';
  }
  if (i > 999)
    return 0;
  return i;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<mu_atoi>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L26
  mov    $0x0,%edx
L37:
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  ja     L33
  lea    (%rdx,%rdx,4),%edx
  add    $0x1,%rdi
  movsbl %al,%eax
  lea    -0x30(%rax,%rdx,2),%edx
  movzbl (%rdi),%eax
  test   %al,%al
  jne    L37
  cmp    $0x3e8,%edx
  mov    $0x0,%eax
  cmovge %eax,%edx
  jmp    L27
L26:
  mov    $0x0,%edx
  jmp    L27
L33:
  mov    $0x0,%edx
L27:
  mov    %edx,%eax
  ret
```

assistant: ```c
mu_atoi(str) char *str;
{
  register char *cp;
  register int i;
  i = 0;
  cp = str;
  while (*cp) {
    if (*cp < '0' || *cp > '9')
      return 0;
    i *= 10;
    i += *cp++ - '0';
  }
  if (i > 999)
    return 0;
  return i;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<mu_atoi>:
  endbr64
  movzbl (%rdi),%eax
  xor    %r8d,%r8d
  test   %al,%al
  jne    L4
  jmp    L37
L7:
  movsbl %al,%eax
  lea    (%r8,%r8,4),%edx
  add    $0x1,%rdi
  lea    (%rax,%rdx,2),%r8d
  movzbl (%rdi),%eax
  test   %al,%al
  je     L28
L4:
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L7
  xor    %r8d,%r8d
L37:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L28:
  xor    %eax,%eax
  cmp    $0x3e8,%r8d
  cmovge %eax,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
mu_atoi(str) char *str;
{
  register char *cp;
  register int i;
  i = 0;
  cp = str;
  while (*cp) {
    if (*cp < '0' || *cp > '9')
      return 0;
    i *= 10;
    i += *cp++ - '0';
  }
  if (i > 999)
    return 0;
  return i;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<mu_atoi>:
  endbr64
  movzbl (%rdi),%eax
  xor    %r8d,%r8d
  test   %al,%al
  jne    L38
  jmp    L36
L21:
  movsbl %al,%eax
  lea    (%r8,%r8,4),%edx
  add    $0x1,%rdi
  lea    (%rax,%rdx,2),%r8d
  movzbl (%rdi),%eax
  test   %al,%al
  je     L19
L38:
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L21
  xor    %r8d,%r8d
L36:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L19:
  xor    %eax,%eax
  cmp    $0x3e8,%r8d
  cmovge %eax,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
mu_atoi(str) char *str;
{
  register char *cp;
  register int i;
  i = 0;
  cp = str;
  while (*cp) {
    if (*cp < '0' || *cp > '9')
      return 0;
    i *= 10;
    i += *cp++ - '0';
  }
  if (i > 999)
    return 0;
  return i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<register_signal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rax
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  lea    -0x10(%rbp),%rcx
  mov    -0x14(%rbp),%eax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <sigaction@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
int register_signal(int sig, void (*handler)(int)) {
  struct sigaction action;
  memset(&action, 0, sizeof(action));
  action.sa_handler = handler;
  return sigaction(sig, &action, NULL);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<register_signal>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %rbp,(%rsp)
  mov    $0x0,%edx
  mov    %r12,%rsi
  mov    %ebx,%edi
  call   <sigaction@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int register_signal(int sig, void (*handler)(int)) {
  struct sigaction action;
  memset(&action, 0, sizeof(action));
  action.sa_handler = handler;
  return sigaction(sig, &action, NULL);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<register_signal>:
  endbr64
  push   %r12
  mov    $0x8,%edx
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rsi,%rbx
  xor    %esi,%esi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  xor    %edx,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  mov    %rbx,(%rsp)
  call   <sigaction@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int register_signal(int sig, void (*handler)(int)) {
  struct sigaction action;
  memset(&action, 0, sizeof(action));
  action.sa_handler = handler;
  return sigaction(sig, &action, NULL);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<register_signal>:
  endbr64
  push   %r12
  mov    $0x8,%edx
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rsi,%rbx
  xor    %esi,%esi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  xor    %edx,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  mov    %rbx,(%rsp)
  call   <sigaction@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int register_signal(int sig, void (*handler)(int)) {
  struct sigaction action;
  memset(&action, 0, sizeof(action));
  action.sa_handler = handler;
  return sigaction(sig, &action, NULL);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D5
type: string

tool: D5: assert test

assistant: ```c
int main() {
  printf("assert test");
  assert(1 == 0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: label: D2
type_guessed: string

tool: D2: assert test

assistant: ```c
int main() {
  printf("assert test");
  assert(1 == 0);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D5(%rip),%rdi
  call   <printf@plt>
  xor    %edi,%edi
  call   <assert@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D5
type: string

tool: D5: assert test

assistant: ```c
int main() {
  printf("assert test");
  assert(1 == 0);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D7(%rip),%rdi
  call   <printf@plt>
  xor    %edi,%edi
  call   <assert@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: label: D7
type: string

tool: D7: assert test

assistant: ```c
int main() {
  printf("assert test");
  assert(1 == 0);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<atodec>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L5
L23:
  addl   $0x1,-0x8(%rbp)
L5:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jbe    L23
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L48
  addl   $0x1,-0x8(%rbp)
  jmp    L48
L92:
  mov    -0xc(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xd(%rbp)
  cmpb   $0x2f,-0xd(%rbp)
  jbe    L39
  cmpb   $0x39,-0xd(%rbp)
  ja     L39
  movzbl -0xd(%rbp),%eax
  sub    $0x30,%eax
  add    %eax,-0xc(%rbp)
  addl   $0x1,-0x8(%rbp)
  jmp    L48
L39:
  mov    $0xffffffff,%eax
  jmp    L67
L48:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jbe    L56
  mov    -0x8(%rbp),%eax
  sub    -0x4(%rbp),%eax
  cmp    $0xb,%eax
  jle    L92
L56:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L109
  negl   -0xc(%rbp)
L109:
  mov    -0xc(%rbp),%eax
L67:
  pop    %rbp
  ret
```

assistant: ```c
int atodec(unsigned char *str) {
  int val, i, mi;
  unsigned char c;
  val = i = 0;
  while (str[i] <= ' ')
    i++;
  mi = i;
  if (str[i] == '-')
    i++;
  while (str[i] > ' ' && (i - mi) < 12) {
    val *= 10;
    c = str[i];
    if (c >= '0' && c <= '9') {
      val += c - '0';
    } else {
      return -1;
    }
    i++;
  }
  if (str[mi] == '-')
    val = val * (-1);
  return val;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<atodec>:
  endbr64
  movzbl (%rdi),%r8d
  cmp    $0x20,%r8b
  ja     L126
  mov    $0x1,%eax
L70:
  mov    %eax,%esi
  add    $0x1,%rax
  movzbl -0x1(%rdi,%rax,1),%r8d
  cmp    $0x20,%r8b
  jbe    L70
  mov    %esi,%r9d
  cmp    $0x2d,%r8b
  je     L104
  movslq %esi,%rax
  movzbl (%rdi,%rax,1),%eax
  mov    $0x0,%edx
  cmp    $0x20,%al
  jbe    L24
L89:
  movslq %esi,%rdx
  lea    0x1(%rdi,%rdx,1),%rdi
  mov    %rdi,%rcx
  mov    $0x0,%edx
  sub    %r9d,%esi
  sub    %edi,%esi
L94:
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  lea    -0x30(%rax),%edi
  cmp    $0x9,%dil
  ja     L29
  movzbl %al,%eax
  lea    -0x30(%rdx,%rax,1),%edx
  movzbl (%rcx),%eax
  cmp    $0x20,%al
  jbe    L99
  add    $0x1,%rcx
  lea    (%rsi,%rcx,1),%edi
  cmp    $0xb,%edi
  jle    L94
L99:
  cmp    $0x2d,%r8b
  je     L51
L24:
  mov    %edx,%eax
  ret
L27:
  mov    $0x0,%r9d
L104:
  lea    0x1(%r9),%esi
  movslq %esi,%rax
  movzbl (%rdi,%rax,1),%eax
  cmp    $0x20,%al
  ja     L89
  mov    $0x0,%edx
L51:
  neg    %edx
  jmp    L24
L29:
  mov    $0xffffffff,%edx
  jmp    L24
L126:
  cmp    $0x2d,%r8b
  je     L27
  movzbl (%rdi),%eax
  mov    $0x0,%r9d
  mov    $0x0,%esi
  jmp    L89
```

assistant: ```c
int atodec(unsigned char *str) {
  int val, i, mi;
  unsigned char c;
  val = i = 0;
  while (str[i] <= ' ')
    i++;
  mi = i;
  if (str[i] == '-')
    i++;
  while (str[i] > ' ' && (i - mi) < 12) {
    val *= 10;
    c = str[i];
    if (c >= '0' && c <= '9') {
      val += c - '0';
    } else {
      return -1;
    }
    i++;
  }
  if (str[mi] == '-')
    val = val * (-1);
  return val;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<atodec>:
  endbr64
  movzbl (%rdi),%r9d
  cmp    $0x20,%r9b
  ja     L128
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L26:
  mov    %eax,%edx
  add    $0x1,%rax
  movzbl -0x1(%rdi,%rax,1),%r9d
  cmp    $0x20,%r9b
  jbe    L26
  mov    %edx,%esi
  cmp    $0x2d,%r9b
  je     L83
  movslq %edx,%rcx
  movzbl (%rdi,%rcx,1),%eax
  cmp    $0x20,%al
  jbe    L65
L7:
  sub    %esi,%edx
  lea    0x1(%rdi,%rcx,1),%rcx
  xor    %r8d,%r8d
  mov    %edx,%esi
  sub    %ecx,%esi
  jmp    L27
  nopl   0x0(%rax)
L75:
  lea    -0x30(%rdx,%rax,1),%r8d
  movzbl (%rcx),%eax
  cmp    $0x20,%al
  jbe    L104
  add    $0x1,%rcx
  lea    (%rsi,%rcx,1),%edx
  cmp    $0xb,%edx
  jg     L104
L27:
  lea    (%r8,%r8,4),%edx
  lea    -0x30(%rax),%edi
  add    %edx,%edx
  cmp    $0x9,%dil
  jbe    L75
  mov    $0xffffffff,%r8d
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L104:
  mov    %r8d,%eax
  neg    %eax
  cmp    $0x2d,%r9b
  cmove  %eax,%r8d
L63:
  mov    %r8d,%eax
  ret
L88:
  xor    %esi,%esi
  nopl   0x0(%rax,%rax,1)
L83:
  lea    0x1(%rsi),%edx
  movslq %edx,%rcx
  movzbl (%rdi,%rcx,1),%eax
  cmp    $0x20,%al
  jbe    L65
  mov    $0x2d,%r9d
  jmp    L7
  cs nopw 0x0(%rax,%rax,1)
L128:
  cmp    $0x2d,%r9b
  je     L88
  movzbl %r9b,%eax
  xor    %esi,%esi
  xor    %edx,%edx
  xor    %ecx,%ecx
  jmp    L7
L65:
  xor    %r8d,%r8d
  jmp    L63
```

assistant: ```c
int atodec(unsigned char *str) {
  int val, i, mi;
  unsigned char c;
  val = i = 0;
  while (str[i] <= ' ')
    i++;
  mi = i;
  if (str[i] == '-')
    i++;
  while (str[i] > ' ' && (i - mi) < 12) {
    val *= 10;
    c = str[i];
    if (c >= '0' && c <= '9') {
      val += c - '0';
    } else {
      return -1;
    }
    i++;
  }
  if (str[mi] == '-')
    val = val * (-1);
  return val;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<atodec>:
  endbr64
  movzbl (%rdi),%esi
  cmp    $0x20,%sil
  ja     L62
  mov    $0x1,%eax
  cs nopw 0x0(%rax,%rax,1)
L40:
  mov    %eax,%edx
  add    $0x1,%rax
  movzbl -0x1(%rdi,%rax,1),%esi
  cmp    $0x20,%sil
  jbe    L40
L45:
  cmp    $0x2d,%sil
  je     L46
  mov    %edx,%r9d
  movzbl %sil,%eax
  movslq %edx,%rcx
L82:
  lea    0x1(%rdi,%rcx,1),%rcx
  sub    %edx,%r9d
  xor    %r8d,%r8d
  sub    %ecx,%r9d
  jmp    L27
  nopl   0x0(%rax)
L71:
  lea    -0x30(%rdx,%rax,1),%r8d
  movzbl (%rcx),%eax
  cmp    $0x20,%al
  jbe    L69
  add    $0x1,%rcx
  lea    (%r9,%rcx,1),%edx
  cmp    $0xb,%edx
  jg     L69
L27:
  lea    (%r8,%r8,4),%edx
  lea    -0x30(%rax),%edi
  add    %edx,%edx
  cmp    $0x9,%dil
  jbe    L71
  mov    $0xffffffff,%r8d
  mov    %r8d,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L69:
  mov    %r8d,%eax
  neg    %eax
  cmp    $0x2d,%sil
  cmove  %eax,%r8d
L92:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L46:
  lea    0x1(%rdx),%r9d
  movslq %r9d,%rcx
  movzbl (%rdi,%rcx,1),%eax
  cmp    $0x20,%al
  ja     L82
  xor    %r8d,%r8d
  jmp    L92
  nopl   0x0(%rax)
L62:
  xor    %edx,%edx
  jmp    L45
```

assistant: ```c
int atodec(unsigned char *str) {
  int val, i, mi;
  unsigned char c;
  val = i = 0;
  while (str[i] <= ' ')
    i++;
  mi = i;
  if (str[i] == '-')
    i++;
  while (str[i] > ' ' && (i - mi) < 12) {
    val *= 10;
    c = str[i];
    if (c >= '0' && c <= '9') {
      val += c - '0';
    } else {
      return -1;
    }
    i++;
  }
  if (str[mi] == '-')
    val = val * (-1);
  return val;
}
```