ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<finaliza>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <system@plt>
  mov    $0x0,%eax
  call   <nome_decorado@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L5
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L19
L5:
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L19:
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D5
type_infered: string
name: unpack_data
arguments: data_tag: D7
type_infered: string
name: unpack_data
arguments: data_tag: D9
type_infered: string

tool: D5: clear

tool: D7: O Jogador 1 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

tool: D9: O Jogador 2 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

assistant: ```c
void finaliza(int pontos[2], int jogadas) {
  system("clear");
  nome_decorado();
  if (pontos[0] > pontos[1]) {
    printf("O Jogador 1 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[0], jogadas);
  } else {
    printf("O Jogador 2 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[1], jogadas);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<finaliza>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  lea    D17(%rip),%rdi
  call   <system@plt>
  mov    $0x0,%eax
  call   <nome_decorado@plt>
  mov    (%rbx),%eax
  mov    0x4(%rbx),%esi
  cmp    %esi,%eax
  jle    L3
  mov    %ebp,%edx
  mov    %eax,%esi
  lea    D14(%rip),%rdi
  call   <printf@plt>
L9:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L3:
  mov    %ebp,%edx
  lea    D23(%rip),%rdi
  call   <printf@plt>
  jmp    L9
```

tool_calls: name: parse_data
arguments: label: D17
type_infered: string
name: parse_data
arguments: label: D14
type_infered: string
name: parse_data
arguments: label: D23
type_infered: string

tool: D17: clear

tool: D14: O Jogador 1 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

tool: D23: O Jogador 2 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

assistant: ```c
void finaliza(int pontos[2], int jogadas) {
  system("clear");
  nome_decorado();
  if (pontos[0] > pontos[1]) {
    printf("O Jogador 1 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[0], jogadas);
  } else {
    printf("O Jogador 2 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[1], jogadas);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<finaliza>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbx
  mov    %rdi,%rbx
  lea    D8(%rip),%rdi
  sub    $0x8,%rsp
  call   <system@plt>
  xor    %eax,%eax
  call   <nome_decorado@plt>
  mov    (%rbx),%r8d
  mov    0x4(%rbx),%esi
  mov    %r12d,%edx
  cmp    %esi,%r8d
  jle    L0
  add    $0x8,%rsp
  mov    %r8d,%esi
  lea    D7(%rip),%rdi
  pop    %rbx
  pop    %r12
  jmp    1090 <printf@plt>
  nopl   0x0(%rax,%rax,1)
L0:
  add    $0x8,%rsp
  lea    D9(%rip),%rdi
  pop    %rbx
  pop    %r12
  jmp    1090 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D8
type_infered: string
name: retrieve_data
arguments: tag: D7
type_infered: string
name: retrieve_data
arguments: tag: D9
type_infered: string

tool: D8: clear

tool: D7: O Jogador 1 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

tool: D9: O Jogador 2 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

assistant: ```c
void finaliza(int pontos[2], int jogadas) {
  system("clear");
  nome_decorado();
  if (pontos[0] > pontos[1]) {
    printf("O Jogador 1 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[0], jogadas);
  } else {
    printf("O Jogador 2 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[1], jogadas);
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<finaliza>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbx
  mov    %rdi,%rbx
  lea    D13(%rip),%rdi
  sub    $0x8,%rsp
  call   <system@plt>
  xor    %eax,%eax
  call   <nome_decorado@plt>
  mov    (%rbx),%r8d
  mov    0x4(%rbx),%esi
  mov    %r12d,%edx
  cmp    %esi,%r8d
  jle    L9
  add    $0x8,%rsp
  mov    %r8d,%esi
  lea    D20(%rip),%rdi
  pop    %rbx
  pop    %r12
  jmp    1090 <printf@plt>
  nopl   0x0(%rax,%rax,1)
L9:
  add    $0x8,%rsp
  lea    D27(%rip),%rdi
  pop    %rbx
  pop    %r12
  jmp    1090 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: label: D13
data_type: string
name: retrieve_data
arguments: label: D20
data_type: string
name: retrieve_data
arguments: label: D27
data_type: string

tool: D13: clear

tool: D20: O Jogador 1 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

tool: D27: O Jogador 2 venceu a partida, com um total de %d pontos.

A partida teve um total de %d jogadas.

assistant: ```c
void finaliza(int pontos[2], int jogadas) {
  system("clear");
  nome_decorado();
  if (pontos[0] > pontos[1]) {
    printf("O Jogador 1 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[0], jogadas);
  } else {
    printf("O Jogador 2 venceu a partida, com um total de %d pontos.\n\nA partida teve um total de %d jogadas.", pontos[1], jogadas);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<mbstowcs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  lea    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x8(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    $0x0,%ecx
  mov    %rax,%rdi
  call   <mbsrtowcs@plt>
  leave
  ret
```

assistant: ```c
size_t mbstowcs(wchar_t *dest, const char *src, size_t n) {
  const char **s = &src;
  return mbsrtowcs(dest, s, n, NULL);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<mbstowcs>:
  endbr64
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  lea    0x8(%rsp),%rsi
  mov    $0x0,%ecx
  call   <mbsrtowcs@plt>
  add    $0x18,%rsp
  ret
```

assistant: ```c
size_t mbstowcs(wchar_t *dest, const char *src, size_t n) {
  const char **s = &src;
  return mbsrtowcs(dest, s, n, NULL);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<mbstowcs>:
  endbr64
  sub    $0x18,%rsp
  xor    %ecx,%ecx
  mov    %rsi,0x8(%rsp)
  lea    0x8(%rsp),%rsi
  call   <mbsrtowcs@plt>
  add    $0x18,%rsp
  ret
```

assistant: ```c
size_t mbstowcs(wchar_t *dest, const char *src, size_t n) {
  const char **s = &src;
  return mbsrtowcs(dest, s, n, NULL);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<mbstowcs>:
  endbr64
  sub    $0x18,%rsp
  xor    %ecx,%ecx
  mov    %rsi,0x8(%rsp)
  lea    0x8(%rsp),%rsi
  call   <mbsrtowcs@plt>
  add    $0x18,%rsp
  ret
```

assistant: ```c
size_t mbstowcs(wchar_t *dest, const char *src, size_t n) {
  const char **s = &src;
  return mbsrtowcs(dest, s, n, NULL);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ft_do_it>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %edx,-0x8(%rbp)
  mov    %ecx,-0x14(%rbp)
  jmp    L10
L29:
  mov    -0x4(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %ecx,%eax
  lea    0x30(%rax),%ecx
  mov    -0x8(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x4(%rbp)
L10:
  cmpl   $0x0,-0x8(%rbp)
  jns    L29
  cmpl   $0xffffffff,-0x14(%rbp)
  jne    L15
  mov    -0x10(%rbp),%rax
  movb   $0x2d,(%rax)
L15:
  mov    -0x10(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
char *ft_do_it(int n, char *str, int l, int sign) {
  while (l >= 0) {
    str[l--] = '0' + n % 10;
    n /= 10;
  }
  if (sign == -1)
    str[0] = '-';
  return (str);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<ft_do_it>:
  endbr64
  mov    %rsi,%r8
  mov    %ecx,%r9d
  test   %edx,%edx
  js     L39
  movslq %edx,%rax
  lea    (%rsi,%rax,1),%rcx
  lea    -0x1(%rsi,%rax,1),%rsi
  mov    %edx,%edx
  sub    %rdx,%rsi
L29:
  movslq %edi,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %edi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  add    %edx,%edx
  sub    %edx,%edi
  add    $0x30,%edi
  mov    %dil,(%rcx)
  mov    %eax,%edi
  sub    $0x1,%rcx
  cmp    %rsi,%rcx
  jne    L29
L39:
  cmp    $0xffffffff,%r9d
  je     L32
L5:
  mov    %r8,%rax
  ret
L32:
  movb   $0x2d,(%r8)
  jmp    L5
```

assistant: ```c
char *ft_do_it(int n, char *str, int l, int sign) {
  while (l >= 0) {
    str[l--] = '0' + n % 10;
    n /= 10;
  }
  if (sign == -1)
    str[0] = '-';
  return (str);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<ft_do_it>:
  endbr64
  mov    %rsi,%r8
  mov    %ecx,%r9d
  test   %edx,%edx
  js     L25
  movslq %edx,%rdx
  lea    (%rsi,%rdx,1),%rcx
  lea    -0x1(%rsi,%rdx,1),%rsi
  sub    %rdx,%rsi
  nopl   (%rax)
L6:
  movslq %edi,%rax
  mov    %edi,%edx
  sub    $0x1,%rcx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  add    %edx,%edx
  sub    %edx,%edi
  add    $0x30,%edi
  mov    %dil,0x1(%rcx)
  mov    %eax,%edi
  cmp    %rsi,%rcx
  jne    L6
L25:
  cmp    $0xffffffff,%r9d
  jne    L28
  movb   $0x2d,(%r8)
L28:
  mov    %r8,%rax
  ret
```

assistant: ```c
char *ft_do_it(int n, char *str, int l, int sign) {
  while (l >= 0) {
    str[l--] = '0' + n % 10;
    n /= 10;
  }
  if (sign == -1)
    str[0] = '-';
  return (str);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<ft_do_it>:
  endbr64
  mov    %rsi,%r8
  mov    %ecx,%r9d
  test   %edx,%edx
  js     L27
  movslq %edx,%rdx
  lea    (%rsi,%rdx,1),%rcx
  lea    -0x1(%rsi,%rdx,1),%rsi
  sub    %rdx,%rsi
  nopl   (%rax)
L14:
  movslq %edi,%rax
  mov    %edi,%edx
  sub    $0x1,%rcx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  add    %edx,%edx
  sub    %edx,%edi
  add    $0x30,%edi
  mov    %dil,0x1(%rcx)
  mov    %eax,%edi
  cmp    %rcx,%rsi
  jne    L14
L27:
  cmp    $0xffffffff,%r9d
  jne    L12
  movb   $0x2d,(%r8)
L12:
  mov    %r8,%rax
  ret
```

assistant: ```c
char *ft_do_it(int n, char *str, int l, int sign) {
  while (l >= 0) {
    str[l--] = '0' + n % 10;
    n /= 10;
  }
  if (sign == -1)
    str[0] = '-';
  return (str);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<STC3115_StopPowerSavingMode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%edi
  call   <STC3115_ReadByte@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0xfffffffe,%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <STC3115_WriteByte@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L9
  mov    -0x4(%rbp),%eax
  jmp    L11
L9:
  mov    $0x0,%eax
L11:
  leave
  ret
```

assistant: ```c
int STC3115_StopPowerSavingMode(void) {
  int res;
  res = STC3115_ReadByte(0x00);
  if (0 != 0)
    return (!0);
  res = STC3115_WriteByte(0x00, (res & ~0x01));
  if (res != 0)
    return (res);
  return (0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<STC3115_StopPowerSavingMode>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%edi
  call   <STC3115_ReadByte@plt>
  and    $0xfffffffe,%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <STC3115_WriteByte@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int STC3115_StopPowerSavingMode(void) {
  int res;
  res = STC3115_ReadByte(0x00);
  if (0 != 0)
    return (!0);
  res = STC3115_WriteByte(0x00, (res & ~0x01));
  if (res != 0)
    return (res);
  return (0);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<STC3115_StopPowerSavingMode>:
  endbr64
  sub    $0x8,%rsp
  xor    %edi,%edi
  call   <STC3115_ReadByte@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  and    $0xfffffffe,%eax
  mov    %eax,%esi
  jmp    1060 <STC3115_WriteByte@plt>
```

assistant: ```c
int STC3115_StopPowerSavingMode(void) {
  int res;
  res = STC3115_ReadByte(0x00);
  if (0 != 0)
    return (!0);
  res = STC3115_WriteByte(0x00, (res & ~0x01));
  if (res != 0)
    return (res);
  return (0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<STC3115_StopPowerSavingMode>:
  endbr64
  sub    $0x8,%rsp
  xor    %edi,%edi
  call   <STC3115_ReadByte@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  and    $0xfffffffe,%eax
  mov    %eax,%esi
  jmp    1060 <STC3115_WriteByte@plt>
```

assistant: ```c
int STC3115_StopPowerSavingMode(void) {
  int res;
  res = STC3115_ReadByte(0x00);
  if (0 != 0)
    return (!0);
  res = STC3115_WriteByte(0x00, (res & ~0x01));
  if (res != 0)
    return (res);
  return (0);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<string_to_i16>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x28(%rbp)
  je     L51
  cmpq   $0x0,-0x30(%rbp)
  je     L51
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L23
L51:
  mov    D116(%rip),%rax
  mov    (%rax),%rdx
  mov    D3(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L70
L23:
  mov    D3(%rip),%rax
  movq   $0x0,(%rax)
  lea    -0x18(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L77
  cmpq   $0x0,-0x10(%rbp)
  jne    L35
  mov    D3(%rip),%rax
  mov    (%rax),%rdx
  mov    D116(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L77
L35:
  mov    D50(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x10(%rbp)
  jne    L109
  mov    D3(%rip),%rax
  mov    (%rax),%rdx
  mov    D40(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L77
L109:
  mov    D119(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x10(%rbp)
  jne    L33
  mov    D3(%rip),%rax
  mov    (%rax),%rdx
  mov    D40(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L33
L77:
  mov    $0x1,%eax
  jmp    L70
L33:
  mov    D52(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x10(%rbp)
  jg     L71
  mov    D128(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x10(%rbp)
  jge    L142
L71:
  mov    D40(%rip),%rax
  mov    (%rax),%rdx
  mov    D3(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L70
L142:
  mov    -0x28(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L70:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L57
  call   <__stack_chk_fail@plt>
L57:
  leave
  ret
```

assistant: ```c
int string_to_i16(int16_t *value, const char *str) {
  long l;
  char *ptr;
  if (value == NULL || str == NULL || *str == '\0') {
    errno = EINVAL;
    return 1;
  }
  errno = 0;
  l = strtol(str, &ptr, 0);
  if (*ptr != '\0' || (l == 0 && errno == EINVAL) || (l == LONG_MIN && errno == ERANGE) || (l == LONG_MAX && errno == ERANGE)) {
    return 1;
  }
  if (l > INT16_MAX || l < INT16_MIN) {
    errno = ERANGE;
    return 1;
  }
  *value = (int16_t)l;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<string_to_i16>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L17
  mov    %rsi,%rdi
  test   %rsi,%rsi
  je     L17
  cmpb   $0x0,(%rsi)
  jne    L129
L17:
  mov    D9(%rip),%rax
  mov    (%rax),%rdx
  mov    D116(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
L113:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L105
  add    $0x10,%rsp
  pop    %rbx
  ret
L129:
  mov    D116(%rip),%rax
  movq   $0x0,(%rax)
  mov    %rsp,%rsi
  mov    $0x0,%edx
  call   <strtol@plt>
  mov    %rax,%rdx
  mov    $0x1,%eax
  mov    (%rsp),%rcx
  cmpb   $0x0,(%rcx)
  jne    L113
  test   %rdx,%rdx
  jne    L165
  mov    D116(%rip),%rsi
  mov    D9(%rip),%rcx
  mov    (%rcx),%rcx
  cmp    %rcx,(%rsi)
  je     L113
L165:
  mov    D62(%rip),%rax
  cmp    %rdx,(%rax)
  je     L168
  mov    D121(%rip),%rax
  cmp    %rdx,(%rax)
  je     L13
L47:
  mov    D92(%rip),%rax
  cmp    %rdx,(%rax)
  jl     L2
  mov    D34(%rip),%rax
  cmp    %rdx,(%rax)
  jg     L2
  mov    %rdx,(%rbx)
  mov    $0x0,%eax
  jmp    L113
L168:
  mov    $0x1,%eax
  mov    D116(%rip),%rsi
  mov    D25(%rip),%rcx
  mov    (%rcx),%rcx
  cmp    %rcx,(%rsi)
  jne    L47
  jmp    L113
L13:
  mov    $0x1,%eax
  mov    D116(%rip),%rsi
  mov    D25(%rip),%rcx
  mov    (%rcx),%rcx
  cmp    %rcx,(%rsi)
  jne    L47
  jmp    L113
L2:
  mov    D25(%rip),%rax
  mov    (%rax),%rdx
  mov    D116(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L113
L105:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int string_to_i16(int16_t *value, const char *str) {
  long l;
  char *ptr;
  if (value == NULL || str == NULL || *str == '\0') {
    errno = EINVAL;
    return 1;
  }
  errno = 0;
  l = strtol(str, &ptr, 0);
  if (*ptr != '\0' || (l == 0 && errno == EINVAL) || (l == LONG_MIN && errno == ERANGE) || (l == LONG_MAX && errno == ERANGE)) {
    return 1;
  }
  if (l > INT16_MAX || l < INT16_MIN) {
    errno = ERANGE;
    return 1;
  }
  *value = (int16_t)l;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<string_to_i16>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L153
  mov    %rsi,%rdi
  test   %rsi,%rsi
  je     L153
  cmpb   $0x0,(%rsi)
  jne    L96
L153:
  mov    D86(%rip),%rax
  mov    (%rax),%rdx
  mov    D87(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
L129:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L21
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L96:
  mov    D87(%rip),%rbp
  xor    %edx,%edx
  mov    %rsp,%rsi
  movq   $0x0,0x0(%rbp)
  call   <strtol@plt>
  mov    (%rsp),%rcx
  mov    %rax,%rdx
  mov    $0x1,%eax
  cmpb   $0x0,(%rcx)
  jne    L129
  test   %rdx,%rdx
  je     L49
L82:
  mov    D82(%rip),%rax
  cmp    %rdx,(%rax)
  je     L80
  mov    D2(%rip),%rax
  cmp    %rdx,(%rax)
  je     L80
L117:
  mov    D56(%rip),%rax
  cmp    %rdx,(%rax)
  jl     L108
  mov    D51(%rip),%rax
  cmp    %rdx,(%rax)
  jg     L108
  mov    %rdx,(%rbx)
  xor    %eax,%eax
  jmp    L129
  nopl   0x0(%rax)
L49:
  mov    D86(%rip),%rcx
  mov    (%rcx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L82
  jmp    L129
  nopl   (%rax)
L80:
  mov    D14(%rip),%rcx
  mov    $0x1,%eax
  mov    (%rcx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L117
  jmp    L129
  nopw   0x0(%rax,%rax,1)
L108:
  mov    D14(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x0(%rbp)
  mov    $0x1,%eax
  jmp    L129
L21:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int string_to_i16(int16_t *value, const char *str) {
  long l;
  char *ptr;
  if (value == NULL || str == NULL || *str == '\0') {
    errno = EINVAL;
    return 1;
  }
  errno = 0;
  l = strtol(str, &ptr, 0);
  if (*ptr != '\0' || (l == 0 && errno == EINVAL) || (l == LONG_MIN && errno == ERANGE) || (l == LONG_MAX && errno == ERANGE)) {
    return 1;
  }
  if (l > INT16_MAX || l < INT16_MIN) {
    errno = ERANGE;
    return 1;
  }
  *value = (int16_t)l;
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<string_to_i16>:
  endbr64
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L131
  mov    %rsi,%rdi
  test   %rsi,%rsi
  je     L131
  cmpb   $0x0,(%rsi)
  jne    L109
L131:
  mov    D35(%rip),%rax
  mov    (%rax),%rdx
  mov    D48(%rip),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
L125:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L26
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L109:
  mov    D48(%rip),%rbp
  xor    %edx,%edx
  mov    %rsp,%rsi
  movq   $0x0,0x0(%rbp)
  call   <strtol@plt>
  mov    (%rsp),%rcx
  mov    %rax,%rdx
  mov    $0x1,%eax
  cmpb   $0x0,(%rcx)
  jne    L125
  test   %rdx,%rdx
  je     L15
L92:
  mov    D3(%rip),%rax
  cmp    %rdx,(%rax)
  je     L28
  mov    D82(%rip),%rax
  cmp    %rdx,(%rax)
  je     L28
L122:
  mov    D2(%rip),%rax
  cmp    %rdx,(%rax)
  jl     L71
  mov    D23(%rip),%rax
  cmp    %rdx,(%rax)
  jg     L71
  mov    %rdx,(%rbx)
  xor    %eax,%eax
  jmp    L125
  nopl   0x0(%rax)
L15:
  mov    D35(%rip),%rcx
  mov    (%rcx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L92
  jmp    L125
  nopl   (%rax)
L28:
  mov    D36(%rip),%rcx
  mov    $0x1,%eax
  mov    (%rcx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L122
  jmp    L125
  nopw   0x0(%rax,%rax,1)
L71:
  mov    D36(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x0(%rbp)
  mov    $0x1,%eax
  jmp    L125
L26:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int string_to_i16(int16_t *value, const char *str) {
  long l;
  char *ptr;
  if (value == NULL || str == NULL || *str == '\0') {
    errno = EINVAL;
    return 1;
  }
  errno = 0;
  l = strtol(str, &ptr, 0);
  if (*ptr != '\0' || (l == 0 && errno == EINVAL) || (l == LONG_MIN && errno == ERANGE) || (l == LONG_MAX && errno == ERANGE)) {
    return 1;
  }
  if (l > INT16_MAX || l < INT16_MIN) {
    errno = ERANGE;
    return 1;
  }
  *value = (int16_t)l;
  return 0;
}
```