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

```asm
<cl_zlib_compress_data>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %rdx,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  mov    D0(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x30(%rsp)
  mov    %rax,0x28(%rsp)
  mov    %rax,0x20(%rsp)
  mov    %rsp,%rdi
  mov    D41(%rip),%rax
  mov    (%rax),%esi
  call   <deflateInit@plt>
  mov    D1(%rip),%rdx
  cmp    (%rdx),%rax
  jne    L16
  mov    %r12,(%rsp)
  mov    %rbx,0x8(%rsp)
  mov    %rbx,0x10(%rsp)
  lea    0x1(%rbp),%r13
  mov    %r13,0x18(%rsp)
  mov    %rsp,%rdi
  mov    D46(%rip),%rax
  mov    (%rax),%esi
  call   <deflate@plt>
  mov    D47(%rip),%rdx
  cmp    (%rdx),%rax
  je     L59
  mov    %rsp,%rdi
  call   <deflateEnd@plt>
  mov    %rbx,%rax
  sub    0x10(%rsp),%rax
  mov    $0x1,%edx
  cmp    %rax,%rbx
  jbe    L33
L64:
  mov    %edx,0x0(%rbp)
  add    $0x1,%eax
L30:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L59:
  mov    %rsp,%rdi
  call   <deflateEnd@plt>
  mov    $0xfffffffe,%eax
  jmp    L30
L33:
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rax
  mov    $0x0,%edx
  jmp    L64
L16:
  mov    $0xffffffff,%eax
  jmp    L30
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cl_zlib_compress_data(void *out_data, const void *in_data, size_t in_size) {
  uint8_t status;
  size_t out_len;
  z_stream strm;
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  if (deflateInit(&strm, Z_DEFAULT_COMPRESSION) != Z_OK)
    return -1;
  strm.next_in = (unsigned char *)in_data;
  strm.avail_in = in_size;
  strm.avail_out = in_size;
  strm.next_out = ((unsigned char *)out_data) + 1;
  if (deflate(&strm, Z_FINISH) == Z_STREAM_ERROR) {
    deflateEnd(&strm);
    return -2;
  }
  deflateEnd(&strm);
  out_len = in_size - strm.avail_out;
  if (out_len >= in_size) {
    memcpy(((char *)out_data) + 1, in_data, in_size);
    out_len = in_size;
    status = 0;
  } else {
    status = 1;
  }
  ((uint8_t *)out_data)[0] = status;
  return out_len + 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cl_zlib_compress_data>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  mov    D48(%rip),%rax
  mov    %rsp,%r13
  mov    %r13,%rdi
  mov    (%rax),%rax
  mov    %rax,0x30(%rsp)
  mov    %rax,0x28(%rsp)
  mov    %rax,0x20(%rsp)
  mov    D31(%rip),%rax
  mov    (%rax),%esi
  call   <deflateInit@plt>
  mov    D10(%rip),%rdx
  cmp    (%rdx),%rax
  jne    L68
  mov    D47(%rip),%rax
  mov    %r13,%rdi
  lea    0x1(%rbp),%r14
  mov    %r12,(%rsp)
  mov    %rbx,0x8(%rsp)
  mov    (%rax),%esi
  mov    %rbx,0x10(%rsp)
  mov    %r14,0x18(%rsp)
  call   <deflate@plt>
  mov    D28(%rip),%rdx
  mov    %r13,%rdi
  cmp    (%rdx),%rax
  je     L31
  call   <deflateEnd@plt>
  mov    %rbx,%rax
  sub    0x10(%rsp),%rax
  mov    $0x1,%edx
  cmp    %rax,%rbx
  jbe    L18
L40:
  mov    %edx,0x0(%rbp)
  add    $0x1,%eax
L8:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L42
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L18:
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rax
  xor    %edx,%edx
  jmp    L40
  nopl   (%rax)
L68:
  mov    $0xffffffff,%eax
  jmp    L8
L31:
  call   <deflateEnd@plt>
  mov    $0xfffffffe,%eax
  jmp    L8
L42:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cl_zlib_compress_data(void *out_data, const void *in_data, size_t in_size) {
  uint8_t status;
  size_t out_len;
  z_stream strm;
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  if (deflateInit(&strm, Z_DEFAULT_COMPRESSION) != Z_OK)
    return -1;
  strm.next_in = (unsigned char *)in_data;
  strm.avail_in = in_size;
  strm.avail_out = in_size;
  strm.next_out = ((unsigned char *)out_data) + 1;
  if (deflate(&strm, Z_FINISH) == Z_STREAM_ERROR) {
    deflateEnd(&strm);
    return -2;
  }
  deflateEnd(&strm);
  out_len = in_size - strm.avail_out;
  if (out_len >= in_size) {
    memcpy(((char *)out_data) + 1, in_data, in_size);
    out_len = in_size;
    status = 0;
  } else {
    status = 1;
  }
  ((uint8_t *)out_data)[0] = status;
  return out_len + 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cl_zlib_compress_data>:
  endbr64
  push   %r14
  movq   %rdx,%xmm1
  push   %r13
  punpcklqdq %xmm1,%xmm1
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    D45(%rip),%rax
  lea    0x10(%rsp),%r13
  movaps %xmm1,(%rsp)
  mov    %r13,%rdi
  mov    (%rax),%rax
  mov    %rax,0x40(%rsp)
  movq   %rax,%xmm0
  mov    D40(%rip),%rax
  punpcklqdq %xmm0,%xmm0
  mov    (%rax),%esi
  movaps %xmm0,0x30(%rsp)
  call   <deflateInit@plt>
  mov    D6(%rip),%rdx
  cmp    (%rdx),%rax
  jne    L44
  mov    D14(%rip),%rax
  movdqa (%rsp),%xmm1
  mov    %r13,%rdi
  lea    0x1(%rbp),%r14
  mov    %r12,0x10(%rsp)
  mov    (%rax),%esi
  mov    %r14,0x28(%rsp)
  movups %xmm1,0x18(%rsp)
  call   <deflate@plt>
  mov    D35(%rip),%rdx
  mov    %r13,%rdi
  cmp    (%rdx),%rax
  je     L1
  call   <deflateEnd@plt>
  mov    %rbx,%rax
  sub    0x20(%rsp),%rax
  mov    $0x1,%edx
  cmp    %rax,%rbx
  jbe    L54
L62:
  mov    %edx,0x0(%rbp)
  add    $0x1,%eax
L64:
  mov    0x48(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L59
  add    $0x50,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L54:
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rax
  xor    %edx,%edx
  jmp    L62
  nopl   (%rax)
L44:
  mov    $0xffffffff,%eax
  jmp    L64
L1:
  call   <deflateEnd@plt>
  mov    $0xfffffffe,%eax
  jmp    L64
L59:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int cl_zlib_compress_data(void *out_data, const void *in_data, size_t in_size) {
  uint8_t status;
  size_t out_len;
  z_stream strm;
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  if (deflateInit(&strm, Z_DEFAULT_COMPRESSION) != Z_OK)
    return -1;
  strm.next_in = (unsigned char *)in_data;
  strm.avail_in = in_size;
  strm.avail_out = in_size;
  strm.next_out = ((unsigned char *)out_data) + 1;
  if (deflate(&strm, Z_FINISH) == Z_STREAM_ERROR) {
    deflateEnd(&strm);
    return -2;
  }
  deflateEnd(&strm);
  out_len = in_size - strm.avail_out;
  if (out_len >= in_size) {
    memcpy(((char *)out_data) + 1, in_data, in_size);
    out_len = in_size;
    status = 0;
  } else {
    status = 1;
  }
  ((uint8_t *)out_data)[0] = status;
  return out_len + 1;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x7d0,-0x4(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D9
type_infered: string

tool: D9: %10i
%-8.5i


assistant: ```c
int main(void) {
  int i = 2000;
  printf("%10i\n%-8.5i\n", i, i);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x7d0,%edx
  mov    $0x7d0,%esi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D8
type: string

tool: D8: %10i
%-8.5i


assistant: ```c
int main(void) {
  int i = 2000;
  printf("%10i\n%-8.5i\n", i, i);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x7d0,%edx
  mov    $0x7d0,%esi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D8
datatype: string

tool: D8: %10i
%-8.5i


assistant: ```c
int main(void) {
  int i = 2000;
  printf("%10i\n%-8.5i\n", i, i);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x7d0,%edx
  mov    $0x7d0,%esi
  lea    D0(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D0
datatype: string

tool: D0: %10i
%-8.5i


assistant: ```c
int main(void) {
  int i = 2000;
  printf("%10i\n%-8.5i\n", i, i);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  sub    $0x8,%rsp
  push   $0x1
  push   $0x1
  push   $0x1
  mov    $0x1,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    $0x1,%edi
  call   <foo@plt>
  add    $0x20,%rsp
  mov    %eax,-0x4(%rbp)
  cmpl   $0x7737,-0x4(%rbp)
  je     L4
  mov    $0x0,%eax
  call   <__builtin_abort@plt>
L4:
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main() {
  unsigned x = foo(1, 1, 1, 1, 1, 1, 1, 1, 1);
  if (x != 0x7737)
    __builtin_abort();
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  sub    $0x10,%rsp
  push   $0x1
  push   $0x1
  push   $0x1
  mov    $0x1,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    $0x1,%edi
  call   <foo@plt>
  add    $0x20,%rsp
  cmp    $0x7737,%eax
  jne    L12
L4:
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
L12:
  mov    $0x0,%eax
  call   <__builtin_abort@plt>
  jmp    L4
```

assistant: ```c
int main() {
  unsigned x = foo(1, 1, 1, 1, 1, 1, 1, 1, 1);
  if (x != 0x7737)
    __builtin_abort();
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  sub    $0x10,%rsp
  mov    $0x1,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  push   $0x1
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    $0x1,%edi
  push   $0x1
  push   $0x1
  call   <foo@plt>
  add    $0x20,%rsp
  cmp    $0x7737,%eax
  je     L4
  xor    %eax,%eax
  call   <__builtin_abort@plt>
L4:
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  unsigned x = foo(1, 1, 1, 1, 1, 1, 1, 1, 1);
  if (x != 0x7737)
    __builtin_abort();
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x10,%rsp
  mov    $0x1,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  push   $0x1
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    $0x1,%edi
  push   $0x1
  push   $0x1
  call   <foo@plt>
  add    $0x20,%rsp
  cmp    $0x7737,%eax
  je     L7
  xor    %eax,%eax
  call   <__builtin_abort@plt>
L7:
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  unsigned x = foo(1, 1, 1, 1, 1, 1, 1, 1, 1);
  if (x != 0x7737)
    __builtin_abort();
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<signalRedraw>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <PrintfStatusBar@plt>
  mov    $0x0,%eax
  call   <CleanInputBar@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void signalRedraw() {
  PrintfStatusBar();
  CleanInputBar();
}
```
user: What is the c source code of the assembly code below?

```asm
<signalRedraw>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <PrintfStatusBar@plt>
  mov    $0x0,%eax
  call   <CleanInputBar@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void signalRedraw() {
  PrintfStatusBar();
  CleanInputBar();
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<signalRedraw>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <PrintfStatusBar@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1060 <CleanInputBar@plt>
```

assistant: ```c
void signalRedraw() {
  PrintfStatusBar();
  CleanInputBar();
}
```
user: What is the c source code of the assembly code below:

```asm
<signalRedraw>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <PrintfStatusBar@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1060 <CleanInputBar@plt>
```

assistant: ```c
void signalRedraw() {
  PrintfStatusBar();
  CleanInputBar();
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<readn_nonblock>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  mov    %eax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L103
L123:
  mov    -0x38(%rbp),%ecx
  mov    -0x20(%rbp),%edx
  mov    -0x18(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <recv@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jns    L95
  mov    D5(%rip),%rax
  mov    (%rax),%rdx
  mov    D38(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L136
  jmp    L103
L136:
  mov    D5(%rip),%rax
  mov    (%rax),%rdx
  mov    D21(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L46
  mov    D5(%rip),%rax
  mov    (%rax),%rdx
  mov    D4(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L5
L46:
  lea    -0x24(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x24(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  movl   $0x64,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x10(%rbp),%rdx
  lea    -0x24(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  call   <select@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jns    L146
  mov    $0xffffffff,%eax
  jmp    L99
L146:
  cmpl   $0x0,-0x1c(%rbp)
  jne    L103
  mov    -0x48(%rbp),%rax
  mov    -0x20(%rbp),%edx
  sub    %edx,%eax
  jmp    L99
L5:
  mov    $0xffffffff,%eax
  jmp    L99
L95:
  cmpl   $0x0,-0x1c(%rbp)
  jne    L39
  mov    -0x48(%rbp),%rax
  mov    -0x20(%rbp),%edx
  sub    %edx,%eax
  jmp    L99
L39:
  mov    -0x1c(%rbp),%eax
  sub    %eax,-0x20(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
L103:
  cmpl   $0x0,-0x20(%rbp)
  jg     L123
  mov    -0x48(%rbp),%rax
L99:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L140
  call   <__stack_chk_fail@plt>
L140:
  leave
  ret
```

assistant: ```c
ssize_t readn_nonblock(int fd, void *buf, size_t len, int flags) {
  int cnt;
  int rc;
  char *bp;
  fd_set rfds;
  cnt = len;
  bp = buf;
  while (cnt > 0) {
    rc = recv(fd, bp, cnt, flags);
    if (rc < 0) {
      if (errno == EINTR)
        continue;
      if (errno == EAGAIN || errno == EWOULDBLOCK) {
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
        struct timeval tv = {.tv_sec = 0, .tv_usec = 100};
        rc = select(fd + 1, &rfds, NULL, NULL, &tv);
        if (rc < 0)
          return -1;
        else if (rc == 0)
          return len - cnt;
        continue;
      }
      return -1;
    } else if (rc == 0)
      return len - cnt;
    cnt -= rc;
    bp += rc;
  }
  return len;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<readn_nonblock>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %edx,0xc(%rsp)
  test   %edx,%edx
  jle    L138
  mov    %edi,%r12d
  mov    %rsi,%rbp
  mov    %rdx,%r14
  mov    %ecx,%r13d
  mov    %edx,%ebx
  lea    0x1c(%rsp),%r15
  jmp    L65
L61:
  mov    D9(%rip),%rax
  mov    (%rax),%rax
  mov    D8(%rip),%rdx
  cmp    (%rdx),%rax
  je     L102
  mov    D34(%rip),%rdx
  cmp    (%rdx),%rax
  je     L66
  mov    D30(%rip),%rdx
  cmp    (%rdx),%rax
  jne    L103
L66:
  mov    %r15,%rdi
  call   <FD_ZERO@plt>
  mov    %r15,%rsi
  mov    %r12d,%edi
  call   <FD_SET@plt>
  movl   $0x64,0x20(%rsp)
  movl   $0x0,0x24(%rsp)
  lea    0x1(%r12),%edi
  lea    0x20(%rsp),%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %r15,%rsi
  call   <select@plt>
  test   %eax,%eax
  js     L132
  jne    L102
  mov    %r14d,%eax
  sub    %ebx,%eax
  mov    %eax,0xc(%rsp)
L138:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L81
  mov    0xc(%rsp),%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L132:
  movl   $0xffffffff,0xc(%rsp)
  jmp    L138
L80:
  mov    %r14d,%eax
  sub    %ebx,%eax
  mov    %eax,0xc(%rsp)
  jmp    L138
L102:
  test   %ebx,%ebx
  jle    L138
L65:
  mov    %r13d,%ecx
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <recv@plt>
  test   %eax,%eax
  js     L61
  je     L80
  sub    %eax,%ebx
  cltq
  add    %rax,%rbp
  jmp    L102
L103:
  movl   $0xffffffff,0xc(%rsp)
  jmp    L138
L81:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t readn_nonblock(int fd, void *buf, size_t len, int flags) {
  int cnt;
  int rc;
  char *bp;
  fd_set rfds;
  cnt = len;
  bp = buf;
  while (cnt > 0) {
    rc = recv(fd, bp, cnt, flags);
    if (rc < 0) {
      if (errno == EINTR)
        continue;
      if (errno == EAGAIN || errno == EWOULDBLOCK) {
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
        struct timeval tv = {.tv_sec = 0, .tv_usec = 100};
        rc = select(fd + 1, &rfds, NULL, NULL, &tv);
        if (rc < 0)
          return -1;
        else if (rc == 0)
          return len - cnt;
        continue;
      }
      return -1;
    } else if (rc == 0)
      return len - cnt;
    cnt -= rc;
    bp += rc;
  }
  return len;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<readn_nonblock>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %edx,0xc(%rsp)
  test   %edx,%edx
  jle    L66
  mov    %edi,%ebx
  mov    %rsi,%r14
  mov    %rdx,%r12
  mov    %ecx,%ebp
  mov    %edx,%r15d
  lea    0x1c(%rsp),%r13
L90:
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r14,%rsi
  mov    %ebx,%edi
  call   <recv@plt>
  test   %eax,%eax
  js     L69
  je     L76
  sub    %eax,%r15d
  cltq
  add    %rax,%r14
  test   %r15d,%r15d
  jg     L90
  nopw   0x0(%rax,%rax,1)
L66:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L26
  mov    0xc(%rsp),%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L69:
  mov    D39(%rip),%rax
  mov    D2(%rip),%rdx
  mov    (%rax),%rax
  cmp    (%rdx),%rax
  je     L90
  mov    D22(%rip),%rdx
  cmp    (%rdx),%rax
  je     L87
  mov    D24(%rip),%rdx
  cmp    (%rdx),%rax
  jne    L0
L87:
  mov    %r13,%rdi
  call   <FD_ZERO@plt>
  mov    %r13,%rsi
  mov    %ebx,%edi
  call   <FD_SET@plt>
  xor    %ecx,%ecx
  xor    %edx,%edx
  lea    0x1(%rbx),%edi
  lea    0x20(%rsp),%r8
  mov    %r13,%rsi
  movq   $0x64,0x20(%rsp)
  call   <select@plt>
  test   %eax,%eax
  js     L0
  jne    L90
L76:
  mov    %r12d,%eax
  sub    %r15d,%eax
  mov    %eax,0xc(%rsp)
  jmp    L66
  cs nopw 0x0(%rax,%rax,1)
L0:
  movl   $0xffffffff,0xc(%rsp)
  jmp    L66
L26:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t readn_nonblock(int fd, void *buf, size_t len, int flags) {
  int cnt;
  int rc;
  char *bp;
  fd_set rfds;
  cnt = len;
  bp = buf;
  while (cnt > 0) {
    rc = recv(fd, bp, cnt, flags);
    if (rc < 0) {
      if (errno == EINTR)
        continue;
      if (errno == EAGAIN || errno == EWOULDBLOCK) {
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
        struct timeval tv = {.tv_sec = 0, .tv_usec = 100};
        rc = select(fd + 1, &rfds, NULL, NULL, &tv);
        if (rc < 0)
          return -1;
        else if (rc == 0)
          return len - cnt;
        continue;
      }
      return -1;
    } else if (rc == 0)
      return len - cnt;
    cnt -= rc;
    bp += rc;
  }
  return len;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<send_auth_header>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x69736142,-0xf(%rbp)
  movw   $0x2063,-0xb(%rbp)
  movb   $0x0,-0x9(%rbp)
  movq   $0x6,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <base64_encode@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  add    $0x1,%rax
  mov    %rax,%rdx
  mov    $0x1a5,%esi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <__xmalloc@plt>
  mov    %rax,-0x18(%rbp)
  lea    -0xf(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  add    %rax,%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <base64_encode@plt>
  mov    -0x18(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  lea    D2(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <send_header@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D13
type: string
name: retrieve_data
arguments: data_label: D2
type: string

tool: D13: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locker/httpget/refs/heads/master/http.c

tool: D2: Authorization

assistant: ```c
void send_auth_header(struct http_connection *conn, const char *creds) {
  const char prefix[] = "Basic ";
  size_t len, offset;
  char *buf;
  offset = sizeof(prefix) - 1;
  len = base64_encode(creds, NULL, 0);
  buf = __xmalloc("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locker/httpget/refs/heads/master/http.c", 421, (len + offset + 1));
  strcpy(buf, prefix);
  base64_encode(creds, buf + offset, len + 1);
  send_header(conn, "Authorization", buf);
  free(buf);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<send_auth_header>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x69736142,0x1(%rsp)
  movw   $0x2063,0x5(%rsp)
  movb   $0x0,0x7(%rsp)
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <base64_encode@plt>
  mov    %rax,%rbp
  lea    0x7(%rax),%rdx
  mov    $0x1a5,%esi
  lea    D5(%rip),%rdi
  call   <__xmalloc@plt>
  mov    %rax,%rbx
  lea    0x1(%rsp),%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    0x1(%rbp),%rdx
  lea    0x6(%rbx),%rsi
  mov    %r12,%rdi
  call   <base64_encode@plt>
  mov    %rbx,%rdx
  lea    D2(%rip),%rsi
  mov    %r13,%rdi
  call   <send_header@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D5
datatype: string
name: disassemble_data
arguments: data_tag: D2
datatype: string

tool: D5: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locker/httpget/refs/heads/master/http.c

tool: D2: Authorization

assistant: ```c
void send_auth_header(struct http_connection *conn, const char *creds) {
  const char prefix[] = "Basic ";
  size_t len, offset;
  char *buf;
  offset = sizeof(prefix) - 1;
  len = base64_encode(creds, NULL, 0);
  buf = __xmalloc("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/locker/httpget/refs/heads/master/http.c", 421, (len + offset + 1));
  strcpy(buf, prefix);
  base64_encode(creds, buf + offset, len + 1);
  send_header(conn, "Authorization", buf);
  free(buf);
}
```