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

```asm
<exit_with_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D0
datatype: string

tool: D0: Usage: train [options] training_set_file [model_file]
options:
-s type : set type of solver (default 0)
	0 -- L2-regularized L2-loss support vector classification (primal)
	1 -- L2-regularized L2-loss support vector regression (primal)
	2 -- L2-regularized L1-loss support vector regression (dual)
	3 -- L2-regularized L2-loss rankSVM (direct count)
	4 -- L2-regularized L2-loss rankSVM (y red-black tree)
	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)
	6 -- L2-regularized L2-loss rankSVM (selection tree)
	7 -- L2-regularized L2-loss rankSVM (y AVL tree)
	8 -- L2-regularized L2-loss rankSVM (y AA tree)
	9 -- PRSVM+
-c cost : set the parameter C (default 1)
-p epsilon : set the epsilon in loss function of SVR (default 0.1)
-e epsilon : set tolerance of termination criterion
	-s 0
		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,
		where f is the primal function and pos/neg are # of
		positive/negative data (default 0.01)
	-s 1, 3, 4, 5, 6, 7, 8, and 9
		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)
	-s 2
		Dual maximal violation <= eps; similar to libsvm (default 0.1)
-q : quiet mode (no outputs)


assistant: ```c
void exit_with_help() {
  printf("Usage: train [options] training_set_file [model_file]\n"
         "options:\n"
         "-s type : set type of solver (default 0)\n"
         "	0 -- L2-regularized L2-loss support vector classification (primal)\n"
         "	1 -- L2-regularized L2-loss support vector regression (primal)\n"
         "	2 -- L2-regularized L1-loss support vector regression (dual)\n"
         "	3 -- L2-regularized L2-loss rankSVM (direct count)\n"
         "	4 -- L2-regularized L2-loss rankSVM (y red-black tree)\n"
         "	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)\n"
         "	6 -- L2-regularized L2-loss rankSVM (selection tree)\n"
         "	7 -- L2-regularized L2-loss rankSVM (y AVL tree)\n"
         "	8 -- L2-regularized L2-loss rankSVM (y AA tree)\n"
         "	9 -- PRSVM+\n"
         "-c cost : set the parameter C (default 1)\n"
         "-p epsilon : set the epsilon in loss function of SVR (default 0.1)\n"
         "-e epsilon : set tolerance of termination criterion\n"
         "	-s 0\n"
         "		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,\n"
         "		where f is the primal function and pos/neg are # of\n"
         "		positive/negative data (default 0.01)\n"
         "	-s 1, 3, 4, 5, 6, 7, 8, and 9\n"
         "		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)\n"
         "	-s 2\n"
         "		Dual maximal violation <= eps; similar to libsvm (default 0.1)\n"
         "-q : quiet mode (no outputs)\n");
  exit(1);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<exit_with_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  add    $0x8,%rsp
  jmp    1070 <exit@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D9
data_type: string

tool: D9: Usage: train [options] training_set_file [model_file]
options:
-s type : set type of solver (default 0)
	0 -- L2-regularized L2-loss support vector classification (primal)
	1 -- L2-regularized L2-loss support vector regression (primal)
	2 -- L2-regularized L1-loss support vector regression (dual)
	3 -- L2-regularized L2-loss rankSVM (direct count)
	4 -- L2-regularized L2-loss rankSVM (y red-black tree)
	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)
	6 -- L2-regularized L2-loss rankSVM (selection tree)
	7 -- L2-regularized L2-loss rankSVM (y AVL tree)
	8 -- L2-regularized L2-loss rankSVM (y AA tree)
	9 -- PRSVM+
-c cost : set the parameter C (default 1)
-p epsilon : set the epsilon in loss function of SVR (default 0.1)
-e epsilon : set tolerance of termination criterion
	-s 0
		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,
		where f is the primal function and pos/neg are # of
		positive/negative data (default 0.01)
	-s 1, 3, 4, 5, 6, 7, 8, and 9
		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)
	-s 2
		Dual maximal violation <= eps; similar to libsvm (default 0.1)
-q : quiet mode (no outputs)


assistant: ```c
void exit_with_help() {
  printf("Usage: train [options] training_set_file [model_file]\n"
         "options:\n"
         "-s type : set type of solver (default 0)\n"
         "	0 -- L2-regularized L2-loss support vector classification (primal)\n"
         "	1 -- L2-regularized L2-loss support vector regression (primal)\n"
         "	2 -- L2-regularized L1-loss support vector regression (dual)\n"
         "	3 -- L2-regularized L2-loss rankSVM (direct count)\n"
         "	4 -- L2-regularized L2-loss rankSVM (y red-black tree)\n"
         "	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)\n"
         "	6 -- L2-regularized L2-loss rankSVM (selection tree)\n"
         "	7 -- L2-regularized L2-loss rankSVM (y AVL tree)\n"
         "	8 -- L2-regularized L2-loss rankSVM (y AA tree)\n"
         "	9 -- PRSVM+\n"
         "-c cost : set the parameter C (default 1)\n"
         "-p epsilon : set the epsilon in loss function of SVR (default 0.1)\n"
         "-e epsilon : set tolerance of termination criterion\n"
         "	-s 0\n"
         "		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,\n"
         "		where f is the primal function and pos/neg are # of\n"
         "		positive/negative data (default 0.01)\n"
         "	-s 1, 3, 4, 5, 6, 7, 8, and 9\n"
         "		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)\n"
         "	-s 2\n"
         "		Dual maximal violation <= eps; similar to libsvm (default 0.1)\n"
         "-q : quiet mode (no outputs)\n");
  exit(1);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<exit_with_help>:
  endbr64
  sub    $0x8,%rsp
  lea    D3(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  add    $0x8,%rsp
  jmp    1070 <exit@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D3
datatype: string

tool: D3: Usage: train [options] training_set_file [model_file]
options:
-s type : set type of solver (default 0)
	0 -- L2-regularized L2-loss support vector classification (primal)
	1 -- L2-regularized L2-loss support vector regression (primal)
	2 -- L2-regularized L1-loss support vector regression (dual)
	3 -- L2-regularized L2-loss rankSVM (direct count)
	4 -- L2-regularized L2-loss rankSVM (y red-black tree)
	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)
	6 -- L2-regularized L2-loss rankSVM (selection tree)
	7 -- L2-regularized L2-loss rankSVM (y AVL tree)
	8 -- L2-regularized L2-loss rankSVM (y AA tree)
	9 -- PRSVM+
-c cost : set the parameter C (default 1)
-p epsilon : set the epsilon in loss function of SVR (default 0.1)
-e epsilon : set tolerance of termination criterion
	-s 0
		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,
		where f is the primal function and pos/neg are # of
		positive/negative data (default 0.01)
	-s 1, 3, 4, 5, 6, 7, 8, and 9
		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)
	-s 2
		Dual maximal violation <= eps; similar to libsvm (default 0.1)
-q : quiet mode (no outputs)


assistant: ```c
void exit_with_help() {
  printf("Usage: train [options] training_set_file [model_file]\n"
         "options:\n"
         "-s type : set type of solver (default 0)\n"
         "	0 -- L2-regularized L2-loss support vector classification (primal)\n"
         "	1 -- L2-regularized L2-loss support vector regression (primal)\n"
         "	2 -- L2-regularized L1-loss support vector regression (dual)\n"
         "	3 -- L2-regularized L2-loss rankSVM (direct count)\n"
         "	4 -- L2-regularized L2-loss rankSVM (y red-black tree)\n"
         "	5 -- L2-regularized L2-loss rankSVM (wx red-black tree)\n"
         "	6 -- L2-regularized L2-loss rankSVM (selection tree)\n"
         "	7 -- L2-regularized L2-loss rankSVM (y AVL tree)\n"
         "	8 -- L2-regularized L2-loss rankSVM (y AA tree)\n"
         "	9 -- PRSVM+\n"
         "-c cost : set the parameter C (default 1)\n"
         "-p epsilon : set the epsilon in loss function of SVR (default 0.1)\n"
         "-e epsilon : set tolerance of termination criterion\n"
         "	-s 0\n"
         "		|f'(w)|_2 <= eps*min(pos,neg)/l*|f'(w0)|_2,\n"
         "		where f is the primal function and pos/neg are # of\n"
         "		positive/negative data (default 0.01)\n"
         "	-s 1, 3, 4, 5, 6, 7, 8, and 9\n"
         "		|f'(w)|_2 <= eps*|f'(w0)|_2 (default 0.001)\n"
         "	-s 2\n"
         "		Dual maximal violation <= eps; similar to libsvm (default 0.1)\n"
         "-q : quiet mode (no outputs)\n");
  exit(1);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<exit_usage>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  lea    D3(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <lprintf@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <exit@plt>
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D3
type: string

tool: D3: Usage: mgetty [-x debug] [-s speed] [-r] line

assistant: ```c
void exit_usage(int code) {
  lprintf(0, "Usage: mgetty [-x debug] [-s speed] [-r] line");
  exit(code);
}
```
user: Translate the below assembly code into C programming language:

```asm
<exit_usage>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  lea    D9(%rip),%rsi
  mov    $0x0,%edi
  call   <lprintf@plt>
  mov    %ebx,%edi
  call   <exit@plt>
  pop    %rbx
  ret
```

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

tool: D9: Usage: mgetty [-x debug] [-s speed] [-r] line

assistant: ```c
void exit_usage(int code) {
  lprintf(0, "Usage: mgetty [-x debug] [-s speed] [-r] line");
  exit(code);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<exit_usage>:
  endbr64
  push   %rbp
  lea    D0(%rip),%rsi
  mov    %edi,%ebp
  xor    %edi,%edi
  call   <lprintf@plt>
  mov    %ebp,%edi
  pop    %rbp
  jmp    1060 <exit@plt>
```

tool_calls: name: read_data
arguments: label: D0
type_guessed: string

tool: D0: Usage: mgetty [-x debug] [-s speed] [-r] line

assistant: ```c
void exit_usage(int code) {
  lprintf(0, "Usage: mgetty [-x debug] [-s speed] [-r] line");
  exit(code);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<exit_usage>:
  endbr64
  push   %rbp
  lea    D4(%rip),%rsi
  mov    %edi,%ebp
  xor    %edi,%edi
  call   <lprintf@plt>
  mov    %ebp,%edi
  pop    %rbp
  jmp    1060 <exit@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D4
type_infered: string

tool: D4: Usage: mgetty [-x debug] [-s speed] [-r] line

assistant: ```c
void exit_usage(int code) {
  lprintf(0, "Usage: mgetty [-x debug] [-s speed] [-r] line");
  exit(code);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<ft_putnbrendl>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <ft_putnbr@plt>
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <ft_putendl@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D7
datatype: string

tool: 

assistant: ```c
void ft_putnbrendl(int nb) {
  ft_putnbr(nb);
  ft_putendl("");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<ft_putnbrendl>:
  endbr64
  sub    $0x8,%rsp
  call   <ft_putnbr@plt>
  lea    D1(%rip),%rdi
  call   <ft_putendl@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: label: D1
type: string

tool: 

assistant: ```c
void ft_putnbrendl(int nb) {
  ft_putnbr(nb);
  ft_putendl("");
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<ft_putnbrendl>:
  endbr64
  sub    $0x8,%rsp
  call   <ft_putnbr@plt>
  lea    D6(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <ft_putendl@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D6
type_infered: string

tool: 

assistant: ```c
void ft_putnbrendl(int nb) {
  ft_putnbr(nb);
  ft_putendl("");
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<ft_putnbrendl>:
  endbr64
  sub    $0x8,%rsp
  call   <ft_putnbr@plt>
  lea    D6(%rip),%rdi
  add    $0x8,%rsp
  jmp    1070 <ft_putendl@plt>
```

tool_calls: name: retrieve_data
arguments: label: D6
data_type: string

tool: 

assistant: ```c
void ft_putnbrendl(int nb) {
  ft_putnbr(nb);
  ft_putendl("");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<LZ4_compress>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %edx,-0x14(%rbp)
  cmpl   $0x1000a,-0x14(%rbp)
  jg     L12
  mov    -0x14(%rbp),%ecx
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <LZ4_compress64kCtx@plt>
  jmp    L2
L12:
  mov    -0x14(%rbp),%ecx
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <LZ4_compressCtx@plt>
L2:
  leave
  ret
```

assistant: ```c
int LZ4_compress(const char *source, char *dest, int isize) {
  if (isize < (int)((1 << 16) + ((8 + 4) - 1)))
    return LZ4_compress64kCtx(NULL, source, dest, isize);
  return LZ4_compressCtx(NULL, source, dest, isize);
}
```
user: Translate the below assembly code into C programming language:

```asm
<LZ4_compress>:
  endbr64
  sub    $0x8,%rsp
  mov    %edx,%ecx
  cmp    $0x1000a,%edx
  jle    L5
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    $0x0,%edi
  call   <LZ4_compressCtx@plt>
L17:
  add    $0x8,%rsp
  ret
L5:
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  mov    $0x0,%edi
  call   <LZ4_compress64kCtx@plt>
  jmp    L17
```

assistant: ```c
int LZ4_compress(const char *source, char *dest, int isize) {
  if (isize < (int)((1 << 16) + ((8 + 4) - 1)))
    return LZ4_compress64kCtx(NULL, source, dest, isize);
  return LZ4_compressCtx(NULL, source, dest, isize);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<LZ4_compress>:
  endbr64
  mov    %edx,%ecx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  xor    %edi,%edi
  cmp    $0x1000a,%ecx
  jle    L6
  jmp    1060 <LZ4_compressCtx@plt>
  nopl   0x0(%rax,%rax,1)
L6:
  jmp    1070 <LZ4_compress64kCtx@plt>
```

assistant: ```c
int LZ4_compress(const char *source, char *dest, int isize) {
  if (isize < (int)((1 << 16) + ((8 + 4) - 1)))
    return LZ4_compress64kCtx(NULL, source, dest, isize);
  return LZ4_compressCtx(NULL, source, dest, isize);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<LZ4_compress>:
  endbr64
  mov    %edx,%ecx
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  xor    %edi,%edi
  cmp    $0x1000a,%ecx
  jle    L9
  jmp    1060 <LZ4_compressCtx@plt>
  nopl   0x0(%rax,%rax,1)
L9:
  jmp    1070 <LZ4_compress64kCtx@plt>
```

assistant: ```c
int LZ4_compress(const char *source, char *dest, int isize) {
  if (isize < (int)((1 << 16) + ((8 + 4) - 1)))
    return LZ4_compress64kCtx(NULL, source, dest, isize);
  return LZ4_compressCtx(NULL, source, dest, isize);
}
```
user: What is the c source code of the assembly code below:

```asm
<log2_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L15
L7:
  addl   $0x1,-0x4(%rbp)
L15:
  shrl   -0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jne    L7
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
unsigned int log2_int(unsigned int x) {
  unsigned int ans = 0;
  while (x >>= 1)
    ans++;
  return ans;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<log2_int>:
  endbr64
  shr    %edi
  je     L15
  mov    $0x0,%eax
L13:
  add    $0x1,%eax
  shr    %edi
  jne    L13
  ret
L15:
  mov    %edi,%eax
  ret
```

assistant: ```c
unsigned int log2_int(unsigned int x) {
  unsigned int ans = 0;
  while (x >>= 1)
    ans++;
  return ans;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<log2_int>:
  endbr64
  xor    %eax,%eax
  shr    %edi
  je     L9
  nopw   0x0(%rax,%rax,1)
L16:
  add    $0x1,%eax
  shr    %edi
  jne    L16
  ret
  nopl   0x0(%rax,%rax,1)
L9:
  ret
```

assistant: ```c
unsigned int log2_int(unsigned int x) {
  unsigned int ans = 0;
  while (x >>= 1)
    ans++;
  return ans;
}
```
user: Translate the below assembly code into C programming language:

```asm
<log2_int>:
  endbr64
  xor    %eax,%eax
  shr    %edi
  je     L3
  nopw   0x0(%rax,%rax,1)
L5:
  add    $0x1,%eax
  shr    %edi
  jne    L5
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  ret
```

assistant: ```c
unsigned int log2_int(unsigned int x) {
  unsigned int ans = 0;
  while (x >>= 1)
    ans++;
  return ans;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<__getspent_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x2c(%rbp)
L35:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jg     L13
  mov    $0xffffffff,%eax
  jmp    L12
L13:
  mov    -0x20(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L25
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rsi
  mov    -0x20(%rbp),%rax
  add    %rsi,%rax
  sub    %rax,%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <lseek@plt>
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <__sgetspent_r@plt>
  test   %rax,%rax
  jns    L22
  jmp    L35
L25:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jg     L20
  mov    $0xffffffff,%eax
  jmp    L12
L20:
  mov    -0x20(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L25
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    -0xc(%rbp),%ecx
  movslq %ecx,%rcx
  sub    %rcx,%rax
  lea    0x1(%rax),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <lseek@plt>
  jmp    L35
L22:
  mov    $0x0,%eax
L12:
  leave
  ret
```

assistant: ```c
int __getspent_r(struct spwd *spwd, char *line_buff, size_t buflen, int spwd_fd) {
  char *endptr;
  int line_len;
restart:
  if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
    return -1;
  endptr = strchr(line_buff, '\n');
  if (endptr != NULL)
    lseek(spwd_fd, (long)(1 + endptr - (line_buff + line_len)), SEEK_CUR);
  else {
    do {
      if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
        return -1;
    } while (!(endptr = strchr(line_buff, '\n')));
    lseek(spwd_fd, (long)(endptr - line_buff) - line_len + 1, SEEK_CUR);
    goto restart;
  }
  if (__sgetspent_r(line_buff, spwd, line_buff, buflen) < 0)
    goto restart;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<__getspent_r>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r14
  mov    %rsi,%rbp
  mov    %rdx,%r13
  mov    %ecx,%r12d
L16:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L31
  mov    $0xa,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L56
  lea    0x1(%rax),%rsi
  movslq %ebx,%rbx
  add    %rbp,%rbx
  sub    %rbx,%rsi
  mov    D16(%rip),%rax
  mov    (%rax),%edx
  mov    %r12d,%edi
  call   <lseek@plt>
  mov    %r13,%rcx
  mov    %rbp,%rdx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <__sgetspent_r@plt>
  test   %rax,%rax
  js     L16
  mov    $0x0,%eax
  jmp    L12
L56:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L49
  mov    $0xa,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L56
  sub    %rbp,%rax
  movslq %ebx,%rbx
  sub    %rbx,%rax
  lea    0x1(%rax),%rsi
  mov    D16(%rip),%rax
  mov    (%rax),%edx
  mov    %r12d,%edi
  call   <lseek@plt>
  jmp    L16
L31:
  mov    $0xffffffff,%eax
  jmp    L12
L49:
  mov    $0xffffffff,%eax
L12:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int __getspent_r(struct spwd *spwd, char *line_buff, size_t buflen, int spwd_fd) {
  char *endptr;
  int line_len;
restart:
  if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
    return -1;
  endptr = strchr(line_buff, '\n');
  if (endptr != NULL)
    lseek(spwd_fd, (long)(1 + endptr - (line_buff + line_len)), SEEK_CUR);
  else {
    do {
      if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
        return -1;
    } while (!(endptr = strchr(line_buff, '\n')));
    lseek(spwd_fd, (long)(endptr - line_buff) - line_len + 1, SEEK_CUR);
    goto restart;
  }
  if (__sgetspent_r(line_buff, spwd, line_buff, buflen) < 0)
    goto restart;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<__getspent_r>:
  endbr64
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  nopl   0x0(%rax,%rax,1)
L51:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  movslq %eax,%rbx
  test   %ebx,%ebx
  jle    L45
  mov    $0xa,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L5
  lea    0x1(%rax),%rsi
  mov    D14(%rip),%rax
  add    %rbp,%rbx
  mov    %r12d,%edi
  sub    %rbx,%rsi
  mov    (%rax),%edx
  call   <lseek@plt>
  mov    %r13,%rcx
  mov    %rbp,%rdx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <__sgetspent_r@plt>
  test   %rax,%rax
  js     L51
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L41:
  mov    $0xa,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L23
L5:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <read@plt>
  movslq %eax,%rbx
  test   %ebx,%ebx
  jg     L41
L45:
  pop    %rbx
  mov    $0xffffffff,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L23:
  sub    %rbp,%rax
  mov    %r12d,%edi
  sub    %rbx,%rax
  lea    0x1(%rax),%rsi
  mov    D14(%rip),%rax
  mov    (%rax),%edx
  call   <lseek@plt>
  jmp    L51
```

assistant: ```c
int __getspent_r(struct spwd *spwd, char *line_buff, size_t buflen, int spwd_fd) {
  char *endptr;
  int line_len;
restart:
  if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
    return -1;
  endptr = strchr(line_buff, '\n');
  if (endptr != NULL)
    lseek(spwd_fd, (long)(1 + endptr - (line_buff + line_len)), SEEK_CUR);
  else {
    do {
      if ((line_len = read(spwd_fd, line_buff, buflen)) <= 0)
        return -1;
    } while (!(endptr = strchr(line_buff, '\n')));
    lseek(spwd_fd, (long)(endptr - line_buff) - line_len + 1, SEEK_CUR);
    goto restart;
  }
  if (__sgetspent_r(line_buff, spwd, line_buff, buflen) < 0)
    goto restart;
  return 0;
}
```