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

```asm
<test_print_results_terminal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  test   %rax,%rax
  js     L22
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L56
L22:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L56:
  mov    -0x20(%rbp),%rax
  test   %rax,%rax
  js     L44
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  jmp    L7
L44:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm1,%xmm1
  cvtsi2sd %rdx,%xmm1
  addsd  %xmm1,%xmm1
L7:
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  test   %rax,%rax
  js     L60
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L49
L60:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L49:
  mov    -0x20(%rbp),%rax
  test   %rax,%rax
  js     L75
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  jmp    L69
L75:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm1,%xmm1
  cvtsi2sd %rdx,%xmm1
  addsd  %xmm1,%xmm1
L69:
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <putc@plt>
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rcx
  lea    D55(%rip),%rdx
  lea    D78(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movsd  -0x10(%rbp),%xmm1
  movsd  D44(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movq   %xmm1,%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  movq   %rcx,%xmm0
  mov    %rdx,%rcx
  lea    D70(%rip),%rdx
  lea    D14(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  movsd  -0x8(%rbp),%xmm1
  movsd  D44(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movq   %xmm1,%rcx
  mov    -0x30(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  movq   %rcx,%xmm0
  mov    %rdx,%rcx
  lea    D42(%rip),%rdx
  lea    D14(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D55
type_infered: string
name: parse_data
arguments: data_label: D78
type_infered: string
name: parse_data
arguments: data_label: D44
type_infered: f64
name: parse_data
arguments: data_label: D70
type_infered: string
name: parse_data
arguments: data_label: D14
type_infered: string
name: parse_data
arguments: data_label: D42
type_infered: string

tool: D55: Tests executed:

tool: D78: %-16s  %zu


tool: D44: 100

tool: D70: Tests passed:

tool: D14: %-16s  %zu (%.0f%%)


tool: D42: Tests failed:

assistant: ```c
void test_print_results_terminal(FILE *output, size_t nb_tests, size_t nb_passed_tests, size_t nb_failed_tests) {
  double ratio_passed, ratio_failed;
  ratio_passed = (double)nb_passed_tests / (double)nb_tests;
  ratio_failed = (double)nb_failed_tests / (double)nb_tests;
  putc('\n', output);
  fprintf(output, "%-16s  %zu\n", "Tests executed:", nb_tests);
  fprintf(output, "%-16s  %zu (%.0f%%)\n", "Tests passed:", nb_passed_tests, ratio_passed * 100.0);
  fprintf(output, "%-16s  %zu (%.0f%%)\n", "Tests failed:", nb_failed_tests, ratio_failed * 100.0);
}
```