ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码：

```asm
<syndrome>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
  movb   $0x0,(%rsi)
  mov    D9(%rip),%r13
  nopl   0x0(%rax,%rax,1)
L8:
  movzbl (%rbx,%r13,1),%esi
  mov    %r12,%rdi
  call   <evalpoly@plt>
  mov    %al,0x0(%rbp,%rbx,1)
  add    $0x1,%rbx
  or     %al,0x0(%rbp)
  cmp    $0x7,%rbx
  jne    L8
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void syndrome(unsigned char c[255], unsigned char s[7]) {
  extern unsigned char e2v[256];
  int i;
  s[0] = 0;
  for (i = 1; i < 7; i++) {
    s[i] = evalpoly(c, e2v[i]);
    s[0] = s[0] | s[i];
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_binary>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L24
L28:
  mov    -0x8(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L1
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L37
L1:
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L37:
  sarq   -0x8(%rbp)
L24:
  cmpq   $0x0,-0x8(%rbp)
  jne    L28
  lea    D15(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D12
datatype: string
name: disassemble_data
arguments: label: D20
datatype: string
name: disassemble_data
arguments: label: D15
datatype: string

tool: D12: 1

tool: D20: 0

tool: D15: 


assistant: ```c
void print_binary(uint64_t long_num) {
  long a = long_num;
  while (a) {
    if (a & 1)
      printf("1");
    else
      printf("0");
    a >>= 1;
  }
  printf("\n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_binary>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  test   %rdi,%rdi
  je     L3
  mov    %rdi,%rbx
  lea    D4(%rip),%r12
  lea    D10(%rip),%rbp
  jmp    L32
L15:
  mov    %r12,%rdi
  call   <printf@plt>
L6:
  sar    %rbx
  je     L3
L32:
  test   $0x1,%bl
  je     L15
  mov    %rbp,%rdi
  call   <printf@plt>
  jmp    L6
L3:
  lea    D28(%rip),%rdi
  call   <printf@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: tag: D4
type: string
name: read_data
arguments: tag: D10
type: string
name: read_data
arguments: tag: D28
type: string

tool: D4: 0

tool: D10: 1

tool: D28: 


assistant: ```c
void print_binary(uint64_t long_num) {
  long a = long_num;
  while (a) {
    if (a & 1)
      printf("1");
    else
      printf("0");
    a >>= 1;
  }
  printf("\n");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<print_binary>:
  endbr64
  test   %rdi,%rdi
  je     L25
  push   %r12
  lea    D7(%rip),%r12
  push   %rbp
  lea    D14(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  jmp    L11
L22:
  mov    %rbp,%rdi
  call   <printf@plt>
  sar    %rbx
  je     L34
L11:
  test   $0x1,%bl
  jne    L22
  mov    %r12,%rdi
  call   <printf@plt>
  sar    %rbx
  jne    L11
L34:
  pop    %rbx
  lea    D13(%rip),%rdi
  pop    %rbp
  pop    %r12
  jmp    1050 <printf@plt>
  nop
L25:
  lea    D13(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: read_data
arguments: data_label: D7
type_infered: string
name: read_data
arguments: data_label: D14
type_infered: string
name: read_data
arguments: data_label: D13
type_infered: string

tool: D7: 0

tool: D14: 1

tool: D13: 


assistant: ```c
void print_binary(uint64_t long_num) {
  long a = long_num;
  while (a) {
    if (a & 1)
      printf("1");
    else
      printf("0");
    a >>= 1;
  }
  printf("\n");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<print_binary>:
  endbr64
  test   %rdi,%rdi
  je     L36
  push   %r12
  lea    D15(%rip),%r12
  push   %rbp
  lea    D21(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  jmp    L5
L17:
  mov    %rbp,%rdi
  call   <printf@plt>
  sar    %rbx
  je     L33
L5:
  test   $0x1,%bl
  jne    L17
  mov    %r12,%rdi
  call   <printf@plt>
  sar    %rbx
  jne    L5
L33:
  pop    %rbx
  lea    D39(%rip),%rdi
  pop    %rbp
  pop    %r12
  jmp    1050 <printf@plt>
  nop
L36:
  lea    D39(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: label: D15
type: string
name: retrieve_data
arguments: label: D21
type: string
name: retrieve_data
arguments: label: D39
type: string

tool: D15: 0

tool: D21: 1

tool: D39: 


assistant: ```c
void print_binary(uint64_t long_num) {
  long a = long_num;
  while (a) {
    if (a & 1)
      printf("1");
    else
      printf("0");
    a >>= 1;
  }
  printf("\n");
}
```
user: What is the c source code of the assembly code below?

```asm
<snd_mask_refine_first>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <snd_mask_single@plt>
  test   %rax,%rax
  je     L9
  mov    $0x0,%eax
  jmp    L17
L9:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <snd_mask_min@plt>
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <snd_mask_leave@plt>
  mov    $0x1,%eax
L17:
  leave
  ret
```

assistant: ```c
int snd_mask_refine_first(struct snd_mask *mask) {
  if (snd_mask_single(mask))
    return 0;
  snd_mask_leave(mask, snd_mask_min(mask));
  return 1;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<snd_mask_refine_first>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <snd_mask_single@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L5
L18:
  pop    %rbx
  ret
L5:
  mov    %rbx,%rdi
  call   <snd_mask_min@plt>
  mov    %eax,%esi
  mov    %rbx,%rdi
  call   <snd_mask_leave@plt>
  mov    $0x1,%eax
  jmp    L18
```

assistant: ```c
int snd_mask_refine_first(struct snd_mask *mask) {
  if (snd_mask_single(mask))
    return 0;
  snd_mask_leave(mask, snd_mask_min(mask));
  return 1;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<snd_mask_refine_first>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <snd_mask_single@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L8
  pop    %rbp
  ret
  nopl   0x0(%rax)
L8:
  mov    %rbp,%rdi
  call   <snd_mask_min@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  call   <snd_mask_leave@plt>
  mov    $0x1,%eax
  pop    %rbp
  ret
```

assistant: ```c
int snd_mask_refine_first(struct snd_mask *mask) {
  if (snd_mask_single(mask))
    return 0;
  snd_mask_leave(mask, snd_mask_min(mask));
  return 1;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<snd_mask_refine_first>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <snd_mask_single@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L3
  pop    %rbp
  ret
  nopl   0x0(%rax)
L3:
  mov    %rbp,%rdi
  call   <snd_mask_min@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  call   <snd_mask_leave@plt>
  mov    $0x1,%eax
  pop    %rbp
  ret
```

assistant: ```c
int snd_mask_refine_first(struct snd_mask *mask) {
  if (snd_mask_single(mask))
    return 0;
  snd_mask_leave(mask, snd_mask_min(mask));
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<chop2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L8
  mov    $0x0,%eax
  jmp    L31
L8:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  jmp    L41
L39:
  subl   $0x1,-0x4(%rbp)
L41:
  cmpl   $0x0,-0x4(%rbp)
  jle    L15
  mov    -0x4(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L39
L15:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
L31:
  leave
  ret
```

assistant: ```c
unsigned char *chop2(unsigned char *str) {
  if (!str)
    return 0;
  int len = strlen(str);
  while (len > 0 && isspace(str[len - 1]))
    --len;
  str[len] = 0;
  return str;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<chop2>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  test   %rdi,%rdi
  je     L25
  call   <strlen@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jle    L35
  cltq
  lea    -0x1(%r12,%rax,1),%rbp
L17:
  movzbl 0x0(%rbp),%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L35
  sub    $0x1,%rbp
  sub    $0x1,%ebx
  jne    L17
L35:
  movslq %ebx,%rbx
  movb   $0x0,(%r12,%rbx,1)
L25:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
unsigned char *chop2(unsigned char *str) {
  if (!str)
    return 0;
  int len = strlen(str);
  while (len > 0 && isspace(str[len - 1]))
    --len;
  str[len] = 0;
  return str;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<chop2>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L43
  call   <strlen@plt>
  movslq %eax,%rbx
  test   %eax,%eax
  jg     L57
  jmp    L45
  nopl   0x0(%rax)
L7:
  lea    -0x1(%rbx),%eax
  sub    $0x1,%rbx
  je     L35
L57:
  movzbl -0x1(%r12,%rbx,1),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L7
L45:
  movb   $0x0,(%r12,%rbx,1)
L43:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax)
L35:
  movslq %eax,%rbx
  jmp    L45
```

assistant: ```c
unsigned char *chop2(unsigned char *str) {
  if (!str)
    return 0;
  int len = strlen(str);
  while (len > 0 && isspace(str[len - 1]))
    --len;
  str[len] = 0;
  return str;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<chop2>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L6
  call   <strlen@plt>
  movslq %eax,%rbx
  test   %eax,%eax
  jg     L0
  jmp    L4
  nopl   0x0(%rax)
L12:
  lea    -0x1(%rbx),%eax
  sub    $0x1,%rbx
  je     L48
L0:
  movzbl -0x1(%r12,%rbx,1),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L12
L4:
  movb   $0x0,(%r12,%rbx,1)
L6:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax)
L48:
  movslq %eax,%rbx
  jmp    L4
```

assistant: ```c
unsigned char *chop2(unsigned char *str) {
  if (!str)
    return 0;
  int len = strlen(str);
  while (len > 0 && isspace(str[len - 1]))
    --len;
  str[len] = 0;
  return str;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<outstringsize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L138
L8:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x5c,%eax
  je     L195
  cmp    $0x5c,%eax
  jg     L134
  cmp    $0x22,%eax
  je     L195
  cmp    $0x22,%eax
  jg     L134
  cmp    $0x20,%eax
  je     L12
  cmp    $0x20,%eax
  jg     L134
  test   %eax,%eax
  je     L76
  test   %eax,%eax
  js     L134
  sub    $0x7,%eax
  cmp    $0x6,%eax
  ja     L134
  jmp    L195
L76:
  mov    -0x20(%rbp),%rax
  sub    $0x1,%rax
  cmp    %rax,-0x8(%rbp)
  jge    L81
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L81
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x37,%al
  jg     L81
  addq   $0x4,-0x10(%rbp)
  jmp    L189
L81:
  addq   $0x2,-0x10(%rbp)
  jmp    L189
L195:
  addq   $0x2,-0x10(%rbp)
  jmp    L189
L12:
  addq   $0x1,-0x10(%rbp)
  jmp    L189
L134:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %eax,%eax
  je     L190
  addq   $0x1,-0x10(%rbp)
  jmp    L105
L190:
  addq   $0x4,-0x10(%rbp)
L105:
  nop
L189:
  addq   $0x1,-0x8(%rbp)
L138:
  mov    -0x8(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jl     L8
  mov    -0x10(%rbp),%rax
  leave
  ret
```

assistant: ```c
long outstringsize(char const *str, long length) {
  long size, i;
  size = 0;
  for (i = 0; i < length; ++i) {
    switch (str[i]) {
    case '\0':
      if (i < length - 1 && str[i + 1] >= '0' && str[i + 1] <= '7')
        size += 4;
      else
        size += 2;
      break;
    case '\a':
    case '\r':
    case '\b':
    case '\t':
    case '\f':
    case '\v':
    case '\n':
    case '\\':
    case '"':
      size += 2;
      break;
    case ' ':
      ++size;
      break;
    default:
      if (isprint(str[i]))
        ++size;
      else
        size += 4;
      break;
    }
  }
  return size;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<outstringsize>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  jle    L141
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    $0x0,%ebx
  mov    $0x0,%ebp
  lea    -0x1(%rsi),%r14
  jmp    L15
L22:
  lea    -0x7(%rdi),%eax
  cmp    $0x6,%al
  jbe    L108
L137:
  movsbl %dil,%edi
  call   <isprint@plt>
  mov    %eax,%edx
  lea    0x1(%rbp),%rax
  add    $0x4,%rbp
  test   %edx,%edx
  cmovne %rax,%rbp
  jmp    L39
L68:
  cmp    $0x22,%dil
  je     L108
  cmp    $0x5c,%dil
  jne    L137
L108:
  add    $0x2,%rbp
L39:
  add    $0x1,%rbx
  cmp    %rbx,%r12
  je     L148
L15:
  movzbl 0x0(%r13,%rbx,1),%edi
  cmp    $0x20,%dil
  je     L130
  jg     L68
  test   %dil,%dil
  jne    L22
  cmp    %rbx,%r14
  jle    L78
  movzbl 0x1(%r13,%rbx,1),%eax
  sub    $0x30,%eax
  cmp    $0x7,%al
  jbe    L112
L78:
  add    $0x2,%rbp
  jmp    L39
L112:
  add    $0x4,%rbp
  jmp    L39
L130:
  add    $0x1,%rbp
  jmp    L39
L141:
  mov    $0x0,%ebp
L148:
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
long outstringsize(char const *str, long length) {
  long size, i;
  size = 0;
  for (i = 0; i < length; ++i) {
    switch (str[i]) {
    case '\0':
      if (i < length - 1 && str[i + 1] >= '0' && str[i + 1] <= '7')
        size += 4;
      else
        size += 2;
      break;
    case '\a':
    case '\r':
    case '\b':
    case '\t':
    case '\f':
    case '\v':
    case '\n':
    case '\\':
    case '"':
      size += 2;
      break;
    case ' ':
      ++size;
      break;
    default:
      if (isprint(str[i]))
        ++size;
      else
        size += 4;
      break;
    }
  }
  return size;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<outstringsize>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  jle    L73
  mov    %rdi,%r14
  mov    %rsi,%r13
  xor    %ebx,%ebx
  xor    %r12d,%r12d
  lea    -0x1(%rsi),%rbp
  jmp    L79
  cs nopw 0x0(%rax,%rax,1)
L69:
  cmp    %rbx,%rbp
  jle    L131
  movzbl 0x1(%r14,%rbx,1),%eax
  sub    $0x30,%eax
  cmp    $0x7,%al
  jbe    L132
  nopw   0x0(%rax,%rax,1)
L131:
  add    $0x2,%r12
L2:
  add    $0x1,%rbx
  cmp    %rbx,%r13
  je     L98
L79:
  movsbl (%r14,%rbx,1),%edi
  cmp    $0x20,%dil
  je     L43
  jg     L29
  test   %dil,%dil
  je     L69
  lea    -0x7(%rdi),%eax
  cmp    $0x6,%al
  jbe    L131
L143:
  call   <isprint@plt>
  mov    %eax,%r8d
  lea    0x1(%r12),%rax
  add    $0x4,%r12
  test   %r8d,%r8d
  cmovne %rax,%r12
  add    $0x1,%rbx
  cmp    %rbx,%r13
  jne    L79
L98:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L29:
  cmp    $0x22,%dil
  je     L131
  cmp    $0x5c,%dil
  je     L131
  jmp    L143
  xchg   %ax,%ax
L43:
  add    $0x1,%r12
  jmp    L2
  cs nopw 0x0(%rax,%rax,1)
L132:
  add    $0x4,%r12
  jmp    L2
  cs nopw 0x0(%rax,%rax,1)
L73:
  xor    %r12d,%r12d
  pop    %rbx
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
long outstringsize(char const *str, long length) {
  long size, i;
  size = 0;
  for (i = 0; i < length; ++i) {
    switch (str[i]) {
    case '\0':
      if (i < length - 1 && str[i + 1] >= '0' && str[i + 1] <= '7')
        size += 4;
      else
        size += 2;
      break;
    case '\a':
    case '\r':
    case '\b':
    case '\t':
    case '\f':
    case '\v':
    case '\n':
    case '\\':
    case '"':
      size += 2;
      break;
    case ' ':
      ++size;
      break;
    default:
      if (isprint(str[i]))
        ++size;
      else
        size += 4;
      break;
    }
  }
  return size;
}
```
user: Translate the below assembly code into C programming language:

```asm
<outstringsize>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  jle    L146
  mov    %rsi,%r14
  mov    %rdi,%rbp
  mov    %rsi,%r13
  sub    $0x1,%r14
  je     L27
  cmp    %r14,%rsi
  cmovle %rsi,%r14
  xor    %ebx,%ebx
  xor    %r12d,%r12d
  jmp    L129
  cs nopw 0x0(%rax,%rax,1)
L83:
  movzbl 0x1(%rbp,%rbx,1),%eax
  lea    0x4(%r12),%rdx
  add    $0x2,%r12
  sub    $0x30,%eax
  cmp    $0x7,%al
  cmovbe %rdx,%r12
L153:
  add    $0x1,%rbx
  cmp    %r14,%rbx
  jge    L184
L129:
  movsbl 0x0(%rbp,%rbx,1),%edi
  cmp    $0x20,%dil
  je     L202
  jg     L152
  test   %dil,%dil
  je     L83
  lea    -0x7(%rdi),%eax
  cmp    $0x6,%al
  ja     L158
L160:
  add    $0x2,%r12
  jmp    L153
  nopl   0x0(%rax,%rax,1)
L162:
  cmp    $0x22,%dil
  je     L98
  cmp    $0x5c,%dil
  jne    L190
L98:
  add    $0x2,%r12
L62:
  add    $0x1,%rbx
L184:
  cmp    %rbx,%r13
  jle    L52
L50:
  movsbl 0x0(%rbp,%rbx,1),%edi
  cmp    $0x20,%dil
  je     L53
  jg     L162
  test   %dil,%dil
  je     L98
  lea    -0x7(%rdi),%eax
  cmp    $0x6,%al
  jbe    L98
L190:
  call   <isprint@plt>
  mov    %eax,%r8d
  lea    0x1(%r12),%rax
  add    $0x4,%r12
  test   %r8d,%r8d
  cmovne %rax,%r12
  jmp    L62
  nopl   0x0(%rax,%rax,1)
L152:
  cmp    $0x22,%dil
  je     L160
  cmp    $0x5c,%dil
  je     L160
L158:
  call   <isprint@plt>
  mov    %eax,%r8d
  lea    0x1(%r12),%rax
  add    $0x4,%r12
  test   %r8d,%r8d
  cmovne %rax,%r12
  jmp    L153
  nopl   0x0(%rax)
L53:
  add    $0x1,%r12
  jmp    L62
  cs nopw 0x0(%rax,%rax,1)
L202:
  add    $0x1,%r12
  jmp    L153
  nopl   0x0(%rax)
L146:
  xor    %r12d,%r12d
L52:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L27:
  xor    %ebx,%ebx
  xor    %r12d,%r12d
  jmp    L50
```

assistant: ```c
long outstringsize(char const *str, long length) {
  long size, i;
  size = 0;
  for (i = 0; i < length; ++i) {
    switch (str[i]) {
    case '\0':
      if (i < length - 1 && str[i + 1] >= '0' && str[i + 1] <= '7')
        size += 4;
      else
        size += 2;
      break;
    case '\a':
    case '\r':
    case '\b':
    case '\t':
    case '\f':
    case '\v':
    case '\n':
    case '\\':
    case '"':
      size += 2;
      break;
    case ' ':
      ++size;
      break;
    default:
      if (isprint(str[i]))
        ++size;
      else
        size += 4;
      break;
    }
  }
  return size;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<hfdprintf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xe0,%rsp
  mov    %edi,-0xd4(%rbp)
  mov    %rsi,-0xe0(%rbp)
  mov    %rdx,-0xa0(%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:
  mov    -0xe0(%rbp),%rdx
  mov    -0xc8(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xc8(%rbp),%edx
  mov    -0xe0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <hvsprintf@plt>
  mov    %rax,-0xb8(%rbp)
  mov    -0xc8(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0xb8(%rbp),%rax
  mov    %rax,-0xc0(%rbp)
  mov    -0xc0(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xcc(%rbp)
  movl   $0x0,-0xc4(%rbp)
L32:
  mov    -0xcc(%rbp),%edx
  mov    -0xb8(%rbp),%rcx
  mov    -0xd4(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <xwrite@plt>
  mov    %eax,-0xc4(%rbp)
  cmpl   $0x0,-0xc4(%rbp)
  jns    L27
  mov    -0xc4(%rbp),%eax
  jmp    L21
L27:
  mov    -0xc4(%rbp),%eax
  sub    %eax,-0xcc(%rbp)
  mov    -0xc4(%rbp),%eax
  cltq
  add    %rax,-0xc0(%rbp)
  cmpl   $0x0,-0xcc(%rbp)
  jg     L32
  mov    -0xb8(%rbp),%rax
  mov    %rax,%rdi
  call   <xfree@plt>
  mov    -0xcc(%rbp),%eax
L21:
  leave
  ret
```

assistant: ```c
int hfdprintf(int fd, const char *format, ...) {
  char *str, *p;
  va_list ap;
  int n, rc;
  va_start(ap, format);
  str = hvsprintf(format, ap);
  va_end(ap);
  p = str;
  n = strlen(p);
  rc = 0;
  do {
    rc = xwrite(fd, str, n);
    if (rc < 0)
      return rc;
    n -= rc;
    p += rc;
  } while (n > 0);
  xfree(str);
  return n;
}
```
user: What is the c source code of the assembly code below:

```asm
<hfdprintf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbx
  mov    $0x0,%r13d
  mov    %r13d,%edi
  call   <va_start@plt>
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <hvsprintf@plt>
  mov    %rax,%rbp
  mov    %r13d,%edi
  call   <va_end@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
L0:
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <xwrite@plt>
  test   %eax,%eax
  js     L4
  sub    %eax,%ebx
  test   %ebx,%ebx
  jg     L0
  mov    %rbp,%rdi
  call   <xfree@plt>
  mov    %ebx,%eax
L4:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int hfdprintf(int fd, const char *format, ...) {
  char *str, *p;
  va_list ap;
  int n, rc;
  va_start(ap, format);
  str = hvsprintf(format, ap);
  va_end(ap);
  p = str;
  n = strlen(p);
  rc = 0;
  do {
    rc = xwrite(fd, str, n);
    if (rc < 0)
      return rc;
    n -= rc;
    p += rc;
  } while (n > 0);
  xfree(str);
  return n;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<hfdprintf>:
  endbr64
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %edi,%r12d
  mov    %r13d,%edi
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r13d,%esi
  mov    %rbp,%rdi
  call   <hvsprintf@plt>
  mov    %r13d,%edi
  mov    %rax,%rbp
  call   <va_end@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  jmp    L3
  nopl   0x0(%rax)
L14:
  sub    %eax,%ebx
  test   %ebx,%ebx
  jle    L24
L3:
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <xwrite@plt>
  test   %eax,%eax
  jns    L14
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L24:
  mov    %rbp,%rdi
  call   <xfree@plt>
  add    $0x8,%rsp
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int hfdprintf(int fd, const char *format, ...) {
  char *str, *p;
  va_list ap;
  int n, rc;
  va_start(ap, format);
  str = hvsprintf(format, ap);
  va_end(ap);
  p = str;
  n = strlen(p);
  rc = 0;
  do {
    rc = xwrite(fd, str, n);
    if (rc < 0)
      return rc;
    n -= rc;
    p += rc;
  } while (n > 0);
  xfree(str);
  return n;
}
```