ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<parseip>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0x2e,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L2
  mov    %rsp,%rbp
  lea    0x10(%rsp),%r13
  jmp    L39
L15:
  movb   $0x0,(%rax)
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp)
  movb   $0x2e,(%rbx)
  lea    0x1(%rbx),%r12
L60:
  add    $0x4,%rbp
  cmp    %r13,%rbp
  je     L51
L39:
  mov    $0x2e,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L15
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp)
  jmp    L60
L51:
  mov    (%rsp),%eax
  shl    $0x18,%eax
  mov    0x4(%rsp),%edx
  shl    $0x10,%edx
  or     %edx,%eax
  or     0xc(%rsp),%eax
  mov    0x8(%rsp),%edx
  shl    $0x8,%edx
  or     %edx,%eax
L40:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L58
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L2:
  mov    %r12,%rdi
  call   <atoi@plt>
  jmp    L40
L58:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int parseip(char *s) {
  int ip = 0;
  if (strchr(s, '.')) {
    int i;
    uint8_t b[4];
    char *p, *n;
    n = s;
    for (i = 0; i < 4; i++) {
      p = strchr(n, '.');
      if (p)
        *p = 0;
      b[i] = atoi(n);
      if (p)
        *p = '.';
      if (p)
        n = p + 1;
    }
    ip = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
  } else {
    ip = atoi(s);
  }
  return ip;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<parseip>:
  endbr64
  push   %r13
  mov    $0x2e,%esi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strchr@plt>
  test   %rax,%rax
  je     L16
  mov    %rsp,%rbp
  lea    0x10(%rsp),%r13
L40:
  mov    $0x2e,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L58
  movb   $0x0,(%rax)
  mov    %r12,%rdi
  lea    0x1(%rbx),%r12
  call   <atoi@plt>
  movb   $0x2e,(%rbx)
  mov    %eax,0x0(%rbp)
L42:
  add    $0x4,%rbp
  cmp    %rbp,%r13
  jne    L40
  mov    (%rsp),%eax
  mov    0x4(%rsp),%edx
  shl    $0x18,%eax
  shl    $0x10,%edx
  or     %edx,%eax
  mov    0x8(%rsp),%edx
  or     0xc(%rsp),%eax
  shl    $0x8,%edx
  or     %edx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L32
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L58:
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp)
  jmp    L42
  nopl   (%rax)
L16:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  add    $0x28,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <atoi@plt>
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int parseip(char *s) {
  int ip = 0;
  if (strchr(s, '.')) {
    int i;
    uint8_t b[4];
    char *p, *n;
    n = s;
    for (i = 0; i < 4; i++) {
      p = strchr(n, '.');
      if (p)
        *p = 0;
      b[i] = atoi(n);
      if (p)
        *p = '.';
      if (p)
        n = p + 1;
    }
    ip = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
  } else {
    ip = atoi(s);
  }
  return ip;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<parseip>:
  endbr64
  push   %r13
  mov    $0x2e,%esi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strchr@plt>
  test   %rax,%rax
  je     L8
  mov    %rsp,%rbp
  lea    0x10(%rsp),%r13
L15:
  mov    $0x2e,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L1
  movb   $0x0,(%rax)
  mov    %r12,%rdi
  lea    0x1(%rbx),%r12
  call   <atoi@plt>
  movb   $0x2e,(%rbx)
  mov    %eax,0x0(%rbp)
L21:
  add    $0x4,%rbp
  cmp    %rbp,%r13
  jne    L15
  mov    (%rsp),%eax
  mov    0x4(%rsp),%edx
  shl    $0x18,%eax
  shl    $0x10,%edx
  or     %edx,%eax
  mov    0x8(%rsp),%edx
  or     0xc(%rsp),%eax
  shl    $0x8,%edx
  or     %edx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L33
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L1:
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp)
  jmp    L21
  nopl   (%rax)
L8:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x28,%rsp
  mov    %r12,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <atoi@plt>
L33:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int parseip(char *s) {
  int ip = 0;
  if (strchr(s, '.')) {
    int i;
    uint8_t b[4];
    char *p, *n;
    n = s;
    for (i = 0; i < 4; i++) {
      p = strchr(n, '.');
      if (p)
        *p = 0;
      b[i] = atoi(n);
      if (p)
        *p = '.';
      if (p)
        n = p + 1;
    }
    ip = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
  } else {
    ip = atoi(s);
  }
  return ip;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x70,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  lea    0x4(%rsp),%rdi
  call   <initialize@plt>
  mov    0x4(%rsp),%edi
  mov    $0x0,%eax
  call   <count_in_circle@plt>
  add    0x8(%rsp),%eax
  mov    %eax,%ebp
  mov    0xc(%rsp),%ebx
  add    0x4(%rsp),%ebx
  mov    %ebx,0x4(%rsp)
  pxor   %xmm2,%xmm2
  cvtsi2sd %ebx,%xmm2
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  D5(%rip),%xmm0
  divsd  %xmm2,%xmm0
  movq   %xmm0,%r14
  subsd  D33(%rip),%xmm0
  andpd  D18(%rip),%xmm0
  movq   %xmm0,%r15
  movsd  D34(%rip),%xmm1
  divsd  %xmm2,%xmm1
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  ja     L29
  sqrtsd %xmm1,%xmm1
  movq   %xmm1,%r12
L20:
  mov    %ebx,%esi
  movq   %r14,%xmm0
  lea    D35(%rip),%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  movq   %r12,%xmm1
  mulsd  D5(%rip),%xmm1
  movq   %r15,%xmm0
  lea    D55(%rip),%rdi
  mov    $0x2,%eax
  call   <printf@plt>
  lea    0x10(%rsp),%rdi
  mov    0x4(%rsp),%edx
  mov    %ebp,%esi
  mov    $0x0,%eax
  call   <save_state@plt>
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    $0x0,%eax
  add    $0x70,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r14
  pop    %r15
  ret
L29:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%r12
  jmp    L20
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D5
type: f64
name: parse_data
arguments: label: D33
type: f64
name: parse_data
arguments: label: D18
type: qword[2]
name: parse_data
arguments: label: D34
type: byte[8]
name: parse_data
arguments: label: D35
type: string
name: parse_data
arguments: label: D55
type: string

tool: D5: 4

tool: D33: 3.141592653589793

tool: {"D18": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D34": [0xe8,0x9c,0x17,0x2a,0xfa,0x92,0xc5,0x3f]}

tool: D35: pi is estimated as %18.16f from %12d samples.


tool: D55: 	Error = %10.8g, standard error = %10.8g


assistant: ```c
main(argc, argv) int argc;
char *argv[];
{
  int in, n, in_old, n_old;
  double pi, error, stderror, p = 3.141592653589793238462643 / 4.0;
  char filename[80];
  initialize(&n, &in_old, &n_old, filename);
  in = count_in_circle(n);
  in += in_old;
  n += n_old;
  pi = (4.0 * in) / n;
  error = fabs(pi - 3.141592653589793238462643);
  stderror = 4 * sqrt(p * (1.0 - p) / n);
  printf("pi is estimated as %18.16f from %12d samples.\n", pi, n);
  printf("\tError = %10.8g, standard error = %10.8g\n", error, stderror);
  save_state(filename, in, n);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%r12
  lea    0x28(%rsp),%rsi
  lea    0x2c(%rsp),%rdx
  lea    0x24(%rsp),%rdi
  mov    %r12,%rcx
  call   <initialize@plt>
  mov    0x24(%rsp),%edi
  xor    %eax,%eax
  call   <count_in_circle@plt>
  mov    0x2c(%rsp),%esi
  pxor   %xmm0,%xmm0
  add    0x24(%rsp),%esi
  cvtsi2sd %esi,%xmm0
  add    0x28(%rsp),%eax
  pxor   %xmm2,%xmm2
  mov    %esi,0x24(%rsp)
  cvtsi2sd %eax,%xmm2
  movsd  D20(%rip),%xmm1
  mulsd  D1(%rip),%xmm2
  mov    %eax,%ebp
  divsd  %xmm0,%xmm1
  divsd  %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  movapd %xmm2,%xmm3
  subsd  D38(%rip),%xmm3
  andpd  D5(%rip),%xmm3
  ja     L19
  sqrtsd %xmm1,%xmm1
L28:
  movapd %xmm2,%xmm0
  lea    D62(%rip),%rdi
  mov    $0x1,%eax
  movsd  %xmm3,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm1
  movsd  0x10(%rsp),%xmm3
  lea    D36(%rip),%rdi
  mulsd  D1(%rip),%xmm1
  mov    $0x2,%eax
  movapd %xmm3,%xmm0
  call   <printf@plt>
  mov    0x24(%rsp),%edx
  xor    %eax,%eax
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <save_state@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x98,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L19:
  movapd %xmm1,%xmm0
  mov    %esi,0x8(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm2,0x10(%rsp)
  call   <sqrt@plt>
  movsd  0x18(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm2
  mov    0x8(%rsp),%esi
  movapd %xmm0,%xmm1
  jmp    L28
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D20
type_infered: byte[8]
name: extract_symbolic_data
arguments: tag: D1
type_infered: f64
name: extract_symbolic_data
arguments: tag: D38
type_infered: f64
name: extract_symbolic_data
arguments: tag: D5
type_infered: qword[2]
name: extract_symbolic_data
arguments: tag: D62
type_infered: string
name: extract_symbolic_data
arguments: tag: D36
type_infered: string

tool: {"D20": [0xe8,0x9c,0x17,0x2a,0xfa,0x92,0xc5,0x3f]}

tool: D1: 4

tool: D38: 3.141592653589793

tool: {"D5": [0x7fffffffffffffff,0x0000000000000000]}

tool: D62: pi is estimated as %18.16f from %12d samples.


tool: D36: 	Error = %10.8g, standard error = %10.8g


assistant: ```c
main(argc, argv) int argc;
char *argv[];
{
  int in, n, in_old, n_old;
  double pi, error, stderror, p = 3.141592653589793238462643 / 4.0;
  char filename[80];
  initialize(&n, &in_old, &n_old, filename);
  in = count_in_circle(n);
  in += in_old;
  n += n_old;
  pi = (4.0 * in) / n;
  error = fabs(pi - 3.141592653589793238462643);
  stderror = 4 * sqrt(p * (1.0 - p) / n);
  printf("pi is estimated as %18.16f from %12d samples.\n", pi, n);
  printf("\tError = %10.8g, standard error = %10.8g\n", error, stderror);
  save_state(filename, in, n);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x98,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%r12
  lea    0x28(%rsp),%rsi
  lea    0x2c(%rsp),%rdx
  lea    0x24(%rsp),%rdi
  mov    %r12,%rcx
  call   <initialize@plt>
  mov    0x24(%rsp),%edi
  xor    %eax,%eax
  call   <count_in_circle@plt>
  mov    0x2c(%rsp),%esi
  pxor   %xmm0,%xmm0
  add    0x24(%rsp),%esi
  cvtsi2sd %esi,%xmm0
  add    0x28(%rsp),%eax
  pxor   %xmm2,%xmm2
  mov    %esi,0x24(%rsp)
  cvtsi2sd %eax,%xmm2
  movsd  D59(%rip),%xmm1
  mulsd  D30(%rip),%xmm2
  mov    %eax,%ebp
  divsd  %xmm0,%xmm1
  divsd  %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  movapd %xmm2,%xmm3
  subsd  D42(%rip),%xmm3
  andpd  D0(%rip),%xmm3
  ja     L3
  sqrtsd %xmm1,%xmm1
L28:
  movapd %xmm2,%xmm0
  lea    D48(%rip),%rdi
  mov    $0x1,%eax
  movsd  %xmm3,0x10(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm1
  movsd  0x10(%rsp),%xmm3
  lea    D47(%rip),%rdi
  mulsd  D30(%rip),%xmm1
  mov    $0x2,%eax
  movapd %xmm3,%xmm0
  call   <printf@plt>
  mov    0x24(%rsp),%edx
  xor    %eax,%eax
  mov    %ebp,%esi
  mov    %r12,%rdi
  call   <save_state@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x98,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L3:
  movapd %xmm1,%xmm0
  mov    %esi,0x8(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm2,0x10(%rsp)
  call   <sqrt@plt>
  movsd  0x18(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm2
  mov    0x8(%rsp),%esi
  movapd %xmm0,%xmm1
  jmp    L28
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D59
type_infered: byte[8]
name: extract_symbolic_data
arguments: tag: D30
type_infered: f64
name: extract_symbolic_data
arguments: tag: D42
type_infered: f64
name: extract_symbolic_data
arguments: tag: D0
type_infered: qword[2]
name: extract_symbolic_data
arguments: tag: D48
type_infered: string
name: extract_symbolic_data
arguments: tag: D47
type_infered: string

tool: {"D59": [0xe8,0x9c,0x17,0x2a,0xfa,0x92,0xc5,0x3f]}

tool: D30: 4

tool: D42: 3.141592653589793

tool: {"D0": [0x7fffffffffffffff,0x0000000000000000]}

tool: D48: pi is estimated as %18.16f from %12d samples.


tool: D47: 	Error = %10.8g, standard error = %10.8g


assistant: ```c
main(argc, argv) int argc;
char *argv[];
{
  int in, n, in_old, n_old;
  double pi, error, stderror, p = 3.141592653589793238462643 / 4.0;
  char filename[80];
  initialize(&n, &in_old, &n_old, filename);
  in = count_in_circle(n);
  in += in_old;
  n += n_old;
  pi = (4.0 * in) / n;
  error = fabs(pi - 3.141592653589793238462643);
  stderror = 4 * sqrt(p * (1.0 - p) / n);
  printf("pi is estimated as %18.16f from %12d samples.\n", pi, n);
  printf("\tError = %10.8g, standard error = %10.8g\n", error, stderror);
  save_state(filename, in, n);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<bytes_to_human_readable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L25
L24:
  mov    -0xc(%rbp),%eax
  add    $0xa,%eax
  mov    -0x18(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  test   %rax,%rax
  je     L27
  addl   $0xa,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
L25:
  cmpl   $0x5,-0x10(%rbp)
  jbe    L24
  jmp    L7
L27:
  nop
L7:
  mov    -0xc(%rbp),%eax
  mov    -0x18(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L31
  mov    -0xc(%rbp),%eax
  mov    $0xffffffffffffffff,%rdx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  not    %rax
  and    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0xc(%rbp),%eax
  sub    $0xa,%eax
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  imul   $0x64,%eax,%eax
  shr    $0xa,%eax
  mov    %eax,-0x8(%rbp)
L31:
  mov    -0x10(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  lea    D8(%rip),%rax
  mov    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %rcx,%r9
  mov    %edx,%r8d
  mov    %eax,%ecx
  lea    D1(%rip),%rax
  mov    %rax,%rdx
  mov    $0x3c,%esi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    D3(%rip),%rax
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D1
type_guessed: string

tool: D1: %u.%02u %s

assistant: ```c
char *bytes_to_human_readable(size_t bytes) {
  static const char *const units[] = {"B", "KB", "MB", "GB", "TB", "PB"};
  static char buf[15 * 4];
  unsigned int i, shift, quoti, remain;
  shift = 0;
  for (i = 0; i < sizeof(units) / sizeof(units[0]); i++) {
    if (bytes / (1ULL << (shift + 10)) == 0)
      break;
    shift += 10;
  }
  quoti = (unsigned int)(bytes / (1ULL << shift));
  remain = 0;
  if (shift > 0) {
    remain = (unsigned int)((bytes & ((1ULL << shift) - 1)) >> (shift - 10));
    remain = (remain * 100) / 1024;
  }
  snprintf(buf, sizeof(buf), "%u.%02u %s", quoti, remain, units[i]);
  return buf;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<bytes_to_human_readable>:
  endbr64
  push   %rbx
  mov    %rdi,%rax
  shr    $0xa,%rax
  je     L41
  mov    $0xa,%ecx
  mov    $0x1,%eax
L6:
  mov    %ecx,%esi
  add    $0xa,%ecx
  mov    %rdi,%rdx
  shr    %cl,%rdx
  test   %rdx,%rdx
  je     L26
  add    $0x1,%eax
  cmp    $0x6,%eax
  jne    L6
L42:
  mov    %rdi,%rbx
  shr    %cl,%rbx
  mov    %rbx,%rsi
  test   %ecx,%ecx
  je     L18
  mov    $0xffffffffffffffff,%rdx
  shl    %cl,%rdx
  not    %rdx
  and    %rdi,%rdx
  sub    $0xa,%ecx
  shr    %cl,%rdx
  imul   $0x64,%edx,%ecx
  shr    $0xa,%ecx
L18:
  mov    %eax,%eax
  lea    D14(%rip),%rdx
  mov    (%rdx,%rax,8),%r9
  mov    %ecx,%r8d
  mov    %esi,%ecx
  lea    D8(%rip),%rdx
  mov    $0x3c,%esi
  lea    D27(%rip),%rbx
  mov    %rbx,%rdi
  call   <snprintf@plt>
  mov    %rbx,%rax
  pop    %rbx
  ret
L26:
  mov    %esi,%ecx
  jmp    L42
L41:
  mov    %edi,%esi
  mov    $0x0,%eax
  mov    $0x0,%ecx
  jmp    L18
```

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

tool: D8: %u.%02u %s

assistant: ```c
char *bytes_to_human_readable(size_t bytes) {
  static const char *const units[] = {"B", "KB", "MB", "GB", "TB", "PB"};
  static char buf[15 * 4];
  unsigned int i, shift, quoti, remain;
  shift = 0;
  for (i = 0; i < sizeof(units) / sizeof(units[0]); i++) {
    if (bytes / (1ULL << (shift + 10)) == 0)
      break;
    shift += 10;
  }
  quoti = (unsigned int)(bytes / (1ULL << shift));
  remain = 0;
  if (shift > 0) {
    remain = (unsigned int)((bytes & ((1ULL << shift) - 1)) >> (shift - 10));
    remain = (remain * 100) / 1024;
  }
  snprintf(buf, sizeof(buf), "%u.%02u %s", quoti, remain, units[i]);
  return buf;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<bytes_to_human_readable>:
  endbr64
  push   %r12
  xor    %ecx,%ecx
  xor    %eax,%eax
L10:
  mov    %ecx,%r8d
  mov    %rdi,%rdx
  add    $0xa,%ecx
  shr    %cl,%rdx
  test   %rdx,%rdx
  je     L30
  add    $0x1,%eax
  cmp    $0x6,%eax
  jne    L10
  mov    %edx,%r10d
  xor    %r9d,%r9d
L24:
  mov    $0xffffffffffffffff,%rax
  shl    %cl,%rax
  mov    %r8d,%ecx
  not    %rax
  and    %rdi,%rax
  shr    %cl,%rax
  imul   $0x64,%eax,%r8d
  shr    $0xa,%r8d
L33:
  lea    D17(%rip),%r12
  mov    %r10d,%ecx
  mov    $0x3c,%esi
  mov    %r12,%rdi
  lea    D1(%rip),%rdx
  call   <snprintf@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L30:
  mov    %rdi,%rsi
  mov    %r8d,%ecx
  lea    D29(%rip),%rdx
  shr    %cl,%rsi
  mov    (%rdx,%rax,8),%r9
  mov    %rsi,%r10
  test   %r8d,%r8d
  je     L33
  mov    %r8d,%ecx
  sub    $0xa,%r8d
  jmp    L24
```

tool_calls: name: parse_data
arguments: label: D1
data_type: string

tool: D1: %u.%02u %s

assistant: ```c
char *bytes_to_human_readable(size_t bytes) {
  static const char *const units[] = {"B", "KB", "MB", "GB", "TB", "PB"};
  static char buf[15 * 4];
  unsigned int i, shift, quoti, remain;
  shift = 0;
  for (i = 0; i < sizeof(units) / sizeof(units[0]); i++) {
    if (bytes / (1ULL << (shift + 10)) == 0)
      break;
    shift += 10;
  }
  quoti = (unsigned int)(bytes / (1ULL << shift));
  remain = 0;
  if (shift > 0) {
    remain = (unsigned int)((bytes & ((1ULL << shift) - 1)) >> (shift - 10));
    remain = (remain * 100) / 1024;
  }
  snprintf(buf, sizeof(buf), "%u.%02u %s", quoti, remain, units[i]);
  return buf;
}
```
user: What is the c source code of the assembly code below:

```asm
<bytes_to_human_readable>:
  endbr64
  mov    %rdi,%r10
  push   %r12
  shr    $0xa,%r10
  je     L51
  mov    %rdi,%rax
  shr    $0x14,%rax
  je     L43
  mov    %rdi,%r10
  shr    $0x1e,%r10
  je     L108
  mov    %rdi,%rax
  shr    $0x28,%rax
  je     L70
  mov    %rdi,%rdx
  shr    $0x32,%rdx
  je     L52
  mov    %rdi,%r10
  shr    $0x3c,%r10
  je     L85
  xor    %r9d,%r9d
  mov    $0x32,%edx
  mov    $0x3c,%ecx
L64:
  mov    $0xffffffffffffffff,%rax
  shl    %cl,%rax
  mov    %edx,%ecx
  not    %rax
  and    %rdi,%rax
  shr    %cl,%rax
  imul   $0x64,%eax,%r8d
  shr    $0xa,%r8d
L31:
  lea    D78(%rip),%r12
  mov    %r10d,%ecx
  mov    $0x3c,%esi
  mov    %r12,%rdi
  lea    D77(%rip),%rdx
  call   <snprintf@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L51:
  mov    %edi,%r10d
  lea    D18(%rip),%r9
  xor    %r8d,%r8d
  jmp    L31
L43:
  lea    D1(%rip),%r9
  mov    $0xa,%ecx
L96:
  lea    -0xa(%rcx),%edx
  jmp    L64
  nopl   0x0(%rax,%rax,1)
L108:
  mov    %eax,%r10d
  lea    D69(%rip),%r9
  mov    $0x14,%ecx
  jmp    L96
L70:
  lea    D38(%rip),%r9
  mov    $0x1e,%ecx
  jmp    L96
L52:
  mov    %eax,%r10d
  lea    D15(%rip),%r9
  mov    $0x28,%ecx
  jmp    L96
L85:
  mov    %edx,%r10d
  lea    D26(%rip),%r9
  mov    $0x32,%ecx
  jmp    L96
```

tool_calls: name: read_data
arguments: data_tag: D77
type_guessed: string
name: read_data
arguments: data_tag: D18
type_guessed: string
name: read_data
arguments: data_tag: D1
type_guessed: string
name: read_data
arguments: data_tag: D69
type_guessed: string
name: read_data
arguments: data_tag: D38
type_guessed: string
name: read_data
arguments: data_tag: D15
type_guessed: string
name: read_data
arguments: data_tag: D26
type_guessed: string

tool: D77: %u.%02u %s

tool: D18: B

tool: D1: KB

tool: D69: MB

tool: D38: GB

tool: D15: TB

tool: D26: PB

assistant: ```c
char *bytes_to_human_readable(size_t bytes) {
  static const char *const units[] = {"B", "KB", "MB", "GB", "TB", "PB"};
  static char buf[15 * 4];
  unsigned int i, shift, quoti, remain;
  shift = 0;
  for (i = 0; i < sizeof(units) / sizeof(units[0]); i++) {
    if (bytes / (1ULL << (shift + 10)) == 0)
      break;
    shift += 10;
  }
  quoti = (unsigned int)(bytes / (1ULL << shift));
  remain = 0;
  if (shift > 0) {
    remain = (unsigned int)((bytes & ((1ULL << shift) - 1)) >> (shift - 10));
    remain = (remain * 100) / 1024;
  }
  snprintf(buf, sizeof(buf), "%u.%02u %s", quoti, remain, units[i]);
  return buf;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<get_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L12
L2:
  movsbq -0x11(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  add    %rcx,%rax
  xor    $0x3d,%rax
  add    %rax,-0x10(%rbp)
L12:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x11(%rbp)
  cmpb   $0x0,-0x11(%rbp)
  jne    L2
  mov    -0x10(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
long get_hash(char *word) {
  long hash = 0, time = 0;
  char c;
  while (c = *word++) {
    hash += (c + time++) ^ 61;
  }
  return hash;
}
```
user: Translate the below assembly code into C programming language:

```asm
<get_hash>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L26
  mov    $0x0,%edx
  mov    $0x0,%ecx
L0:
  mov    %rdx,%rsi
  add    $0x1,%rdx
  movsbq %al,%rax
  add    %rsi,%rax
  xor    $0x3d,%rax
  add    %rax,%rcx
  movzbl (%rdi,%rdx,1),%eax
  test   %al,%al
  jne    L0
L13:
  mov    %rcx,%rax
  ret
L26:
  mov    $0x0,%ecx
  jmp    L13
```

assistant: ```c
long get_hash(char *word) {
  long hash = 0, time = 0;
  char c;
  while (c = *word++) {
    hash += (c + time++) ^ 61;
  }
  return hash;
}
```
user: What is the c source code of the assembly code below?

```asm
<get_hash>:
  endbr64
  movsbq (%rdi),%rax
  test   %al,%al
  je     L15
  xor    %edx,%edx
  xor    %r8d,%r8d
  nopl   0x0(%rax)
L11:
  mov    %rdx,%rcx
  add    $0x1,%rdx
  add    %rcx,%rax
  xor    $0x3d,%rax
  add    %rax,%r8
  movsbq (%rdi,%rdx,1),%rax
  test   %al,%al
  jne    L11
  mov    %r8,%rax
  ret
  cs nopw 0x0(%rax,%rax,1)
L15:
  xor    %r8d,%r8d
  mov    %r8,%rax
  ret
```

assistant: ```c
long get_hash(char *word) {
  long hash = 0, time = 0;
  char c;
  while (c = *word++) {
    hash += (c + time++) ^ 61;
  }
  return hash;
}
```