user: Converte this assembly snippet into its equivalent C code:

```asm
<printspeed>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  movsd  %xmm0,-0x18(%rbp)
  cmpq   $0x3fffffff,-0x10(%rbp)
  jbe    L52
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L97
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L138
L97:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L138:
  movsd  D69(%rip),%xmm1
  divsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L78
L52:
  cmpq   $0xfffff,-0x10(%rbp)
  jbe    L56
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L116
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L27
L116:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L27:
  movsd  D46(%rip),%xmm1
  divsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L78
L56:
  cmpq   $0x3ff,-0x10(%rbp)
  jbe    L2
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L63
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L76
L63:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L76:
  movsd  D0(%rip),%xmm1
  divsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L78
L2:
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  js     L98
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L59
L98:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L59:
  divsd  -0x18(%rbp),%xmm0
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %rax,%rsi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L78:
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D69
type: byte[8]
name: retrieve_data
arguments: data_tag: D38
type: string
name: retrieve_data
arguments: data_tag: D46
type: byte[8]
name: retrieve_data
arguments: data_tag: D14
type: string
name: retrieve_data
arguments: data_tag: D0
type: byte[8]
name: retrieve_data
arguments: data_tag: D23
type: string
name: retrieve_data
arguments: data_tag: D25
type: string

tool: {"D69": [0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x41]}

tool: D38: %s %.4f sec (%.3f GBps)


tool: {"D46": [0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x41]}

tool: D14: %s %.4f (%.3f MBps)


tool: {"D0": [0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x40]}

tool: D23: %s %.4f (%.3f KBps)


tool: D25: %s %.4f (%f Bps)


assistant: ```c
void printspeed(char *caption, unsigned long bytes, double time) {
  if (bytes / 1073741824UL > 0) {
    printf("%s %.4f sec (%.3f GBps)\n", caption, time, (double)bytes / 1073741824UL / time);
  } else if (bytes / 1048576 > 0) {
    printf("%s %.4f (%.3f MBps)\n", caption, time, (double)bytes / 1048576 / time);
  } else if (bytes / 1024 > 0) {
    printf("%s %.4f (%.3f KBps)\n", caption, time, (double)bytes / 1024 / time);
  } else {
    printf("%s %.4f (%f Bps)\n", caption, time, (double)bytes / time);
  }
}
```