ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<is3WinDirection>:
  endbr64
  push   %r15
  movslq %ecx,%rcx
  movsbl %r8b,%r15d
  push   %r14
  mov    %r15d,%r9d
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movabs $0xffffffff00000000,%rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    $0xffffffff,%eax
  mov    %rbx,0x38(%rsp)
  mov    %rax,0x18(%rsp)
  add    $0x1,%rax
  mov    %rax,0x20(%rsp)
  add    $0x1,%rax
  mov    %rax,0x28(%rsp)
  movabs $0x1ffffffff,%rax
  movq   $0xffffffffffffffff,0x10(%rsp)
  mov    0x10(%rsp,%rcx,4),%r14d
  mov    %rax,0x30(%rsp)
  movq   $0x1,0x40(%rsp)
  mov    %rax,0x48(%rsp)
  mov    0x30(%rsp,%rcx,4),%r8d
  mov    %r14d,%ecx
  mov    %r8d,0xc(%rsp)
  call   <countOutwards@plt>
  mov    0xc(%rsp),%r8d
  mov    %r14d,%ecx
  mov    %r15d,%r9d
  neg    %ecx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  neg    %r8d
  mov    %eax,%ebx
  call   <countOutwards@plt>
  add    %eax,%ebx
  cmp    $0x2,%ebx
  setg   %al
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x68,%rsp
  movzbl %al,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int is3WinDirection(const struct connect4 *game, int row, int col, int dir, char piece) {
  const int DX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
  const int DY[] = {-1, 1, 0, -1, 1, 0, -1, 1};
  int check3 = countOutwards(game, row, col, DX[dir], DY[dir], piece) + countOutwards(game, row, col, -DX[dir], -DY[dir], piece);
  return check3 >= 3;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<is3WinDirection>:
  endbr64
  push   %r15
  movslq %ecx,%rcx
  movsbl %r8b,%r15d
  push   %r14
  mov    %r15d,%r9d
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x68,%rsp
  movdqa D9(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x10(%rsp)
  movdqa D23(%rip),%xmm0
  movaps %xmm0,0x20(%rsp)
  movdqa D3(%rip),%xmm0
  mov    0x10(%rsp,%rcx,4),%r14d
  movaps %xmm0,0x30(%rsp)
  movdqa D16(%rip),%xmm0
  movaps %xmm0,0x40(%rsp)
  mov    0x30(%rsp,%rcx,4),%r8d
  mov    %r14d,%ecx
  mov    %r8d,0xc(%rsp)
  call   <countOutwards@plt>
  mov    0xc(%rsp),%r8d
  mov    %r14d,%ecx
  mov    %r15d,%r9d
  neg    %ecx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  neg    %r8d
  mov    %eax,%ebx
  call   <countOutwards@plt>
  add    %eax,%ebx
  cmp    $0x2,%ebx
  setg   %al
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L2
  add    $0x68,%rsp
  movzbl %al,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D9
data_type: byte[16]
name: disassemble_data
arguments: data_tag: D23
data_type: byte[16]
name: disassemble_data
arguments: data_tag: D3
data_type: byte[16]
name: disassemble_data
arguments: data_tag: D16
data_type: byte[16]

tool: {"D9": [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00]}

tool: {"D23": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: {"D3": [0xff,0xff,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff]}

tool: {"D16": [0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x01,0x00,0x00,0x00]}

assistant: ```c
int is3WinDirection(const struct connect4 *game, int row, int col, int dir, char piece) {
  const int DX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
  const int DY[] = {-1, 1, 0, -1, 1, 0, -1, 1};
  int check3 = countOutwards(game, row, col, DX[dir], DY[dir], piece) + countOutwards(game, row, col, -DX[dir], -DY[dir], piece);
  return check3 >= 3;
}
```
user: Translate the below assembly code into C programming language:

```asm
<assertLocalUrl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  call   <startsWith@plt>
  test   %rax,%rax
  je     L61
  addq   $0x6,-0x8(%rbp)
L61:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L49
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <errAbort@plt>
L49:
  mov    -0x8(%rbp),%rax
  lea    D75(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L30
  mov    -0x8(%rbp),%rax
  lea    D18(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L30
  mov    -0x8(%rbp),%rax
  lea    D10(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L30
  mov    -0x8(%rbp),%rax
  lea    D48(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L30
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D57(%rip),%rax
  mov    %rax,%rdi
  call   <endsWith@plt>
  test   %rax,%rax
  je     L11
L30:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <errAbort@plt>
L11:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D42
datatype: string
name: unpack_data
arguments: data_tag: D20
datatype: string
name: unpack_data
arguments: data_tag: D75
datatype: string
name: unpack_data
arguments: data_tag: D18
datatype: string
name: unpack_data
arguments: data_tag: D10
datatype: string
name: unpack_data
arguments: data_tag: D48
datatype: string
name: unpack_data
arguments: data_tag: D57
datatype: string
name: unpack_data
arguments: data_tag: D33
datatype: string

tool: D42: local:

tool: D20: Local urls must start at /

tool: D75: ..

tool: D18: ~

tool: D10: //

tool: D48: /./

tool: D57: /.

tool: D33: relative paths not allowed in local urls (%s)

assistant: ```c
char *assertLocalUrl(char *url) {
  if (startsWith("local:", url))
    url += 6;
  if (url[0] != '/')
    errAbort("Local urls must start at /");
  if (strstr(url, "..") || strstr(url, "~") || strstr(url, "//") || strstr(url, "/./") || endsWith("/.", url)) {
    errAbort("relative paths not allowed in local urls (%s)", url);
  }
  return url;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<assertLocalUrl>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  lea    D17(%rip),%rdi
  call   <startsWith@plt>
  mov    %rax,%rdx
  lea    0x6(%rbx),%rax
  test   %rdx,%rdx
  cmovne %rax,%rbx
  cmpb   $0x2f,(%rbx)
  jne    L42
L28:
  lea    D28(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L70
  lea    D43(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L0
L70:
  mov    %rbx,%rsi
  lea    D78(%rip),%rdi
  mov    $0x0,%eax
  call   <errAbort@plt>
L63:
  mov    %rbx,%rax
  pop    %rbx
  ret
L42:
  lea    D29(%rip),%rdi
  mov    $0x0,%eax
  call   <errAbort@plt>
  jmp    L28
L0:
  lea    D27(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L70
  lea    D56(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L70
  mov    %rbx,%rsi
  lea    D23(%rip),%rdi
  call   <endsWith@plt>
  test   %rax,%rax
  je     L63
  jmp    L70
```

tool_calls: name: parse_data
arguments: tag: D17
datatype: string
name: parse_data
arguments: tag: D28
datatype: string
name: parse_data
arguments: tag: D43
datatype: string
name: parse_data
arguments: tag: D78
datatype: string
name: parse_data
arguments: tag: D29
datatype: string
name: parse_data
arguments: tag: D27
datatype: string
name: parse_data
arguments: tag: D56
datatype: string
name: parse_data
arguments: tag: D23
datatype: string

tool: D17: local:

tool: D28: ..

tool: D43: ~

tool: D78: relative paths not allowed in local urls (%s)

tool: D29: Local urls must start at /

tool: D27: //

tool: D56: /./

tool: D23: /.

assistant: ```c
char *assertLocalUrl(char *url) {
  if (startsWith("local:", url))
    url += 6;
  if (url[0] != '/')
    errAbort("Local urls must start at /");
  if (strstr(url, "..") || strstr(url, "~") || strstr(url, "//") || strstr(url, "/./") || endsWith("/.", url)) {
    errAbort("relative paths not allowed in local urls (%s)", url);
  }
  return url;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<assertLocalUrl>:
  endbr64
  push   %r12
  mov    %rdi,%rsi
  mov    %rdi,%r12
  lea    D51(%rip),%rdi
  call   <startsWith@plt>
  mov    %rax,%r8
  lea    0x6(%r12),%rax
  test   %r8,%r8
  cmovne %rax,%r12
  cmpb   $0x2f,(%r12)
  je     L20
  lea    D63(%rip),%rdi
  xor    %eax,%eax
  call   <errAbort@plt>
L20:
  lea    D66(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L58
  lea    D50(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L13
L58:
  mov    %r12,%rsi
  lea    D28(%rip),%rdi
  xor    %eax,%eax
  call   <errAbort@plt>
L18:
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  lea    D53(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L58
  lea    D0(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L58
  mov    %r12,%rsi
  lea    D56(%rip),%rdi
  call   <endsWith@plt>
  test   %rax,%rax
  jne    L58
  jmp    L18
```

tool_calls: name: extract_symbolic_data
arguments: tag: D51
data_type: string
name: extract_symbolic_data
arguments: tag: D63
data_type: string
name: extract_symbolic_data
arguments: tag: D66
data_type: string
name: extract_symbolic_data
arguments: tag: D50
data_type: string
name: extract_symbolic_data
arguments: tag: D28
data_type: string
name: extract_symbolic_data
arguments: tag: D53
data_type: string
name: extract_symbolic_data
arguments: tag: D0
data_type: string
name: extract_symbolic_data
arguments: tag: D56
data_type: string

tool: D51: local:

tool: D63: Local urls must start at /

tool: D66: ..

tool: D50: ~

tool: D28: relative paths not allowed in local urls (%s)

tool: D53: //

tool: D0: /./

tool: D56: /.

assistant: ```c
char *assertLocalUrl(char *url) {
  if (startsWith("local:", url))
    url += 6;
  if (url[0] != '/')
    errAbort("Local urls must start at /");
  if (strstr(url, "..") || strstr(url, "~") || strstr(url, "//") || strstr(url, "/./") || endsWith("/.", url)) {
    errAbort("relative paths not allowed in local urls (%s)", url);
  }
  return url;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<assertLocalUrl>:
  endbr64
  push   %r12
  mov    %rdi,%rsi
  mov    %rdi,%r12
  lea    D72(%rip),%rdi
  call   <startsWith@plt>
  mov    %rax,%r8
  lea    0x6(%r12),%rax
  test   %r8,%r8
  cmovne %rax,%r12
  cmpb   $0x2f,(%r12)
  je     L9
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  call   <errAbort@plt>
L9:
  lea    D63(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L47
  lea    D22(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L1
L47:
  mov    %r12,%rsi
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <errAbort@plt>
L41:
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L1:
  lea    D48(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L47
  lea    D54(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L47
  mov    %r12,%rsi
  lea    D10(%rip),%rdi
  call   <endsWith@plt>
  test   %rax,%rax
  jne    L47
  jmp    L41
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D72
data_type: string
name: extract_symbolic_data
arguments: data_tag: D78
data_type: string
name: extract_symbolic_data
arguments: data_tag: D63
data_type: string
name: extract_symbolic_data
arguments: data_tag: D22
data_type: string
name: extract_symbolic_data
arguments: data_tag: D6
data_type: string
name: extract_symbolic_data
arguments: data_tag: D48
data_type: string
name: extract_symbolic_data
arguments: data_tag: D54
data_type: string
name: extract_symbolic_data
arguments: data_tag: D10
data_type: string

tool: D72: local:

tool: D78: Local urls must start at /

tool: D63: ..

tool: D22: ~

tool: D6: relative paths not allowed in local urls (%s)

tool: D48: //

tool: D54: /./

tool: D10: /.

assistant: ```c
char *assertLocalUrl(char *url) {
  if (startsWith("local:", url))
    url += 6;
  if (url[0] != '/')
    errAbort("Local urls must start at /");
  if (strstr(url, "..") || strstr(url, "~") || strstr(url, "//") || strstr(url, "/./") || endsWith("/.", url)) {
    errAbort("relative paths not allowed in local urls (%s)", url);
  }
  return url;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<fnnsetc_>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x140,%rsp
  mov    %rdi,-0x128(%rbp)
  mov    %rsi,-0x130(%rbp)
  mov    %rdx,-0x138(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x114(%rbp)
  jmp    L10
L8:
  mov    -0x114(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x130(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x114(%rbp),%eax
  cltq
  mov    %dl,-0x110(%rbp,%rax,1)
  addl   $0x1,-0x114(%rbp)
L10:
  mov    -0x138(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x114(%rbp)
  jl     L8
  mov    -0x138(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x114(%rbp)
  mov    -0x114(%rbp),%eax
  cltq
  movb   $0x0,-0x110(%rbp,%rax,1)
  lea    -0x110(%rbp),%rdx
  mov    -0x128(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <c_nnsetc@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
void fnnsetc_(char *pnam, char *cval, int *clen) {
  char cdum[256];
  int i;
  for (i = 0; i < *clen; i++) {
    cdum[i] = cval[i];
  }
  i = *clen;
  cdum[i] = '\0';
  c_nnsetc(pnam, cdum);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<fnnsetc_>:
  endbr64
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  mov    (%rdx),%r8d
  test   %r8d,%r8d
  jle    L6
  mov    %r8d,%ecx
L20:
  movzbl (%rsi,%rax,1),%edx
  mov    %dl,(%rsp,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L20
L6:
  movslq %r8d,%r8
  movb   $0x0,(%rsp,%r8,1)
  mov    %rsp,%rsi
  call   <c_nnsetc@plt>
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x118,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void fnnsetc_(char *pnam, char *cval, int *clen) {
  char cdum[256];
  int i;
  for (i = 0; i < *clen; i++) {
    cdum[i] = cval[i];
  }
  i = *clen;
  cdum[i] = '\0';
  c_nnsetc(pnam, cdum);
}
```
user: Translate the below assembly code into C programming language:

```asm
<fnnsetc_>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  mov    (%rdx),%eax
  mov    %rsp,%r8
  movslq %eax,%rbx
  test   %eax,%eax
  jle    L7
  mov    %r8,%rdi
  mov    %rbx,%rdx
  call   <memcpy@plt>
  mov    %rax,%r8
L7:
  mov    %r8,%rsi
  mov    %rbp,%rdi
  movb   $0x0,(%rsp,%rbx,1)
  call   <c_nnsetc@plt>
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void fnnsetc_(char *pnam, char *cval, int *clen) {
  char cdum[256];
  int i;
  for (i = 0; i < *clen; i++) {
    cdum[i] = cval[i];
  }
  i = *clen;
  cdum[i] = '\0';
  c_nnsetc(pnam, cdum);
}
```
user: What is the c source code of the assembly code below:

```asm
<fnnsetc_>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  mov    (%rdx),%eax
  mov    %rsp,%r8
  movslq %eax,%rbx
  test   %eax,%eax
  jle    L19
  mov    %r8,%rdi
  mov    %rbx,%rdx
  call   <memcpy@plt>
  mov    %rax,%r8
L19:
  mov    %r8,%rsi
  mov    %rbp,%rdi
  movb   $0x0,(%rsp,%rbx,1)
  call   <c_nnsetc@plt>
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void fnnsetc_(char *pnam, char *cval, int *clen) {
  char cdum[256];
  int i;
  for (i = 0; i < *clen; i++) {
    cdum[i] = cval[i];
  }
  i = *clen;
  cdum[i] = '\0';
  c_nnsetc(pnam, cdum);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<atoi_safe>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0xc(%rbp)
  movb   $0x0,-0x17(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L112
  movb   $0x1,-0x17(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L112
  addq   $0x1,-0x28(%rbp)
  subl   $0x1,-0x14(%rbp)
L112:
  movw   $0x0,-0x16(%rbp)
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L8
L120:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L49
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L74
L49:
  mov    $0x0,%eax
  jmp    L29
L74:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
  movswl -0x16(%rbp),%eax
  mov    -0x8(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  sub    -0x4(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jge    L94
  mov    -0x4(%rbp),%eax
  add    %eax,-0xc(%rbp)
  jmp    L17
L94:
  cmpb   $0x0,-0x17(%rbp)
  je     L9
  mov    -0xc(%rbp),%eax
  neg    %eax
  jmp    L29
L9:
  mov    -0xc(%rbp),%eax
  jmp    L29
L17:
  movzwl -0x16(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x16(%rbp)
  subl   $0x1,-0x10(%rbp)
L8:
  cmpl   $0x0,-0x10(%rbp)
  jns    L120
  cmpb   $0x0,-0x17(%rbp)
  je     L110
  negl   -0xc(%rbp)
L110:
  mov    -0xc(%rbp),%eax
L29:
  leave
  ret
```

assistant: ```c
int atoi_safe(char *string) {
  int length = strlen(string);
  int i;
  int total = 0;
  char negative = 0;
  if (string[0] == '-') {
    negative = 1;
    if (string[1] != '\0') {
      string++;
      length--;
    }
  }
  short shift = 0;
  for (i = length - 1; i >= 0; i--) {
    if (string[i] < 48 || string[i] > 57) {
      return 0;
    }
    int temp = string[i] - 48;
    int teemp = temp << shift;
    if (INT_MAX - (teemp) > total) {
      total += teemp;
    } else {
      if (negative) {
        return -1 * total;
      } else {
        return total;
      }
    }
    shift += 1;
  }
  if (negative) {
    total *= -1;
  }
  return total;
}
```
user: Translate the below assembly code into C programming language:

```asm
<atoi_safe>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  mov    %eax,%edi
  cmpb   $0x2d,(%rbx)
  je     L116
  mov    $0x0,%r9d
  sub    $0x1,%edi
  js     L24
L27:
  mov    D4(%rip),%rax
  mov    (%rax),%r10d
  movslq %edi,%rdi
  mov    %rdi,%rdx
  mov    $0x0,%esi
L60:
  mov    %edi,%ecx
  sub    %edx,%ecx
  movzbl (%rbx,%rdx,1),%eax
  lea    -0x30(%rax),%r8d
  cmp    $0x9,%r8b
  ja     L55
  movsbl %al,%eax
  sub    $0x30,%eax
  shl    %cl,%eax
  mov    %r10d,%ecx
  sub    %eax,%ecx
  cmp    %esi,%ecx
  jle    L17
  add    %eax,%esi
  sub    $0x1,%rdx
  test   %edx,%edx
  jns    L60
  test   %r9b,%r9b
  je     L18
L33:
  neg    %esi
  jmp    L18
L116:
  cmpb   $0x0,0x1(%rbx)
  je     L54
  add    $0x1,%rbx
  sub    $0x1,%edi
L54:
  mov    $0x1,%r9d
  sub    $0x1,%edi
  mov    $0x0,%esi
  jns    L27
  jmp    L33
L17:
  mov    %esi,%eax
  neg    %eax
  test   %r9b,%r9b
  cmovne %eax,%esi
  jmp    L18
L55:
  mov    $0x0,%esi
L18:
  mov    %esi,%eax
  pop    %rbx
  ret
L24:
  mov    $0x0,%esi
  jmp    L18
```

assistant: ```c
int atoi_safe(char *string) {
  int length = strlen(string);
  int i;
  int total = 0;
  char negative = 0;
  if (string[0] == '-') {
    negative = 1;
    if (string[1] != '\0') {
      string++;
      length--;
    }
  }
  short shift = 0;
  for (i = length - 1; i >= 0; i--) {
    if (string[i] < 48 || string[i] > 57) {
      return 0;
    }
    int temp = string[i] - 48;
    int teemp = temp << shift;
    if (INT_MAX - (teemp) > total) {
      total += teemp;
    } else {
      if (negative) {
        return -1 * total;
      } else {
        return total;
      }
    }
    shift += 1;
  }
  if (negative) {
    total *= -1;
  }
  return total;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<atoi_safe>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  cmpb   $0x2d,(%rbx)
  mov    %eax,%edi
  je     L51
  xor    %r9d,%r9d
  sub    $0x1,%edi
  js     L58
L5:
  mov    D0(%rip),%rax
  movslq %edi,%rsi
  mov    (%rax),%r8d
  xor    %eax,%eax
  jmp    L21
  nopl   (%rax)
L47:
  movsbl %dl,%edx
  shl    %cl,%edx
  mov    %r8d,%ecx
  sub    %edx,%ecx
  cmp    %eax,%ecx
  jle    L56
  sub    $0x1,%rsi
  add    %edx,%eax
  test   %esi,%esi
  js     L56
L21:
  movzbl (%rbx,%rsi,1),%edx
  mov    %edi,%ecx
  sub    %esi,%ecx
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L47
L58:
  xor    %eax,%eax
L61:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L56:
  mov    %eax,%edx
  pop    %rbx
  neg    %edx
  test   %r9b,%r9b
  cmovne %edx,%eax
  ret
  nopl   0x0(%rax)
L51:
  cmpb   $0x0,0x1(%rbx)
  jne    L94
  sub    $0x1,%edi
  js     L58
  mov    $0x1,%r9d
  jmp    L5
  nopl   0x0(%rax,%rax,1)
L94:
  add    $0x1,%rbx
  mov    $0x1,%r9d
  sub    $0x2,%edi
  jns    L5
  xor    %eax,%eax
  jmp    L61
```

assistant: ```c
int atoi_safe(char *string) {
  int length = strlen(string);
  int i;
  int total = 0;
  char negative = 0;
  if (string[0] == '-') {
    negative = 1;
    if (string[1] != '\0') {
      string++;
      length--;
    }
  }
  short shift = 0;
  for (i = length - 1; i >= 0; i--) {
    if (string[i] < 48 || string[i] > 57) {
      return 0;
    }
    int temp = string[i] - 48;
    int teemp = temp << shift;
    if (INT_MAX - (teemp) > total) {
      total += teemp;
    } else {
      if (negative) {
        return -1 * total;
      } else {
        return total;
      }
    }
    shift += 1;
  }
  if (negative) {
    total *= -1;
  }
  return total;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<atoi_safe>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  cmpb   $0x2d,(%rbx)
  mov    %eax,%edi
  je     L97
  xor    %r9d,%r9d
  sub    $0x1,%edi
  js     L96
L22:
  mov    D4(%rip),%rax
  movslq %edi,%rsi
  mov    (%rax),%r8d
  xor    %eax,%eax
  jmp    L90
  nopl   (%rax)
L108:
  movsbl %dl,%edx
  shl    %cl,%edx
  mov    %r8d,%ecx
  sub    %edx,%ecx
  cmp    %eax,%ecx
  jle    L12
  sub    $0x1,%rsi
  add    %edx,%eax
  test   %esi,%esi
  js     L12
L90:
  movzbl (%rbx,%rsi,1),%edx
  mov    %edi,%ecx
  sub    %esi,%ecx
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L108
L96:
  xor    %eax,%eax
L102:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L12:
  mov    %eax,%edx
  pop    %rbx
  neg    %edx
  test   %r9b,%r9b
  cmovne %edx,%eax
  ret
  nopl   0x0(%rax)
L97:
  cmpb   $0x0,0x1(%rbx)
  jne    L2
  sub    $0x1,%edi
  js     L96
  mov    $0x1,%r9d
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L2:
  add    $0x1,%rbx
  mov    $0x1,%r9d
  sub    $0x2,%edi
  jns    L22
  xor    %eax,%eax
  jmp    L102
```

assistant: ```c
int atoi_safe(char *string) {
  int length = strlen(string);
  int i;
  int total = 0;
  char negative = 0;
  if (string[0] == '-') {
    negative = 1;
    if (string[1] != '\0') {
      string++;
      length--;
    }
  }
  short shift = 0;
  for (i = length - 1; i >= 0; i--) {
    if (string[i] < 48 || string[i] > 57) {
      return 0;
    }
    int temp = string[i] - 48;
    int teemp = temp << shift;
    if (INT_MAX - (teemp) > total) {
      total += teemp;
    } else {
      if (negative) {
        return -1 * total;
      } else {
        return total;
      }
    }
    shift += 1;
  }
  if (negative) {
    total *= -1;
  }
  return total;
}
```