ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r12
  lea    D6(%rip),%rdi
  push   %rbp
  lea    D3(%rip),%rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%rbx
  call   <scanf@plt>
  movslq 0xc(%rsp),%rax
  lea    0x30(%rsp),%r12
  mov    %rax,%rcx
  imul   $0x68db8bad,%rax,%rax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sar    $0x2c,%rax
  mov    %eax,%edx
  sub    %esi,%eax
  sub    %esi,%edx
  movd   %eax,%xmm2
  mov    %eax,0xc(%rsp)
  imul   $0x2710,%edx,%edi
  sub    %edi,%ecx
  movd   %ecx,%xmm1
  pshufd $0x0,%xmm1,%xmm0
  movaps %xmm0,0x10(%rsp)
  pshufd $0x0,%xmm2,%xmm0
  movaps %xmm0,0x20(%rsp)
  nopl   0x0(%rax)
L3:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L3
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x40,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D6
type_infered: string
name: unpack_data
arguments: label: D3
type_infered: string

tool: D6: %d

tool: D3: %d


assistant: ```c
int main() {
  int vetor[8], i = 0, numero, primeira_pt;
  scanf("%d", &numero);
  primeira_pt = numero % 10000;
  numero /= 10000;
  for (i; i < 4; i++) {
    vetor[i] = 0;
    vetor[i] = primeira_pt;
  }
  for (i; i < 8; i++) {
    vetor[i] = 0;
    vetor[i] = numero;
  }
  for (i = 0; i < 8; i++) {
    printf("%d\n", vetor[i]);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<cpu_sbc_flags>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %edx,%eax
  mov    %ecx,-0x24(%rbp)
  mov    %esi,%edx
  mov    %dl,-0x1c(%rbp)
  mov    %al,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x1ffff,%eax
  mov    %eax,%edx
  movzbl -0x1c(%rbp),%eax
  xor    %eax,%edx
  movzbl -0x20(%rbp),%eax
  xor    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x24(%rbp),%eax
  movzbl %al,%eax
  test   %eax,%eax
  je     L11
  mov    $0x0,%eax
  jmp    L44
L11:
  mov    $0xffffff80,%eax
L44:
  mov    %al,-0x8(%rbp)
  movb   $0x40,-0x7(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x10,%eax
  test   %eax,%eax
  je     L30
  mov    $0x0,%eax
  jmp    L55
L30:
  mov    $0x20,%eax
L55:
  mov    %al,-0x6(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x100,%eax
  test   %eax,%eax
  je     L56
  mov    $0x0,%eax
  jmp    L28
L56:
  mov    $0x10,%eax
L28:
  mov    %al,-0x5(%rbp)
  movzbl -0x8(%rbp),%eax
  or     -0x7(%rbp),%al
  or     -0x6(%rbp),%al
  or     -0x5(%rbp),%al
  movzbl %al,%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <cpu_set_r8@plt>
  nop
  leave
  ret
```

assistant: ```c
void cpu_sbc_flags(struct cpu *cpu, unsigned char a, unsigned char b, signed int t) {
  unsigned int carries = (t & 0x1FFFF) ^ a ^ b;
  unsigned char z = (t & 0xFF) ? 0 : ((unsigned char)(0x80));
  unsigned char n = ((unsigned char)(0x40));
  unsigned char h = carries & 0x10 ? 0 : ((unsigned char)(0x20));
  unsigned char c = carries & 0x100 ? 0 : ((unsigned char)(0x10));
  cpu_set_r8(cpu, (0), z | n | h | c);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<cpu_sbc_flags>:
  endbr64
  sub    $0x8,%rsp
  mov    %ecx,%eax
  and    $0x1ffff,%eax
  xor    %esi,%edx
  movzbl %dl,%edx
  xor    %edx,%eax
  mov    %eax,%edx
  shr    $0x8,%edx
  xor    $0x1,%edx
  and    $0x1,%edx
  shl    $0x4,%edx
  shr    $0x4,%eax
  xor    $0x1,%eax
  and    $0x1,%eax
  shl    $0x5,%eax
  or     %eax,%edx
  test   %cl,%cl
  sete   %al
  shl    $0x7,%eax
  or     %eax,%edx
  or     $0x40,%edx
  movzbl %dl,%edx
  mov    $0x0,%esi
  call   <cpu_set_r8@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void cpu_sbc_flags(struct cpu *cpu, unsigned char a, unsigned char b, signed int t) {
  unsigned int carries = (t & 0x1FFFF) ^ a ^ b;
  unsigned char z = (t & 0xFF) ? 0 : ((unsigned char)(0x80));
  unsigned char n = ((unsigned char)(0x40));
  unsigned char h = carries & 0x10 ? 0 : ((unsigned char)(0x20));
  unsigned char c = carries & 0x100 ? 0 : ((unsigned char)(0x10));
  cpu_set_r8(cpu, (0), z | n | h | c);
}
```
user: Translate the below assembly code into C programming language:

```asm
<cpu_sbc_flags>:
  endbr64
  xor    %esi,%edx
  mov    %ecx,%eax
  and    $0x1ffff,%eax
  movzbl %dl,%edx
  xor    %edx,%eax
  mov    %eax,%edx
  shr    $0x4,%eax
  shr    $0x8,%edx
  xor    $0x1,%eax
  xor    $0x1,%edx
  and    $0x1,%eax
  and    $0x1,%edx
  shl    $0x5,%eax
  shl    $0x4,%edx
  or     %eax,%edx
  test   %cl,%cl
  sete   %al
  xor    %esi,%esi
  shl    $0x7,%eax
  or     %eax,%edx
  or     $0x40,%edx
  movzbl %dl,%edx
  jmp    1050 <cpu_set_r8@plt>
```

assistant: ```c
void cpu_sbc_flags(struct cpu *cpu, unsigned char a, unsigned char b, signed int t) {
  unsigned int carries = (t & 0x1FFFF) ^ a ^ b;
  unsigned char z = (t & 0xFF) ? 0 : ((unsigned char)(0x80));
  unsigned char n = ((unsigned char)(0x40));
  unsigned char h = carries & 0x10 ? 0 : ((unsigned char)(0x20));
  unsigned char c = carries & 0x100 ? 0 : ((unsigned char)(0x10));
  cpu_set_r8(cpu, (0), z | n | h | c);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cpu_sbc_flags>:
  endbr64
  xor    %esi,%edx
  mov    %ecx,%eax
  and    $0x1ffff,%eax
  movzbl %dl,%edx
  xor    %edx,%eax
  mov    %eax,%edx
  shr    $0x4,%eax
  shr    $0x8,%edx
  xor    $0x1,%eax
  xor    $0x1,%edx
  and    $0x1,%eax
  and    $0x1,%edx
  shl    $0x5,%eax
  shl    $0x4,%edx
  or     %eax,%edx
  test   %cl,%cl
  sete   %al
  xor    %esi,%esi
  shl    $0x7,%eax
  or     %eax,%edx
  or     $0x40,%edx
  movzbl %dl,%edx
  jmp    1050 <cpu_set_r8@plt>
```

assistant: ```c
void cpu_sbc_flags(struct cpu *cpu, unsigned char a, unsigned char b, signed int t) {
  unsigned int carries = (t & 0x1FFFF) ^ a ^ b;
  unsigned char z = (t & 0xFF) ? 0 : ((unsigned char)(0x80));
  unsigned char n = ((unsigned char)(0x40));
  unsigned char h = carries & 0x10 ? 0 : ((unsigned char)(0x20));
  unsigned char c = carries & 0x100 ? 0 : ((unsigned char)(0x10));
  cpu_set_r8(cpu, (0), z | n | h | c);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<pthread_mutex_lock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <assert@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <mutex_lock@plt>
  leave
  ret
```

assistant: ```c
int pthread_mutex_lock(pthread_mutex_t *mutex) {
  assert(mutex);
  return mutex_lock(mutex);
}
```
user: Translate the below assembly code into C programming language:

```asm
<pthread_mutex_lock>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <assert@plt>
  mov    %rbx,%rdi
  call   <mutex_lock@plt>
  pop    %rbx
  ret
```

assistant: ```c
int pthread_mutex_lock(pthread_mutex_t *mutex) {
  assert(mutex);
  return mutex_lock(mutex);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pthread_mutex_lock>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <assert@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <mutex_lock@plt>
```

assistant: ```c
int pthread_mutex_lock(pthread_mutex_t *mutex) {
  assert(mutex);
  return mutex_lock(mutex);
}
```
user: Translate the below assembly code into C programming language:

```asm
<pthread_mutex_lock>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <assert@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <mutex_lock@plt>
```

assistant: ```c
int pthread_mutex_lock(pthread_mutex_t *mutex) {
  assert(mutex);
  return mutex_lock(mutex);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movss  D17(%rip),%xmm0
  movss  %xmm0,(%rax)
  mov    -0x8(%rbp),%rax
  movss  (%rax),%xmm1
  movss  D16(%rip),%xmm0
  mulss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D17
type_infered: f32
name: disassemble_data
arguments: data_tag: D16
type_infered: byte[4]

tool: D17: 23423.23423

tool: {"D16": [0x00,0x00,0x7a,0x44]}

assistant: ```c
int main() {
  volatile float *f = malloc(sizeof(float));
  *f = 23423.23423;
  return (int)(*f * 1000) % 256;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movss  D7(%rip),%xmm0
  movss  %xmm0,(%rax)
  movss  (%rax),%xmm0
  mulss  D5(%rip),%xmm0
  cvttss2si %xmm0,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D7
type_infered: f32
name: extract_symbolic_data
arguments: tag: D5
type_infered: byte[4]

tool: D7: 23423.23423

tool: {"D5": [0x00,0x00,0x7a,0x44]}

assistant: ```c
int main() {
  volatile float *f = malloc(sizeof(float));
  *f = 23423.23423;
  return (int)(*f * 1000) % 256;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movss  D12(%rip),%xmm0
  movss  %xmm0,(%rax)
  movss  (%rax),%xmm0
  mulss  D7(%rip),%xmm0
  add    $0x8,%rsp
  cvttss2si %xmm0,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D12
datatype: f32
name: retrieve_data
arguments: data_label: D7
datatype: byte[4]

tool: D12: 23423.23423

tool: {"D7": [0x00,0x00,0x7a,0x44]}

assistant: ```c
int main() {
  volatile float *f = malloc(sizeof(float));
  *f = 23423.23423;
  return (int)(*f * 1000) % 256;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movss  D10(%rip),%xmm0
  movss  %xmm0,(%rax)
  movss  (%rax),%xmm0
  mulss  D7(%rip),%xmm0
  add    $0x8,%rsp
  cvttss2si %xmm0,%eax
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  ret
```

tool_calls: name: retrieve_data
arguments: label: D10
type: f32
name: retrieve_data
arguments: label: D7
type: byte[4]

tool: D10: 23423.23423

tool: {"D7": [0x00,0x00,0x7a,0x44]}

assistant: ```c
int main() {
  volatile float *f = malloc(sizeof(float));
  *f = 23423.23423;
  return (int)(*f * 1000) % 256;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<eprintf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  je     L4
  mov    -0x8(%rbp),%edi
  mov    -0x18(%rbp),%rsi
  mov    -0x10(%rbp),%rcx
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %edi,%r9d
  mov    %rsi,%r8
  mov    %eax,%esi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L2
L4:
  mov    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L2:
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D13
data_type: string
name: disassemble_data
arguments: label: D2
data_type: string

tool: D13: Failure at line %d, result is <%.*s>, should be <%s> of size %d


tool: D2: Failure at line %d, result is <%s>, should be <%s>


assistant: ```c
void eprintf(int line, char *result, char *expected, int size) {
  if (size != 0)
    printf("Failure at line %d, result is <%.*s>, should be <%s> of size %d\n", line, size, result, expected, size);
  else
    printf("Failure at line %d, result is <%s>, should be <%s>\n", line, result, expected);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<eprintf>:
  endbr64
  sub    $0x8,%rsp
  mov    %rdx,%r8
  test   %ecx,%ecx
  je     L4
  mov    %ecx,%edx
  mov    %ecx,%r9d
  mov    %rsi,%rcx
  mov    %edi,%esi
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L0:
  add    $0x8,%rsp
  ret
L4:
  mov    %rdx,%rcx
  mov    %rsi,%rdx
  mov    %edi,%esi
  lea    D13(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L0
```

tool_calls: name: parse_data
arguments: data_label: D4
data_type: string
name: parse_data
arguments: data_label: D13
data_type: string

tool: D4: Failure at line %d, result is <%.*s>, should be <%s> of size %d


tool: D13: Failure at line %d, result is <%s>, should be <%s>


assistant: ```c
void eprintf(int line, char *result, char *expected, int size) {
  if (size != 0)
    printf("Failure at line %d, result is <%.*s>, should be <%s> of size %d\n", line, size, result, expected, size);
  else
    printf("Failure at line %d, result is <%s>, should be <%s>\n", line, result, expected);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<eprintf>:
  endbr64
  mov    %rdx,%r8
  mov    %ecx,%edx
  test   %ecx,%ecx
  je     L5
  mov    %ecx,%r9d
  xor    %eax,%eax
  mov    %rsi,%rcx
  mov    %edi,%esi
  lea    D11(%rip),%rdi
  jmp    1050 <printf@plt>
  nopl   0x0(%rax,%rax,1)
L5:
  mov    %rsi,%rdx
  mov    %r8,%rcx
  mov    %edi,%esi
  xor    %eax,%eax
  lea    D0(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: read_data
arguments: tag: D11
type_guessed: string
name: read_data
arguments: tag: D0
type_guessed: string

tool: D11: Failure at line %d, result is <%.*s>, should be <%s> of size %d


tool: D0: Failure at line %d, result is <%s>, should be <%s>


assistant: ```c
void eprintf(int line, char *result, char *expected, int size) {
  if (size != 0)
    printf("Failure at line %d, result is <%.*s>, should be <%s> of size %d\n", line, size, result, expected, size);
  else
    printf("Failure at line %d, result is <%s>, should be <%s>\n", line, result, expected);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<eprintf>:
  endbr64
  mov    %rdx,%r8
  mov    %ecx,%edx
  test   %ecx,%ecx
  je     L4
  mov    %ecx,%r9d
  xor    %eax,%eax
  mov    %rsi,%rcx
  mov    %edi,%esi
  lea    D1(%rip),%rdi
  jmp    1050 <printf@plt>
  nopl   0x0(%rax,%rax,1)
L4:
  mov    %rsi,%rdx
  mov    %r8,%rcx
  mov    %edi,%esi
  xor    %eax,%eax
  lea    D18(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: parse_data
arguments: label: D1
type_guessed: string
name: parse_data
arguments: label: D18
type_guessed: string

tool: D1: Failure at line %d, result is <%.*s>, should be <%s> of size %d


tool: D18: Failure at line %d, result is <%s>, should be <%s>


assistant: ```c
void eprintf(int line, char *result, char *expected, int size) {
  if (size != 0)
    printf("Failure at line %d, result is <%.*s>, should be <%s> of size %d\n", line, size, result, expected, size);
  else
    printf("Failure at line %d, result is <%s>, should be <%s>\n", line, result, expected);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sd_is_fifo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x44(%rbp)
  jns    L125
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L20
L125:
  lea    -0x40(%rbp),%rax
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x40(%rbp),%rdx
  mov    -0x44(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <fstat@plt>
  test   %rax,%rax
  jns    L100
  mov    D43(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L20
L100:
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <S_ISFIFO@plt>
  test   %eax,%eax
  jne    L37
  mov    $0x0,%eax
  jmp    L20
L37:
  cmpq   $0x0,-0x50(%rbp)
  je     L119
  lea    -0x20(%rbp),%rax
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x20(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L5
  mov    D43(%rip),%rax
  mov    (%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L97
  mov    D43(%rip),%rax
  mov    (%rax),%edx
  mov    D69(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L64
L97:
  mov    $0x0,%eax
  jmp    L20
L64:
  mov    D43(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L20
L5:
  mov    -0x20(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  cmp    %rax,%rdx
  jne    L8
  mov    -0x18(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  cmp    %rax,%rdx
  jne    L8
  mov    $0x1,%eax
  jmp    L20
L8:
  mov    $0x0,%eax
  jmp    L20
L119:
  mov    $0x1,%eax
L20:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L133
  call   <__stack_chk_fail@plt>
L133:
  leave
  ret
```

assistant: ```c
int sd_is_fifo(int fd, const char *path) {
  struct stat st_fd;
  if (fd < 0)
    return -EINVAL;
  memset(&st_fd, 0, sizeof(st_fd));
  if (fstat(fd, &st_fd) < 0)
    return -errno;
  if (!S_ISFIFO(st_fd.st_mode))
    return 0;
  if (path) {
    struct stat st_path;
    memset(&st_path, 0, sizeof(st_path));
    if (stat(path, &st_path) < 0) {
      if (errno == ENOENT || errno == ENOTDIR)
        return 0;
      return -errno;
    }
    return st_path.st_dev == st_fd.st_dev && st_path.st_ino == st_fd.st_ino;
  }
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<sd_is_fifo>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L74
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %rsp,%r12
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %r12,%rsi
  mov    %ebx,%edi
  call   <fstat@plt>
  test   %rax,%rax
  js     L7
  mov    0x10(%rsp),%edi
  call   <S_ISFIFO@plt>
  test   %eax,%eax
  je     L3
  mov    $0x1,%eax
  test   %rbp,%rbp
  je     L3
  lea    0x20(%rsp),%rbx
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L77
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    $0x0,%eax
  mov    D42(%rip),%rcx
  cmp    (%rcx),%edx
  je     L3
  mov    %edx,%eax
  neg    %eax
  mov    D14(%rip),%rcx
  cmp    (%rcx),%edx
  mov    $0x0,%edx
  cmove  %edx,%eax
  jmp    L3
L74:
  mov    D37(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L3:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L73
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L7:
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L3
L77:
  mov    $0x0,%eax
  mov    (%rsp),%rcx
  cmp    %rcx,0x20(%rsp)
  jne    L3
  mov    0x8(%rsp),%rax
  cmp    %rax,0x28(%rsp)
  sete   %al
  movzbl %al,%eax
  jmp    L3
L73:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sd_is_fifo(int fd, const char *path) {
  struct stat st_fd;
  if (fd < 0)
    return -EINVAL;
  memset(&st_fd, 0, sizeof(st_fd));
  if (fstat(fd, &st_fd) < 0)
    return -errno;
  if (!S_ISFIFO(st_fd.st_mode))
    return 0;
  if (path) {
    struct stat st_path;
    memset(&st_path, 0, sizeof(st_path));
    if (stat(path, &st_path) < 0) {
      if (errno == ENOENT || errno == ENOTDIR)
        return 0;
      return -errno;
    }
    return st_path.st_dev == st_fd.st_dev && st_path.st_ino == st_fd.st_ino;
  }
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sd_is_fifo>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L40
  mov    %rsp,%r13
  mov    %edi,%ebp
  mov    %rsi,%r12
  mov    $0x18,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r13,%rsi
  mov    %ebp,%edi
  call   <fstat@plt>
  test   %rax,%rax
  js     L37
  mov    0x10(%rsp),%edi
  call   <S_ISFIFO@plt>
  test   %eax,%eax
  je     L76
  mov    $0x1,%eax
  test   %r12,%r12
  je     L76
  lea    0x20(%rsp),%rbp
  xor    %esi,%esi
  mov    $0x18,%edx
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L43
  mov    D10(%rip),%rax
  mov    D19(%rip),%rcx
  mov    (%rax),%edx
  xor    %eax,%eax
  cmp    (%rcx),%edx
  je     L76
  mov    D43(%rip),%rsi
  mov    %edx,%ecx
  neg    %ecx
  cmp    (%rsi),%edx
  cmovne %ecx,%eax
  jmp    L76
  xchg   %ax,%ax
L37:
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L76:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L63
  add    $0x40,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L40:
  mov    D45(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L76
  nopl   (%rax)
L43:
  mov    (%rsp),%rcx
  xor    %eax,%eax
  cmp    %rcx,0x20(%rsp)
  jne    L76
  mov    0x8(%rsp),%rax
  cmp    %rax,0x28(%rsp)
  sete   %al
  movzbl %al,%eax
  jmp    L76
L63:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sd_is_fifo(int fd, const char *path) {
  struct stat st_fd;
  if (fd < 0)
    return -EINVAL;
  memset(&st_fd, 0, sizeof(st_fd));
  if (fstat(fd, &st_fd) < 0)
    return -errno;
  if (!S_ISFIFO(st_fd.st_mode))
    return 0;
  if (path) {
    struct stat st_path;
    memset(&st_path, 0, sizeof(st_path));
    if (stat(path, &st_path) < 0) {
      if (errno == ENOENT || errno == ENOTDIR)
        return 0;
      return -errno;
    }
    return st_path.st_dev == st_fd.st_dev && st_path.st_ino == st_fd.st_ino;
  }
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sd_is_fifo>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L16
  mov    %rsp,%r13
  mov    %edi,%ebp
  mov    %rsi,%r12
  mov    $0x18,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r13,%rsi
  mov    %ebp,%edi
  call   <fstat@plt>
  test   %rax,%rax
  js     L70
  mov    0x10(%rsp),%edi
  call   <S_ISFIFO@plt>
  test   %eax,%eax
  je     L41
  mov    $0x1,%eax
  test   %r12,%r12
  je     L41
  lea    0x20(%rsp),%rbp
  xor    %esi,%esi
  mov    $0x18,%edx
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <stat@plt>
  test   %rax,%rax
  jns    L91
  mov    D15(%rip),%rax
  mov    D31(%rip),%rcx
  mov    (%rax),%edx
  xor    %eax,%eax
  cmp    (%rcx),%edx
  je     L41
  mov    D41(%rip),%rsi
  mov    %edx,%ecx
  neg    %ecx
  cmp    (%rsi),%edx
  cmovne %ecx,%eax
  jmp    L41
  xchg   %ax,%ax
L70:
  mov    D15(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L41:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L46
  add    $0x40,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L16:
  mov    D35(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L41
  nopl   (%rax)
L91:
  mov    (%rsp),%rcx
  xor    %eax,%eax
  cmp    %rcx,0x20(%rsp)
  jne    L41
  mov    0x8(%rsp),%rax
  cmp    %rax,0x28(%rsp)
  sete   %al
  movzbl %al,%eax
  jmp    L41
L46:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sd_is_fifo(int fd, const char *path) {
  struct stat st_fd;
  if (fd < 0)
    return -EINVAL;
  memset(&st_fd, 0, sizeof(st_fd));
  if (fstat(fd, &st_fd) < 0)
    return -errno;
  if (!S_ISFIFO(st_fd.st_mode))
    return 0;
  if (path) {
    struct stat st_path;
    memset(&st_path, 0, sizeof(st_path));
    if (stat(path, &st_path) < 0) {
      if (errno == ENOENT || errno == ENOTDIR)
        return 0;
      return -errno;
    }
    return st_path.st_dev == st_fd.st_dev && st_path.st_ino == st_fd.st_ino;
  }
  return 1;
}
```