#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, size_t, ...);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
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);
}


x86 assembly (clang, -O0):
<test_print_results_terminal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   -0x18(%rbp),%xmm0
movaps 0xecc(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0xed0(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm4
unpckhpd %xmm1,%xmm1
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   -0x20(%rbp),%xmm0
punpckldq %xmm3,%xmm0
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xa,%edi
call   1030 <putc@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
lea    0xe5a(%rip),%rsi
lea    0xe5f(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
movsd  0xe0c(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
lea    0xe4c(%rip),%rsi
lea    0xe5a(%rip),%rdx
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rcx
movsd  0xde2(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
lea    0xe22(%rip),%rsi
lea    0xe3e(%rip),%rdx
mov    $0x1,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_print_results_terminal>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movq   %rdx,%xmm0
movdqa 0xebc(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xec0(%rip),%xmm2
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,%xmm4
movq   %rsi,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
divsd  %xmm3,%xmm4
movapd %xmm4,(%rsp)
movq   %rcx,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm3,%xmm1
movapd %xmm1,0x10(%rsp)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <putc@plt>
lea    0xe6b(%rip),%rsi
lea    0xe70(%rip),%rdx
mov    %rbx,%rdi
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <fprintf@plt>
movapd (%rsp),%xmm0
mulsd  0xe42(%rip),%xmm0
lea    0xe5f(%rip),%r12
lea    0xe6d(%rip),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rcx
mov    $0x1,%al
call   1040 <fprintf@plt>
movapd 0x10(%rsp),%xmm0
mulsd  0xe16(%rip),%xmm0
lea    0xe56(%rip),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rcx
mov    $0x1,%al
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%-16s %zu\0A\00"
@.str.1 = [16 x i8] c"Tests executed:\00"
@.str.2 = [21 x i8] c"%-16s %zu (%.0f%%)\0A\00"
@.str.3 = [14 x i8] c"Tests passed:\00"
@.str.4 = [14 x i8] c"Tests failed:\00"
define void @test_print_results_terminal(i32* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca double
store i32* %0, i32** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%11 = load i64, i64* %7
%12 = uitofp i64 %11 to double
%13 = load i64, i64* %6
%14 = uitofp i64 %13 to double
%15 = fdiv double %12, %14
store double %15, double* %9
%16 = load i64, i64* %8
%17 = uitofp i64 %16 to double
%18 = load i64, i64* %6
%19 = uitofp i64 %18 to double
%20 = fdiv double %17, %19
store double %20, double* %10
%21 = load i32*, i32** %5
%22 = call i32 @putc(i8 signext 10, i32* %21)
%23 = load i32*, i32** %5
%24 = load i64, i64* %6
%25 = call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %24)
%26 = load i32*, i32** %5
%27 = load i64, i64* %7
%28 = load double, double* %9
%29 = fmul double %28, 1.000000e+02
%30 = call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %27, double %29)
%31 = load i32*, i32** %5
%32 = load i64, i64* %8
%33 = load double, double* %10
%34 = fmul double %33, 1.000000e+02
%35 = call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 %32, double %34)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%-16s %zu\0A\00"
@.str.1 = [16 x i8] c"Tests executed:\00"
@.str.2 = [21 x i8] c"%-16s %zu (%.0f%%)\0A\00"
@.str.3 = [14 x i8] c"Tests passed:\00"
@.str.4 = [14 x i8] c"Tests failed:\00"
define void @test_print_results_terminal(i32* nocapture %0, i64 %1, i64 %2, i64 %3) {
%5 = uitofp i64 %2 to double
%6 = uitofp i64 %1 to double
%7 = fdiv double %5, %6
%8 = uitofp i64 %3 to double
%9 = fdiv double %8, %6
%10 = tail call i32 @putc(i8 signext 10, i32* %0)
%11 = tail call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %1)
%12 = fmul double %7, 1.000000e+02
%13 = tail call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %2, double %12)
%14 = fmul double %9, 1.000000e+02
%15 = tail call i32 (i32*, i8*, i8*, i64, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 %3, double %14)
ret void
}