ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<discretize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movss  %xmm0,-0x14(%rbp)
  movss  %xmm1,-0x18(%rbp)
  mov    %edi,-0x1c(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x1c(%rbp),%xmm0
  mulss  -0x14(%rbp),%xmm0
  divss  -0x18(%rbp),%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,-0x4(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x4(%rbp),%xmm0
  mulss  -0x18(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl -0x1c(%rbp),%xmm1
  divss  %xmm1,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
float discretize(float value, float max, int modulo) {
  int t = (int)(value * modulo / max);
  return t * max / modulo;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<discretize>:
  endbr64
  pxor   %xmm2,%xmm2
  cvtsi2ss %edi,%xmm2
  mulss  %xmm2,%xmm0
  divss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  %xmm1,%xmm0
  divss  %xmm2,%xmm0
  ret
```

assistant: ```c
float discretize(float value, float max, int modulo) {
  int t = (int)(value * modulo / max);
  return t * max / modulo;
}
```
user: What is the c source code of the assembly code below:

```asm
<discretize>:
  endbr64
  pxor   %xmm2,%xmm2
  cvtsi2ss %edi,%xmm2
  mulss  %xmm2,%xmm0
  divss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  %xmm1,%xmm0
  divss  %xmm2,%xmm0
  ret
```

assistant: ```c
float discretize(float value, float max, int modulo) {
  int t = (int)(value * modulo / max);
  return t * max / modulo;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<discretize>:
  endbr64
  pxor   %xmm2,%xmm2
  cvtsi2ss %edi,%xmm2
  mulss  %xmm2,%xmm0
  divss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  %xmm1,%xmm0
  divss  %xmm2,%xmm0
  ret
```

assistant: ```c
float discretize(float value, float max, int modulo) {
  int t = (int)(value * modulo / max);
  return t * max / modulo;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movb   $0x21,-0x1(%rbp)
  jmp    L10
L16:
  movsbl -0x1(%rbp),%edx
  movsbl -0x1(%rbp),%eax
  mov    %eax,%esi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movzbl -0x1(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x1(%rbp)
L10:
  cmpb   $0x7f,-0x1(%rbp)
  jne    L16
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D11
type_infered: string
name: unpack_data
arguments: tag: D38
type_infered: string
name: unpack_data
arguments: tag: D27
type_infered: string

tool: D11: 
********************************

tool: D38: 
TABELA ASCII

tool: D27: 
 %d 	 %c

assistant: ```c
int main() {
  char num;
  printf("\n********************************\n");
  printf("\nTABELA ASCII\n");
  printf("\n********************************\n");
  for (num = 33; num <= 126; num++) {
    printf("\n %d \t %c", num, num);
  }
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    D23(%rip),%rbx
  mov    %rbx,%rdi
  call   <puts@plt>
  lea    D22(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdi
  call   <puts@plt>
  mov    $0x21,%ebx
  lea    D4(%rip),%rbp
L4:
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x7f,%ebx
  jne    L4
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D23
type_infered: string
name: extract_symbolic_data
arguments: label: D22
type_infered: string
name: extract_symbolic_data
arguments: label: D4
type_infered: string

tool: D23: 
********************************

tool: D22: 
TABELA ASCII

tool: D4: 
 %d 	 %c

assistant: ```c
int main() {
  char num;
  printf("\n********************************\n");
  printf("\nTABELA ASCII\n");
  printf("\n********************************\n");
  for (num = 33; num <= 126; num++) {
    printf("\n %d \t %c", num, num);
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D21(%rip),%rbp
  push   %rbx
  mov    %rbp,%rdi
  mov    $0x21,%ebx
  sub    $0x8,%rsp
  call   <puts@plt>
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  lea    D28(%rip),%rbp
  call   <puts@plt>
  nopl   0x0(%rax)
L3:
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x7f,%ebx
  jne    L3
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D21
type_infered: string
name: retrieve_data
arguments: data_label: D4
type_infered: string
name: retrieve_data
arguments: data_label: D28
type_infered: string

tool: D21: 
********************************

tool: D4: 
TABELA ASCII

tool: D28: 
 %d 	 %c

assistant: ```c
int main() {
  char num;
  printf("\n********************************\n");
  printf("\nTABELA ASCII\n");
  printf("\n********************************\n");
  for (num = 33; num <= 126; num++) {
    printf("\n %d \t %c", num, num);
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D1(%rip),%rbp
  push   %rbx
  mov    %rbp,%rdi
  mov    $0x21,%ebx
  sub    $0x8,%rsp
  call   <puts@plt>
  lea    D28(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  lea    D3(%rip),%rbp
  call   <puts@plt>
  nopl   0x0(%rax)
L8:
  mov    %ebx,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x7f,%ebx
  jne    L8
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D1
type: string
name: retrieve_data
arguments: data_tag: D28
type: string
name: retrieve_data
arguments: data_tag: D3
type: string

tool: D1: 
********************************

tool: D28: 
TABELA ASCII

tool: D3: 
 %d 	 %c

assistant: ```c
int main() {
  char num;
  printf("\n********************************\n");
  printf("\nTABELA ASCII\n");
  printf("\n********************************\n");
  for (num = 33; num <= 126; num++) {
    printf("\n %d \t %c", num, num);
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<option_dup_subs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x870,%rsp
  mov    %rdi,-0x868(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x820(%rbp),%rax
  mov    %rax,-0x858(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x850(%rbp)
  movq   $0x400,-0x848(%rbp)
  movb   $0x0,-0x10(%rbp)
  mov    -0x868(%rbp),%rcx
  lea    -0x410(%rbp),%rax
  mov    $0x400,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  jmp    L3
L80:
  mov    -0x850(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x24,%al
  jne    L96
  mov    -0x850(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x7b,%al
  jne    L96
  mov    -0x850(%rbp),%rax
  mov    $0x7d,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x840(%rbp)
  cmpq   $0x0,-0x840(%rbp)
  je     L96
  mov    -0x850(%rbp),%rax
  add    $0x1,%rax
  cmp    %rax,-0x840(%rbp)
  jbe    L96
  mov    -0x850(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x838(%rbp)
  mov    -0x840(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x850(%rbp)
  mov    -0x840(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x838(%rbp),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x830(%rbp)
  cmpq   $0x0,-0x830(%rbp)
  je     L3
  mov    -0x830(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x828(%rbp)
  mov    -0x828(%rbp),%rax
  cmp    -0x848(%rbp),%rax
  ja     L3
  mov    -0x828(%rbp),%rdx
  mov    -0x830(%rbp),%rcx
  mov    -0x858(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x828(%rbp),%rax
  add    %rax,-0x858(%rbp)
  mov    -0x828(%rbp),%rax
  sub    %rax,-0x848(%rbp)
  jmp    L3
L96:
  mov    -0x850(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x850(%rbp)
  mov    -0x858(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x858(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  subq   $0x1,-0x848(%rbp)
L3:
  mov    -0x850(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L24
  cmpq   $0x0,-0x848(%rbp)
  jne    L80
L24:
  mov    -0x858(%rbp),%rax
  movb   $0x0,(%rax)
  lea    -0x820(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L41
  call   <__stack_chk_fail@plt>
L41:
  leave
  ret
```

assistant: ```c
char *option_dup_subs(const char *opt) {
  char out[1024 + 1];
  char in[1024 + 1];
  char *outptr = out;
  char *inptr = in;
  char *ch1, *ch2, *env;
  ssize_t nchr = 1024;
  size_t envlen;
  in[1024] = '\0';
  strncpy(in, opt, 1024);
  while (*inptr && nchr > 0) {
    if (inptr[0] == '$' && inptr[1] == '{') {
      ch2 = strchr(inptr, '}');
      if (ch2 && inptr + 1 < ch2) {
        ch1 = inptr + 2;
        inptr = ch2 + 1;
        *ch2 = '\0';
        env = getenv(ch1);
        if (env) {
          envlen = strlen(env);
          if (envlen <= nchr) {
            memcpy(outptr, env, envlen);
            outptr += envlen;
            nchr -= envlen;
          }
        }
        continue;
      }
    }
    *outptr++ = *inptr++;
    --nchr;
  }
  *outptr = '\0';
  return strdup(out);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<option_dup_subs>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x820,%rsp
  mov    %rdi,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x818(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x810(%rsp)
  lea    0x410(%rsp),%rdi
  mov    $0x400,%edx
  call   <strncpy@plt>
  movzbl 0x410(%rsp),%eax
  test   %al,%al
  je     L18
  mov    $0x400,%r12d
  lea    0x410(%rsp),%rbx
  mov    %rsp,%rbp
  jmp    L114
L16:
  movzbl (%rbx),%eax
  mov    %al,0x0(%rbp)
  sub    $0x1,%r12
  lea    0x1(%rbx),%rbx
  lea    0x1(%rbp),%rbp
L109:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L115
  test   %r12,%r12
  je     L115
L114:
  cmp    $0x24,%al
  jne    L16
  cmpb   $0x7b,0x1(%rbx)
  jne    L16
  mov    $0x7d,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L16
  lea    0x1(%rbx),%rdx
  cmp    %rdx,%rax
  jbe    L16
  lea    0x2(%rbx),%rdi
  lea    0x1(%rax),%rbx
  movb   $0x0,(%rax)
  call   <getenv@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L109
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%r14
  cmp    %r12,%rax
  ja     L109
  mov    %rax,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    %r14,%rbp
  sub    %r14,%r12
  jmp    L109
L18:
  mov    %rsp,%rbp
L115:
  movb   $0x0,0x0(%rbp)
  mov    %rsp,%rdi
  call   <strdup@plt>
  mov    0x818(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L13
  add    $0x820,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *option_dup_subs(const char *opt) {
  char out[1024 + 1];
  char in[1024 + 1];
  char *outptr = out;
  char *inptr = in;
  char *ch1, *ch2, *env;
  ssize_t nchr = 1024;
  size_t envlen;
  in[1024] = '\0';
  strncpy(in, opt, 1024);
  while (*inptr && nchr > 0) {
    if (inptr[0] == '$' && inptr[1] == '{') {
      ch2 = strchr(inptr, '}');
      if (ch2 && inptr + 1 < ch2) {
        ch1 = inptr + 2;
        inptr = ch2 + 1;
        *ch2 = '\0';
        env = getenv(ch1);
        if (env) {
          envlen = strlen(env);
          if (envlen <= nchr) {
            memcpy(outptr, env, envlen);
            outptr += envlen;
            nchr -= envlen;
          }
        }
        continue;
      }
    }
    *outptr++ = *inptr++;
    --nchr;
  }
  *outptr = '\0';
  return strdup(out);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<option_dup_subs>:
  endbr64
  push   %r15
  mov    %rdi,%rsi
  mov    $0x400,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x828,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x818(%rsp)
  xor    %eax,%eax
  lea    0x410(%rsp),%rbx
  movb   $0x0,0x810(%rsp)
  mov    %rbx,%rdi
  call   <strncpy@plt>
  movzbl 0x410(%rsp),%eax
  test   %al,%al
  je     L16
  mov    %rsp,%r14
  mov    $0x400,%r13d
  mov    %r14,%r12
  jmp    L29
  cs nopw 0x0(%rax,%rax,1)
L14:
  movzbl (%rbx),%eax
  sub    $0x1,%r13
  mov    %rbp,%rbx
  add    $0x1,%r12
  mov    %al,-0x1(%r12)
L80:
  movzbl (%rbx),%eax
  test   %r13,%r13
  je     L23
  test   %al,%al
  je     L23
L29:
  lea    0x1(%rbx),%rbp
  cmp    $0x24,%al
  jne    L14
  cmpb   $0x7b,0x1(%rbx)
  jne    L14
  mov    $0x7d,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L14
  cmp    %rbp,%rax
  jbe    L14
  movb   $0x0,(%rax)
  lea    0x2(%rbx),%rdi
  lea    0x1(%rax),%rbx
  call   <getenv@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L80
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%r15
  cmp    %r13,%rax
  ja     L80
  mov    %r12,%rdi
  mov    %rax,%rdx
  mov    %rbp,%rsi
  add    %r15,%r12
  call   <memcpy@plt>
  sub    %r15,%r13
  jmp    L80
  nopw   0x0(%rax,%rax,1)
L16:
  mov    %rsp,%r14
  mov    %r14,%r12
  xchg   %ax,%ax
L23:
  movb   $0x0,(%r12)
  mov    %r14,%rdi
  call   <strdup@plt>
  mov    0x818(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L77
  add    $0x828,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *option_dup_subs(const char *opt) {
  char out[1024 + 1];
  char in[1024 + 1];
  char *outptr = out;
  char *inptr = in;
  char *ch1, *ch2, *env;
  ssize_t nchr = 1024;
  size_t envlen;
  in[1024] = '\0';
  strncpy(in, opt, 1024);
  while (*inptr && nchr > 0) {
    if (inptr[0] == '$' && inptr[1] == '{') {
      ch2 = strchr(inptr, '}');
      if (ch2 && inptr + 1 < ch2) {
        ch1 = inptr + 2;
        inptr = ch2 + 1;
        *ch2 = '\0';
        env = getenv(ch1);
        if (env) {
          envlen = strlen(env);
          if (envlen <= nchr) {
            memcpy(outptr, env, envlen);
            outptr += envlen;
            nchr -= envlen;
          }
        }
        continue;
      }
    }
    *outptr++ = *inptr++;
    --nchr;
  }
  *outptr = '\0';
  return strdup(out);
}
```
user: Translate the below assembly code into C programming language:

```asm
<option_dup_subs>:
  endbr64
  push   %r15
  mov    %rdi,%rsi
  mov    $0x400,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x828,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x818(%rsp)
  xor    %eax,%eax
  lea    0x410(%rsp),%rbx
  movb   $0x0,0x810(%rsp)
  mov    %rbx,%rdi
  call   <strncpy@plt>
  movzbl 0x410(%rsp),%eax
  test   %al,%al
  je     L13
  mov    %rsp,%r13
  mov    $0x400,%r14d
  mov    %r13,%rbp
  jmp    L44
  nopw   0x0(%rax,%rax,1)
L78:
  mov    %al,0x0(%rbp)
  sub    $0x1,%r14
  mov    %r12,%rbx
  add    $0x1,%rbp
L64:
  movzbl (%rbx),%eax
  test   %r14,%r14
  je     L129
  test   %al,%al
  je     L129
L44:
  lea    0x1(%rbx),%r12
  cmp    $0x24,%al
  jne    L78
  cmpb   $0x7b,0x1(%rbx)
  jne    L78
  mov    $0x7d,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L52
  cmp    %r12,%rax
  ja     L2
L52:
  movzbl (%rbx),%eax
  jmp    L78
  nopl   0x0(%rax)
L13:
  mov    %rsp,%r13
  mov    %r13,%rbp
  cs nopw 0x0(%rax,%rax,1)
L129:
  movb   $0x0,0x0(%rbp)
  mov    %r13,%rdi
  call   <strdup@plt>
  mov    0x818(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L63
  add    $0x828,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  movb   $0x0,(%rax)
  lea    0x2(%rbx),%rdi
  lea    0x1(%rax),%rbx
  call   <getenv@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L64
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%r15
  cmp    %r14,%rax
  ja     L64
  mov    %rbp,%rdi
  mov    %rax,%rdx
  mov    %r12,%rsi
  add    %r15,%rbp
  call   <memcpy@plt>
  sub    %r15,%r14
  jmp    L64
L63:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *option_dup_subs(const char *opt) {
  char out[1024 + 1];
  char in[1024 + 1];
  char *outptr = out;
  char *inptr = in;
  char *ch1, *ch2, *env;
  ssize_t nchr = 1024;
  size_t envlen;
  in[1024] = '\0';
  strncpy(in, opt, 1024);
  while (*inptr && nchr > 0) {
    if (inptr[0] == '$' && inptr[1] == '{') {
      ch2 = strchr(inptr, '}');
      if (ch2 && inptr + 1 < ch2) {
        ch1 = inptr + 2;
        inptr = ch2 + 1;
        *ch2 = '\0';
        env = getenv(ch1);
        if (env) {
          envlen = strlen(env);
          if (envlen <= nchr) {
            memcpy(outptr, env, envlen);
            outptr += envlen;
            nchr -= envlen;
          }
        }
        continue;
      }
    }
    *outptr++ = *inptr++;
    --nchr;
  }
  *outptr = '\0';
  return strdup(out);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<atoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0xa,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L137
  movl   $0x1,-0xc(%rbp)
  addq   $0x1,-0x18(%rbp)
L137:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jne    L16
  addq   $0x1,-0x18(%rbp)
  subl   $0x1,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x78,%al
  jne    L96
  movl   $0x10,-0x10(%rbp)
  subl   $0x1,-0x4(%rbp)
  addq   $0x1,-0x18(%rbp)
  jmp    L16
L96:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x30,%al
  jle    L16
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L16
  movl   $0x8,-0x10(%rbp)
  jmp    L16
L34:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L10
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L10
  mov    -0x4(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <pow@plt>
  movsbl %al,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  imul   %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L32
L10:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L60
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L60
  mov    -0x4(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <pow@plt>
  movsbl %al,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  imul   %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L32
L60:
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x8(%rbp)
L32:
  addq   $0x1,-0x18(%rbp)
  subl   $0x1,-0x4(%rbp)
L16:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L34
  cmpl   $0x1,-0xc(%rbp)
  jne    L73
  mov    -0x8(%rbp),%eax
  neg    %eax
  jmp    L77
L73:
  mov    -0x8(%rbp),%eax
L77:
  leave
  ret
```

assistant: ```c
int atoi(const char *s) {
  int base = 10, f = 0, retn = 0, i = (strlen(s) - 1);
  if (*s == '-') {
    f = 1;
    ++s;
  }
  if (*s == '0') {
    ++s;
    --i;
    if (*s == 'x') {
      base = 16;
      --i;
      ++s;
    } else if ((*s > '0') && (*s <= '9')) {
      base = 8;
    }
  }
  while (*s) {
    if ((*s >= '0') && (*s <= '9')) {
      retn = retn + (pow(base, i) * ((*s) - '0'));
    } else if ((*s >= 'A') && (*s <= 'F')) {
      retn = retn + (pow(base, i) * ((*s) - ('A' - 10)));
    } else {
      retn /= base;
    }
    s++;
    i--;
  }
  if (f == 1) {
    return -retn;
  } else {
    return retn;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<atoi>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r15
  call   <strlen@plt>
  mov    $0x0,%r14d
  cmpb   $0x2d,(%r15)
  je     L84
L43:
  lea    -0x1(%rax),%r13d
  mov    $0xa,%r12d
  cmpb   $0x30,(%r15)
  je     L100
L58:
  movzbl (%r15),%eax
  mov    %r15,%rbx
  mov    $0x0,%ebp
  add    %r15d,%r13d
  test   %al,%al
  jne    L41
L115:
  mov    %ebp,%eax
  neg    %eax
  cmp    $0x1,%r14d
  cmove  %eax,%ebp
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L84:
  add    $0x1,%r15
  mov    $0x1,%r14d
  jmp    L43
L100:
  lea    0x1(%r15),%rcx
  lea    -0x2(%rax),%r13d
  movzbl 0x1(%r15),%edx
  cmp    $0x78,%dl
  je     L90
  sub    $0x31,%edx
  mov    %rcx,%r15
  cmp    $0x9,%dl
  sbb    %r12d,%r12d
  and    $0xfffffffe,%r12d
  add    $0xa,%r12d
  jmp    L58
L90:
  lea    -0x3(%rax),%r13d
  add    $0x2,%r15
  mov    $0x10,%r12d
  jmp    L58
L27:
  mov    %r12d,%edi
  call   <pow@plt>
  movsbl (%rbx),%edx
  sub    $0x30,%edx
  movsbl %al,%eax
  imul   %eax,%edx
  add    %edx,%ebp
L70:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L115
L41:
  mov    %r13d,%esi
  sub    %ebx,%esi
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L27
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L119
  mov    %ebp,%eax
  cltd
  idiv   %r12d
  mov    %eax,%ebp
  jmp    L70
L119:
  mov    %r12d,%edi
  call   <pow@plt>
  movsbl (%rbx),%edx
  sub    $0x37,%edx
  movsbl %al,%eax
  imul   %eax,%edx
  add    %edx,%ebp
  jmp    L70
```

assistant: ```c
int atoi(const char *s) {
  int base = 10, f = 0, retn = 0, i = (strlen(s) - 1);
  if (*s == '-') {
    f = 1;
    ++s;
  }
  if (*s == '0') {
    ++s;
    --i;
    if (*s == 'x') {
      base = 16;
      --i;
      ++s;
    } else if ((*s > '0') && (*s <= '9')) {
      base = 8;
    }
  }
  while (*s) {
    if ((*s >= '0') && (*s <= '9')) {
      retn = retn + (pow(base, i) * ((*s) - '0'));
    } else if ((*s >= 'A') && (*s <= 'F')) {
      retn = retn + (pow(base, i) * ((*s) - ('A' - 10)));
    } else {
      retn /= base;
    }
    s++;
    i--;
  }
  if (f == 1) {
    return -retn;
  } else {
    return retn;
  }
}
```