ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的？

```asm
<drawRoundRect>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,%ebx
  mov    %ecx,%r13d
  mov    %r8d,%r12d
  movswl %r9w,%ebp
  lea    (%r8,%r8,1),%eax
  mov    %edx,0x8(%rsp)
  mov    %edx,%r15d
  mov    %ax,0x2(%rsp)
  sub    %eax,%r15d
  movswl %r15w,%r15d
  mov    %edi,0x4(%rsp)
  mov    %edi,%ecx
  lea    (%r8,%rcx,1),%r14d
  movswl %r14w,%r14d
  movswl %si,%esi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r14d,%edi
  call   <writeFastHLine@plt>
  mov    %r13d,0xc(%rsp)
  mov    %r13d,%ecx
  lea    -0x1(%rcx,%rbx,1),%r13d
  movswl %r13w,%esi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r14d,%edi
  call   <writeFastHLine@plt>
  movzwl 0xc(%rsp),%eax
  sub    0x2(%rsp),%ax
  movswl %ax,%r15d
  add    %r12d,%ebx
  movswl %bx,%ebx
  movswl 0x4(%rsp),%edi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %ebx,%esi
  call   <writeFastVLine@plt>
  movzwl 0x8(%rsp),%eax
  add    0x4(%rsp),%ax
  mov    %ax,0x2(%rsp)
  lea    -0x1(%rax),%edi
  movswl %di,%edi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %ebx,%esi
  call   <writeFastVLine@plt>
  movswl %r12w,%r15d
  mov    %ebp,%r8d
  mov    $0x1,%ecx
  mov    %r15d,%edx
  mov    %ebx,%esi
  mov    %r14d,%edi
  call   <drawCircleHelper@plt>
  movzwl 0x2(%rsp),%eax
  sub    %r12d,%eax
  sub    $0x1,%eax
  cwtl
  mov    %ebp,%r8d
  mov    $0x2,%ecx
  mov    %r15d,%edx
  mov    %ebx,%esi
  mov    %eax,%ebx
  mov    %eax,%edi
  call   <drawCircleHelper@plt>
  sub    %r12d,%r13d
  movswl %r13w,%r13d
  mov    %ebp,%r8d
  mov    $0x4,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  mov    %ebx,%edi
  call   <drawCircleHelper@plt>
  mov    %ebp,%r8d
  mov    $0x8,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  mov    %r14d,%edi
  call   <drawCircleHelper@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void drawRoundRect(short x, short y, short w, short h, short r, short color) {
  writeFastHLine(x + r, y, w - 2 * r, color);
  writeFastHLine(x + r, y + h - 1, w - 2 * r, color);
  writeFastVLine(x, y + r, h - 2 * r, color);
  writeFastVLine(x + w - 1, y + r, h - 2 * r, color);
  drawCircleHelper(x + r, y + r, r, 1, color);
  drawCircleHelper(x + w - r - 1, y + r, r, 2, color);
  drawCircleHelper(x + w - r - 1, y + h - r - 1, r, 4, color);
  drawCircleHelper(x + r, y + h - r - 1, r, 8, color);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<drawRoundRect>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %r8d,%r13d
  lea    (%r8,%r8,1),%r8d
  push   %r12
  lea    0x0(%r13,%rdi,1),%r10d
  mov    %esi,%r12d
  movswl %si,%esi
  push   %rbp
  movswl %r10w,%r10d
  movswl %r9w,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    %r8d,%edx
  mov    %r10d,%edi
  movswl %dx,%edx
  mov    %ebp,%ecx
  add    %r14d,%ebx
  sub    $0x18,%rsp
  mov    %r10d,(%rsp)
  mov    %r8d,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  call   <writeFastHLine@plt>
  lea    -0x1(%r15,%r12,1),%r9d
  mov    0x8(%rsp),%edx
  mov    %ebp,%ecx
  mov    (%rsp),%edi
  movswl %r9w,%esi
  mov    %r9d,0x4(%rsp)
  add    %r13d,%r12d
  movswl %r12w,%r12d
  call   <writeFastHLine@plt>
  mov    0xc(%rsp),%r8d
  movswl %r14w,%edi
  mov    %ebp,%ecx
  mov    %r12d,%esi
  sub    %r8d,%r15d
  movswl %r15w,%r15d
  mov    %r15d,%edx
  call   <writeFastVLine@plt>
  lea    -0x1(%rbx),%edi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r12d,%esi
  sub    %r13d,%ebx
  movswl %di,%edi
  movswl %r13w,%r15d
  call   <writeFastVLine@plt>
  lea    -0x1(%rbx),%r14d
  mov    (%rsp),%edi
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r12d,%esi
  movswl %r14w,%r14d
  mov    $0x1,%ecx
  call   <drawCircleHelper@plt>
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  mov    $0x2,%ecx
  call   <drawCircleHelper@plt>
  mov    0x4(%rsp),%r9d
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r14d,%edi
  mov    $0x4,%ecx
  sub    %r13d,%r9d
  movswl %r9w,%r12d
  mov    %r12d,%esi
  call   <drawCircleHelper@plt>
  mov    (%rsp),%edi
  add    $0x18,%rsp
  mov    %ebp,%r8d
  pop    %rbx
  mov    %r15d,%edx
  pop    %rbp
  mov    %r12d,%esi
  mov    $0x8,%ecx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <drawCircleHelper@plt>
```

assistant: ```c
void drawRoundRect(short x, short y, short w, short h, short r, short color) {
  writeFastHLine(x + r, y, w - 2 * r, color);
  writeFastHLine(x + r, y + h - 1, w - 2 * r, color);
  writeFastVLine(x, y + r, h - 2 * r, color);
  writeFastVLine(x + w - 1, y + r, h - 2 * r, color);
  drawCircleHelper(x + r, y + r, r, 1, color);
  drawCircleHelper(x + w - r - 1, y + r, r, 2, color);
  drawCircleHelper(x + w - r - 1, y + h - r - 1, r, 4, color);
  drawCircleHelper(x + r, y + h - r - 1, r, 8, color);
}
```
user: What is the c source code of the assembly code below:

```asm
<drawRoundRect>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %r8d,%r13d
  lea    (%r8,%r8,1),%r8d
  push   %r12
  lea    0x0(%r13,%rdi,1),%r10d
  mov    %esi,%r12d
  movswl %si,%esi
  push   %rbp
  movswl %r10w,%r10d
  movswl %r9w,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    %r8d,%edx
  mov    %r10d,%edi
  movswl %dx,%edx
  mov    %ebp,%ecx
  add    %r14d,%ebx
  sub    $0x18,%rsp
  mov    %r10d,(%rsp)
  mov    %r8d,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  call   <writeFastHLine@plt>
  lea    -0x1(%r15,%r12,1),%r9d
  mov    0x8(%rsp),%edx
  mov    %ebp,%ecx
  mov    (%rsp),%edi
  movswl %r9w,%esi
  mov    %r9d,0x4(%rsp)
  add    %r13d,%r12d
  movswl %r12w,%r12d
  call   <writeFastHLine@plt>
  mov    0xc(%rsp),%r8d
  movswl %r14w,%edi
  mov    %ebp,%ecx
  mov    %r12d,%esi
  sub    %r8d,%r15d
  movswl %r15w,%r15d
  mov    %r15d,%edx
  call   <writeFastVLine@plt>
  lea    -0x1(%rbx),%edi
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r12d,%esi
  sub    %r13d,%ebx
  movswl %di,%edi
  movswl %r13w,%r15d
  call   <writeFastVLine@plt>
  lea    -0x1(%rbx),%r14d
  mov    (%rsp),%edi
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r12d,%esi
  movswl %r14w,%r14d
  mov    $0x1,%ecx
  call   <drawCircleHelper@plt>
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  mov    $0x2,%ecx
  call   <drawCircleHelper@plt>
  mov    0x4(%rsp),%r9d
  mov    %ebp,%r8d
  mov    %r15d,%edx
  mov    %r14d,%edi
  mov    $0x4,%ecx
  sub    %r13d,%r9d
  movswl %r9w,%r12d
  mov    %r12d,%esi
  call   <drawCircleHelper@plt>
  mov    (%rsp),%edi
  add    $0x18,%rsp
  mov    %ebp,%r8d
  pop    %rbx
  mov    %r15d,%edx
  pop    %rbp
  mov    %r12d,%esi
  mov    $0x8,%ecx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <drawCircleHelper@plt>
```

assistant: ```c
void drawRoundRect(short x, short y, short w, short h, short r, short color) {
  writeFastHLine(x + r, y, w - 2 * r, color);
  writeFastHLine(x + r, y + h - 1, w - 2 * r, color);
  writeFastVLine(x, y + r, h - 2 * r, color);
  writeFastVLine(x + w - 1, y + r, h - 2 * r, color);
  drawCircleHelper(x + r, y + r, r, 1, color);
  drawCircleHelper(x + w - r - 1, y + r, r, 2, color);
  drawCircleHelper(x + w - r - 1, y + h - r - 1, r, 4, color);
  drawCircleHelper(x + r, y + h - r - 1, r, 8, color);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<gheap_sort_heap>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L5
L18:
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <_gheap_pop_max_item@plt>
  subq   $0x1,-0x8(%rbp)
L5:
  cmpq   $0x1,-0x8(%rbp)
  ja     L18
  nop
  nop
  leave
  ret
```

assistant: ```c
void gheap_sort_heap(const struct gheap_ctx *const ctx, void *const base, const size_t heap_size) {
  for (size_t i = heap_size; i > 1; --i) {
    _gheap_pop_max_item(ctx, base, i - 1);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<gheap_sort_heap>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rdx,%rbx
  cmp    $0x1,%rdx
  jbe    L13
L15:
  sub    $0x1,%rbx
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <_gheap_pop_max_item@plt>
  cmp    $0x1,%rbx
  jne    L15
L13:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void gheap_sort_heap(const struct gheap_ctx *const ctx, void *const base, const size_t heap_size) {
  for (size_t i = heap_size; i > 1; --i) {
    _gheap_pop_max_item(ctx, base, i - 1);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<gheap_sort_heap>:
  endbr64
  cmp    $0x1,%rdx
  jbe    L2
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  nopw   0x0(%rax,%rax,1)
L12:
  sub    $0x1,%rbx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %rbx,%rdx
  call   <_gheap_pop_max_item@plt>
  cmp    $0x1,%rbx
  jne    L12
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L2:
  ret
```

assistant: ```c
void gheap_sort_heap(const struct gheap_ctx *const ctx, void *const base, const size_t heap_size) {
  for (size_t i = heap_size; i > 1; --i) {
    _gheap_pop_max_item(ctx, base, i - 1);
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<gheap_sort_heap>:
  endbr64
  cmp    $0x1,%rdx
  jbe    L15
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  nopw   0x0(%rax,%rax,1)
L11:
  sub    $0x1,%rbx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %rbx,%rdx
  call   <_gheap_pop_max_item@plt>
  cmp    $0x1,%rbx
  jne    L11
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L15:
  ret
```

assistant: ```c
void gheap_sort_heap(const struct gheap_ctx *const ctx, void *const base, const size_t heap_size) {
  for (size_t i = heap_size; i > 1; --i) {
    _gheap_pop_max_item(ctx, base, i - 1);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<isTypePackedPixel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <legalType@plt>
  mov    %eax,%edi
  call   <assert@plt>
  mov    D37(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D87(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D51(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D83(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D79(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D20(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D71(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D15(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D84(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D94(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D26(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  je     L118
  mov    D31(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x8(%rbp)
  jne    L94
L118:
  mov    $0x1,%eax
  jmp    L36
L94:
  mov    $0x0,%eax
L36:
  leave
  ret
```

assistant: ```c
GLboolean isTypePackedPixel(GLenum type) {
  assert(legalType(type));
  if (type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV || type == GL_UNSIGNED_SHORT_5_6_5 || type == GL_UNSIGNED_SHORT_5_6_5_REV || type == GL_UNSIGNED_SHORT_4_4_4_4 || type == GL_UNSIGNED_SHORT_4_4_4_4_REV || type == GL_UNSIGNED_SHORT_5_5_5_1 || type == GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
    return 1;
  } else
    return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<isTypePackedPixel>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <legalType@plt>
  mov    %eax,%edi
  call   <assert@plt>
  mov    $0x1,%eax
  mov    D11(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D41(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D100(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D79(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D48(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D12(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D70(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D4(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D113(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D35(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D55(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L102
  mov    D110(%rip),%rax
  cmp    %rbx,(%rax)
  sete   %al
  movzbl %al,%eax
L102:
  pop    %rbx
  ret
```

assistant: ```c
GLboolean isTypePackedPixel(GLenum type) {
  assert(legalType(type));
  if (type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV || type == GL_UNSIGNED_SHORT_5_6_5 || type == GL_UNSIGNED_SHORT_5_6_5_REV || type == GL_UNSIGNED_SHORT_4_4_4_4 || type == GL_UNSIGNED_SHORT_4_4_4_4_REV || type == GL_UNSIGNED_SHORT_5_5_5_1 || type == GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
    return 1;
  } else
    return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<isTypePackedPixel>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <legalType@plt>
  mov    %eax,%edi
  call   <assert@plt>
  mov    D46(%rip),%rdx
  mov    $0x1,%eax
  cmp    %rbx,(%rdx)
  je     L93
  mov    D103(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D30(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D11(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D51(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D118(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D8(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D117(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D109(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D14(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D90(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L93
  mov    D75(%rip),%rax
  cmp    %rbx,(%rax)
  sete   %al
  movzbl %al,%eax
L93:
  pop    %rbx
  ret
```

assistant: ```c
GLboolean isTypePackedPixel(GLenum type) {
  assert(legalType(type));
  if (type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV || type == GL_UNSIGNED_SHORT_5_6_5 || type == GL_UNSIGNED_SHORT_5_6_5_REV || type == GL_UNSIGNED_SHORT_4_4_4_4 || type == GL_UNSIGNED_SHORT_4_4_4_4_REV || type == GL_UNSIGNED_SHORT_5_5_5_1 || type == GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
    return 1;
  } else
    return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<isTypePackedPixel>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <legalType@plt>
  mov    %eax,%edi
  call   <assert@plt>
  mov    D92(%rip),%rdx
  mov    $0x1,%eax
  cmp    %rbx,(%rdx)
  je     L70
  mov    D14(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D12(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D80(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D13(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D112(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D109(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D94(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D10(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D53(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D65(%rip),%rdx
  cmp    %rbx,(%rdx)
  je     L70
  mov    D93(%rip),%rax
  cmp    %rbx,(%rax)
  sete   %al
  movzbl %al,%eax
L70:
  pop    %rbx
  ret
```

assistant: ```c
GLboolean isTypePackedPixel(GLenum type) {
  assert(legalType(type));
  if (type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV || type == GL_UNSIGNED_SHORT_5_6_5 || type == GL_UNSIGNED_SHORT_5_6_5_REV || type == GL_UNSIGNED_SHORT_4_4_4_4 || type == GL_UNSIGNED_SHORT_4_4_4_4_REV || type == GL_UNSIGNED_SHORT_5_5_5_1 || type == GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_10_10_10_2 || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
    return 1;
  } else
    return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<nm_utils_addr_family_to_char>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x80,-0x4(%rbp)
  je     L10
  cmpl   $0x81,-0x4(%rbp)
  jne    L17
  mov    $0x34,%eax
  jmp    L39
L10:
  mov    $0x36,%eax
  jmp    L39
L17:
  mov    $0x3f,%edi
  call   <g_return_val_if_reached@plt>
L39:
  leave
  ret
```

assistant: ```c
char nm_utils_addr_family_to_char(int addr_family) {
  switch (addr_family) {
  case AF_INET:
    return '4';
  case AF_INET6:
    return '6';
  }
  g_return_val_if_reached('?');
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<nm_utils_addr_family_to_char>:
  endbr64
  mov    $0x36,%eax
  cmp    $0x80,%edi
  je     L15
  mov    $0x34,%eax
  cmp    $0x81,%edi
  je     L15
  sub    $0x8,%rsp
  mov    $0x3f,%edi
  call   <g_return_val_if_reached@plt>
  add    $0x8,%rsp
  ret
L15:
  ret
```

assistant: ```c
char nm_utils_addr_family_to_char(int addr_family) {
  switch (addr_family) {
  case AF_INET:
    return '4';
  case AF_INET6:
    return '6';
  }
  g_return_val_if_reached('?');
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<nm_utils_addr_family_to_char>:
  endbr64
  mov    $0x36,%eax
  cmp    $0x80,%edi
  je     L12
  mov    $0x34,%eax
  cmp    $0x81,%edi
  je     L12
  sub    $0x8,%rsp
  mov    $0x3f,%edi
  call   <g_return_val_if_reached@plt>
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax)
L12:
  ret
```

assistant: ```c
char nm_utils_addr_family_to_char(int addr_family) {
  switch (addr_family) {
  case AF_INET:
    return '4';
  case AF_INET6:
    return '6';
  }
  g_return_val_if_reached('?');
}
```
user: What is the c source code of the assembly code below:

```asm
<nm_utils_addr_family_to_char>:
  endbr64
  mov    $0x36,%eax
  cmp    $0x80,%edi
  je     L11
  mov    $0x34,%eax
  cmp    $0x81,%edi
  je     L11
  sub    $0x8,%rsp
  mov    $0x3f,%edi
  call   <g_return_val_if_reached@plt>
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax)
L11:
  ret
```

assistant: ```c
char nm_utils_addr_family_to_char(int addr_family) {
  switch (addr_family) {
  case AF_INET:
    return '4';
  case AF_INET6:
    return '6';
  }
  g_return_val_if_reached('?');
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cvtnum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x18(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtoll@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L60
  mov    -0x18(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  jne    L60
  mov    $0xffffffffffffffff,%rax
  jmp    L26
L60:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L140
  mov    -0x10(%rbp),%rax
  jmp    L26
L140:
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L78
  mov    $0xffffffffffffffff,%rax
  jmp    L26
L78:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <tolower@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    $0x65,%eax
  cmp    $0xf,%eax
  ja     L121
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D15(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D15(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L121:
  mov    -0x10(%rbp),%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0xa,%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0x14,%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0x1e,%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0x28,%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0x32,%rax
  jmp    L26
  mov    -0x10(%rbp),%rax
  shl    $0x3c,%rax
L26:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  leave
  ret
```

assistant: ```c
long long cvtnum(char *s) {
  long long i;
  char *sp;
  int c;
  i = strtoll(s, &sp, 0);
  if (i == 0 && sp == s)
    return -1LL;
  if (*sp == '\0')
    return i;
  if (sp[1] != '\0')
    return -1LL;
  c = tolower(*sp);
  switch (c) {
  default:
    return i;
  case 'k':
    return ((long long)(i) << 10);
  case 'm':
    return ((long long)(i) << 20);
  case 'g':
    return ((long long)(i) << 30);
  case 't':
    return ((long long)(i) << 40);
  case 'p':
    return ((long long)(i) << 50);
  case 'e':
    return ((long long)(i) << 60);
  }
  return -1LL;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cvtnum>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  mov    $0x0,%edx
  call   <strtoll@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L16
  cmp    %rbp,(%rsp)
  je     L76
L16:
  mov    (%rsp),%rax
  movzbl (%rax),%edi
  test   %dil,%dil
  je     L95
  cmpb   $0x0,0x1(%rax)
  jne    L125
  movsbl %dil,%edi
  call   <tolower@plt>
  sub    $0x65,%eax
  cmp    $0xf,%eax
  ja     L95
  mov    %eax,%eax
  lea    D7(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  shl    $0xa,%rbx
L95:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  mov    %rbx,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  shl    $0x14,%rbx
  jmp    L95
  shl    $0x1e,%rbx
  jmp    L95
  shl    $0x28,%rbx
  jmp    L95
  shl    $0x32,%rbx
  jmp    L95
  shl    $0x3c,%rbx
  jmp    L95
L76:
  mov    $0xffffffffffffffff,%rbx
  jmp    L95
L125:
  mov    $0xffffffffffffffff,%rbx
  jmp    L95
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long long cvtnum(char *s) {
  long long i;
  char *sp;
  int c;
  i = strtoll(s, &sp, 0);
  if (i == 0 && sp == s)
    return -1LL;
  if (*sp == '\0')
    return i;
  if (sp[1] != '\0')
    return -1LL;
  c = tolower(*sp);
  switch (c) {
  default:
    return i;
  case 'k':
    return ((long long)(i) << 10);
  case 'm':
    return ((long long)(i) << 20);
  case 'g':
    return ((long long)(i) << 30);
  case 't':
    return ((long long)(i) << 40);
  case 'p':
    return ((long long)(i) << 50);
  case 'e':
    return ((long long)(i) << 60);
  }
  return -1LL;
}
```