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

```asm
<main01>:
  endbr64
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x8(%rsp)
  lea    0x8(%rsp),%rdi
  call   <test@plt>
  mov    0x8(%rsp),%esi
  lea    D14(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D7(%rip),%rdi
  call   <puts@plt>
  movl   $0x1,0x10(%rsp)
  movl   $0x2,0x14(%rsp)
  movl   $0x3,0x18(%rsp)
  movl   $0x4,0x1c(%rsp)
  movl   $0x5,0x20(%rsp)
  movl   $0x6,0x24(%rsp)
  movl   $0x7,0x28(%rsp)
  movl   $0x8,0x2c(%rsp)
  movl   $0x9,0x30(%rsp)
  movl   $0xa,0x34(%rsp)
  mov    $0x28,%esi
  lea    D27(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x10(%rsp),%rdi
  call   <test1@plt>
  movq   $0x0,0x40(%rsp)
  movq   $0x0,0x48(%rsp)
  movq   $0x0,0x50(%rsp)
  movq   $0x0,0x58(%rsp)
  movq   $0x0,0x60(%rsp)
  movq   $0x0,0x68(%rsp)
  movq   $0x0,0x70(%rsp)
  movl   $0x0,0x78(%rsp)
  lea    0x40(%rsp),%rdi
  call   <test2@plt>
  movl   $0xa,0xc(%rsp)
  lea    0xc(%rsp),%rdi
  call   <test@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    $0x0,%eax
  add    $0x98,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D14
type_guessed: string
name: unpack_data
arguments: tag: D7
type_guessed: string
name: unpack_data
arguments: tag: D27
type_guessed: string

tool: D14: i = %d


tool: D7: ------------------------

tool: D27: sizeof(array) = %d


assistant: ```c
int main01(void) {
  int i = 0;
  test(&i);
  printf("i = %d\n", i);
  printf("------------------------\n");
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  printf("sizeof(array) = %d\n", sizeof(array));
  test1(array);
  int array2[5][3] = {0};
  test2(array2);
  void (*p2)(int *);
  p2 = test;
  int a = 10;
  p2(&a);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main01>:
  endbr64
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdi
  movl   $0x0,0x8(%rsp)
  call   <test@plt>
  mov    0x8(%rsp),%esi
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D26(%rip),%rdi
  call   <puts@plt>
  mov    $0x28,%esi
  movabs $0x200000001,%rax
  lea    D16(%rip),%rdi
  mov    %rax,0x10(%rsp)
  movabs $0x400000003,%rax
  mov    %rax,0x18(%rsp)
  movabs $0x600000005,%rax
  mov    %rax,0x20(%rsp)
  movabs $0x800000007,%rax
  mov    %rax,0x28(%rsp)
  movabs $0xa00000009,%rax
  mov    %rax,0x30(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x10(%rsp),%rdi
  call   <test1@plt>
  pxor   %xmm0,%xmm0
  lea    0x40(%rsp),%rdi
  movq   $0x0,0x70(%rsp)
  movl   $0x0,0x78(%rsp)
  movaps %xmm0,0x40(%rsp)
  movaps %xmm0,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  call   <test2@plt>
  lea    0xc(%rsp),%rdi
  movl   $0xa,0xc(%rsp)
  call   <test@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  xor    %eax,%eax
  add    $0x98,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D3
datatype: string
name: extract_symbolic_data
arguments: data_label: D26
datatype: string
name: extract_symbolic_data
arguments: data_label: D16
datatype: string

tool: D3: i = %d


tool: D26: ------------------------

tool: D16: sizeof(array) = %d


assistant: ```c
int main01(void) {
  int i = 0;
  test(&i);
  printf("i = %d\n", i);
  printf("------------------------\n");
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  printf("sizeof(array) = %d\n", sizeof(array));
  test1(array);
  int array2[5][3] = {0};
  test2(array2);
  void (*p2)(int *);
  p2 = test;
  int a = 10;
  p2(&a);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main01>:
  endbr64
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdi
  movl   $0x0,0x8(%rsp)
  call   <test@plt>
  mov    0x8(%rsp),%esi
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D21(%rip),%rdi
  call   <puts@plt>
  movdqa D45(%rip),%xmm0
  mov    D23(%rip),%rax
  mov    $0x28,%esi
  lea    D14(%rip),%rdi
  movaps %xmm0,0x10(%rsp)
  movdqa D5(%rip),%xmm0
  mov    %rax,0x30(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x20(%rsp)
  call   <printf@plt>
  lea    0x10(%rsp),%rdi
  call   <test1@plt>
  pxor   %xmm0,%xmm0
  lea    0x40(%rsp),%rdi
  movq   $0x0,0x70(%rsp)
  movl   $0x0,0x78(%rsp)
  movaps %xmm0,0x40(%rsp)
  movaps %xmm0,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  call   <test2@plt>
  lea    0xc(%rsp),%rdi
  movl   $0xa,0xc(%rsp)
  call   <test@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  xor    %eax,%eax
  add    $0x98,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D36
datatype: string
name: read_data
arguments: label: D21
datatype: string
name: read_data
arguments: label: D45
datatype: byte[16]
name: read_data
arguments: label: D23
datatype: byte[8]
name: read_data
arguments: label: D14
datatype: string
name: read_data
arguments: label: D5
datatype: byte[16]

tool: D36: i = %d


tool: D21: ------------------------

tool: {"D45": [0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D23": [0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00]}

tool: D14: sizeof(array) = %d


tool: {"D5": [0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00]}

assistant: ```c
int main01(void) {
  int i = 0;
  test(&i);
  printf("i = %d\n", i);
  printf("------------------------\n");
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  printf("sizeof(array) = %d\n", sizeof(array));
  test1(array);
  int array2[5][3] = {0};
  test2(array2);
  void (*p2)(int *);
  p2 = test;
  int a = 10;
  p2(&a);
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<stringInsert>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x2,%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L2
  mov    $0x0,%eax
  jmp    L0
L2:
  mov    -0x44(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  add    %rax,%rcx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    -0x44(%rbp),%eax
  lea    0x1(%rax),%r12d
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x44(%rbp),%eax
  movslq %eax,%r13
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    0x0(%r13,%rax,1),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %r12d,%edx
  mov    %rbx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x28(%rbp),%rax
L0:
  add    $0x38,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
char *stringInsert(const char *string, const char *substr, const int32_t offset) {
  char *newstr = (char *)calloc(strlen(string) + strlen(substr) + 2, sizeof(char));
  if (newstr == NULL)
    return NULL;
  memcpy(newstr, string, offset);
  memcpy(newstr + offset, substr, strlen(substr));
  memcpy(newstr + offset + strlen(substr), string + offset, strlen(string) - offset + 1);
  return newstr;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<stringInsert>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %edx,%r13d
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %r12,%rdi
  call   <strlen@plt>
  lea    0x2(%rbx,%rax,1),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    $0x0,%r15d
  test   %rax,%rax
  je     L9
  mov    %rax,%rbx
  mov    %rax,%r15
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  movslq %r13d,%r14
  lea    (%rbx,%r14,1),%rdi
  mov    %r12,%rsi
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,0xc(%rsp)
  add    %r14,%rbp
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    0xc(%rsp),%edx
  sub    %r13d,%edx
  add    $0x1,%edx
  cltq
  add    %r14,%rax
  lea    (%rbx,%rax,1),%rdi
  mov    %rbp,%rsi
  call   <memcpy@plt>
L9:
  mov    %r15,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *stringInsert(const char *string, const char *substr, const int32_t offset) {
  char *newstr = (char *)calloc(strlen(string) + strlen(substr) + 2, sizeof(char));
  if (newstr == NULL)
    return NULL;
  memcpy(newstr, string, offset);
  memcpy(newstr + offset, substr, strlen(substr));
  memcpy(newstr + offset + strlen(substr), string + offset, strlen(string) - offset + 1);
  return newstr;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<stringInsert>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  mov    $0x1,%esi
  lea    0x2(%rbp,%rax,1),%edi
  xor    %ebp,%ebp
  call   <calloc@plt>
  test   %rax,%rax
  je     L2
  mov    %rbx,%rsi
  mov    %r14d,%edx
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <memcpy@plt>
  mov    %r15,%rdi
  movslq %r14d,%r13
  call   <strlen@plt>
  mov    %r15,%rsi
  lea    0x0(%rbp,%r13,1),%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  mov    %rbx,%rdi
  add    %r13,%rbx
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  sub    %r14d,%r12d
  mov    %rbx,%rsi
  movslq %eax,%rdi
  lea    0x1(%r12),%edx
  add    %r13,%rdi
  add    %rbp,%rdi
  call   <memcpy@plt>
L2:
  add    $0x8,%rsp
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *stringInsert(const char *string, const char *substr, const int32_t offset) {
  char *newstr = (char *)calloc(strlen(string) + strlen(substr) + 2, sizeof(char));
  if (newstr == NULL)
    return NULL;
  memcpy(newstr, string, offset);
  memcpy(newstr + offset, substr, strlen(substr));
  memcpy(newstr + offset + strlen(substr), string + offset, strlen(string) - offset + 1);
  return newstr;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<stringInsert>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  mov    $0x1,%esi
  lea    0x2(%rbp,%rax,1),%edi
  xor    %ebp,%ebp
  call   <calloc@plt>
  test   %rax,%rax
  je     L0
  mov    %rbx,%rsi
  mov    %r14d,%edx
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <memcpy@plt>
  mov    %r15,%rdi
  movslq %r14d,%r13
  call   <strlen@plt>
  mov    %r15,%rsi
  lea    0x0(%rbp,%r13,1),%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  mov    %rbx,%rdi
  add    %r13,%rbx
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  sub    %r14d,%r12d
  mov    %rbx,%rsi
  movslq %eax,%rdi
  lea    0x1(%r12),%edx
  add    %r13,%rdi
  add    %rbp,%rdi
  call   <memcpy@plt>
L0:
  add    $0x8,%rsp
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *stringInsert(const char *string, const char *substr, const int32_t offset) {
  char *newstr = (char *)calloc(strlen(string) + strlen(substr) + 2, sizeof(char));
  if (newstr == NULL)
    return NULL;
  memcpy(newstr, string, offset);
  memcpy(newstr + offset, substr, strlen(substr));
  memcpy(newstr + offset + strlen(substr), string + offset, strlen(string) - offset + 1);
  return newstr;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<extExists>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <appendExt@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fileExists@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0xc(%rbp),%eax
  leave
  ret
```

assistant: ```c
int extExists(const char *name, const char *newExt) {
  char *fName = appendExt(name, newExt);
  int exists = fileExists(fName);
  free(fName);
  return exists;
}
```
user: Translate the below assembly code into C programming language:

```asm
<extExists>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <appendExt@plt>
  mov    %rax,%rbx
  mov    %rax,%rdi
  call   <fileExists@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int extExists(const char *name, const char *newExt) {
  char *fName = appendExt(name, newExt);
  int exists = fileExists(fName);
  free(fName);
  return exists;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<extExists>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x8,%rsp
  call   <appendExt@plt>
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <fileExists@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int extExists(const char *name, const char *newExt) {
  char *fName = appendExt(name, newExt);
  int exists = fileExists(fName);
  free(fName);
  return exists;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<extExists>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x8,%rsp
  call   <appendExt@plt>
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <fileExists@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int extExists(const char *name, const char *newExt) {
  char *fName = appendExt(name, newExt);
  int exists = fileExists(fName);
  free(fName);
  return exists;
}
```
user: What is the c source code of the assembly code below?

```asm
<binrpc_build_hdr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %r8d,-0x20(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <binrpc_get_int_len@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <binrpc_get_int_len@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L72
  movl   $0x1,-0x10(%rbp)
L72:
  cmpl   $0x0,-0xc(%rbp)
  jne    L54
  movl   $0x1,-0xc(%rbp)
L54:
  mov    -0x10(%rbp),%eax
  lea    0x2(%rax),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x20(%rbp)
  jl     L39
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movb   $0xa1,(%rax)
  addq   $0x1,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  shl    $0x2,%eax
  or     %eax,%edx
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  or     %edx,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  addq   $0x1,-0x8(%rbp)
  jmp    L27
L74:
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  shl    $0x3,%eax
  mov    -0x18(%rbp),%edx
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  subl   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
L27:
  cmpl   $0x0,-0x10(%rbp)
  jg     L74
  jmp    L1
L46:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  shl    $0x3,%eax
  mov    -0x1c(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  subl   $0x1,-0xc(%rbp)
  addq   $0x1,-0x8(%rbp)
L1:
  cmpl   $0x0,-0xc(%rbp)
  jg     L46
  mov    -0x8(%rbp),%rax
  sub    -0x28(%rbp),%rax
  jmp    L61
L39:
  nop
  mov    $0xfffffffe,%eax
L61:
  leave
  ret
```

assistant: ```c
int binrpc_build_hdr(int type, int body_len, unsigned int cookie, unsigned char *buf, int b_len) {
  unsigned char *p;
  int len_len;
  int c_len;
  len_len = binrpc_get_int_len(body_len);
  c_len = binrpc_get_int_len(cookie);
  if (len_len == 0)
    len_len = 1;
  if (c_len == 0)
    c_len = 1;
  if (b_len < (2 + len_len + c_len)) {
    goto error_len;
  }
  p = buf;
  *p = (0xA << 4) | 1;
  p++;
  *p = (type << 4) | ((len_len - 1) << 2) | (c_len - 1);
  p++;
  for (; len_len > 0; len_len--, p++) {
    *p = (unsigned char)(body_len >> ((len_len - 1) * 8));
  }
  for (; c_len > 0; c_len--, p++) {
    *p = (unsigned char)(cookie >> ((c_len - 1) * 8));
  }
  return (int)(p - buf);
error_len:
  return -2;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<binrpc_build_hdr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r14d
  mov    %esi,%r12d
  mov    %edx,%ebx
  mov    %rcx,%rbp
  mov    %r8d,%r15d
  mov    %esi,%edi
  call   <binrpc_get_int_len@plt>
  mov    %eax,%r13d
  mov    %ebx,%edi
  call   <binrpc_get_int_len@plt>
  mov    %eax,%edi
  test   %r13d,%r13d
  mov    $0x1,%eax
  cmove  %eax,%r13d
  test   %edi,%edi
  cmove  %eax,%edi
  lea    0x2(%r13,%rdi,1),%eax
  cmp    %r15d,%eax
  jg     L11
  movb   $0xa1,0x0(%rbp)
  lea    -0x1(%r13),%ecx
  shl    $0x4,%r14d
  lea    0x0(,%rcx,4),%eax
  or     %eax,%r14d
  lea    -0x1(%rdi),%eax
  or     %eax,%r14d
  mov    %r14b,0x1(%rbp)
  lea    0x2(%rbp),%rax
  test   %r13d,%r13d
  jle    L19
  shl    $0x3,%ecx
  mov    %rax,%rdx
L13:
  mov    %r12d,%esi
  sar    %cl,%esi
  mov    %sil,(%rdx)
  add    $0x1,%rdx
  sub    $0x8,%ecx
  cmp    $0xfffffff8,%ecx
  jne    L13
  mov    %r13d,%r13d
  add    %r13,%rax
L19:
  test   %edi,%edi
  jle    L31
  lea    -0x8(,%rdi,8),%ecx
  mov    %rax,%rdx
L43:
  mov    %ebx,%esi
  shr    %cl,%esi
  mov    %sil,(%rdx)
  add    $0x1,%rdx
  sub    $0x8,%ecx
  cmp    $0xfffffff8,%ecx
  jne    L43
  mov    %edi,%edi
  add    %rdi,%rax
L31:
  sub    %ebp,%eax
L28:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  mov    $0xfffffffe,%eax
  jmp    L28
```

assistant: ```c
int binrpc_build_hdr(int type, int body_len, unsigned int cookie, unsigned char *buf, int b_len) {
  unsigned char *p;
  int len_len;
  int c_len;
  len_len = binrpc_get_int_len(body_len);
  c_len = binrpc_get_int_len(cookie);
  if (len_len == 0)
    len_len = 1;
  if (c_len == 0)
    c_len = 1;
  if (b_len < (2 + len_len + c_len)) {
    goto error_len;
  }
  p = buf;
  *p = (0xA << 4) | 1;
  p++;
  *p = (type << 4) | ((len_len - 1) << 2) | (c_len - 1);
  p++;
  for (; len_len > 0; len_len--, p++) {
    *p = (unsigned char)(body_len >> ((len_len - 1) * 8));
  }
  for (; c_len > 0; c_len--, p++) {
    *p = (unsigned char)(cookie >> ((c_len - 1) * 8));
  }
  return (int)(p - buf);
error_len:
  return -2;
}
```
user: What is the c source code of the assembly code below?

```asm
<binrpc_build_hdr>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  mov    %esi,%edi
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x8,%rsp
  call   <binrpc_get_int_len@plt>
  mov    %ebx,%edi
  mov    %eax,%r15d
  call   <binrpc_get_int_len@plt>
  movslq %eax,%rdi
  lea    0x2(%r15),%eax
  test   %r15d,%r15d
  jne    L0
  mov    $0x3,%eax
  mov    $0x1,%r15d
L0:
  test   %edi,%edi
  mov    $0x1,%edx
  cmove  %rdx,%rdi
  add    %edi,%eax
  cmp    %r14d,%eax
  jg     L63
  lea    -0x1(%r15),%r8d
  shl    $0x4,%r13d
  movb   $0xa1,(%r12)
  lea    0x0(,%r8,4),%eax
  or     %eax,%r13d
  lea    -0x1(%rdi),%eax
  or     %eax,%r13d
  lea    0x2(%r12),%rax
  mov    %r13b,0x1(%r12)
  test   %r15d,%r15d
  jle    L25
  lea    0x0(,%r8,8),%ecx
  mov    %rax,%rdx
  nopl   (%rax)
L34:
  mov    %ebp,%esi
  add    $0x1,%rdx
  sar    %cl,%esi
  sub    $0x8,%ecx
  mov    %sil,-0x1(%rdx)
  cmp    $0xfffffff8,%ecx
  jne    L34
  lea    0x1(%rax,%r8,1),%rax
L25:
  test   %edi,%edi
  jle    L32
  lea    -0x8(,%rdi,8),%ecx
  mov    %rax,%rdx
  nop
L38:
  mov    %ebx,%esi
  add    $0x1,%rdx
  shr    %cl,%esi
  sub    $0x8,%ecx
  mov    %sil,-0x1(%rdx)
  cmp    $0xfffffff8,%ecx
  jne    L38
  add    %rdi,%rax
L32:
  sub    %r12d,%eax
L55:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  mov    $0xfffffffe,%eax
  jmp    L55
```

assistant: ```c
int binrpc_build_hdr(int type, int body_len, unsigned int cookie, unsigned char *buf, int b_len) {
  unsigned char *p;
  int len_len;
  int c_len;
  len_len = binrpc_get_int_len(body_len);
  c_len = binrpc_get_int_len(cookie);
  if (len_len == 0)
    len_len = 1;
  if (c_len == 0)
    c_len = 1;
  if (b_len < (2 + len_len + c_len)) {
    goto error_len;
  }
  p = buf;
  *p = (0xA << 4) | 1;
  p++;
  *p = (type << 4) | ((len_len - 1) << 2) | (c_len - 1);
  p++;
  for (; len_len > 0; len_len--, p++) {
    *p = (unsigned char)(body_len >> ((len_len - 1) * 8));
  }
  for (; c_len > 0; c_len--, p++) {
    *p = (unsigned char)(cookie >> ((c_len - 1) * 8));
  }
  return (int)(p - buf);
error_len:
  return -2;
}
```
user: What is the c source code of the assembly code below:

```asm
<binrpc_build_hdr>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  mov    %esi,%edi
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x8,%rsp
  call   <binrpc_get_int_len@plt>
  mov    %ebx,%edi
  mov    %eax,%r15d
  call   <binrpc_get_int_len@plt>
  movslq %eax,%rdi
  lea    0x2(%r15),%eax
  test   %r15d,%r15d
  jne    L31
  mov    $0x3,%eax
  mov    $0x1,%r15d
L31:
  test   %edi,%edi
  mov    $0x1,%edx
  cmove  %rdx,%rdi
  add    %edi,%eax
  cmp    %r14d,%eax
  jg     L21
  lea    -0x1(%r15),%r8d
  shl    $0x4,%r13d
  movb   $0xa1,(%r12)
  lea    0x0(,%r8,4),%eax
  or     %eax,%r13d
  lea    -0x1(%rdi),%eax
  or     %eax,%r13d
  lea    0x2(%r12),%rax
  mov    %r13b,0x1(%r12)
  test   %r15d,%r15d
  jle    L56
  lea    0x0(,%r8,8),%ecx
  mov    %rax,%rdx
  nopl   (%rax)
L48:
  mov    %ebp,%esi
  add    $0x1,%rdx
  sar    %cl,%esi
  sub    $0x8,%ecx
  mov    %sil,-0x1(%rdx)
  cmp    $0xfffffff8,%ecx
  jne    L48
  lea    0x1(%rax,%r8,1),%rax
L56:
  test   %edi,%edi
  jle    L64
  lea    -0x8(,%rdi,8),%ecx
  mov    %rax,%rdx
  nop
L66:
  mov    %ebx,%esi
  add    $0x1,%rdx
  shr    %cl,%esi
  sub    $0x8,%ecx
  mov    %sil,-0x1(%rdx)
  cmp    $0xfffffff8,%ecx
  jne    L66
  add    %rdi,%rax
L64:
  sub    %r12d,%eax
L1:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L21:
  mov    $0xfffffffe,%eax
  jmp    L1
```

assistant: ```c
int binrpc_build_hdr(int type, int body_len, unsigned int cookie, unsigned char *buf, int b_len) {
  unsigned char *p;
  int len_len;
  int c_len;
  len_len = binrpc_get_int_len(body_len);
  c_len = binrpc_get_int_len(cookie);
  if (len_len == 0)
    len_len = 1;
  if (c_len == 0)
    c_len = 1;
  if (b_len < (2 + len_len + c_len)) {
    goto error_len;
  }
  p = buf;
  *p = (0xA << 4) | 1;
  p++;
  *p = (type << 4) | ((len_len - 1) << 2) | (c_len - 1);
  p++;
  for (; len_len > 0; len_len--, p++) {
    *p = (unsigned char)(body_len >> ((len_len - 1) * 8));
  }
  for (; c_len > 0; c_len--, p++) {
    *p = (unsigned char)(cookie >> ((c_len - 1) * 8));
  }
  return (int)(p - buf);
error_len:
  return -2;
}
```