#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 *, ...);
int print_summary(FILE *f, long total, long pass, long fail) {
  fprintf(f, "Total:  %ld\n", total);
  fprintf(f, "Passed: %ld (%0.0lf%%)\n", pass,
          ((double)pass / (double)total) * (double)100.0);
  fprintf(f, "Failed: %ld (%0.0lf%%)\n", fail,
          ((double)fail / (double)total) * (double)100.0);
  fprintf(f, "\n");
  return 0;
}


x86 assembly (clang, -O0):
<print_summary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
cvtsi2sdq -0x18(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xeac(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
cvtsi2sdq -0x20(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe70(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xe92(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_summary>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0xecd(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
cvtsi2sd %r15,%xmm0
cvtsi2sd %rbx,%xmm1
movsd  %xmm1,(%rsp)
divsd  %xmm1,%xmm0
mulsd  0xea0(%rip),%xmm0
lea    0xeae(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    $0x1,%al
call   1040 <fprintf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
divsd  (%rsp),%xmm0
mulsd  0xe77(%rip),%xmm0
lea    0xe9d(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1030 <fputc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Total: %ld\0A\00"
@.str.1 = [24 x i8] c"Passed: %ld (%0.0lf%%)\0A\00"
@.str.2 = [24 x i8] c"Failed: %ld (%0.0lf%%)\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @print_summary(i32* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i32*, i32** %5
%10 = load i64, i64* %6
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = load i32*, i32** %5
%13 = load i64, i64* %7
%14 = load i64, i64* %7
%15 = sitofp i64 %14 to double
%16 = load i64, i64* %6
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = fmul double %18, 1.000000e+02
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %13, double %19)
%21 = load i32*, i32** %5
%22 = load i64, i64* %8
%23 = load i64, i64* %8
%24 = sitofp i64 %23 to double
%25 = load i64, i64* %6
%26 = sitofp i64 %25 to double
%27 = fdiv double %24, %26
%28 = fmul double %27, 1.000000e+02
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %22, double %28)
%30 = load i32*, i32** %5
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Total: %ld\0A\00"
@.str.1 = [24 x i8] c"Passed: %ld (%0.0lf%%)\0A\00"
@.str.2 = [24 x i8] c"Failed: %ld (%0.0lf%%)\0A\00"
define i32 @print_summary(i32* nocapture %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %1)
%6 = sitofp i64 %2 to double
%7 = sitofp i64 %1 to double
%8 = fdiv double %6, %7
%9 = fmul double %8, 1.000000e+02
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %2, double %9)
%11 = sitofp i64 %3 to double
%12 = fdiv double %11, %7
%13 = fmul double %12, 1.000000e+02
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %3, double %13)
%15 = tail call i32 @fputc(i32 10, i32* %0)
ret i32 0
}