ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<atoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  movl   $0x1,-0x14(%rbp)
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L32
  movl   $0xffffffff,-0x14(%rbp)
L32:
  movl   $0x0,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L49
L7:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0xc(%rbp),%eax
  add    %eax,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
L49:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L41
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L41
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L7
L41:
  mov    -0x14(%rbp),%eax
  imul   -0x10(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int atoi(const char *str) {
  int negative = 1;
  if (*str == '-')
    negative = -1;
  int num = 0;
  const char *ptr = str;
  while (*ptr && *ptr >= '0' && *ptr <= '9') {
    int digit = *ptr - '0';
    num *= 10;
    num += digit;
    ptr++;
  }
  return negative * num;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<atoi>:
  endbr64
  movzbl (%rdi),%edx
  cmp    $0x2d,%dl
  je     L35
  lea    -0x30(%rdx),%eax
  cmp    $0x9,%al
  ja     L18
  mov    $0x0,%eax
L32:
  lea    (%rax,%rax,4),%eax
  movsbl %dl,%edx
  lea    -0x30(%rdx,%rax,2),%eax
  add    $0x1,%rdi
  movzbl (%rdi),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  jbe    L32
  mov    $0x1,%edx
L27:
  imul   %edx,%eax
  ret
L35:
  mov    $0xffffffff,%edx
  mov    $0x0,%eax
  jmp    L27
L18:
  mov    $0x1,%edx
  mov    $0x0,%eax
  jmp    L27
```

assistant: ```c
int atoi(const char *str) {
  int negative = 1;
  if (*str == '-')
    negative = -1;
  int num = 0;
  const char *ptr = str;
  while (*ptr && *ptr >= '0' && *ptr <= '9') {
    int digit = *ptr - '0';
    num *= 10;
    num += digit;
    ptr++;
  }
  return negative * num;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<atoi>:
  endbr64
  movzbl (%rdi),%eax
  xor    %r8d,%r8d
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  ja     L19
  nopw   0x0(%rax,%rax,1)
L4:
  sub    $0x30,%eax
  lea    (%r8,%r8,4),%edx
  add    $0x1,%rdi
  movsbl %al,%eax
  lea    (%rax,%rdx,2),%r8d
  movzbl (%rdi),%eax
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L4
L19:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int atoi(const char *str) {
  int negative = 1;
  if (*str == '-')
    negative = -1;
  int num = 0;
  const char *ptr = str;
  while (*ptr && *ptr >= '0' && *ptr <= '9') {
    int digit = *ptr - '0';
    num *= 10;
    num += digit;
    ptr++;
  }
  return negative * num;
}
```
user: Translate the below assembly code into C programming language:

```asm
<atoi>:
  endbr64
  movzbl (%rdi),%eax
  xor    %r8d,%r8d
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  ja     L17
  nopw   0x0(%rax,%rax,1)
L12:
  sub    $0x30,%eax
  lea    (%r8,%r8,4),%edx
  add    $0x1,%rdi
  movsbl %al,%eax
  lea    (%rax,%rdx,2),%r8d
  movzbl (%rdi),%eax
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L12
L17:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int atoi(const char *str) {
  int negative = 1;
  if (*str == '-')
    negative = -1;
  int num = 0;
  const char *ptr = str;
  while (*ptr && *ptr >= '0' && *ptr <= '9') {
    int digit = *ptr - '0';
    num *= 10;
    num += digit;
    ptr++;
  }
  return negative * num;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<fftw_malloc_plain>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L17
  movq   $0x1,-0x18(%rbp)
L17:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fftw_malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L18
  lea    D3(%rip),%rax
  mov    %rax,%rdx
  mov    $0x180,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <fftw_assertion_failed@plt>
L18:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D3
type_infered: string
name: extract_symbolic_data
arguments: tag: D2
type_infered: string

tool: D3: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c

tool: D2: p

assistant: ```c
void *fftw_malloc_plain(size_t n) {
  void *p;
  if (n == 0)
    n = 1;
  p = fftw_malloc(n);
  (void)((p) || (fftw_assertion_failed("p", 384, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c"), 0));
  return p;
}
```
user: What is the c source code of the assembly code below?

```asm
<fftw_malloc_plain>:
  endbr64
  push   %rbx
  test   %rdi,%rdi
  mov    $0x1,%eax
  cmove  %rax,%rdi
  call   <fftw_malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L18
L7:
  mov    %rbx,%rax
  pop    %rbx
  ret
L18:
  lea    D19(%rip),%rdx
  mov    $0x180,%esi
  lea    D9(%rip),%rdi
  call   <fftw_assertion_failed@plt>
  jmp    L7
```

tool_calls: name: read_data
arguments: tag: D19
data_type: string
name: read_data
arguments: tag: D9
data_type: string

tool: D19: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c

tool: D9: p

assistant: ```c
void *fftw_malloc_plain(size_t n) {
  void *p;
  if (n == 0)
    n = 1;
  p = fftw_malloc(n);
  (void)((p) || (fftw_assertion_failed("p", 384, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c"), 0));
  return p;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fftw_malloc_plain>:
  endbr64
  push   %r12
  test   %rdi,%rdi
  mov    $0x1,%eax
  cmove  %rax,%rdi
  call   <fftw_malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L9
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L9:
  lea    D0(%rip),%rdx
  mov    $0x180,%esi
  lea    D1(%rip),%rdi
  call   <fftw_assertion_failed@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

tool_calls: name: parse_data
arguments: tag: D0
datatype: string
name: parse_data
arguments: tag: D1
datatype: string

tool: D0: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c

tool: D1: p

assistant: ```c
void *fftw_malloc_plain(size_t n) {
  void *p;
  if (n == 0)
    n = 1;
  p = fftw_malloc(n);
  (void)((p) || (fftw_assertion_failed("p", 384, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c"), 0));
  return p;
}
```
user: What is the c source code of the assembly code below:

```asm
<fftw_malloc_plain>:
  endbr64
  push   %r12
  test   %rdi,%rdi
  mov    $0x1,%eax
  cmove  %rax,%rdi
  call   <fftw_malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L1
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L1:
  lea    D7(%rip),%rdx
  mov    $0x180,%esi
  lea    D3(%rip),%rdi
  call   <fftw_assertion_failed@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

tool_calls: name: retrieve_data
arguments: label: D7
type_guessed: string
name: retrieve_data
arguments: label: D3
type_guessed: string

tool: D7: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c

tool: D3: p

assistant: ```c
void *fftw_malloc_plain(size_t n) {
  void *p;
  if (n == 0)
    n = 1;
  p = fftw_malloc(n);
  (void)((p) || (fftw_assertion_failed("p", 384, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/kernel/alloc.c"), 0));
  return p;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<hex_aton>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  cmpb   $0x2f,-0x4(%rbp)
  jle    L6
  cmpb   $0x39,-0x4(%rbp)
  jg     L6
  movsbl -0x4(%rbp),%eax
  sub    $0x30,%eax
  jmp    L75
L6:
  cmpb   $0x60,-0x4(%rbp)
  jle    L34
  cmpb   $0x66,-0x4(%rbp)
  jg     L34
  movsbl -0x4(%rbp),%eax
  sub    $0x57,%eax
  jmp    L75
L34:
  cmpb   $0x40,-0x4(%rbp)
  jle    L52
  cmpb   $0x46,-0x4(%rbp)
  jg     L52
  movsbl -0x4(%rbp),%eax
  sub    $0x37,%eax
  jmp    L75
L52:
  mov    $0xffffffff,%eax
L75:
  pop    %rbp
  ret
```

assistant: ```c
int hex_aton(char a) {
  if (a >= '0' && a <= '9')
    return a - '0';
  else if (a >= 'a' && a <= 'f')
    return 10 + a - 'a';
  else if (a >= 'A' && a <= 'F')
    return 10 + a - 'A';
  else
    return -1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<hex_aton>:
  endbr64
  lea    -0x30(%rdi),%eax
  cmp    $0x9,%al
  jbe    L3
  lea    -0x61(%rdi),%eax
  cmp    $0x5,%al
  jbe    L16
  lea    -0x41(%rdi),%eax
  cmp    $0x5,%al
  ja     L21
  movsbl %dil,%edi
  lea    -0x37(%rdi),%eax
  ret
L3:
  movsbl %dil,%edi
  lea    -0x30(%rdi),%eax
  ret
L16:
  movsbl %dil,%edi
  lea    -0x57(%rdi),%eax
  ret
L21:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int hex_aton(char a) {
  if (a >= '0' && a <= '9')
    return a - '0';
  else if (a >= 'a' && a <= 'f')
    return 10 + a - 'a';
  else if (a >= 'A' && a <= 'F')
    return 10 + a - 'A';
  else
    return -1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<hex_aton>:
  endbr64
  lea    -0x30(%rdi),%eax
  cmp    $0x9,%al
  jbe    L28
  lea    -0x61(%rdi),%eax
  cmp    $0x5,%al
  jbe    L14
  lea    -0x41(%rdi),%eax
  cmp    $0x5,%al
  ja     L22
  sub    $0x37,%edi
  movsbl %dil,%eax
  ret
  nopl   0x0(%rax)
L14:
  sub    $0x57,%edi
  movsbl %dil,%eax
  ret
L28:
  movsbl %al,%eax
  ret
L22:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int hex_aton(char a) {
  if (a >= '0' && a <= '9')
    return a - '0';
  else if (a >= 'a' && a <= 'f')
    return 10 + a - 'a';
  else if (a >= 'A' && a <= 'F')
    return 10 + a - 'A';
  else
    return -1;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<hex_aton>:
  endbr64
  lea    -0x30(%rdi),%eax
  cmp    $0x9,%al
  jbe    L1
  lea    -0x61(%rdi),%eax
  cmp    $0x5,%al
  jbe    L16
  lea    -0x41(%rdi),%eax
  cmp    $0x5,%al
  ja     L24
  sub    $0x37,%edi
  movsbl %dil,%eax
  ret
  nopl   0x0(%rax)
L16:
  sub    $0x57,%edi
  movsbl %dil,%eax
  ret
L1:
  movsbl %al,%eax
  ret
L24:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int hex_aton(char a) {
  if (a >= '0' && a <= '9')
    return a - '0';
  else if (a >= 'a' && a <= 'f')
    return 10 + a - 'a';
  else if (a >= 'A' && a <= 'F')
    return 10 + a - 'A';
  else
    return -1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fgeth>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  mov    %rdi,%rbx
  mov    %rbx,%rdi
  call   <getc@plt>
  movslq %eax,%r12
  mov    %rbx,%rdi
  call   <getc@plt>
  shl    $0x8,%eax
  cltq
  or     %rax,%r12
  mov    %rbx,%rdi
  call   <getc@plt>
  cltq
  shl    $0x10,%rax
  or     %rax,%r12
  mov    %rbx,%rdi
  call   <getc@plt>
  cltq
  shl    $0x18,%rax
  or     %r12,%rax
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
long fgeth(register FILE *f) {
  register long h;
  h = getc(f);
  h |= getc(f) << 8;
  h |= (long)getc(f) << 16;
  return h | (long)getc(f) << 24;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<fgeth>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  call   <getc@plt>
  mov    %eax,%ebp
  mov    %r13,%rdi
  call   <getc@plt>
  mov    %eax,%ebx
  mov    %r13,%rdi
  call   <getc@plt>
  mov    %eax,%r12d
  mov    %r13,%rdi
  call   <getc@plt>
  cltq
  shl    $0x18,%rax
  movslq %r12d,%r12
  shl    $0x10,%r12
  or     %r12,%rax
  shl    $0x8,%ebx
  or     %ebp,%ebx
  movslq %ebx,%rbx
  or     %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
long fgeth(register FILE *f) {
  register long h;
  h = getc(f);
  h |= getc(f) << 8;
  h |= (long)getc(f) << 16;
  return h | (long)getc(f) << 24;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fgeth>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <getc@plt>
  mov    %r13,%rdi
  mov    %eax,%ebp
  call   <getc@plt>
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <getc@plt>
  mov    %r13,%rdi
  shl    $0x8,%ebx
  movslq %eax,%r12
  or     %ebp,%ebx
  call   <getc@plt>
  shl    $0x10,%r12
  add    $0x8,%rsp
  movslq %ebx,%rbx
  cltq
  shl    $0x18,%rax
  or     %r12,%rax
  or     %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
long fgeth(register FILE *f) {
  register long h;
  h = getc(f);
  h |= getc(f) << 8;
  h |= (long)getc(f) << 16;
  return h | (long)getc(f) << 24;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<fgeth>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <getc@plt>
  mov    %r13,%rdi
  mov    %eax,%ebp
  call   <getc@plt>
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <getc@plt>
  mov    %r13,%rdi
  shl    $0x8,%ebx
  movslq %eax,%r12
  or     %ebp,%ebx
  call   <getc@plt>
  shl    $0x10,%r12
  add    $0x8,%rsp
  movslq %ebx,%rbx
  cltq
  shl    $0x18,%rax
  or     %r12,%rax
  or     %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
long fgeth(register FILE *f) {
  register long h;
  h = getc(f);
  h |= getc(f) << 8;
  h |= (long)getc(f) << 16;
  return h | (long)getc(f) << 24;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<fluid_verb>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <__BNF_trans_string@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L14
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <__BNF_trans_string@plt>
  mov    %eax,-0x4(%rbp)
  jmp    L19
L14:
  nop
L19:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D13
datatype: string
name: parse_data
arguments: label: D1
datatype: string

tool: D13: water

tool: D1: oil

assistant: ```c
int fluid_verb(void) {
  int state;
  do {
    state = __BNF_trans_string("water");
    if (!state)
      break;
    state = __BNF_trans_string("oil");
  } while (0);
  return state;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<fluid_verb>:
  endbr64
  sub    $0x8,%rsp
  lea    D18(%rip),%rdi
  call   <__BNF_trans_string@plt>
  test   %eax,%eax
  jne    L5
L14:
  add    $0x8,%rsp
  ret
L5:
  lea    D19(%rip),%rdi
  call   <__BNF_trans_string@plt>
  jmp    L14
```

tool_calls: name: extract_symbolic_data
arguments: tag: D18
type_infered: string
name: extract_symbolic_data
arguments: tag: D19
type_infered: string

tool: D18: water

tool: D19: oil

assistant: ```c
int fluid_verb(void) {
  int state;
  do {
    state = __BNF_trans_string("water");
    if (!state)
      break;
    state = __BNF_trans_string("oil");
  } while (0);
  return state;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<fluid_verb>:
  endbr64
  sub    $0x8,%rsp
  lea    D10(%rip),%rdi
  call   <__BNF_trans_string@plt>
  test   %eax,%eax
  jne    L7
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
  nop
L7:
  lea    D1(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <__BNF_trans_string@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D10
data_type: string
name: extract_symbolic_data
arguments: data_label: D1
data_type: string

tool: D10: water

tool: D1: oil

assistant: ```c
int fluid_verb(void) {
  int state;
  do {
    state = __BNF_trans_string("water");
    if (!state)
      break;
    state = __BNF_trans_string("oil");
  } while (0);
  return state;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<fluid_verb>:
  endbr64
  sub    $0x8,%rsp
  lea    D9(%rip),%rdi
  call   <__BNF_trans_string@plt>
  test   %eax,%eax
  jne    L6
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
  nop
L6:
  lea    D10(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <__BNF_trans_string@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D9
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D10
type_guessed: string

tool: D9: water

tool: D10: oil

assistant: ```c
int fluid_verb(void) {
  int state;
  do {
    state = __BNF_trans_string("water");
    if (!state)
      break;
    state = __BNF_trans_string("oil");
  } while (0);
  return state;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<psf_hexdump>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  jle    L18
  mov    %rdi,%rbx
  test   %rdi,%rdi
  je     L18
  lea    D34(%rip),%rdi
  mov    %esi,%ebp
  lea    0x10(%rsp),%r12
  call   <puts@plt>
  mov    %rbx,0x8(%rsp)
  xor    %ebx,%ebx
L96:
  mov    $0x11,%edx
  mov    $0x20,%esi
  mov    %r12,%rdi
  xor    %r13d,%r13d
  call   <memset@plt>
  mov    %ebx,%esi
  lea    D32(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%r15
  nopw   0x0(%rax,%rax,1)
L91:
  lea    (%rbx,%r13,1),%eax
  mov    %r13d,%r14d
  cmp    %eax,%ebp
  jle    L5
  cmp    $0x8,%r13
  lea    D37(%rip),%rax
  lea    D39(%rip),%rdi
  movzbl (%r15),%esi
  cmovne %rax,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsbl (%r15),%edi
  call   <psf_isprint@plt>
  mov    %rax,%r8
  mov    $0x2e,%eax
  test   %r8,%r8
  je     L61
  movzbl (%r15),%eax
L61:
  mov    %al,(%r12,%r13,1)
  add    $0x1,%r13
  add    $0x1,%r15
  cmp    $0x10,%r13
  jne    L91
L15:
  mov    %r12,%rsi
  lea    D9(%rip),%rdi
  xor    %eax,%eax
  add    $0x10,%ebx
  movb   $0x0,0x20(%rsp)
  call   <printf@plt>
  addq   $0x10,0x8(%rsp)
  cmp    %ebx,%ebp
  jg     L96
  lea    D34(%rip),%rdi
  call   <puts@plt>
L18:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L59
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L5:
  cmp    $0x8,%r13d
  jg     L26
  mov    $0x20,%edi
  call   <putchar@plt>
L26:
  lea    D48(%rip),%r13
  nopw   0x0(%rax,%rax,1)
L80:
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%r14d
  call   <printf@plt>
  cmp    $0x10,%r14d
  jne    L80
  jmp    L15
L59:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D34
data_type: string
name: unpack_data
arguments: data_label: D32
data_type: string
name: unpack_data
arguments: data_label: D37
data_type: string
name: unpack_data
arguments: data_label: D39
data_type: string
name: unpack_data
arguments: data_label: D9
data_type: string
name: unpack_data
arguments: data_label: D48
data_type: string

tool: 

tool: D32: %08X: 

tool: D37: %02X 

tool: D39:  %02X 

tool: D9:  %s


tool: D48:    

assistant: ```c
void psf_hexdump(const void *ptr, int len) {
  const char *data;
  char ascii[17];
  int k, m;
  if ((data = ptr) == NULL)
    return;
  if (len <= 0)
    return;
  puts("");
  for (k = 0; k < len; k += 16) {
    memset(ascii, ' ', sizeof(ascii));
    printf("%08X: ", k);
    for (m = 0; m < 16 && k + m < len; m++) {
      printf(m == 8 ? " %02X " : "%02X ", data[k + m] & 0xFF);
      ascii[m] = psf_isprint(data[k + m]) ? data[k + m] : '.';
    };
    if (m <= 8)
      printf(" ");
    for (; m < 16; m++)
      printf("   ");
    ascii[16] = 0;
    printf(" %s\n", ascii);
  };
  puts("");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<psf_hexdump>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,0x4(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  jle    L86
  mov    %rdi,%rbx
  test   %rdi,%rdi
  je     L86
  lea    D63(%rip),%rdi
  lea    0x10(%rsp),%r12
  call   <puts@plt>
  lea    D55(%rip),%r13
  mov    %rbx,0x8(%rsp)
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L23:
  mov    $0x11,%edx
  mov    $0x20,%esi
  mov    %r12,%rdi
  xor    %r15d,%r15d
  call   <memset@plt>
  mov    %ebx,%esi
  lea    D69(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rbp
L45:
  mov    %r15d,%r14d
  lea    (%rbx,%r15,1),%eax
  cmp    %eax,0x4(%rsp)
  jle    L96
L9:
  cmp    $0x8,%r15
  lea    D7(%rip),%rax
  lea    D62(%rip),%rdi
  movzbl 0x0(%rbp),%esi
  cmovne %rax,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsbl 0x0(%rbp),%edi
  call   <psf_isprint@plt>
  test   %rax,%rax
  je     L64
  movzbl 0x0(%rbp),%eax
  add    $0x1,%rbp
  mov    %al,(%r12,%r15,1)
  add    $0x1,%r15
  cmp    $0x10,%r15
  jne    L45
L27:
  mov    %r12,%rsi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  add    $0x10,%ebx
  movb   $0x0,0x20(%rsp)
  call   <printf@plt>
  addq   $0x10,0x8(%rsp)
  cmp    %ebx,0x4(%rsp)
  jg     L23
  lea    D63(%rip),%rdi
  call   <puts@plt>
L86:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L64:
  movb   $0x2e,(%r12,%r15,1)
  add    $0x1,%r15
  add    $0x1,%rbp
  cmp    $0x10,%r15
  je     L27
  mov    %r15d,%r14d
  lea    (%rbx,%r15,1),%eax
  cmp    %eax,0x4(%rsp)
  jg     L9
L96:
  cmp    $0x8,%r15d
  jg     L36
  mov    $0x20,%edi
  call   <putchar@plt>
  nopl   0x0(%rax)
L36:
  mov    %r13,%rdi
  xor    %eax,%eax
  add    $0x1,%r14d
  call   <printf@plt>
  cmp    $0x10,%r14d
  jne    L36
  jmp    L27
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D63
datatype: string
name: unpack_data
arguments: label: D55
datatype: string
name: unpack_data
arguments: label: D69
datatype: string
name: unpack_data
arguments: label: D7
datatype: string
name: unpack_data
arguments: label: D62
datatype: string
name: unpack_data
arguments: label: D0
datatype: string

tool: 

tool: D55:    

tool: D69: %08X: 

tool: D7: %02X 

tool: D62:  %02X 

tool: D0:  %s


assistant: ```c
void psf_hexdump(const void *ptr, int len) {
  const char *data;
  char ascii[17];
  int k, m;
  if ((data = ptr) == NULL)
    return;
  if (len <= 0)
    return;
  puts("");
  for (k = 0; k < len; k += 16) {
    memset(ascii, ' ', sizeof(ascii));
    printf("%08X: ", k);
    for (m = 0; m < 16 && k + m < len; m++) {
      printf(m == 8 ? " %02X " : "%02X ", data[k + m] & 0xFF);
      ascii[m] = psf_isprint(data[k + m]) ? data[k + m] : '.';
    };
    if (m <= 8)
      printf(" ");
    for (; m < 16; m++)
      printf("   ");
    ascii[16] = 0;
    printf(" %s\n", ascii);
  };
  puts("");
}
```