ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<Recv>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r14d
  mov    %rsi,%rbx
  mov    %rdx,%r13
  mov    %ecx,%r12d
  mov    $0x0,%ebp
  jmp    L6
L17:
  add    %eax,%ebp
  cltq
  add    %rax,%rbx
L6:
  movslq %ebp,%rax
  mov    %r13,%rdx
  sub    %rax,%rdx
  mov    %r12d,%ecx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  call   <recv@plt>
  test   %eax,%eax
  jg     L17
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int Recv(int socket, void *buffer, socklen_t size, int flag) {
  void *ptr = buffer;
  int received = 0, bytes = -1;
  while ((bytes = recv(socket, ptr, size - received, flag)) > 0) {
    received += bytes;
    ptr += bytes;
  }
  return received;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<Recv>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %ecx,%ebx
  jmp    L10
  nopl   0x0(%rax)
L9:
  add    %eax,%r14d
  cltq
  add    %rax,%r13
L10:
  movslq %r14d,%rax
  mov    %rbp,%rdx
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sub    %rax,%rdx
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  jg     L9
  pop    %rbx
  mov    %r14d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int Recv(int socket, void *buffer, socklen_t size, int flag) {
  void *ptr = buffer;
  int received = 0, bytes = -1;
  while ((bytes = recv(socket, ptr, size - received, flag)) > 0) {
    received += bytes;
    ptr += bytes;
  }
  return received;
}
```
user: Translate the below assembly code into C programming language:

```asm
<Recv>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %ecx,%ebx
  jmp    L5
  nopl   0x0(%rax)
L13:
  add    %eax,%r14d
  cltq
  add    %rax,%r13
L5:
  movslq %r14d,%rax
  mov    %rbp,%rdx
  mov    %ebx,%ecx
  mov    %r13,%rsi
  sub    %rax,%rdx
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  jg     L13
  pop    %rbx
  mov    %r14d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int Recv(int socket, void *buffer, socklen_t size, int flag) {
  void *ptr = buffer;
  int received = 0, bytes = -1;
  while ((bytes = recv(socket, ptr, size - received, flag)) > 0) {
    received += bytes;
    ptr += bytes;
  }
  return received;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<is_number>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  jmp    L23
L37:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L20
  mov    $0x0,%eax
  jmp    L16
L20:
  addq   $0x1,-0x8(%rbp)
L23:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L37
  mov    $0x1,%eax
L16:
  leave
  ret
```

assistant: ```c
int is_number(char *num_str) {
  for (; *num_str != '\0'; num_str++) {
    if (!isdigit((unsigned char)*num_str)) {
      return (0);
    }
  }
  return (1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<is_number>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L21
L36:
  movzbl %dil,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L38
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L36
  mov    $0x1,%eax
L38:
  pop    %rbx
  ret
L21:
  mov    $0x1,%eax
  jmp    L38
```

assistant: ```c
int is_number(char *num_str) {
  for (; *num_str != '\0'; num_str++) {
    if (!isdigit((unsigned char)*num_str)) {
      return (0);
    }
  }
  return (1);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<is_number>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  test   %dil,%dil
  jne    L29
  jmp    L9
  nopw   0x0(%rax,%rax,1)
L18:
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L9
L29:
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L18
  pop    %rbx
  ret
L9:
  mov    $0x1,%eax
  pop    %rbx
  ret
```

assistant: ```c
int is_number(char *num_str) {
  for (; *num_str != '\0'; num_str++) {
    if (!isdigit((unsigned char)*num_str)) {
      return (0);
    }
  }
  return (1);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<is_number>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  test   %dil,%dil
  jne    L7
  jmp    L35
  nopw   0x0(%rax,%rax,1)
L9:
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L35
L7:
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L9
  pop    %rbx
  ret
L35:
  mov    $0x1,%eax
  pop    %rbx
  ret
```

assistant: ```c
int is_number(char *num_str) {
  for (; *num_str != '\0'; num_str++) {
    if (!isdigit((unsigned char)*num_str)) {
      return (0);
    }
  }
  return (1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ClientFromName>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x430,%rsp
  mov    %rdi,-0x428(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D40(%rip),%eax
  test   %eax,%eax
  jne    L42
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <trap_Cvar_VariableIntegerValue@plt>
  mov    %eax,D21(%rip)
L42:
  movl   $0x0,-0x414(%rbp)
  jmp    L0
L12:
  mov    -0x414(%rbp),%eax
  lea    0x240(%rax),%ecx
  lea    -0x410(%rbp),%rax
  mov    $0x400,%edx
  mov    %rax,%rsi
  mov    %ecx,%edi
  call   <trap_GetConfigstring@plt>
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <Q_CleanStr@plt>
  lea    -0x410(%rbp),%rax
  lea    D21(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <Info_ValueForKey@plt>
  mov    %eax,%edx
  mov    -0x428(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <Q_stricmp@plt>
  test   %eax,%eax
  jne    L67
  mov    -0x414(%rbp),%eax
  jmp    L38
L67:
  addl   $0x1,-0x414(%rbp)
L0:
  mov    D21(%rip),%eax
  cmp    %eax,-0x414(%rbp)
  jge    L61
  cmpl   $0x3f,-0x414(%rbp)
  jle    L12
L61:
  mov    $0xffffffff,%eax
L38:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D9
type: string
name: unpack_data
arguments: tag: D21
type: string

tool: D9: sv_maxclients

tool: D21: n

assistant: ```c
int ClientFromName(char *name) {
  int i;
  char buf[1024];
  static int maxclients;
  if (!maxclients)
    maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
  for (i = 0; i < maxclients && i < 64; i++) {
    trap_GetConfigstring(((64 + 256) + 256) + i, buf, sizeof(buf));
    Q_CleanStr(buf);
    if (!Q_stricmp(Info_ValueForKey(buf, "n"), name))
      return i;
  }
  return -1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<find_header_value>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x8(%rbp)
  jmp    L13
L52:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mem_case_equal@plt>
  test   %rax,%rax
  je     L72
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L72
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    D33(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strspn@plt>
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  jmp    L73
L72:
  mov    -0x18(%rbp),%rax
  lea    D16(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcspn@plt>
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2,%edx
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  je     L19
  mov    $0x2,%eax
  jmp    L21
L19:
  mov    $0x0,%eax
L21:
  cltq
  add    %rax,-0x18(%rbp)
L13:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L42
  mov    -0x18(%rbp),%rax
  mov    $0x2,%edx
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  je     L52
L42:
  mov    $0x0,%eax
L73:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D33
datatype: string
name: disassemble_data
arguments: data_tag: D16
datatype: string
name: disassemble_data
arguments: data_tag: D25
datatype: string

tool: D33:  	

tool: D16: 

tool: D25: 


assistant: ```c
const char *find_header_value(const char *str, const char *field) {
  size_t len = strlen(field);
  while (*str && !mem_equal(str, "\r\n", 2)) {
    if (mem_case_equal(str, field, len) && str[len] == ':') {
      str += len + 1;
      return str + strspn(str, " \t");
    }
    str += strcspn(str, "\r");
    str += mem_equal(str, "\r\n", 2) ? 2 : 0;
  }
  return NULL;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<find_header_value>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%r13
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %rax,%r12
  lea    D20(%rip),%rbp
  lea    D4(%rip),%r14
  mov    $0x0,%eax
  cmpb   $0x0,(%rbx)
  jne    L60
  jmp    L43
L32:
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <strcspn@plt>
  cltq
  add    %rax,%rbx
  mov    $0x2,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  lea    (%rbx,%rax,2),%rbx
  cmpb   $0x0,(%rbx)
  je     L23
L60:
  mov    $0x2,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  jne    L33
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <mem_case_equal@plt>
  test   %rax,%rax
  je     L32
  cmpb   $0x3a,(%rbx,%r12,1)
  jne    L32
  lea    0x1(%rbx,%r12,1),%rbx
  lea    D21(%rip),%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  cltq
  add    %rbx,%rax
  jmp    L43
L33:
  mov    $0x0,%eax
L43:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L23:
  mov    $0x0,%eax
  jmp    L43
```

tool_calls: name: retrieve_data
arguments: tag: D20
type_infered: string
name: retrieve_data
arguments: tag: D4
type_infered: string
name: retrieve_data
arguments: tag: D21
type_infered: string

tool: D20: 


tool: D4: 

tool: D21:  	

assistant: ```c
const char *find_header_value(const char *str, const char *field) {
  size_t len = strlen(field);
  while (*str && !mem_equal(str, "\r\n", 2)) {
    if (mem_case_equal(str, field, len) && str[len] == ':') {
      str += len + 1;
      return str + strspn(str, " \t");
    }
    str += strcspn(str, "\r");
    str += mem_equal(str, "\r\n", 2) ? 2 : 0;
  }
  return NULL;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<find_header_value>:
  endbr64
  push   %r14
  lea    D9(%rip),%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  lea    D27(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  cmpb   $0x0,(%rbx)
  mov    %rax,%r12
  jne    L31
  jmp    L59
  nopw   0x0(%rax,%rax,1)
L52:
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <mem_case_equal@plt>
  test   %rax,%rax
  je     L25
  cmpb   $0x3a,(%rbx,%r12,1)
  je     L58
L25:
  mov    %rbx,%rdi
  mov    %r14,%rsi
  call   <strcspn@plt>
  mov    $0x2,%edx
  mov    %rbp,%rsi
  cltq
  add    %rax,%rbx
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  lea    (%rbx,%rax,2),%rbx
  cmpb   $0x0,(%rbx)
  je     L59
L31:
  mov    $0x2,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  je     L52
L59:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L58:
  lea    0x1(%rbx,%r12,1),%rbx
  lea    D12(%rip),%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  cltq
  add    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: parse_data
arguments: label: D9
type_guessed: string
name: parse_data
arguments: label: D27
type_guessed: string
name: parse_data
arguments: label: D12
type_guessed: string

tool: D9: 

tool: D27: 


tool: D12:  	

assistant: ```c
const char *find_header_value(const char *str, const char *field) {
  size_t len = strlen(field);
  while (*str && !mem_equal(str, "\r\n", 2)) {
    if (mem_case_equal(str, field, len) && str[len] == ':') {
      str += len + 1;
      return str + strspn(str, " \t");
    }
    str += strcspn(str, "\r");
    str += mem_equal(str, "\r\n", 2) ? 2 : 0;
  }
  return NULL;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<find_header_value>:
  endbr64
  push   %r14
  lea    D29(%rip),%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  lea    D19(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  cmpb   $0x0,(%rbx)
  mov    %rax,%r12
  jne    L10
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L24:
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <mem_case_equal@plt>
  test   %rax,%rax
  je     L5
  cmpb   $0x3a,(%rbx,%r12,1)
  je     L22
L5:
  mov    %rbx,%rdi
  mov    %r14,%rsi
  call   <strcspn@plt>
  mov    $0x2,%edx
  mov    %rbp,%rsi
  cltq
  add    %rax,%rbx
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  lea    (%rbx,%rax,2),%rbx
  cmpb   $0x0,(%rbx)
  je     L3
L10:
  mov    $0x2,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <mem_equal@plt>
  test   %rax,%rax
  je     L24
L3:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L22:
  lea    0x1(%rbx,%r12,1),%rbx
  lea    D26(%rip),%rsi
  mov    %rbx,%rdi
  call   <strspn@plt>
  cltq
  add    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D29
data_type: string
name: unpack_data
arguments: data_tag: D19
data_type: string
name: unpack_data
arguments: data_tag: D26
data_type: string

tool: D29: 

tool: D19: 


tool: D26:  	

assistant: ```c
const char *find_header_value(const char *str, const char *field) {
  size_t len = strlen(field);
  while (*str && !mem_equal(str, "\r\n", 2)) {
    if (mem_case_equal(str, field, len) && str[len] == ':') {
      str += len + 1;
      return str + strspn(str, " \t");
    }
    str += strcspn(str, "\r");
    str += mem_equal(str, "\r\n", 2) ? 2 : 0;
  }
  return NULL;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<kopiuj>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L12
L7:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x4(%rbp)
L12:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L7
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void kopiuj(char tab1[], char *tab2) {
  int i = 0;
  while (tab1[i] != '\0') {
    tab2[i] = tab1[i];
    i++;
  }
  tab2[i] = '\0';
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<kopiuj>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L20
  mov    $0x0,%eax
L4:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  test   %dl,%dl
  jne    L4
L18:
  movb   $0x0,(%rsi,%rax,1)
  ret
L20:
  mov    $0x0,%eax
  jmp    L18
```

assistant: ```c
void kopiuj(char tab1[], char *tab2) {
  int i = 0;
  while (tab1[i] != '\0') {
    tab2[i] = tab1[i];
    i++;
  }
  tab2[i] = '\0';
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<kopiuj>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L11
  xor    %eax,%eax
  nopl   (%rax)
L8:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  test   %dl,%dl
  jne    L8
  add    %rax,%rsi
L11:
  movb   $0x0,(%rsi)
  ret
```

assistant: ```c
void kopiuj(char tab1[], char *tab2) {
  int i = 0;
  while (tab1[i] != '\0') {
    tab2[i] = tab1[i];
    i++;
  }
  tab2[i] = '\0';
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<kopiuj>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L2
  xor    %eax,%eax
  nopl   (%rax)
L12:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  test   %dl,%dl
  jne    L12
  add    %rax,%rsi
L2:
  movb   $0x0,(%rsi)
  ret
```

assistant: ```c
void kopiuj(char tab1[], char *tab2) {
  int i = 0;
  while (tab1[i] != '\0') {
    tab2[i] = tab1[i];
    i++;
  }
  tab2[i] = '\0';
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<readline>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x0,-0x4(%rbp)
  movb   $0x20,-0x5(%rbp)
  movb   $0x20,-0x6(%rbp)
  jmp    L40
L89:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <getc@plt>
  mov    %al,-0x6(%rbp)
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x4(%rbp)
  jne    L88
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    $0x1,%eax
  jmp    L85
L88:
  movsbl -0x6(%rbp),%eax
  mov    %eax,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  je     L83
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  jne    L40
L83:
  movsbl -0x6(%rbp),%eax
  mov    %eax,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  je     L72
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x20,(%rax)
  jmp    L8
L72:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x6(%rbp),%eax
  mov    %al,(%rdx)
L8:
  movzbl -0x6(%rbp),%eax
  mov    %al,-0x5(%rbp)
  addl   $0x1,-0x4(%rbp)
L40:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %eax,%eax
  jne    L16
  cmpb   $0xa,-0x6(%rbp)
  jne    L89
L16:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
L85:
  leave
  ret
```

assistant: ```c
int readline(FILE *fd, char *line, int len) {
  char c, lastc;
  int pos;
  pos = 0;
  lastc = ' ';
  c = ' ';
  while ((!feof(fd)) && (c != '\n')) {
    c = (char)getc(fd);
    if (pos == len - 1) {
      line[len] = (char)0;
      return 1;
    } else {
      if ((!(whitespace(c))) || (!(whitespace(lastc)))) {
        if (whitespace(c))
          line[pos] = ' ';
        else
          line[pos] = c;
        lastc = c;
        pos++;
      }
    }
  }
  line[pos] = (char)0;
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<readline>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,(%rsp)
  mov    %edx,0xc(%rsp)
  mov    $0x0,%ebp
  movb   $0x20,0xb(%rsp)
  mov    $0x20,%r14d
  lea    -0x1(%rdx),%r15d
  jmp    L63
L3:
  movslq 0xc(%rsp),%rax
  mov    (%rsp),%rsi
  movb   $0x0,(%rsi,%rax,1)
  mov    $0x1,%eax
  jmp    L55
L88:
  mov    %r12d,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  je     L16
  movslq %ebp,%rax
  mov    (%rsp),%rcx
  movb   $0x20,(%rcx,%rax,1)
L6:
  add    $0x1,%ebp
  mov    %bl,0xb(%rsp)
L63:
  mov    %r13,%rdi
  call   <feof@plt>
  cmp    $0xa,%r14b
  je     L90
  test   %eax,%eax
  jne    L90
  mov    %r13,%rdi
  call   <getc@plt>
  mov    %rax,%rbx
  mov    %eax,%r14d
  cmp    %ebp,%r15d
  je     L3
  movsbl %al,%r12d
  mov    %r12d,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  je     L88
  movsbl 0xb(%rsp),%edi
  call   <whitespace@plt>
  test   %rax,%rax
  jne    L63
  jmp    L88
L16:
  movslq %ebp,%rax
  mov    (%rsp),%rdx
  mov    %bl,(%rdx,%rax,1)
  jmp    L6
L90:
  movslq %ebp,%rbp
  mov    (%rsp),%rax
  movb   $0x0,(%rax,%rbp,1)
  mov    $0x0,%eax
L55:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int readline(FILE *fd, char *line, int len) {
  char c, lastc;
  int pos;
  pos = 0;
  lastc = ' ';
  c = ' ';
  while ((!feof(fd)) && (c != '\n')) {
    c = (char)getc(fd);
    if (pos == len - 1) {
      line[len] = (char)0;
      return 1;
    } else {
      if ((!(whitespace(c))) || (!(whitespace(lastc)))) {
        if (whitespace(c))
          line[pos] = ' ';
        else
          line[pos] = c;
        lastc = c;
        pos++;
      }
    }
  }
  line[pos] = (char)0;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<readline>:
  endbr64
  push   %r15
  mov    %edx,%eax
  push   %r14
  sub    $0x1,%eax
  mov    $0x20,%r14d
  push   %r13
  mov    $0x20,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,(%rsp)
  mov    %edx,0xc(%rsp)
  mov    %eax,0x8(%rsp)
L47:
  mov    %r12,%rdi
  call   <feof@plt>
  cmp    $0xa,%r13b
  je     L26
L37:
  test   %eax,%eax
  jne    L26
  mov    %r12,%rdi
  call   <getc@plt>
  mov    %rax,%rbx
  mov    %eax,%r13d
  cmp    %ebp,0x8(%rsp)
  je     L24
  movsbl %al,%r15d
  mov    %r15d,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  je     L57
  movsbl %r14b,%edi
  call   <whitespace@plt>
  test   %rax,%rax
  jne    L47
L57:
  mov    %r15d,%edi
  mov    %ebx,%r14d
  call   <whitespace@plt>
  mov    (%rsp),%rcx
  movslq %ebp,%rdx
  mov    %r12,%rdi
  test   %rax,%rax
  mov    $0x20,%eax
  cmove  %ebx,%eax
  add    $0x1,%ebp
  mov    %al,(%rcx,%rdx,1)
  call   <feof@plt>
  cmp    $0xa,%r13b
  jne    L37
L26:
  mov    (%rsp),%rax
  movslq %ebp,%rbp
  movb   $0x0,(%rax,%rbp,1)
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L24:
  movslq 0xc(%rsp),%rax
  mov    (%rsp),%rsi
  movb   $0x0,(%rsi,%rax,1)
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int readline(FILE *fd, char *line, int len) {
  char c, lastc;
  int pos;
  pos = 0;
  lastc = ' ';
  c = ' ';
  while ((!feof(fd)) && (c != '\n')) {
    c = (char)getc(fd);
    if (pos == len - 1) {
      line[len] = (char)0;
      return 1;
    } else {
      if ((!(whitespace(c))) || (!(whitespace(lastc)))) {
        if (whitespace(c))
          line[pos] = ' ';
        else
          line[pos] = c;
        lastc = c;
        pos++;
      }
    }
  }
  line[pos] = (char)0;
  return 0;
}
```