#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 */
double ceil(double);
double floor(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, long, ...);
int print_summary(FILE *f, long total, long pass, long fail, long skip) {
  double dpass = 100.0, dfail = 0.0, dskip = 0.0;
  fprintf(f, "Total:  %ld\n", total);
  if (total) {
    dpass = ((double)pass / (double)(total - skip)) * 10000.0;
    dpass = floor(dpass) / 100.0;
    dfail = ((double)fail / (double)(total - skip)) * 10000.0;
    dfail = ceil(dfail) / 100.0;
    dskip = ((double)skip / (double)total) * 10000.0;
    dskip = ceil(dskip) / 100.0;
  }
  fprintf(f,
          "Passed: %ld (%0.2lf%%)\nFailed: %ld (%0.2lf%%)\nSkipped: %ld "
          "(%0.2lf%%)\n\n",
          pass, dpass, fail, dfail, skip, dskip);
  return 0;
}


x86 assembly (clang, -O0):
<print_summary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  0xeac(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     124c <print_summary+0x11c>
cvtsi2sdq -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
sub    -0x28(%rbp),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <floor@plt>
movsd  0xe3c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
sub    -0x28(%rbp),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  0xdf9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdq -0x28(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xde0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  0xdbd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
movsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rcx
movsd  -0x38(%rbp),%xmm1
mov    -0x28(%rbp),%r8
movsd  -0x40(%rbp),%xmm2
lea    0xdab(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_summary>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r12
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r13
lea    0xecd(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rbx,%rbx
je     11f6 <print_summary+0xc6>
cvtsi2sd %r15,%xmm0
mov    %rbx,%rax
sub    %r12,%rax
cvtsi2sd %rax,%xmm1
movsd  %xmm1,0x18(%rsp)
divsd  %xmm1,%xmm0
mulsd  0xe80(%rip),%xmm0
call   1050 <floor@plt>
movapd %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
divsd  0x18(%rsp),%xmm0
mulsd  0xe60(%rip),%xmm0
call   1030 <ceil@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
divpd  0xe52(%rip),%xmm1
movapd %xmm1,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
divsd  %xmm1,%xmm0
mulsd  0xe29(%rip),%xmm0
call   1030 <ceil@plt>
movapd %xmm0,%xmm2
movaps (%rsp),%xmm0
divsd  0xe0c(%rip),%xmm2
jmp    1202 <print_summary+0xd2>
movsd  0xe02(%rip),%xmm0
xorpd  %xmm2,%xmm2
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
lea    0xe1d(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %r12,%r8
mov    $0x3,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Total: %ld\0A\00"
@.str.1 = [72 x i8] c"Passed: %ld (%0.2lf%%)\0AFailed: %ld (%0.2lf%%)\0ASkipped: %ld (%0.2lf%%)\0A\0A\00"
define i32 @print_summary(i32* %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca double
%12 = alloca double
%13 = alloca double
store i32* %0, i32** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
store double 1.000000e+02, double* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
%14 = load i32*, i32** %6
%15 = load i64, i64* %7
%16 = call i32 (i32*, i8*, i64, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %15)
%17 = load i64, i64* %7
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %51
19: ; preds = %5
%20 = load i64, i64* %8
%21 = sitofp i64 %20 to double
%22 = load i64, i64* %7
%23 = load i64, i64* %10
%24 = sub nsw i64 %22, %23
%25 = sitofp i64 %24 to double
%26 = fdiv double %21, %25
%27 = fmul double %26, 1.000000e+04
store double %27, double* %11
%28 = load double, double* %11
%29 = call double @llvm.floor.f64(double %28)
%30 = fdiv double %29, 1.000000e+02
store double %30, double* %11
%31 = load i64, i64* %9
%32 = sitofp i64 %31 to double
%33 = load i64, i64* %7
%34 = load i64, i64* %10
%35 = sub nsw i64 %33, %34
%36 = sitofp i64 %35 to double
%37 = fdiv double %32, %36
%38 = fmul double %37, 1.000000e+04
store double %38, double* %12
%39 = load double, double* %12
%40 = call double @llvm.ceil.f64(double %39)
%41 = fdiv double %40, 1.000000e+02
store double %41, double* %12
%42 = load i64, i64* %10
%43 = sitofp i64 %42 to double
%44 = load i64, i64* %7
%45 = sitofp i64 %44 to double
%46 = fdiv double %43, %45
%47 = fmul double %46, 1.000000e+04
store double %47, double* %13
%48 = load double, double* %13
%49 = call double @llvm.ceil.f64(double %48)
%50 = fdiv double %49, 1.000000e+02
store double %50, double* %13
br label %51
51: ; preds = %19, %5
%52 = load i32*, i32** %6
%53 = load i64, i64* %8
%54 = load double, double* %11
%55 = load i64, i64* %9
%56 = load double, double* %12
%57 = load i64, i64* %10
%58 = load double, double* %13
%59 = call i32 (i32*, i8*, i64, ...) @fprintf(i32* %52, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i64 %53, double %54, i64 %55, double %56, i64 %57, double %58)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Total: %ld\0A\00"
@.str.1 = [72 x i8] c"Passed: %ld (%0.2lf%%)\0AFailed: %ld (%0.2lf%%)\0ASkipped: %ld (%0.2lf%%)\0A\0A\00"
define i32 @print_summary(i32* nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = tail call i32 (i32*, i8*, i64, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = icmp eq i64 %1, 0
br i1 %7, label %28, label %8
8: ; preds = %5
%9 = sitofp i64 %2 to double
%10 = sub nsw i64 %1, %4
%11 = sitofp i64 %10 to double
%12 = fdiv double %9, %11
%13 = fmul double %12, 1.000000e+04
%14 = tail call double @llvm.floor.f64(double %13)
%15 = sitofp i64 %3 to double
%16 = fdiv double %15, %11
%17 = fmul double %16, 1.000000e+04
%18 = tail call double @llvm.ceil.f64(double %17)
%19 = insertelement <2 x double> poison, double %14, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = fdiv <2 x double> %20, <double 1.000000e+02, double 1.000000e+02>
%22 = sitofp i64 %4 to double
%23 = sitofp i64 %1 to double
%24 = fdiv double %22, %23
%25 = fmul double %24, 1.000000e+04
%26 = tail call double @llvm.ceil.f64(double %25)
%27 = fdiv double %26, 1.000000e+02
br label %28
28: ; preds = %8, %5
%29 = phi double [ %27, %8 ], [ 0.000000e+00, %5 ]
%30 = phi <2 x double> [ %21, %8 ], [ <double 1.000000e+02, double 0.000000e+00>, %5 ]
%31 = extractelement <2 x double> %30, i64 0
%32 = extractelement <2 x double> %30, i64 1
%33 = tail call i32 (i32*, i8*, i64, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i64 %2, double %31, i64 %3, double %32, i64 %4, double %29)
ret i32 0
}