ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码：

```asm
<GST_WRITE_DOUBLE_LE>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movsd  %xmm0,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movsd  -0x30(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  lea    -0x10(%rbp),%rcx
  lea    -0x14(%rbp),%rax
  mov    $0x8,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x14(%rbp),%eax
  movzbl %al,%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x4(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  sar    $0x10,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x8(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  shr    $0x18,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  add    $0xc,%rax
  mov    %edx,(%rax)
  mov    -0x14(%rbp),%eax
  mov    $0x20,%edx
  mov    %edx,%ecx
  sar    %cl,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x10(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  mov    $0x28,%edx
  mov    %edx,%ecx
  sar    %cl,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x14(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  mov    $0x30,%edx
  mov    %edx,%ecx
  sar    %cl,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x18(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  mov    $0x38,%edx
  mov    %edx,%ecx
  sar    %cl,%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x1c(%rax),%rdx
  movzbl %cl,%eax
  mov    %eax,(%rdx)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L5
  call   <__stack_chk_fail@plt>
L5:
  leave
  ret
```

assistant: ```c
void GST_WRITE_DOUBLE_LE(uint8_t *data, double num) {
  double d = num;
  uint64_t i = 0;
  memcpy(&i, &d, sizeof(double));
  do {
    ((uint8_t *)(data))[0] = (((uint64_t)(i)) >> 0) & 0xff;
    ((uint8_t *)(data))[1] = (((uint64_t)(i)) >> 8) & 0xff;
    ((uint8_t *)(data))[2] = (((uint64_t)(i)) >> 16) & 0xff;
    ((uint8_t *)(data))[3] = (((uint64_t)(i)) >> 24) & 0xff;
    ((uint8_t *)(data))[4] = (((uint64_t)(i)) >> 32) & 0xff;
    ((uint8_t *)(data))[5] = (((uint64_t)(i)) >> 40) & 0xff;
    ((uint8_t *)(data))[6] = (((uint64_t)(i)) >> 48) & 0xff;
    ((uint8_t *)(data))[7] = (((uint64_t)(i)) >> 56) & 0xff;
  } while (0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<GST_WRITE_DOUBLE_LE>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movsd  %xmm0,0x10(%rsp)
  movl   $0x0,0xc(%rsp)
  lea    0x10(%rsp),%rsi
  lea    0xc(%rsp),%rdi
  mov    $0x8,%edx
  call   <memcpy@plt>
  mov    0xc(%rsp),%eax
  movzbl %al,%edx
  mov    %edx,(%rbx)
  movzbl %ah,%edx
  mov    %edx,0x4(%rbx)
  mov    %eax,%edx
  sar    $0x10,%edx
  and    $0xff,%edx
  mov    %edx,0x8(%rbx)
  mov    %eax,%edx
  shr    $0x18,%edx
  mov    %edx,0xc(%rbx)
  mov    %eax,%edx
  mov    $0x20,%ecx
  sar    %cl,%edx
  and    $0xff,%edx
  mov    %edx,0x10(%rbx)
  mov    %eax,%edx
  mov    $0x28,%ecx
  sar    %cl,%edx
  and    $0xff,%edx
  mov    %edx,0x14(%rbx)
  mov    %eax,%edx
  mov    $0x30,%ecx
  sar    %cl,%edx
  and    $0xff,%edx
  mov    %edx,0x18(%rbx)
  mov    $0x38,%ecx
  sar    %cl,%eax
  and    $0xff,%eax
  mov    %eax,0x1c(%rbx)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x20,%rsp
  pop    %rbx
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void GST_WRITE_DOUBLE_LE(uint8_t *data, double num) {
  double d = num;
  uint64_t i = 0;
  memcpy(&i, &d, sizeof(double));
  do {
    ((uint8_t *)(data))[0] = (((uint64_t)(i)) >> 0) & 0xff;
    ((uint8_t *)(data))[1] = (((uint64_t)(i)) >> 8) & 0xff;
    ((uint8_t *)(data))[2] = (((uint64_t)(i)) >> 16) & 0xff;
    ((uint8_t *)(data))[3] = (((uint64_t)(i)) >> 24) & 0xff;
    ((uint8_t *)(data))[4] = (((uint64_t)(i)) >> 32) & 0xff;
    ((uint8_t *)(data))[5] = (((uint64_t)(i)) >> 40) & 0xff;
    ((uint8_t *)(data))[6] = (((uint64_t)(i)) >> 48) & 0xff;
    ((uint8_t *)(data))[7] = (((uint64_t)(i)) >> 56) & 0xff;
  } while (0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<GST_WRITE_DOUBLE_LE>:
  endbr64
  push   %rbx
  mov    $0x8,%edx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  lea    0xc(%rsp),%rdi
  movl   $0x0,0xc(%rsp)
  movsd  %xmm0,0x10(%rsp)
  call   <memcpy@plt>
  mov    0xc(%rsp),%eax
  mov    $0x20,%ecx
  movzbl %al,%edx
  mov    %edx,(%rbx)
  movzbl %ah,%edx
  mov    %edx,0x4(%rbx)
  mov    %eax,%edx
  sar    $0x10,%edx
  and    $0xff,%edx
  mov    %edx,0x8(%rbx)
  mov    %eax,%edx
  shr    $0x18,%edx
  mov    %edx,0xc(%rbx)
  mov    %eax,%edx
  sar    %cl,%edx
  mov    $0x28,%ecx
  and    $0xff,%edx
  mov    %edx,0x10(%rbx)
  mov    %eax,%edx
  sar    %cl,%edx
  mov    $0x30,%ecx
  and    $0xff,%edx
  mov    %edx,0x14(%rbx)
  mov    %eax,%edx
  sar    %cl,%edx
  mov    $0x38,%ecx
  sar    %cl,%eax
  and    $0xff,%edx
  and    $0xff,%eax
  mov    %edx,0x18(%rbx)
  mov    %eax,0x1c(%rbx)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x20,%rsp
  pop    %rbx
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void GST_WRITE_DOUBLE_LE(uint8_t *data, double num) {
  double d = num;
  uint64_t i = 0;
  memcpy(&i, &d, sizeof(double));
  do {
    ((uint8_t *)(data))[0] = (((uint64_t)(i)) >> 0) & 0xff;
    ((uint8_t *)(data))[1] = (((uint64_t)(i)) >> 8) & 0xff;
    ((uint8_t *)(data))[2] = (((uint64_t)(i)) >> 16) & 0xff;
    ((uint8_t *)(data))[3] = (((uint64_t)(i)) >> 24) & 0xff;
    ((uint8_t *)(data))[4] = (((uint64_t)(i)) >> 32) & 0xff;
    ((uint8_t *)(data))[5] = (((uint64_t)(i)) >> 40) & 0xff;
    ((uint8_t *)(data))[6] = (((uint64_t)(i)) >> 48) & 0xff;
    ((uint8_t *)(data))[7] = (((uint64_t)(i)) >> 56) & 0xff;
  } while (0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<GST_WRITE_DOUBLE_LE>:
  endbr64
  push   %rbx
  mov    $0x8,%edx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  lea    0xc(%rsp),%rdi
  movsd  %xmm0,0x10(%rsp)
  movl   $0x0,0xc(%rsp)
  call   <memcpy@plt>
  mov    0xc(%rsp),%eax
  mov    $0x20,%ecx
  mov    %eax,%edx
  movzbl %al,%esi
  sar    $0x10,%edx
  movd   %esi,%xmm0
  movzbl %ah,%esi
  movzbl %dl,%edi
  mov    %eax,%edx
  movd   %esi,%xmm2
  shr    $0x18,%edx
  movd   %edi,%xmm1
  punpckldq %xmm2,%xmm0
  movd   %edx,%xmm3
  mov    %eax,%edx
  sar    %cl,%edx
  mov    $0x28,%ecx
  punpckldq %xmm3,%xmm1
  movzbl %dl,%esi
  mov    %eax,%edx
  punpcklqdq %xmm1,%xmm0
  sar    %cl,%edx
  mov    $0x30,%ecx
  movups %xmm0,(%rbx)
  movd   %esi,%xmm0
  movzbl %dl,%edi
  mov    %eax,%edx
  sar    %cl,%edx
  movd   %edi,%xmm6
  movzbl %dl,%ecx
  punpckldq %xmm6,%xmm0
  movd   %ecx,%xmm1
  mov    $0x38,%ecx
  sar    %cl,%eax
  movzbl %al,%eax
  movd   %eax,%xmm4
  punpckldq %xmm4,%xmm1
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,0x10(%rbx)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x20,%rsp
  pop    %rbx
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void GST_WRITE_DOUBLE_LE(uint8_t *data, double num) {
  double d = num;
  uint64_t i = 0;
  memcpy(&i, &d, sizeof(double));
  do {
    ((uint8_t *)(data))[0] = (((uint64_t)(i)) >> 0) & 0xff;
    ((uint8_t *)(data))[1] = (((uint64_t)(i)) >> 8) & 0xff;
    ((uint8_t *)(data))[2] = (((uint64_t)(i)) >> 16) & 0xff;
    ((uint8_t *)(data))[3] = (((uint64_t)(i)) >> 24) & 0xff;
    ((uint8_t *)(data))[4] = (((uint64_t)(i)) >> 32) & 0xff;
    ((uint8_t *)(data))[5] = (((uint64_t)(i)) >> 40) & 0xff;
    ((uint8_t *)(data))[6] = (((uint64_t)(i)) >> 48) & 0xff;
    ((uint8_t *)(data))[7] = (((uint64_t)(i)) >> 56) & 0xff;
  } while (0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<memmove>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jae    L26
  mov    -0x10(%rbp),%rax
  sub    -0x8(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  jbe    L21
L26:
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L62
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  cmp    %rax,-0x28(%rbp)
  ja     L62
L21:
  mov    $0x1,%eax
  jmp    L10
L62:
  mov    $0x0,%eax
L10:
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <__builtin_expect@plt>
  test   %rax,%rax
  je     L16
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L47
L16:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <bcopy@plt>
  mov    -0x18(%rbp),%rax
L47:
  leave
  ret
```

assistant: ```c
void *memmove(void *dst, const void *src, size_t n) {
  const char *p = src;
  char *q = dst;
  if (__builtin_expect(((q < p) && ((size_t)(p - q) >= n)) || ((p < q) && ((size_t)(q - p) >= n)), 1)) {
    return memcpy(dst, src, n);
  } else {
    bcopy(src, dst, n);
    return dst;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<memmove>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  cmp    %rdi,%rsi
  jbe    L1
  mov    %rsi,%rax
  sub    %rdi,%rax
  mov    $0x1,%edi
  cmp    %rdx,%rax
  jae    L34
L1:
  mov    $0x0,%edi
  cmp    %rbx,%rbp
  jae    L34
  mov    %rbx,%rax
  sub    %rbp,%rax
  cmp    %r12,%rax
  setae  %dil
  movzbl %dil,%edi
L34:
  mov    $0x1,%esi
  call   <__builtin_expect@plt>
  test   %rax,%rax
  je     L24
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <memcpy@plt>
L48:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L24:
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <bcopy@plt>
  mov    %rbx,%rax
  jmp    L48
```

assistant: ```c
void *memmove(void *dst, const void *src, size_t n) {
  const char *p = src;
  char *q = dst;
  if (__builtin_expect(((q < p) && ((size_t)(p - q) >= n)) || ((p < q) && ((size_t)(q - p) >= n)), 1)) {
    return memcpy(dst, src, n);
  } else {
    bcopy(src, dst, n);
    return dst;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<memmove>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  cmp    %rdi,%rsi
  jbe    L23
  mov    %rsi,%rax
  sub    %rdi,%rax
  mov    $0x1,%edi
  cmp    %rdx,%rax
  jb     L23
L41:
  mov    $0x1,%esi
  call   <__builtin_expect@plt>
  mov    %r13,%rdx
  test   %rax,%rax
  je     L46
  mov    %rbp,%rsi
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1080 <memcpy@plt>
  nopl   0x0(%rax)
L23:
  xor    %edi,%edi
  cmp    %r12,%rbp
  jae    L41
  mov    %r12,%rax
  xor    %edi,%edi
  sub    %rbp,%rax
  cmp    %r13,%rax
  setae  %dil
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L46:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <bcopy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void *memmove(void *dst, const void *src, size_t n) {
  const char *p = src;
  char *q = dst;
  if (__builtin_expect(((q < p) && ((size_t)(p - q) >= n)) || ((p < q) && ((size_t)(q - p) >= n)), 1)) {
    return memcpy(dst, src, n);
  } else {
    bcopy(src, dst, n);
    return dst;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<memmove>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  cmp    %rdi,%rsi
  jbe    L25
  mov    %rsi,%rax
  sub    %rdi,%rax
  mov    $0x1,%edi
  cmp    %rdx,%rax
  jb     L25
L7:
  mov    $0x1,%esi
  call   <__builtin_expect@plt>
  mov    %r13,%rdx
  test   %rax,%rax
  je     L3
  mov    %rbp,%rsi
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1080 <memcpy@plt>
  nopl   0x0(%rax)
L25:
  xor    %edi,%edi
  cmp    %r12,%rbp
  jae    L7
  mov    %r12,%rax
  xor    %edi,%edi
  sub    %rbp,%rax
  cmp    %r13,%rax
  setae  %dil
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L3:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <bcopy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void *memmove(void *dst, const void *src, size_t n) {
  const char *p = src;
  char *q = dst;
  if (__builtin_expect(((q < p) && ((size_t)(p - q) >= n)) || ((p < q) && ((size_t)(q - p) >= n)), 1)) {
    return memcpy(dst, src, n);
  } else {
    bcopy(src, dst, n);
    return dst;
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<do_banner>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D13
data_type: string
name: extract_symbolic_data
arguments: data_label: D18
data_type: string

tool: D13: MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant


tool: D18: more info at http://www.winimage.com/zLibDll/unzip.html



assistant: ```c
void do_banner() {
  printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<do_banner>:
  endbr64
  sub    $0x8,%rsp
  lea    D14(%rip),%rdi
  call   <printf@plt>
  lea    D9(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: tag: D14
datatype: string
name: unpack_data
arguments: tag: D9
datatype: string

tool: D14: MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant


tool: D9: more info at http://www.winimage.com/zLibDll/unzip.html



assistant: ```c
void do_banner() {
  printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<do_banner>:
  endbr64
  sub    $0x8,%rsp
  lea    D14(%rip),%rdi
  call   <printf@plt>
  lea    D7(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D14
data_type: string
name: extract_symbolic_data
arguments: tag: D7
data_type: string

tool: D14: MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant


tool: D7: more info at http://www.winimage.com/zLibDll/unzip.html



assistant: ```c
void do_banner() {
  printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<do_banner>:
  endbr64
  sub    $0x8,%rsp
  lea    D10(%rip),%rdi
  call   <printf@plt>
  lea    D11(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: unpack_data
arguments: tag: D10
type: string
name: unpack_data
arguments: tag: D11
type: string

tool: D10: MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant


tool: D11: more info at http://www.winimage.com/zLibDll/unzip.html



assistant: ```c
void do_banner() {
  printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<tapdisk_storage_type>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    D45(%rip),%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x30(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L85:
  cmp    %rdx,%rsp
  je     L112
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L85
L112:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L88
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L88:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <realpath@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L69
  mov    D46(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L32
L69:
  lea    -0x3c(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  je     L17
  mov    D46(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L32
L17:
  mov    -0x3c(%rbp),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  and    %edx,%eax
  cmp    $0x80,%eax
  je     L46
  cmp    $0x81,%eax
  jne    L0
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <__tapdisk_blk_storage_type@plt>
  mov    %eax,-0x38(%rbp)
  jmp    L47
L46:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <__tapdisk_fs_storage_type@plt>
  mov    %eax,-0x38(%rbp)
  jmp    L47
L0:
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  mov    %eax,-0x38(%rbp)
  nop
L47:
  mov    -0x38(%rbp),%eax
L32:
  mov    %rbx,%rsp
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L57
  call   <__stack_chk_fail@plt>
L57:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int tapdisk_storage_type(const char *path) {
  char rpath[PATH_MAX], *p;
  struct stat st;
  int err, rv;
  p = realpath(path, rpath);
  if (!p)
    return -errno;
  err = stat(rpath, &st);
  if (err)
    return -errno;
  switch (st.st_mode & S_IFMT) {
  case S_IFBLK:
    rv = __tapdisk_blk_storage_type(rpath);
    break;
  case S_IFREG:
    rv = __tapdisk_fs_storage_type(rpath);
    break;
  default:
    rv = -EINVAL;
    break;
  }
  return rv;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<tapdisk_storage_type>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    D37(%rip),%rax
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L18:
  cmp    %rdx,%rsp
  je     L64
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L18
L64:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L45
  orq    $0x0,-0x8(%rsp,%rax,1)
L45:
  mov    %rsp,%rbx
  mov    %rsp,%rsi
  call   <realpath@plt>
  test   %rax,%rax
  je     L116
  lea    -0x1c(%rbp),%rsi
  mov    %rbx,%rdi
  call   <stat@plt>
  test   %eax,%eax
  jne    L55
  mov    D30(%rip),%rdx
  mov    -0x1c(%rbp),%eax
  and    (%rdx),%eax
  cmp    $0x80,%eax
  je     L111
  cmp    $0x81,%eax
  jne    L100
  mov    %rbx,%rdi
  call   <__tapdisk_blk_storage_type@plt>
  jmp    L27
L116:
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L27:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L50
  mov    -0x8(%rbp),%rbx
  leave
  ret
L55:
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L27
L111:
  mov    %rbx,%rdi
  call   <__tapdisk_fs_storage_type@plt>
  jmp    L27
L100:
  mov    D12(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L27
L50:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int tapdisk_storage_type(const char *path) {
  char rpath[PATH_MAX], *p;
  struct stat st;
  int err, rv;
  p = realpath(path, rpath);
  if (!p)
    return -errno;
  err = stat(rpath, &st);
  if (err)
    return -errno;
  switch (st.st_mode & S_IFMT) {
  case S_IFBLK:
    rv = __tapdisk_blk_storage_type(rpath);
    break;
  case S_IFREG:
    rv = __tapdisk_fs_storage_type(rpath);
    break;
  default:
    rv = -EINVAL;
    break;
  }
  return rv;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<tapdisk_storage_type>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  mov    D37(%rip),%rax
  mov    %rsp,%rcx
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L108
L28:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L28
L108:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L19
L115:
  mov    %rsp,%rsi
  call   <realpath@plt>
  test   %rax,%rax
  je     L42
  lea    -0xc(%rbp),%rsi
  mov    %rsp,%rdi
  call   <stat@plt>
  test   %eax,%eax
  jne    L42
  mov    D16(%rip),%rdx
  mov    -0xc(%rbp),%eax
  and    (%rdx),%eax
  cmp    $0x80,%eax
  je     L102
  cmp    $0x81,%eax
  jne    L71
  mov    %rsp,%rdi
  call   <__tapdisk_blk_storage_type@plt>
  nopl   0x0(%rax)
L48:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L110
  leave
  ret
  nopl   0x0(%rax)
L42:
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L48
  nopl   (%rax)
L19:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L115
  nopl   0x0(%rax,%rax,1)
L71:
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L48
  nopl   (%rax)
L102:
  mov    %rsp,%rdi
  call   <__tapdisk_fs_storage_type@plt>
  jmp    L48
L110:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int tapdisk_storage_type(const char *path) {
  char rpath[PATH_MAX], *p;
  struct stat st;
  int err, rv;
  p = realpath(path, rpath);
  if (!p)
    return -errno;
  err = stat(rpath, &st);
  if (err)
    return -errno;
  switch (st.st_mode & S_IFMT) {
  case S_IFBLK:
    rv = __tapdisk_blk_storage_type(rpath);
    break;
  case S_IFREG:
    rv = __tapdisk_fs_storage_type(rpath);
    break;
  default:
    rv = -EINVAL;
    break;
  }
  return rv;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<tapdisk_storage_type>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  mov    D34(%rip),%rax
  mov    %rsp,%rcx
  movslq (%rax),%rax
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L105
L116:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L116
L105:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L36
L75:
  mov    %rsp,%rsi
  call   <realpath@plt>
  test   %rax,%rax
  je     L92
  lea    -0xc(%rbp),%rsi
  mov    %rsp,%rdi
  call   <stat@plt>
  test   %eax,%eax
  jne    L92
  mov    D7(%rip),%rdx
  mov    -0xc(%rbp),%eax
  and    (%rdx),%eax
  cmp    $0x80,%eax
  je     L89
  cmp    $0x81,%eax
  jne    L85
  mov    %rsp,%rdi
  call   <__tapdisk_blk_storage_type@plt>
  nopl   0x0(%rax)
L26:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L17
  leave
  ret
  nopl   0x0(%rax)
L92:
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L26
  nopl   (%rax)
L36:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L75
  nopl   0x0(%rax,%rax,1)
L85:
  mov    D27(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L26
  nopl   (%rax)
L89:
  mov    %rsp,%rdi
  call   <__tapdisk_fs_storage_type@plt>
  jmp    L26
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int tapdisk_storage_type(const char *path) {
  char rpath[PATH_MAX], *p;
  struct stat st;
  int err, rv;
  p = realpath(path, rpath);
  if (!p)
    return -errno;
  err = stat(rpath, &st);
  if (err)
    return -errno;
  switch (st.st_mode & S_IFMT) {
  case S_IFBLK:
    rv = __tapdisk_blk_storage_type(rpath);
    break;
  case S_IFREG:
    rv = __tapdisk_fs_storage_type(rpath);
    break;
  default:
    rv = -EINVAL;
    break;
  }
  return rv;
}
```