ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<xrop3_81_1_1>:
  endbr64
  movzbl %dil,%edi
  movzbl %sil,%esi
  mov    %edi,%eax
  shl    $0x8,%eax
  or     %edi,%eax
  mov    %esi,%edx
  shl    $0x8,%edx
  or     %esi,%edx
  or     %edx,%eax
  xor    $0xffffff00,%eax
  ret
```

assistant: ```c
unsigned xrop3_81_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = S & stk3;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}
```
user: What is the c source code of the assembly code below:

```asm
<xrop3_81_1_1>:
  endbr64
  movzbl %sil,%esi
  movzbl %dil,%edi
  mov    %esi,%eax
  shl    $0x8,%eax
  or     %edi,%eax
  shl    $0x8,%edi
  or     %esi,%eax
  or     %edi,%eax
  xor    $0xffffff00,%eax
  ret
```

assistant: ```c
unsigned xrop3_81_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = S & stk3;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<xrop3_81_1_1>:
  endbr64
  movzbl %sil,%esi
  movzbl %dil,%edi
  mov    %esi,%eax
  shl    $0x8,%eax
  or     %edi,%eax
  shl    $0x8,%edi
  or     %esi,%eax
  or     %edi,%eax
  xor    $0xffffff00,%eax
  ret
```

assistant: ```c
unsigned xrop3_81_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = S & stk3;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<UARTFIFODisable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <UARTBaseValid@plt>
  test   %eax,%eax
  jne    L0
  mov    $0x255,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <AssertFailure@plt>
L0:
  mov    -0x8(%rbp),%rax
  add    $0x2c,%rax
  mov    (%rax),%rax
  mov    -0x8(%rbp),%rdx
  add    $0x2c,%rdx
  and    $0xffffffffffffffef,%rax
  mov    %rax,(%rdx)
  nop
  leave
  ret
```

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

tool: D2: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c

assistant: ```c
void UARTFIFODisable(unsigned long ulBase) {
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c", 597);
    }
  };
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) &= ~(0x00000010);
}
```
user: What is the c source code of the assembly code below:

```asm
<UARTFIFODisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <UARTBaseValid@plt>
  test   %eax,%eax
  je     L2
L9:
  mov    0x2c(%rbx),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,0x2c(%rbx)
  pop    %rbx
  ret
L2:
  mov    $0x255,%esi
  lea    D2(%rip),%rdi
  call   <AssertFailure@plt>
  jmp    L9
```

tool_calls: name: retrieve_data
arguments: tag: D2
type: string

tool: D2: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c

assistant: ```c
void UARTFIFODisable(unsigned long ulBase) {
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c", 597);
    }
  };
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) &= ~(0x00000010);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<UARTFIFODisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <UARTBaseValid@plt>
  test   %eax,%eax
  je     L3
  mov    0x2c(%rbx),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,0x2c(%rbx)
  pop    %rbx
  ret
  nop
L3:
  mov    $0x255,%esi
  lea    D1(%rip),%rdi
  call   <AssertFailure@plt>
  mov    0x2c(%rbx),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,0x2c(%rbx)
  pop    %rbx
  ret
```

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

tool: D1: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c

assistant: ```c
void UARTFIFODisable(unsigned long ulBase) {
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c", 597);
    }
  };
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) &= ~(0x00000010);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<UARTFIFODisable>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <UARTBaseValid@plt>
  test   %eax,%eax
  je     L1
  mov    0x2c(%rbx),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,0x2c(%rbx)
  pop    %rbx
  ret
  nop
L1:
  mov    $0x255,%esi
  lea    D8(%rip),%rdi
  call   <AssertFailure@plt>
  mov    0x2c(%rbx),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,0x2c(%rbx)
  pop    %rbx
  ret
```

tool_calls: name: read_data
arguments: data_tag: D8
datatype: string

tool: D8: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c

assistant: ```c
void UARTFIFODisable(unsigned long ulBase) {
  {
    if (!(UARTBaseValid(ulBase))) {
      AssertFailure("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AmesianX/OpenBLT/refs/heads/master/Target/Demo/ARMCM3_LM3S_EK_LM3S6965_Crossworks/Boot/lib/driverlib/uartlib.c", 597);
    }
  };
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) &= ~(0x00000010);
}
```
user: What is the c source code of the assembly code below:

```asm
<hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  mov    %rdi,%rax
  mov    %rax,%r12
  mov    $0x0,%ebx
  jmp    L3
L16:
  mov    %ebx,%eax
  shl    $0x2,%eax
  add    %ebx,%eax
  add    %eax,%eax
  lea    -0x30(%rax),%edx
  mov    %r12,%rax
  lea    0x1(%rax),%r12
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  imul   $0xffffffffbdf7d06b,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xe,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  mov    %edx,%ebx
  sub    %ecx,%ebx
  imul   $0x563f,%ebx,%edx
  sub    %edx,%eax
  mov    %eax,%ebx
L3:
  movzbl (%r12),%eax
  test   %al,%al
  jne    L16
  mov    %ebx,%eax
  neg    %eax
  cmovns %eax,%ebx
  movslq %ebx,%rax
  imul   $0xffffffffbdf7d06b,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0xe,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x563f,%eax,%edx
  mov    %ebx,%eax
  sub    %edx,%eax
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
int hash(register char *string) {
  register int hashval = 0;
  register char *s = string;
  for (hashval = 0; *s != '\0';)
    hashval = (10 * hashval - 48 + *s++) % 22079;
  hashval = ((hashval < 0) ? -hashval : hashval);
  return (hashval % 22079);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<hash>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L25
  mov    $0x0,%eax
L3:
  add    $0x1,%rdi
  lea    (%rax,%rax,4),%eax
  movsbl %dl,%edx
  lea    -0x30(%rdx,%rax,2),%edx
  movslq %edx,%rax
  imul   $0xffffffffbdf7d06b,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0xe,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x563f,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  movzbl (%rdi),%edx
  test   %dl,%dl
  jne    L3
L0:
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  movslq %edx,%rax
  imul   $0xffffffffbdf7d06b,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0xe,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x563f,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  ret
L25:
  mov    $0x0,%eax
  jmp    L0
```

assistant: ```c
int hash(register char *string) {
  register int hashval = 0;
  register char *s = string;
  for (hashval = 0; *s != '\0';)
    hashval = (10 * hashval - 48 + *s++) % 22079;
  hashval = ((hashval < 0) ? -hashval : hashval);
  return (hashval % 22079);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<hash>:
  endbr64
  movsbl (%rdi),%eax
  test   %al,%al
  je     L13
  xor    %edx,%edx
  nopl   (%rax)
L3:
  lea    (%rdx,%rdx,4),%edx
  add    $0x1,%rdi
  lea    -0x30(%rax,%rdx,2),%eax
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0xffffffffbdf7d06b,%rdx,%rdx
  sar    $0x1f,%ecx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xe,%edx
  sub    %ecx,%edx
  imul   $0x563f,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  movsbl (%rdi),%eax
  test   %al,%al
  jne    L3
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  ret
  xchg   %ax,%ax
L13:
  xor    %eax,%eax
  ret
```

assistant: ```c
int hash(register char *string) {
  register int hashval = 0;
  register char *s = string;
  for (hashval = 0; *s != '\0';)
    hashval = (10 * hashval - 48 + *s++) % 22079;
  hashval = ((hashval < 0) ? -hashval : hashval);
  return (hashval % 22079);
}
```
user: Translate the below assembly code into C programming language:

```asm
<hash>:
  endbr64
  movsbl (%rdi),%eax
  test   %al,%al
  je     L11
  xor    %edx,%edx
  nopl   (%rax)
L0:
  lea    (%rdx,%rdx,4),%edx
  add    $0x1,%rdi
  lea    -0x30(%rax,%rdx,2),%eax
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0xffffffffbdf7d06b,%rdx,%rdx
  sar    $0x1f,%ecx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xe,%edx
  sub    %ecx,%edx
  imul   $0x563f,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  movsbl (%rdi),%eax
  test   %al,%al
  jne    L0
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  ret
  xchg   %ax,%ax
L11:
  xor    %eax,%eax
  ret
```

assistant: ```c
int hash(register char *string) {
  register int hashval = 0;
  register char *s = string;
  for (hashval = 0; *s != '\0';)
    hashval = (10 * hashval - 48 + *s++) % 22079;
  hashval = ((hashval < 0) ? -hashval : hashval);
  return (hashval % 22079);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<lang_specific_driver>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void lang_specific_driver(in_argc, in_argv, in_added_libraries) int *in_argc __attribute__((__unused__));
char ***in_argv __attribute__((__unused__));
int *in_added_libraries __attribute__((__unused__));
{ return; }
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<lang_specific_driver>:
  endbr64
  ret
```

assistant: ```c
void lang_specific_driver(in_argc, in_argv, in_added_libraries) int *in_argc __attribute__((__unused__));
char ***in_argv __attribute__((__unused__));
int *in_added_libraries __attribute__((__unused__));
{ return; }
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<lang_specific_driver>:
  endbr64
  ret
```

assistant: ```c
void lang_specific_driver(in_argc, in_argv, in_added_libraries) int *in_argc __attribute__((__unused__));
char ***in_argv __attribute__((__unused__));
int *in_added_libraries __attribute__((__unused__));
{ return; }
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<lang_specific_driver>:
  endbr64
  ret
```

assistant: ```c
void lang_specific_driver(in_argc, in_argv, in_added_libraries) int *in_argc __attribute__((__unused__));
char ***in_argv __attribute__((__unused__));
int *in_added_libraries __attribute__((__unused__));
{ return; }
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<gob_encode_string_int_helper>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %rdx,%r13
  mov    %ecx,%r14d
  call   <gob_start_struct@plt>
  mov    %eax,%r15d
  cltq
  add    %rax,%rbp
  sub    %rax,%r12
  mov    $0x2,%edx
  test   %r13,%r13
  je     L48
  cmpb   $0x0,0x0(%r13)
  jne    L44
L48:
  test   %r14d,%r14d
  jne    L43
L36:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <gob_end_struct@plt>
  add    %r15d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L44:
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbp
  sub    %rdx,%r12
  add    %eax,%r15d
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <gob_encode_string@plt>
  movslq %eax,%rdx
  add    %rdx,%rbp
  sub    %rdx,%r12
  add    %eax,%r15d
  mov    $0x1,%edx
  jmp    L48
L43:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbp
  sub    %rdx,%r12
  add    %eax,%r15d
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <gob_encode_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbp
  sub    %rdx,%r12
  add    %eax,%r15d
  jmp    L36
```

assistant: ```c
int gob_encode_string_int_helper(char *buf, size_t buf_size, const char *name, int id) {
  int total_size = 0;
  int num_bytes = 0;
  char *write_ptr = buf;
  num_bytes = gob_start_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  int fieldDelta = 1;
  if (name == NULL || *name == '\0') {
    fieldDelta++;
  } else {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_string(write_ptr, buf_size, name);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  if (id != 0) {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_int(write_ptr, buf_size, id);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  num_bytes = gob_end_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  return total_size;
}
```
user: What is the c source code of the assembly code below:

```asm
<gob_encode_string_int_helper>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  call   <gob_start_struct@plt>
  mov    $0x2,%edx
  mov    %eax,%ebx
  cltq
  add    %rax,%r12
  sub    %rax,%rbp
  test   %r14,%r14
  je     L5
  cmpb   $0x0,(%r14)
  jne    L43
L5:
  test   %r13d,%r13d
  jne    L29
L49:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_end_struct@plt>
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L43:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x1,%edx
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_string@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    $0x1,%edx
  test   %r13d,%r13d
  je     L49
L29:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  jmp    L49
```

assistant: ```c
int gob_encode_string_int_helper(char *buf, size_t buf_size, const char *name, int id) {
  int total_size = 0;
  int num_bytes = 0;
  char *write_ptr = buf;
  num_bytes = gob_start_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  int fieldDelta = 1;
  if (name == NULL || *name == '\0') {
    fieldDelta++;
  } else {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_string(write_ptr, buf_size, name);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  if (id != 0) {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_int(write_ptr, buf_size, id);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  num_bytes = gob_end_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  return total_size;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<gob_encode_string_int_helper>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  call   <gob_start_struct@plt>
  mov    $0x2,%edx
  mov    %eax,%ebx
  cltq
  add    %rax,%r12
  sub    %rax,%rbp
  test   %r14,%r14
  je     L2
  cmpb   $0x0,(%r14)
  jne    L33
L2:
  test   %r13d,%r13d
  jne    L46
L49:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_end_struct@plt>
  add    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L33:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x1,%edx
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_string@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    $0x1,%edx
  test   %r13d,%r13d
  je     L49
L46:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <gob_encode_int@plt>
  movslq %eax,%rdx
  add    %eax,%ebx
  add    %rdx,%r12
  sub    %rdx,%rbp
  jmp    L49
```

assistant: ```c
int gob_encode_string_int_helper(char *buf, size_t buf_size, const char *name, int id) {
  int total_size = 0;
  int num_bytes = 0;
  char *write_ptr = buf;
  num_bytes = gob_start_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  int fieldDelta = 1;
  if (name == NULL || *name == '\0') {
    fieldDelta++;
  } else {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_string(write_ptr, buf_size, name);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  if (id != 0) {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, fieldDelta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_int(write_ptr, buf_size, id);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  num_bytes = gob_end_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  return total_size;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<buf_printf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xe0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %rsi,-0xd0(%rbp)
  mov    %rdx,-0xd8(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L9
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L9:
  movl   $0x0,-0xb8(%rbp)
  mov    -0xd8(%rbp),%rdx
  mov    -0xb4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xd0(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jle    L7
  mov    -0xd0(%rbp),%rax
  mov    (%rax),%esi
  mov    -0xc8(%rbp),%rax
  mov    (%rax),%rax
  mov    -0xb4(%rbp),%ecx
  mov    -0xd8(%rbp),%rdx
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    %eax,-0xb8(%rbp)
L7:
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0xc8(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0xb8(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0xc8(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0xd0(%rbp),%rax
  mov    (%rax),%eax
  sub    -0xb8(%rbp),%eax
  mov    %eax,%edx
  mov    -0xd0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xb8(%rbp),%eax
  leave
  ret
```

assistant: ```c
int buf_printf(char **buf, int *len, const char *fmt, ...) {
  int l = 0;
  va_list ap;
  va_start(ap, fmt);
  if ((*len) > 0)
    l = vsnprintf(*buf, *len, fmt, ap);
  va_end(ap);
  (*buf) += l;
  (*len) -= l;
  return l;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<buf_printf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %rdx,%r13
  mov    %rdx,%rsi
  mov    $0x0,%edi
  call   <va_start@plt>
  mov    (%rbx),%esi
  mov    $0x0,%r12d
  test   %esi,%esi
  jg     L0
L9:
  mov    $0x0,%edi
  call   <va_end@plt>
  movslq %r12d,%rax
  add    %rax,0x0(%rbp)
  sub    %r12d,(%rbx)
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  mov    $0x0,%edi
  mov    %edi,%ecx
  mov    %r13,%rdx
  mov    0x0(%rbp),%rdi
  call   <vsnprintf@plt>
  mov    %eax,%r12d
  jmp    L9
```

assistant: ```c
int buf_printf(char **buf, int *len, const char *fmt, ...) {
  int l = 0;
  va_list ap;
  va_start(ap, fmt);
  if ((*len) > 0)
    l = vsnprintf(*buf, *len, fmt, ap);
  va_end(ap);
  (*buf) += l;
  (*len) -= l;
  return l;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<buf_printf>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdx,%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %rsi,%rbx
  mov    %rdx,%rsi
  call   <va_start@plt>
  mov    (%rbx),%esi
  test   %esi,%esi
  jle    L1
  mov    0x0(%rbp),%rdi
  xor    %ecx,%ecx
  mov    %r13,%rdx
  call   <vsnprintf@plt>
  movslq %eax,%r14
  mov    %r14,%r12
L1:
  xor    %edi,%edi
  call   <va_end@plt>
  add    %r14,0x0(%rbp)
  mov    %r12d,%eax
  sub    %r12d,(%rbx)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int buf_printf(char **buf, int *len, const char *fmt, ...) {
  int l = 0;
  va_list ap;
  va_start(ap, fmt);
  if ((*len) > 0)
    l = vsnprintf(*buf, *len, fmt, ap);
  va_end(ap);
  (*buf) += l;
  (*len) -= l;
  return l;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<buf_printf>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdx,%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %rsi,%rbx
  mov    %rdx,%rsi
  call   <va_start@plt>
  mov    (%rbx),%esi
  test   %esi,%esi
  jle    L1
  mov    0x0(%rbp),%rdi
  xor    %ecx,%ecx
  mov    %r13,%rdx
  call   <vsnprintf@plt>
  movslq %eax,%r14
  mov    %r14,%r12
L1:
  xor    %edi,%edi
  call   <va_end@plt>
  add    %r14,0x0(%rbp)
  mov    %r12d,%eax
  sub    %r12d,(%rbx)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int buf_printf(char **buf, int *len, const char *fmt, ...) {
  int l = 0;
  va_list ap;
  va_start(ap, fmt);
  if ((*len) > 0)
    l = vsnprintf(*buf, *len, fmt, ap);
  va_end(ap);
  (*buf) += l;
  (*len) -= l;
  return l;
}
```