#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, long, double);
void printStat(const char *ftype, size_t num, size_t total) {
  if (num > 0) {
    double percent;
    percent = ((double)num / total) * 100;
    printf("\t%20s: %10ld (%5.5lf%%)\n", ftype, (long)num, percent);
  }
}


x86 assembly (clang, -O0):
<printStat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    119c <printStat+0x8c>
movq   -0x10(%rbp),%xmm0
movaps 0xed5(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0xed9(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x18(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe86(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
movsd  -0x20(%rbp),%xmm0
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStat>:
mov    %rsi,%rax
test   %rsi,%rsi
je     1178 <printStat+0x68>
mov    %rdi,%rsi
movq   %rax,%xmm1
movdqa 0xed8(%rip),%xmm2
punpckldq %xmm2,%xmm1
movapd 0xedc(%rip),%xmm3
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movq   %rdx,%xmm1
punpckldq %xmm2,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xeb7(%rip),%xmm0
lea    0xeb8(%rip),%rdi
mov    %rax,%rdx
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\09%20s: %10ld (%5.5lf%%)\0A\00"
define void @printStat(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %5
%9 = icmp ugt i64 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %3
%11 = load i64, i64* %5
%12 = uitofp i64 %11 to double
%13 = load i64, i64* %6
%14 = uitofp i64 %13 to double
%15 = fdiv double %12, %14
%16 = fmul double %15, 1.000000e+02
store double %16, double* %7
%17 = load i8*, i8** %4
%18 = load i64, i64* %5
%19 = load double, double* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %17, i64 %18, double %19)
br label %21
21: ; preds = %10, %3
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\09%20s: %10ld (%5.5lf%%)\0A\00"
define void @printStat(i8* %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = uitofp i64 %1 to double
%7 = uitofp i64 %2 to double
%8 = fdiv double %6, %7
%9 = fmul double %8, 1.000000e+02
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1, double %9)
br label %11
11: ; preds = %5, %3
ret void
}