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

```asm
<checkWin>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  push   %r14
  mov    %edx,%r14d
  mov    %esi,%edx
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  movsbl (%rcx),%r8d
  mov    %r14d,%ecx
  mov    %esi,0xc(%rsp)
  lea    0x20(%rsp),%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %esi,0x18(%rsp)
  mov    %rbp,%rsi
  mov    %r14d,0x1c(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  call   <checkChip@plt>
  mov    0x20(%rsp),%ecx
  test   %ecx,%ecx
  je     L65
  movslq 0x18(%rsp),%rax
  movslq 0x1c(%rsp),%rdx
  lea    0x1c(%rsp),%r15
  movzbl 0x0(%r13),%ecx
L63:
  lea    (%rax,%rax,8),%rax
  mov    $0x4,%ebx
  add    %r12,%rax
  cmp    %cl,(%rax,%rdx,1)
  jne    L58
L14:
  mov    0x0(%rbp),%edx
  lea    0x18(%rsp),%rdi
  mov    %r15,%rsi
  call   <moveCoord@plt>
  sub    $0x1,%ebx
  je     L38
  movslq 0x18(%rsp),%rax
  movslq 0x1c(%rsp),%rdx
  movzbl 0x0(%r13),%ecx
  lea    (%rax,%rax,8),%rax
  add    %r12,%rax
  cmp    %cl,(%rax,%rdx,1)
  je     L14
L58:
  movslq 0xc(%rsp),%rax
  mov    0x4(%rbp),%edx
  add    $0x4,%rbp
  mov    %r14d,0x1c(%rsp)
  mov    %eax,0x18(%rsp)
  test   %edx,%edx
  je     L65
  movslq %r14d,%rdx
  jmp    L63
  nopl   0x0(%rax,%rax,1)
L38:
  xor    %eax,%eax
L57:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L65:
  mov    %r13,%rdi
  call   <switchChip@plt>
  mov    $0x1,%eax
  jmp    L57
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int checkWin(char grid[9][9], int userX, int lastY, char *chip) {
  int chipNum = 0, x = userX, y = lastY;
  int directions[8] = {0};
  checkChip(grid, directions, userX, lastY, *chip);
  for (int i = 0; directions[i]; i++) {
    while (grid[x][y] == *chip) {
      moveCoord(&x, &y, directions[i]);
      chipNum++;
      if (chipNum >= 4) {
        return 0;
      }
    }
    x = userX;
    y = lastY;
    chipNum = 0;
  }
  switchChip(chip);
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<checkWin>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  push   %r14
  mov    %edx,%r14d
  mov    %esi,%edx
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  movsbl (%rcx),%r8d
  mov    %r14d,%ecx
  mov    %esi,0xc(%rsp)
  lea    0x20(%rsp),%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %esi,0x18(%rsp)
  mov    %rbp,%rsi
  mov    %r14d,0x1c(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  call   <checkChip@plt>
  mov    0x20(%rsp),%ecx
  test   %ecx,%ecx
  je     L48
  movslq 0x18(%rsp),%rax
  movslq 0x1c(%rsp),%rdx
  lea    0x1c(%rsp),%r15
  movzbl 0x0(%r13),%ecx
L67:
  lea    (%rax,%rax,8),%rax
  mov    $0x4,%ebx
  add    %r12,%rax
  cmp    %cl,(%rax,%rdx,1)
  jne    L24
L13:
  mov    0x0(%rbp),%edx
  lea    0x18(%rsp),%rdi
  mov    %r15,%rsi
  call   <moveCoord@plt>
  sub    $0x1,%ebx
  je     L65
  movslq 0x18(%rsp),%rax
  movslq 0x1c(%rsp),%rdx
  movzbl 0x0(%r13),%ecx
  lea    (%rax,%rax,8),%rax
  add    %r12,%rax
  cmp    %cl,(%rax,%rdx,1)
  je     L13
L24:
  movslq 0xc(%rsp),%rax
  mov    0x4(%rbp),%edx
  add    $0x4,%rbp
  mov    %r14d,0x1c(%rsp)
  mov    %eax,0x18(%rsp)
  test   %edx,%edx
  je     L48
  movslq %r14d,%rdx
  jmp    L67
  nopl   0x0(%rax,%rax,1)
L65:
  xor    %eax,%eax
L27:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L19
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L48:
  mov    %r13,%rdi
  call   <switchChip@plt>
  mov    $0x1,%eax
  jmp    L27
L19:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int checkWin(char grid[9][9], int userX, int lastY, char *chip) {
  int chipNum = 0, x = userX, y = lastY;
  int directions[8] = {0};
  checkChip(grid, directions, userX, lastY, *chip);
  for (int i = 0; directions[i]; i++) {
    while (grid[x][y] == *chip) {
      moveCoord(&x, &y, directions[i]);
      chipNum++;
      if (chipNum >= 4) {
        return 0;
      }
    }
    x = userX;
    y = lastY;
    chipNum = 0;
  }
  switchChip(chip);
  return 1;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<basename>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L12
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  jmp    L19
L12:
  mov    -0x18(%rbp),%rax
L19:
  leave
  ret
```

assistant: ```c
const char *basename(const char *path) {
  const char *ptr = strrchr(path, '/');
  return ptr ? ptr + 1 : path;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<basename>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x2f,%esi
  call   <strrchr@plt>
  lea    0x1(%rax),%rdx
  test   %rax,%rax
  mov    %rbx,%rax
  cmovne %rdx,%rax
  pop    %rbx
  ret
```

assistant: ```c
const char *basename(const char *path) {
  const char *ptr = strrchr(path, '/');
  return ptr ? ptr + 1 : path;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<basename>:
  endbr64
  push   %rbx
  mov    $0x2f,%esi
  mov    %rdi,%rbx
  call   <strrchr@plt>
  lea    0x1(%rax),%rdx
  test   %rax,%rax
  mov    %rbx,%rax
  pop    %rbx
  cmovne %rdx,%rax
  ret
```

assistant: ```c
const char *basename(const char *path) {
  const char *ptr = strrchr(path, '/');
  return ptr ? ptr + 1 : path;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<basename>:
  endbr64
  push   %rbx
  mov    $0x2f,%esi
  mov    %rdi,%rbx
  call   <strrchr@plt>
  lea    0x1(%rax),%rdx
  test   %rax,%rax
  mov    %rbx,%rax
  pop    %rbx
  cmovne %rdx,%rax
  ret
```

assistant: ```c
const char *basename(const char *path) {
  const char *ptr = strrchr(path, '/');
  return ptr ? ptr + 1 : path;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<string_cat_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  pop    %rbp
  ret
```

assistant: ```c
void string_cat_int(struct string_t *string, int val) {
  if (!string)
    return;
}
```
user: Translate the below assembly code into C programming language:

```asm
<string_cat_int>:
  endbr64
  ret
```

assistant: ```c
void string_cat_int(struct string_t *string, int val) {
  if (!string)
    return;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<string_cat_int>:
  endbr64
  ret
```

assistant: ```c
void string_cat_int(struct string_t *string, int val) {
  if (!string)
    return;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<string_cat_int>:
  endbr64
  ret
```

assistant: ```c
void string_cat_int(struct string_t *string, int val) {
  if (!string)
    return;
}
```
user: What is the c source code of the assembly code below:

```asm
<times_table>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x0,-0xc(%rbp)
  jmp    L18
L48:
  movl   $0x0,-0x8(%rbp)
  jmp    L59
L13:
  mov    -0xc(%rbp),%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  je     L3
  mov    $0x2c,%edi
  call   <_putchar@plt>
  mov    $0x20,%edi
  call   <_putchar@plt>
L3:
  cmpl   $0x9,-0x4(%rbp)
  jle    L77
  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
  add    $0x30,%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <_putchar@plt>
  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
  add    $0x30,%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <_putchar@plt>
  jmp    L51
L77:
  cmpl   $0x9,-0x4(%rbp)
  jg     L15
  cmpl   $0x0,-0x8(%rbp)
  je     L15
  mov    $0x20,%edi
  call   <_putchar@plt>
  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
  sub    %eax,%edx
  mov    %edx,%ecx
  mov    %ecx,%eax
  add    $0x30,%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <_putchar@plt>
  jmp    L51
L15:
  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
  add    $0x30,%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <_putchar@plt>
L51:
  addl   $0x1,-0x8(%rbp)
L59:
  cmpl   $0x9,-0x8(%rbp)
  jle    L13
  mov    $0xa,%edi
  call   <_putchar@plt>
  addl   $0x1,-0xc(%rbp)
L18:
  cmpl   $0x9,-0xc(%rbp)
  jle    L48
  nop
  nop
  leave
  ret
```

assistant: ```c
void times_table(void) {
  int i, j, res;
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      res = (i * j);
      if (j != 0) {
        _putchar(',');
        _putchar(' ');
      }
      if (res >= 10) {
        _putchar((res / 10) + '0');
        _putchar((res % 10) + '0');
      } else if (res < 10 && j != 0) {
        _putchar(' ');
        _putchar((res % 10) + '0');
      } else
        _putchar((res % 10) + '0');
    }
    _putchar('\n');
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<times_table>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x0,%r14d
  jmp    L79
L65:
  mov    $0x2c,%edi
  call   <_putchar@plt>
  mov    $0x20,%edi
  call   <_putchar@plt>
  cmp    $0x9,%ebx
  jg     L45
  mov    $0x20,%edi
  call   <_putchar@plt>
  movslq %ebx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  mov    %ebx,%edi
  sub    %eax,%edi
  add    $0x30,%edi
  movsbl %dil,%edi
  call   <_putchar@plt>
L71:
  cmp    $0x9,%ebp
  jg     L7
L39:
  add    $0x1,%ebp
  add    %r13d,%ebx
L16:
  cmp    $0x1,%ebp
  jne    L65
  mov    $0x30,%edi
  call   <_putchar@plt>
  jmp    L39
L45:
  movslq %ebx,%r12
  imul   $0x66666667,%r12,%r12
  sar    $0x22,%r12
  mov    %ebx,%eax
  sar    $0x1f,%eax
  sub    %eax,%r12d
  lea    0x30(%r12),%edi
  movsbl %dil,%edi
  call   <_putchar@plt>
  lea    (%r12,%r12,4),%eax
  add    %eax,%eax
  mov    %ebx,%edi
  sub    %eax,%edi
  add    $0x30,%edi
  movsbl %dil,%edi
  call   <_putchar@plt>
  jmp    L71
L7:
  mov    $0xa,%edi
  call   <_putchar@plt>
  add    $0x1,%r14d
  cmp    $0xa,%r14d
  je     L54
L79:
  mov    %r14d,%r13d
  mov    $0x0,%ebx
  mov    $0x1,%ebp
  jmp    L16
L54:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
void times_table(void) {
  int i, j, res;
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      res = (i * j);
      if (j != 0) {
        _putchar(',');
        _putchar(' ');
      }
      if (res >= 10) {
        _putchar((res / 10) + '0');
        _putchar((res % 10) + '0');
      } else if (res < 10 && j != 0) {
        _putchar(' ');
        _putchar((res % 10) + '0');
      } else
        _putchar((res % 10) + '0');
    }
    _putchar('\n');
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<times_table>:
  endbr64
  push   %r14
  mov    $0xcccccccd,%r14d
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  nopl   (%rax)
L30:
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  jmp    L54
  xchg   %ax,%ax
L40:
  mov    $0x30,%edi
  call   <_putchar@plt>
L43:
  add    %r13d,%ebp
L54:
  add    $0x1,%ebx
  cmp    $0x1,%ebx
  je     L40
  mov    $0x2c,%edi
  call   <_putchar@plt>
  mov    $0x20,%edi
  call   <_putchar@plt>
  cmp    $0x9,%ebp
  jle    L37
  mov    %ebp,%r12d
  imul   %r14,%r12
  shr    $0x23,%r12
  lea    0x30(%r12),%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
  lea    (%r12,%r12,4),%eax
  mov    %ebp,%edi
  add    %eax,%eax
  sub    %eax,%edi
  add    $0x30,%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
L46:
  cmp    $0xa,%ebx
  jne    L43
  mov    $0xa,%edi
  add    $0x1,%r13d
  call   <_putchar@plt>
  cmp    $0xa,%r13d
  jne    L30
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L37:
  mov    $0x20,%edi
  call   <_putchar@plt>
  lea    0x30(%rbp),%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
  jmp    L46
```

assistant: ```c
void times_table(void) {
  int i, j, res;
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      res = (i * j);
      if (j != 0) {
        _putchar(',');
        _putchar(' ');
      }
      if (res >= 10) {
        _putchar((res / 10) + '0');
        _putchar((res % 10) + '0');
      } else if (res < 10 && j != 0) {
        _putchar(' ');
        _putchar((res % 10) + '0');
      } else
        _putchar((res % 10) + '0');
    }
    _putchar('\n');
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<times_table>:
  endbr64
  push   %r14
  mov    $0xcccccccd,%r14d
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  nopl   (%rax)
L33:
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  jmp    L46
  xchg   %ax,%ax
L43:
  mov    $0x30,%edi
  call   <_putchar@plt>
L34:
  add    %r13d,%ebp
L46:
  add    $0x1,%ebx
  cmp    $0x1,%ebx
  je     L43
  mov    $0x2c,%edi
  call   <_putchar@plt>
  mov    $0x20,%edi
  call   <_putchar@plt>
  cmp    $0x9,%ebp
  jle    L38
  mov    %ebp,%r12d
  imul   %r14,%r12
  shr    $0x23,%r12
  lea    0x30(%r12),%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
  lea    (%r12,%r12,4),%eax
  mov    %ebp,%edi
  add    %eax,%eax
  sub    %eax,%edi
  add    $0x30,%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
L19:
  cmp    $0xa,%ebx
  jne    L34
  mov    $0xa,%edi
  add    $0x1,%r13d
  call   <_putchar@plt>
  cmp    $0xa,%r13d
  jne    L33
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L38:
  mov    $0x20,%edi
  call   <_putchar@plt>
  lea    0x30(%rbp),%edi
  movzbl %dil,%edi
  call   <_putchar@plt>
  jmp    L19
```

assistant: ```c
void times_table(void) {
  int i, j, res;
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 9; j++) {
      res = (i * j);
      if (j != 0) {
        _putchar(',');
        _putchar(' ');
      }
      if (res >= 10) {
        _putchar((res / 10) + '0');
        _putchar((res % 10) + '0');
      } else if (res < 10 && j != 0) {
        _putchar(' ');
        _putchar((res % 10) + '0');
      } else
        _putchar((res % 10) + '0');
    }
    _putchar('\n');
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<parse_boolean>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L34
  mov    $0x1,%eax
  jmp    L73
L34:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strupr@plt>
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cmp    $0x29,%eax
  seta   %dl
  test   %dl,%dl
  jne    L24
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  mov    %rax,%rdx
  and    $0x40500001,%edx
  test   %rdx,%rdx
  setne  %dl
  test   %dl,%dl
  jne    L41
  movabs $0x21000200002,%rdx
  and    %rax,%rdx
  test   %rdx,%rdx
  setne  %dl
  test   %dl,%dl
  jne    L54
  and    $0x80000000,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  je     L24
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x4e,%al
  jne    L59
  mov    $0x1,%eax
  jmp    L73
L59:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jne    L105
  mov    $0xffffffff,%eax
  jmp    L73
L105:
  mov    $0x0,%eax
  jmp    L73
L54:
  mov    $0x1,%eax
  jmp    L73
L41:
  mov    $0xffffffff,%eax
  jmp    L73
L24:
  mov    $0x0,%eax
L73:
  leave
  ret
```

assistant: ```c
int parse_boolean(char *token) {
  if (token == NULL)
    return +1;
  strupr(token);
  switch (token[0]) {
  case 'O':
    if (token[1] == 'N')
      return +1;
    else if (token[1] == 'F')
      return -1;
    else
      return 0;
  case 'T':
  case 'Y':
  case 'E':
  case '1':
    return +1;
  case 'F':
  case 'N':
  case 'D':
  case '0':
    return -1;
  default:
    return 0;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<parse_boolean>:
  endbr64
  mov    $0x1,%eax
  test   %rdi,%rdi
  je     L27
  push   %rbx
  mov    %rdi,%rbx
  call   <strupr@plt>
  movzbl (%rbx),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x29,%cl
  ja     L30
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x21000200002,%rdx
  test   %rdx,%rax
  jne    L82
  test   $0x40500001,%eax
  jne    L61
  mov    $0x0,%eax
  cmp    $0x1f,%cl
  je     L22
L64:
  pop    %rbx
  ret
L22:
  movzbl 0x1(%rbx),%edx
  mov    $0x1,%eax
  cmp    $0x4e,%dl
  je     L64
  cmp    $0x46,%dl
  sete   %al
  movzbl %al,%eax
  neg    %eax
  jmp    L64
L30:
  mov    $0x0,%eax
  jmp    L64
L82:
  mov    $0x1,%eax
  jmp    L64
L61:
  mov    $0xffffffff,%eax
  jmp    L64
L27:
  ret
```

assistant: ```c
int parse_boolean(char *token) {
  if (token == NULL)
    return +1;
  strupr(token);
  switch (token[0]) {
  case 'O':
    if (token[1] == 'N')
      return +1;
    else if (token[1] == 'F')
      return -1;
    else
      return 0;
  case 'T':
  case 'Y':
  case 'E':
  case '1':
    return +1;
  case 'F':
  case 'N':
  case 'D':
  case '0':
    return -1;
  default:
    return 0;
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<parse_boolean>:
  endbr64
  test   %rdi,%rdi
  je     L57
  push   %rbx
  mov    %rdi,%rbx
  call   <strupr@plt>
  movzbl (%rbx),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x29,%cl
  ja     L30
  movabs $0x21000200002,%rdx
  mov    $0x1,%eax
  shl    %cl,%rax
  test   %rdx,%rax
  jne    L23
  test   $0x40500001,%eax
  jne    L45
  xor    %eax,%eax
  cmp    $0x1f,%cl
  je     L1
  pop    %rbx
  ret
  nopl   0x0(%rax)
L23:
  mov    $0x1,%eax
  pop    %rbx
  ret
  nop
L1:
  movzbl 0x1(%rbx),%eax
  cmp    $0x4e,%al
  je     L23
  cmp    $0x46,%al
  pop    %rbx
  sete   %al
  movzbl %al,%eax
  neg    %eax
  ret
  nopl   0x0(%rax)
L30:
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L57:
  mov    $0x1,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L45:
  mov    $0xffffffff,%eax
  pop    %rbx
  ret
```

assistant: ```c
int parse_boolean(char *token) {
  if (token == NULL)
    return +1;
  strupr(token);
  switch (token[0]) {
  case 'O':
    if (token[1] == 'N')
      return +1;
    else if (token[1] == 'F')
      return -1;
    else
      return 0;
  case 'T':
  case 'Y':
  case 'E':
  case '1':
    return +1;
  case 'F':
  case 'N':
  case 'D':
  case '0':
    return -1;
  default:
    return 0;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<parse_boolean>:
  endbr64
  test   %rdi,%rdi
  je     L47
  push   %rbx
  mov    %rdi,%rbx
  call   <strupr@plt>
  movzbl (%rbx),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x29,%cl
  ja     L13
  movabs $0x21000200002,%rdx
  mov    $0x1,%eax
  shl    %cl,%rax
  test   %rdx,%rax
  jne    L27
  test   $0x40500001,%eax
  jne    L59
  xor    %eax,%eax
  cmp    $0x1f,%cl
  je     L24
  pop    %rbx
  ret
  nopl   0x0(%rax)
L27:
  mov    $0x1,%eax
  pop    %rbx
  ret
  nop
L24:
  movzbl 0x1(%rbx),%eax
  cmp    $0x4e,%al
  je     L27
  cmp    $0x46,%al
  pop    %rbx
  sete   %al
  movzbl %al,%eax
  neg    %eax
  ret
  nopl   0x0(%rax)
L13:
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L47:
  mov    $0x1,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L59:
  mov    $0xffffffff,%eax
  pop    %rbx
  ret
```

assistant: ```c
int parse_boolean(char *token) {
  if (token == NULL)
    return +1;
  strupr(token);
  switch (token[0]) {
  case 'O':
    if (token[1] == 'N')
      return +1;
    else if (token[1] == 'F')
      return -1;
    else
      return 0;
  case 'T':
  case 'Y':
  case 'E':
  case '1':
    return +1;
  case 'F':
  case 'N':
  case 'D':
  case '0':
    return -1;
  default:
    return 0;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<co_net_probe>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8d,-0x2c(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L19
L16:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L22
  mov    -0x4(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <co_net__request_heartbeat@plt>
L22:
  addl   $0x1,-0x4(%rbp)
L19:
  mov    -0x4(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jle    L16
  mov    -0x2c(%rbp),%edi
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <co_net__wait_for_bootup@plt>
  leave
  ret
```

assistant: ```c
int co_net_probe(const struct sock *sock, char *nodes_seen, int start, int end, int timeout) {
  for (int i = start; i <= end; ++i)
    if (!nodes_seen[i])
      co_net__request_heartbeat(sock, i);
  return co_net__wait_for_bootup(sock, nodes_seen, start, end, timeout);
}
```
user: Translate the below assembly code into C programming language:

```asm
<co_net_probe>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %edx,%r14d
  mov    %ecx,%ebp
  mov    %r8d,%r15d
  cmp    %ecx,%edx
  jg     L4
  movslq %edx,%rbx
  jmp    L31
L41:
  add    $0x1,%rbx
  cmp    %ebx,%ebp
  jl     L4
L31:
  mov    %ebx,%esi
  cmpb   $0x0,(%r12,%rbx,1)
  jne    L41
  mov    %r13,%rdi
  call   <co_net__request_heartbeat@plt>
  jmp    L41
L4:
  mov    %r15d,%r8d
  mov    %ebp,%ecx
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <co_net__wait_for_bootup@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int co_net_probe(const struct sock *sock, char *nodes_seen, int start, int end, int timeout) {
  for (int i = start; i <= end; ++i)
    if (!nodes_seen[i])
      co_net__request_heartbeat(sock, i);
  return co_net__wait_for_bootup(sock, nodes_seen, start, end, timeout);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<co_net_probe>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    %ecx,%edx
  jg     L17
  movslq %edx,%rbx
  jmp    L15
  nopw   0x0(%rax,%rax,1)
L31:
  add    $0x1,%rbx
  cmp    %ebx,%r12d
  jl     L17
L15:
  cmpb   $0x0,0x0(%rbp,%rbx,1)
  mov    %ebx,%esi
  jne    L31
  mov    %r15,%rdi
  add    $0x1,%rbx
  call   <co_net__request_heartbeat@plt>
  cmp    %ebx,%r12d
  jge    L15
L17:
  add    $0x8,%rsp
  mov    %r14d,%r8d
  mov    %r12d,%ecx
  mov    %r13d,%edx
  pop    %rbx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <co_net__wait_for_bootup@plt>
```

assistant: ```c
int co_net_probe(const struct sock *sock, char *nodes_seen, int start, int end, int timeout) {
  for (int i = start; i <= end; ++i)
    if (!nodes_seen[i])
      co_net__request_heartbeat(sock, i);
  return co_net__wait_for_bootup(sock, nodes_seen, start, end, timeout);
}
```