#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 uint64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void report(uint64_t count, double cycleNS) {
  double nsPerThing = (6 * 1e9) / count;
  double cyclesPerThing = nsPerThing / cycleNS;
  printf("    latency: %f ns %f cycles\n", nsPerThing, cyclesPerThing);
  printf("    rate: %f/ns %f/cycle\n", 1 / nsPerThing, 1 / cyclesPerThing);
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xedb(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%esi
cvttsd2si -0x20(%rbp),%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe9d(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%esi
movsd  0xe8c(%rip),%xmm0
divsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
sub    $0x18,%rsp
cvtsi2sd %edi,%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
cvttsd2si %xmm2,%esi
cvttsd2si %xmm1,%edx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
movsd  0xeb4(%rip),%xmm0
movapd %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%esi
divsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edx
lea    0xebb(%rip),%rdi
add    $0x18,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c" latency: %f ns %f cycles\0A\00"
@.str.1 = [26 x i8] c" rate: %f/ns %f/cycle\0A\00"
define void @report(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
%9 = fdiv double 6.000000e+09, %8
store double %9, double* %5
%10 = load double, double* %5
%11 = load double, double* %4
%12 = fdiv double %10, %11
store double %12, double* %6
%13 = load double, double* %5
%14 = fptosi double %13 to i32
%15 = load double, double* %6
%16 = fptosi double %15 to i32
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16)
%18 = load double, double* %5
%19 = fdiv double 1.000000e+00, %18
%20 = fptosi double %19 to i32
%21 = load double, double* %6
%22 = fdiv double 1.000000e+00, %21
%23 = fptosi double %22 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c" latency: %f ns %f cycles\0A\00"
@.str.1 = [26 x i8] c" rate: %f/ns %f/cycle\0A\00"
define void @report(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fdiv double 6.000000e+09, %3
%5 = fdiv double %4, %1
%6 = fptosi double %4 to i32
%7 = fptosi double %5 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = fdiv double 1.000000e+00, %4
%10 = fptosi double %9 to i32
%11 = fdiv double 1.000000e+00, %5
%12 = fptosi double %11 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12)
ret void
}