ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<solve_sub_string>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  sub    $0x8,%rsp
  xchg   %ax,%ax
L6:
  mov    %r12,%rdi
  mov    %r12,%rbp
  call   <perform_KMG@plt>
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,%r12
  call   <compare_strings@plt>
  test   %eax,%eax
  je     L6
  nopl   (%rax)
L7:
  mov    %r12,%rdi
  mov    %r12,%rbp
  call   <perform_exponent@plt>
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,%r12
  call   <compare_strings@plt>
  test   %eax,%eax
  je     L7
  nopl   (%rax)
L5:
  mov    %r12,%rdi
  mov    %r12,%rbp
  call   <perform_muldiv@plt>
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,%r12
  call   <compare_strings@plt>
  test   %eax,%eax
  je     L5
  nopl   (%rax)
L2:
  mov    %r12,%rdi
  mov    %r12,%rbp
  call   <perform_addsub@plt>
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,%r12
  call   <compare_strings@plt>
  test   %eax,%eax
  je     L2
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *solve_sub_string(char buffer[]) {
  char *string = buffer;
  do {
    buffer = string;
    string = perform_KMG(buffer);
  } while (!compare_strings(buffer, string));
  do {
    buffer = string;
    string = perform_exponent(buffer);
  } while (!compare_strings(buffer, string));
  do {
    buffer = string;
    string = perform_muldiv(buffer);
  } while (!compare_strings(buffer, string));
  do {
    buffer = string;
    string = perform_addsub(buffer);
  } while (!compare_strings(buffer, string));
  return string;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<AnimationPlayPrev>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,%edx
  mov    %esi,%eax
  mov    %dx,-0x4(%rbp)
  mov    %ax,-0x8(%rbp)
  mov    $0xee,%edi
  call   <SendChar@plt>
  mov    $0xb1,%edi
  call   <SendChar@plt>
  mov    $0x24,%edi
  call   <SendChar@plt>
  movzwl -0x4(%rbp),%eax
  shr    $0x8,%ax
  movzwl %ax,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <SendChar@plt>
  movzwl -0x4(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <SendChar@plt>
  movzwl -0x8(%rbp),%eax
  shr    $0x8,%ax
  movzwl %ax,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <SendChar@plt>
  movzwl -0x8(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xfc,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  nop
  leave
  ret
```

assistant: ```c
void AnimationPlayPrev(unsigned short int screen_id, unsigned short int control_id) {
  SendChar((0XEE) & 0xFF);
  SendChar((0xB1) & 0xFF);
  SendChar((0x24) & 0xFF);
  SendChar(((screen_id) >> 8) & 0xFF);
  SendChar((screen_id)&0xFF);
  SendChar(((control_id) >> 8) & 0xFF);
  SendChar((control_id)&0xFF);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<AnimationPlayPrev>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %esi,%ebx
  mov    $0xee,%edi
  call   <SendChar@plt>
  mov    $0xb1,%edi
  call   <SendChar@plt>
  mov    $0x24,%edi
  call   <SendChar@plt>
  mov    %ebp,%eax
  movzbl %ah,%edi
  call   <SendChar@plt>
  movzbl %bpl,%edi
  call   <SendChar@plt>
  movzbl %bh,%edi
  call   <SendChar@plt>
  movzbl %bl,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xfc,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void AnimationPlayPrev(unsigned short int screen_id, unsigned short int control_id) {
  SendChar((0XEE) & 0xFF);
  SendChar((0xB1) & 0xFF);
  SendChar((0x24) & 0xFF);
  SendChar(((screen_id) >> 8) & 0xFF);
  SendChar((screen_id)&0xFF);
  SendChar(((control_id) >> 8) & 0xFF);
  SendChar((control_id)&0xFF);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<AnimationPlayPrev>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  mov    $0xee,%edi
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <SendChar@plt>
  mov    $0xb1,%edi
  call   <SendChar@plt>
  mov    $0x24,%edi
  call   <SendChar@plt>
  mov    %ebp,%eax
  movzbl %ah,%edi
  call   <SendChar@plt>
  movzbl %bpl,%edi
  call   <SendChar@plt>
  movzbl %bh,%edi
  call   <SendChar@plt>
  movzbl %bl,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xfc,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  add    $0x8,%rsp
  mov    $0xff,%edi
  pop    %rbx
  pop    %rbp
  jmp    1050 <SendChar@plt>
```

assistant: ```c
void AnimationPlayPrev(unsigned short int screen_id, unsigned short int control_id) {
  SendChar((0XEE) & 0xFF);
  SendChar((0xB1) & 0xFF);
  SendChar((0x24) & 0xFF);
  SendChar(((screen_id) >> 8) & 0xFF);
  SendChar((screen_id)&0xFF);
  SendChar(((control_id) >> 8) & 0xFF);
  SendChar((control_id)&0xFF);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<AnimationPlayPrev>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  mov    $0xee,%edi
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <SendChar@plt>
  mov    $0xb1,%edi
  call   <SendChar@plt>
  mov    $0x24,%edi
  call   <SendChar@plt>
  mov    %ebp,%eax
  movzbl %ah,%edi
  call   <SendChar@plt>
  movzbl %bpl,%edi
  call   <SendChar@plt>
  movzbl %bh,%edi
  call   <SendChar@plt>
  movzbl %bl,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  mov    $0xfc,%edi
  call   <SendChar@plt>
  mov    $0xff,%edi
  call   <SendChar@plt>
  add    $0x8,%rsp
  mov    $0xff,%edi
  pop    %rbx
  pop    %rbp
  jmp    1050 <SendChar@plt>
```

assistant: ```c
void AnimationPlayPrev(unsigned short int screen_id, unsigned short int control_id) {
  SendChar((0XEE) & 0xFF);
  SendChar((0xB1) & 0xFF);
  SendChar((0x24) & 0xFF);
  SendChar(((screen_id) >> 8) & 0xFF);
  SendChar((screen_id)&0xFF);
  SendChar(((control_id) >> 8) & 0xFF);
  SendChar((control_id)&0xFF);
  SendChar((((0XFFFCFFFF) >> 16) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) >> 16) & 0xFF);
  SendChar((((0XFFFCFFFF) & 0xFFFF) >> 8) & 0xFF);
  SendChar(((0XFFFCFFFF) & 0xFFFF) & 0xFF);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<strcmp_1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L10
L1:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x4(%rbp)
L10:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x4(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L1
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movsbl %dl,%edx
  sub    %edx,%eax
  pop    %rbp
  ret
```

assistant: ```c
int strcmp_1(char *s, char *t) {
  int i = 0;
  for (i = 0; s[i] == t[i]; i++) {
    if (s[i] = '\0') {
      return 0;
    };
  };
  return (s[i] - t[i]);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strcmp_1>:
  endbr64
  movzbl (%rdi),%eax
  movzbl (%rsi),%ecx
  cmp    %cl,%al
  jne    L5
  mov    $0x1,%edx
L9:
  movb   $0x0,-0x1(%rdi,%rdx,1)
  movzbl (%rdi,%rdx,1),%eax
  add    $0x1,%rdx
  movzbl -0x1(%rsi,%rdx,1),%ecx
  cmp    %cl,%al
  je     L9
L5:
  movsbl %al,%eax
  movsbl %cl,%ecx
  sub    %ecx,%eax
  ret
```

assistant: ```c
int strcmp_1(char *s, char *t) {
  int i = 0;
  for (i = 0; s[i] == t[i]; i++) {
    if (s[i] = '\0') {
      return 0;
    };
  };
  return (s[i] - t[i]);
}
```
user: What is the c source code of the assembly code below?

```asm
<strcmp_1>:
  endbr64
  movsbl (%rdi),%eax
  movsbl (%rsi),%ecx
  cmp    %cl,%al
  jne    L6
  mov    $0x1,%edx
  nopl   0x0(%rax,%rax,1)
L18:
  movb   $0x0,-0x1(%rdi,%rdx,1)
  movsbl (%rdi,%rdx,1),%eax
  add    $0x1,%rdx
  movsbl -0x1(%rsi,%rdx,1),%ecx
  cmp    %cl,%al
  je     L18
L6:
  sub    %ecx,%eax
  ret
```

assistant: ```c
int strcmp_1(char *s, char *t) {
  int i = 0;
  for (i = 0; s[i] == t[i]; i++) {
    if (s[i] = '\0') {
      return 0;
    };
  };
  return (s[i] - t[i]);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strcmp_1>:
  endbr64
  movsbl (%rdi),%eax
  movsbl (%rsi),%ecx
  cmp    %cl,%al
  jne    L6
  mov    $0x1,%edx
  nopl   0x0(%rax,%rax,1)
L2:
  movb   $0x0,-0x1(%rdi,%rdx,1)
  movsbl (%rdi,%rdx,1),%eax
  add    $0x1,%rdx
  movsbl -0x1(%rsi,%rdx,1),%ecx
  cmp    %cl,%al
  je     L2
L6:
  sub    %ecx,%eax
  ret
```

assistant: ```c
int strcmp_1(char *s, char *t) {
  int i = 0;
  for (i = 0; s[i] == t[i]; i++) {
    if (s[i] = '\0') {
      return 0;
    };
  };
  return (s[i] - t[i]);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<test_uint>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    $0x0,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%esi
  mov    $0x0,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    -0x4(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  movl   $0x0,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  nop
  leave
  ret
```

assistant: ```c
void test_uint(unsigned n) {
  sink(f_uint_1(0));
  sink(f_uint_2(0, 1));
  sink(f_uint_2(1, 0));
  sink(f_uint_2(n, 0));
  sink(f_uint_2(0, n));
  sink(f_uint_1(n));
  n = 0;
  sink(f_uint_1(n));
  sink(f_uint_2(1, n));
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<test_uint>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    $0x0,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%esi
  mov    $0x0,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x0,%esi
  mov    %ebx,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebx,%esi
  mov    $0x0,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebx,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x0,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  pop    %rbx
  ret
```

assistant: ```c
void test_uint(unsigned n) {
  sink(f_uint_1(0));
  sink(f_uint_2(0, 1));
  sink(f_uint_2(1, 0));
  sink(f_uint_2(n, 0));
  sink(f_uint_2(0, n));
  sink(f_uint_1(n));
  n = 0;
  sink(f_uint_1(n));
  sink(f_uint_2(1, n));
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<test_uint>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  xor    %edi,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %esi,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %esi,%esi
  mov    %ebp,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebp,%esi
  xor    %edi,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebp,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %edi,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%edi
  xor    %esi,%esi
  call   <f_uint_2@plt>
  pop    %rbp
  mov    %eax,%edi
  jmp    1090 <sink@plt>
```

assistant: ```c
void test_uint(unsigned n) {
  sink(f_uint_1(0));
  sink(f_uint_2(0, 1));
  sink(f_uint_2(1, 0));
  sink(f_uint_2(n, 0));
  sink(f_uint_2(0, n));
  sink(f_uint_1(n));
  n = 0;
  sink(f_uint_1(n));
  sink(f_uint_2(1, n));
}
```
user: Translate the below assembly code into C programming language:

```asm
<test_uint>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  xor    %edi,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %esi,%esi
  mov    $0x1,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %esi,%esi
  mov    %ebp,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebp,%esi
  xor    %edi,%edi
  call   <f_uint_2@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    %ebp,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  xor    %edi,%edi
  call   <f_uint_1@plt>
  mov    %eax,%edi
  call   <sink@plt>
  mov    $0x1,%edi
  xor    %esi,%esi
  call   <f_uint_2@plt>
  pop    %rbp
  mov    %eax,%edi
  jmp    1090 <sink@plt>
```

assistant: ```c
void test_uint(unsigned n) {
  sink(f_uint_1(0));
  sink(f_uint_2(0, 1));
  sink(f_uint_2(1, 0));
  sink(f_uint_2(n, 0));
  sink(f_uint_2(0, n));
  sink(f_uint_1(n));
  n = 0;
  sink(f_uint_1(n));
  sink(f_uint_2(1, n));
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<kwboot_tty_recv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %ecx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xffffffff,-0x30(%rbp)
  lea    -0x34(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x34(%rbp),%rdx
  mov    -0x44(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  movq   $0x0,-0x18(%rbp)
  mov    -0x48(%rbp),%eax
  imul   $0x3e8,%eax,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  cmp    $0xf4240,%eax
  jle    L81
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x431bde83,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x12,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cltq
  add    %rcx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%edx
  movslq %edx,%rax
  imul   $0x431bde83,%rax,%rax
  shr    $0x20,%rax
  sar    $0x12,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0xf4240,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x20(%rbp)
L81:
  mov    -0x44(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x20(%rbp),%rdx
  lea    -0x34(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  call   <select@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  js     L39
  cmpl   $0x0,-0x2c(%rbp)
  jne    L7
  mov    D3(%rip),%rax
  mov    (%rax),%edx
  mov    D7(%rip),%rax
  mov    %edx,(%rax)
  jmp    L13
L7:
  mov    -0x58(%rbp),%rdx
  mov    -0x50(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  js     L0
  mov    -0x28(%rbp),%rax
  add    %rax,-0x50(%rbp)
  mov    -0x28(%rbp),%rax
  sub    %rax,-0x58(%rbp)
  cmpq   $0x0,-0x58(%rbp)
  jne    L81
  movl   $0x0,-0x30(%rbp)
  jmp    L13
L39:
  nop
  jmp    L13
L0:
  nop
L13:
  mov    -0x30(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L66
  call   <__stack_chk_fail@plt>
L66:
  leave
  ret
```

assistant: ```c
int kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) {
  int rc, nfds;
  fd_set rfds;
  struct timeval tv;
  ssize_t n;
  rc = -1;
  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);
  tv.tv_sec = 0;
  tv.tv_usec = timeo * 1000;
  if (tv.tv_usec > 1000000) {
    tv.tv_sec += tv.tv_usec / 1000000;
    tv.tv_usec %= 1000000;
  }
  do {
    nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
    if (nfds < 0)
      goto out;
    if (!nfds) {
      errno = ETIMEDOUT;
      goto out;
    }
    n = read(fd, buf, len);
    if (n < 0)
      goto out;
    buf = (char *)buf + n;
    len -= n;
  } while (len > 0);
  rc = 0;
out:
  return rc;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<kwboot_tty_recv>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbp
  mov    %rdx,%rbx
  mov    %ecx,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r14
  mov    %r14,%rdi
  call   <FD_ZERO@plt>
  mov    %r14,%rsi
  mov    %r12d,%edi
  call   <FD_SET@plt>
  movq   $0x0,0x18(%rsp)
  imul   $0x3e8,%r13d,%ecx
  mov    %ecx,0x10(%rsp)
  cmp    $0xf4240,%ecx
  jle    L18
  movslq %ecx,%rax
  imul   $0x431bde83,%rax,%rax
  sar    $0x32,%rax
  mov    %ecx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  movslq %eax,%rdx
  mov    %rdx,0x18(%rsp)
  imul   $0xf4240,%eax,%eax
  sub    %eax,%ecx
  mov    %ecx,0x10(%rsp)
L18:
  lea    0x10(%rsp),%r13
L23:
  lea    0xc(%rsp),%rsi
  lea    0x1(%r12),%edi
  mov    %r13,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  call   <select@plt>
  test   %eax,%eax
  js     L85
  je     L34
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  test   %rax,%rax
  js     L59
  add    %rax,%rbp
  sub    %rax,%rbx
  jne    L23
  mov    $0x0,%eax
  jmp    L52
L34:
  mov    D2(%rip),%rax
  mov    (%rax),%edx
  mov    D16(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L52
L85:
  mov    $0xffffffff,%eax
L52:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L56
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L59:
  mov    $0xffffffff,%eax
  jmp    L52
L56:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) {
  int rc, nfds;
  fd_set rfds;
  struct timeval tv;
  ssize_t n;
  rc = -1;
  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);
  tv.tv_sec = 0;
  tv.tv_usec = timeo * 1000;
  if (tv.tv_usec > 1000000) {
    tv.tv_sec += tv.tv_usec / 1000000;
    tv.tv_usec %= 1000000;
  }
  do {
    nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
    if (nfds < 0)
      goto out;
    if (!nfds) {
      errno = ETIMEDOUT;
      goto out;
    }
    n = read(fd, buf, len);
    if (n < 0)
      goto out;
    buf = (char *)buf + n;
    len -= n;
  } while (len > 0);
  rc = 0;
out:
  return rc;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<kwboot_tty_recv>:
  endbr64
  push   %r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r13
  mov    %r13,%rdi
  call   <FD_ZERO@plt>
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <FD_SET@plt>
  imul   $0x3e8,%r14d,%ecx
  movq   $0x0,0x18(%rsp)
  mov    %ecx,0x10(%rsp)
  cmp    $0xf4240,%ecx
  jle    L2
  movslq %ecx,%rax
  mov    %ecx,%edx
  imul   $0x431bde83,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x32,%rax
  sub    %edx,%eax
  movslq %eax,%rdx
  imul   $0xf4240,%eax,%eax
  mov    %rdx,0x18(%rsp)
  sub    %eax,%ecx
  mov    %ecx,0x10(%rsp)
L2:
  lea    0x1(%r12),%r15d
  lea    0x10(%rsp),%r14
  jmp    L27
  nopw   0x0(%rax,%rax,1)
L9:
  je     L73
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  test   %rax,%rax
  js     L25
  add    %rax,%rbp
  sub    %rax,%rbx
  je     L7
L27:
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %r14,%r8
  mov    %r13,%rsi
  mov    %r15d,%edi
  call   <select@plt>
  test   %eax,%eax
  jns    L9
L25:
  mov    $0xffffffff,%eax
L11:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L73:
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    D16(%rip),%rax
  mov    %edx,(%rax)
  jmp    L25
  nopl   0x0(%rax)
L7:
  xor    %eax,%eax
  jmp    L11
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) {
  int rc, nfds;
  fd_set rfds;
  struct timeval tv;
  ssize_t n;
  rc = -1;
  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);
  tv.tv_sec = 0;
  tv.tv_usec = timeo * 1000;
  if (tv.tv_usec > 1000000) {
    tv.tv_sec += tv.tv_usec / 1000000;
    tv.tv_usec %= 1000000;
  }
  do {
    nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
    if (nfds < 0)
      goto out;
    if (!nfds) {
      errno = ETIMEDOUT;
      goto out;
    }
    n = read(fd, buf, len);
    if (n < 0)
      goto out;
    buf = (char *)buf + n;
    len -= n;
  } while (len > 0);
  rc = 0;
out:
  return rc;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<kwboot_tty_recv>:
  endbr64
  push   %r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r13
  mov    %r13,%rdi
  call   <FD_ZERO@plt>
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <FD_SET@plt>
  imul   $0x3e8,%r14d,%ecx
  movq   $0x0,0x18(%rsp)
  mov    %ecx,0x10(%rsp)
  cmp    $0xf4240,%ecx
  jle    L6
  movslq %ecx,%rax
  mov    %ecx,%edx
  imul   $0x431bde83,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x32,%rax
  sub    %edx,%eax
  movslq %eax,%rdx
  imul   $0xf4240,%eax,%eax
  mov    %rdx,0x18(%rsp)
  sub    %eax,%ecx
  mov    %ecx,0x10(%rsp)
L6:
  lea    0x1(%r12),%r15d
  lea    0x10(%rsp),%r14
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L15:
  je     L29
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  test   %rax,%rax
  js     L26
  add    %rax,%rbp
  sub    %rax,%rbx
  je     L36
L66:
  xor    %ecx,%ecx
  xor    %edx,%edx
  mov    %r14,%r8
  mov    %r13,%rsi
  mov    %r15d,%edi
  call   <select@plt>
  test   %eax,%eax
  jns    L15
L26:
  mov    $0xffffffff,%eax
L76:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L82
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L29:
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  mov    D17(%rip),%rax
  mov    %edx,(%rax)
  jmp    L26
  nopl   0x0(%rax)
L36:
  xor    %eax,%eax
  jmp    L76
L82:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) {
  int rc, nfds;
  fd_set rfds;
  struct timeval tv;
  ssize_t n;
  rc = -1;
  FD_ZERO(&rfds);
  FD_SET(fd, &rfds);
  tv.tv_sec = 0;
  tv.tv_usec = timeo * 1000;
  if (tv.tv_usec > 1000000) {
    tv.tv_sec += tv.tv_usec / 1000000;
    tv.tv_usec %= 1000000;
  }
  do {
    nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
    if (nfds < 0)
      goto out;
    if (!nfds) {
      errno = ETIMEDOUT;
      goto out;
    }
    n = read(fd, buf, len);
    if (n < 0)
      goto out;
    buf = (char *)buf + n;
    len -= n;
  } while (len > 0);
  rc = 0;
out:
  return rc;
}
```