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

```asm
<USBULPIRegRead>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x75,%rax
  mov    %rax,%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%rax
  add    $0x76,%rax
  movl   $0x5,(%rax)
  nop
L3:
  mov    -0x8(%rbp),%rax
  add    $0x76,%rax
  mov    (%rax),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L3
  mov    -0x8(%rbp),%rax
  add    $0x76,%rax
  movl   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x74,%rax
  mov    (%rax),%eax
  pop    %rbp
  ret
```

assistant: ```c
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000004 | 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
  return ((*((volatile uint8_t *)(ui32Base + 0x00000074))));
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<USBULPIRegRead>:
  endbr64
  mov    %esi,0x75(%rdi)
  lea    0x76(%rdi),%rdx
  movl   $0x5,0x76(%rdi)
L1:
  mov    (%rdx),%eax
  test   $0x2,%al
  je     L1
  movl   $0x0,0x76(%rdi)
  mov    0x74(%rdi),%eax
  ret
```

assistant: ```c
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000004 | 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
  return ((*((volatile uint8_t *)(ui32Base + 0x00000074))));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<USBULPIRegRead>:
  endbr64
  mov    %esi,0x75(%rdi)
  lea    0x76(%rdi),%rdx
  movl   $0x5,0x76(%rdi)
  nopw   0x0(%rax,%rax,1)
L0:
  mov    (%rdx),%eax
  test   $0x2,%al
  je     L0
  movl   $0x0,0x76(%rdi)
  mov    0x74(%rdi),%eax
  ret
```

assistant: ```c
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000004 | 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
  return ((*((volatile uint8_t *)(ui32Base + 0x00000074))));
}
```
user: What is the c source code of the assembly code below:

```asm
<USBULPIRegRead>:
  endbr64
  mov    %esi,0x75(%rdi)
  lea    0x76(%rdi),%rdx
  movl   $0x5,0x76(%rdi)
  nopw   0x0(%rax,%rax,1)
L7:
  mov    (%rdx),%eax
  test   $0x2,%al
  je     L7
  movl   $0x0,0x76(%rdi)
  mov    0x74(%rdi),%eax
  ret
```

assistant: ```c
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000004 | 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
  return ((*((volatile uint8_t *)(ui32Base + 0x00000074))));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<blosc_compname_to_compcode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0xffffffff,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L5
  movl   $0x0,-0x4(%rbp)
L5:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D8
type_infered: string

tool: D8: blosclz

assistant: ```c
int blosc_compname_to_compcode(const char *compname) {
  int code = -1;
  if (strcmp(compname, "blosclz") == 0) {
    code = 0;
  }
  return code;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<blosc_compname_to_compcode>:
  endbr64
  sub    $0x8,%rsp
  lea    D1(%rip),%rsi
  call   <strcmp@plt>
  neg    %rax
  sbb    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D1
data_type: string

tool: D1: blosclz

assistant: ```c
int blosc_compname_to_compcode(const char *compname) {
  int code = -1;
  if (strcmp(compname, "blosclz") == 0) {
    code = 0;
  }
  return code;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<blosc_compname_to_compcode>:
  endbr64
  sub    $0x8,%rsp
  lea    D9(%rip),%rsi
  call   <strcmp@plt>
  neg    %rax
  sbb    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D9
type_infered: string

tool: D9: blosclz

assistant: ```c
int blosc_compname_to_compcode(const char *compname) {
  int code = -1;
  if (strcmp(compname, "blosclz") == 0) {
    code = 0;
  }
  return code;
}
```
user: Translate the below assembly code into C programming language:

```asm
<blosc_compname_to_compcode>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rsi
  call   <strcmp@plt>
  neg    %rax
  sbb    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D2
type_infered: string

tool: D2: blosclz

assistant: ```c
int blosc_compname_to_compcode(const char *compname) {
  int code = -1;
  if (strcmp(compname, "blosclz") == 0) {
    code = 0;
  }
  return code;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<getUserOkay>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  movb   $0x0,-0xd(%rbp)
L14:
  lea    -0xd(%rbp),%rax
  mov    %rax,%rsi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    %eax,-0xc(%rbp)
  mov    $0x0,%eax
  call   <emptyBuffer@plt>
  cmpl   $0x0,-0xc(%rbp)
  je     L14
  movzbl -0xd(%rbp),%eax
  cmp    $0x79,%al
  jne    L31
  mov    $0x1,%eax
  jmp    L20
L31:
  mov    $0x0,%eax
L20:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L35
  call   <__stack_chk_fail@plt>
L35:
  leave
  ret
```

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

tool: D1: %c

assistant: ```c
int getUserOkay() {
  int ok = 0;
  char c = 0;
  do {
    ok = scanf("%c", &c);
    emptyBuffer();
  } while (!ok);
  if (c == 'y') {
    return 1;
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<getUserOkay>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x7(%rsp)
  lea    D9(%rip),%rbp
L18:
  lea    0x7(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <emptyBuffer@plt>
  test   %ebx,%ebx
  je     L18
  cmpb   $0x79,0x7(%rsp)
  sete   %al
  movzbl %al,%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L2
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

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

tool: D9: %c

assistant: ```c
int getUserOkay() {
  int ok = 0;
  char c = 0;
  do {
    ok = scanf("%c", &c);
    emptyBuffer();
  } while (!ok);
  if (c == 'y') {
    return 1;
  }
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<getUserOkay>:
  endbr64
  push   %r12
  push   %rbp
  lea    D0(%rip),%rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x7(%rsp)
  lea    0x7(%rsp),%r12
  nopl   (%rax)
L2:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <emptyBuffer@plt>
  test   %ebx,%ebx
  je     L2
  xor    %eax,%eax
  cmpb   $0x79,0x7(%rsp)
  sete   %al
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D0
type_infered: string

tool: D0: %c

assistant: ```c
int getUserOkay() {
  int ok = 0;
  char c = 0;
  do {
    ok = scanf("%c", &c);
    emptyBuffer();
  } while (!ok);
  if (c == 'y') {
    return 1;
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<getUserOkay>:
  endbr64
  push   %r12
  push   %rbp
  lea    D2(%rip),%rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x7(%rsp)
  lea    0x7(%rsp),%r12
  nopl   (%rax)
L6:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <emptyBuffer@plt>
  test   %ebx,%ebx
  je     L6
  xor    %eax,%eax
  cmpb   $0x79,0x7(%rsp)
  sete   %al
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D2
type_infered: string

tool: D2: %c

assistant: ```c
int getUserOkay() {
  int ok = 0;
  char c = 0;
  do {
    ok = scanf("%c", &c);
    emptyBuffer();
  } while (!ok);
  if (c == 'y') {
    return 1;
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<free2dArray_d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int free2dArray_d(double **x2d) {
  free(&x2d[0][0]);
  free(&x2d[0]);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<free2dArray_d>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  call   <free@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int free2dArray_d(double **x2d) {
  free(&x2d[0][0]);
  free(&x2d[0]);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<free2dArray_d>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  mov    (%rdi),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int free2dArray_d(double **x2d) {
  free(&x2d[0][0]);
  free(&x2d[0]);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<free2dArray_d>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  mov    (%rdi),%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

assistant: ```c
int free2dArray_d(double **x2d) {
  free(&x2d[0][0]);
  free(&x2d[0]);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<_string_adds>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L19
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,(%rax)
  jmp    L25
L19:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jb     L2
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L2:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  add    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,(%rax)
L25:
  nop
  leave
  ret
```

assistant: ```c
void _string_adds(size_t *length, size_t *top, char **string, const char *s) {
  char *old_string;
  size_t length_s;
  size_t length2;
  char *string2;
  length_s = strlen(s);
  if (!*string) {
    *string = strdup(s);
    *length = length_s + 1;
    *top = length_s;
  } else {
    if (*top + length_s >= *length) {
      length2 = *length * 2 + length_s;
      string2 = malloc(length2);
      strcpy(string2, *string);
      old_string = *string;
      *string = string2;
      *length = length2;
      free(old_string);
    }
    strcpy(&(*string)[*top], s);
    *top += length_s;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<_string_adds>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,%rbx
  mov    %rdx,%r12
  mov    %rcx,%r13
  mov    %rcx,%rdi
  call   <strlen@plt>
  mov    %rax,%rbp
  mov    (%r12),%r15
  test   %r15,%r15
  je     L37
  mov    0x8(%rsp),%rax
  mov    (%rax),%rax
  mov    %rbp,%rdx
  add    (%rbx),%rdx
  cmp    %rax,%rdx
  jae    L26
L38:
  mov    (%rbx),%rdi
  add    (%r12),%rdi
  mov    %r13,%rsi
  call   <strcpy@plt>
  mov    %rbp,%r14
  add    (%rbx),%r14
L33:
  mov    %r14,(%rbx)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L37:
  mov    %rax,%r14
  mov    %r13,%rdi
  call   <strdup@plt>
  mov    %rax,(%r12)
  add    $0x1,%rbp
  mov    0x8(%rsp),%rax
  mov    %rbp,(%rax)
  jmp    L33
L26:
  lea    0x0(%rbp,%rax,2),%r14
  mov    %r14,%rdi
  call   <malloc@plt>
  mov    %r15,%rsi
  mov    %rax,%r15
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    (%r12),%rdi
  mov    %r15,(%r12)
  mov    0x8(%rsp),%rax
  mov    %r14,(%rax)
  call   <free@plt>
  jmp    L38
```

assistant: ```c
void _string_adds(size_t *length, size_t *top, char **string, const char *s) {
  char *old_string;
  size_t length_s;
  size_t length2;
  char *string2;
  length_s = strlen(s);
  if (!*string) {
    *string = strdup(s);
    *length = length_s + 1;
    *top = length_s;
  } else {
    if (*top + length_s >= *length) {
      length2 = *length * 2 + length_s;
      string2 = malloc(length2);
      strcpy(string2, *string);
      old_string = *string;
      *string = string2;
      *length = length2;
      free(old_string);
    }
    strcpy(&(*string)[*top], s);
    *top += length_s;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<_string_adds>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  mov    %rdi,%r14
  mov    %rcx,%rdi
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    0x0(%r13),%r12
  test   %r12,%r12
  je     L8
  mov    %rax,%rdx
  mov    0x0(%rbp),%rax
  mov    (%r14),%rcx
  lea    (%rax,%rdx,1),%rsi
  cmp    %rcx,%rsi
  jae    L4
L2:
  lea    (%r12,%rax,1),%rdi
  mov    %r15,%rsi
  mov    %rdx,(%rsp)
  call   <strcpy@plt>
  mov    (%rsp),%rbx
  add    0x0(%rbp),%rbx
L32:
  mov    %rbx,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L4:
  lea    (%rdx,%rcx,2),%rcx
  mov    %rdx,0x8(%rsp)
  mov    %rcx,%rdi
  mov    %rcx,(%rsp)
  call   <malloc@plt>
  mov    %r12,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <strcpy@plt>
  mov    (%rsp),%rcx
  mov    0x0(%r13),%rdi
  mov    %rbx,0x0(%r13)
  mov    %rcx,(%r14)
  call   <free@plt>
  mov    0x0(%r13),%r12
  mov    0x0(%rbp),%rax
  mov    0x8(%rsp),%rdx
  jmp    L2
  xchg   %ax,%ax
L8:
  mov    %r15,%rdi
  mov    %rax,%rbx
  call   <strdup@plt>
  mov    %rax,0x0(%r13)
  lea    0x1(%rbx),%rax
  mov    %rax,(%r14)
  jmp    L32
```

assistant: ```c
void _string_adds(size_t *length, size_t *top, char **string, const char *s) {
  char *old_string;
  size_t length_s;
  size_t length2;
  char *string2;
  length_s = strlen(s);
  if (!*string) {
    *string = strdup(s);
    *length = length_s + 1;
    *top = length_s;
  } else {
    if (*top + length_s >= *length) {
      length2 = *length * 2 + length_s;
      string2 = malloc(length2);
      strcpy(string2, *string);
      old_string = *string;
      *string = string2;
      *length = length2;
      free(old_string);
    }
    strcpy(&(*string)[*top], s);
    *top += length_s;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<_string_adds>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  mov    %rdi,%r14
  mov    %rcx,%rdi
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    0x0(%r13),%r12
  test   %r12,%r12
  je     L23
  mov    %rax,%rdx
  mov    0x0(%rbp),%rax
  mov    (%r14),%rcx
  lea    (%rax,%rdx,1),%rsi
  cmp    %rcx,%rsi
  jae    L22
L36:
  lea    (%r12,%rax,1),%rdi
  mov    %r15,%rsi
  mov    %rdx,(%rsp)
  call   <strcpy@plt>
  mov    (%rsp),%rbx
  add    0x0(%rbp),%rbx
L29:
  mov    %rbx,0x0(%rbp)
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L22:
  lea    (%rdx,%rcx,2),%rcx
  mov    %rdx,0x8(%rsp)
  mov    %rcx,%rdi
  mov    %rcx,(%rsp)
  call   <malloc@plt>
  mov    %r12,%rsi
  mov    %rax,%rdi
  mov    %rax,%rbx
  call   <strcpy@plt>
  mov    (%rsp),%rcx
  mov    0x0(%r13),%rdi
  mov    %rbx,0x0(%r13)
  mov    %rcx,(%r14)
  call   <free@plt>
  mov    0x0(%r13),%r12
  mov    0x0(%rbp),%rax
  mov    0x8(%rsp),%rdx
  jmp    L36
  xchg   %ax,%ax
L23:
  mov    %r15,%rdi
  mov    %rax,%rbx
  call   <strdup@plt>
  mov    %rax,0x0(%r13)
  lea    0x1(%rbx),%rax
  mov    %rax,(%r14)
  jmp    L29
```

assistant: ```c
void _string_adds(size_t *length, size_t *top, char **string, const char *s) {
  char *old_string;
  size_t length_s;
  size_t length2;
  char *string2;
  length_s = strlen(s);
  if (!*string) {
    *string = strdup(s);
    *length = length_s + 1;
    *top = length_s;
  } else {
    if (*top + length_s >= *length) {
      length2 = *length * 2 + length_s;
      string2 = malloc(length2);
      strcpy(string2, *string);
      old_string = *string;
      *string = string2;
      *length = length2;
      free(old_string);
    }
    strcpy(&(*string)[*top], s);
    *top += length_s;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<encodegraphsize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  cmpl   $0x3e,-0x14(%rbp)
  jg     L32
  mov    -0x14(%rbp),%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L28
L32:
  cmpl   $0x3efff,-0x14(%rbp)
  jg     L9
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x7e,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0xc,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L28
L9:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x7e,(%rax)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x7e,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x1e,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x18,%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x12,%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0xc,%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sar    $0x6,%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  and    $0x3f,%eax
  lea    0x3f(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
L28:
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void encodegraphsize(int n, char **pp) {
  char *p;
  p = *pp;
  if (n <= 62)
    *p++ = 63 + n;
  else if (n <= 258047) {
    *p++ = 126;
    *p++ = 63 + (n >> 12);
    *p++ = 63 + ((n >> 6) & 63);
    *p++ = 63 + (n & 63);
  } else {
    *p++ = 126;
    *p++ = 126;
    *p++ = 63 + (n >> 30);
    *p++ = 63 + ((n >> 24) & 63);
    *p++ = 63 + ((n >> 18) & 63);
    *p++ = 63 + ((n >> 12) & 63);
    *p++ = 63 + ((n >> 6) & 63);
    *p++ = 63 + (n & 63);
  }
  *pp = p;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<encodegraphsize>:
  endbr64
  mov    %edi,%eax
  mov    %rsi,%rcx
  mov    (%rsi),%rdx
  cmp    $0x3e,%edi
  jg     L33
  lea    0x1(%rdx),%rsi
  add    $0x3f,%eax
  mov    %al,(%rdx)
L2:
  mov    %rsi,(%rcx)
  ret
L33:
  cmp    $0x3efff,%edi
  jg     L11
  movb   $0x7e,(%rdx)
  mov    %edi,%esi
  sar    $0xc,%esi
  add    $0x3f,%esi
  mov    %sil,0x1(%rdx)
  mov    %edi,%esi
  sar    $0x6,%esi
  and    $0x3f,%esi
  add    $0x3f,%esi
  mov    %sil,0x2(%rdx)
  lea    0x4(%rdx),%rsi
  and    $0x3f,%eax
  add    $0x3f,%eax
  mov    %al,0x3(%rdx)
  jmp    L2
L11:
  movb   $0x7e,(%rdx)
  movb   $0x7e,0x1(%rdx)
  mov    %edi,%esi
  sar    $0x1e,%esi
  add    $0x3f,%esi
  mov    %sil,0x2(%rdx)
  mov    %edi,%esi
  sar    $0x18,%esi
  and    $0x3f,%esi
  add    $0x3f,%esi
  mov    %sil,0x3(%rdx)
  mov    %edi,%esi
  sar    $0x12,%esi
  and    $0x3f,%esi
  add    $0x3f,%esi
  mov    %sil,0x4(%rdx)
  mov    %edi,%esi
  sar    $0xc,%esi
  and    $0x3f,%esi
  add    $0x3f,%esi
  mov    %sil,0x5(%rdx)
  mov    %edi,%esi
  sar    $0x6,%esi
  and    $0x3f,%esi
  add    $0x3f,%esi
  mov    %sil,0x6(%rdx)
  lea    0x8(%rdx),%rsi
  and    $0x3f,%eax
  add    $0x3f,%eax
  mov    %al,0x7(%rdx)
  jmp    L2
```

assistant: ```c
void encodegraphsize(int n, char **pp) {
  char *p;
  p = *pp;
  if (n <= 62)
    *p++ = 63 + n;
  else if (n <= 258047) {
    *p++ = 126;
    *p++ = 63 + (n >> 12);
    *p++ = 63 + ((n >> 6) & 63);
    *p++ = 63 + (n & 63);
  } else {
    *p++ = 126;
    *p++ = 126;
    *p++ = 63 + (n >> 30);
    *p++ = 63 + ((n >> 24) & 63);
    *p++ = 63 + ((n >> 18) & 63);
    *p++ = 63 + ((n >> 12) & 63);
    *p++ = 63 + ((n >> 6) & 63);
    *p++ = 63 + (n & 63);
  }
  *pp = p;
}
```