#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, char *,
                           unsigned long);
void account_print(FILE *out, char *variable_name, int cpu,
                   long unsigned *n_all) {
  double cycle_period_secs = (double)10000 / 1000000;
  fprintf(out, "[%d]: %s occurences: %lu\n", cpu, variable_name, n_all[cpu]);
  fprintf(out, "[%d]: %s rate: %.0lf event/s\n", cpu, variable_name,
          n_all[cpu] / (1000 * cycle_period_secs));
}


x86 assembly (clang, -O0):
<account_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movabs $0x3f847ae147ae147b,%rax
7a 84 3f
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rsi
mov    %esi,%edx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    (%rax,%rsi,8),%r8
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rsi
mov    %esi,%edx
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
movq   (%rax,%rsi,8),%xmm0
movaps 0xe8b(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xe8f(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe83(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%r8
mov    %r8,%rsi
sar    $0x3f,%rsi
movsd  0xe6c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rsi,%rax
or     %rax,%r8
lea    0xe78(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<account_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
movslq %edx,%rbx
mov    (%rcx,%rbx,8),%r8
lea    0xf01(%rip),%rsi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <fprintf@plt>
movsd  (%r12,%rbx,8),%xmm0
unpcklps 0xeba(%rip),%xmm0
subpd  0xec2(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xebe(%rip),%xmm1
cvttsd2si %xmm1,%rax
mov    %rax,%rcx
subsd  0xeb6(%rip),%xmm1
cvttsd2si %xmm1,%r8
sar    $0x3f,%rcx
and    %rcx,%r8
or     %rax,%r8
lea    0xec2(%rip),%rsi
mov    %r15,%rdi
mov    %ebx,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"[%d]: %s occurences: %lu\0A\00"
@.str.1 = [30 x i8] c"[%d]: %s rate: %.0lf event/s\0A\00"
define void @account_print(i32* %0, i8* %1, i32 %2, i64* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64*
%9 = alloca double
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i64* %3, i64** %8
store double 1.000000e-02, double* %9
%10 = load i32*, i32** %5
%11 = load i32, i32* %7
%12 = load i8*, i8** %6
%13 = load i64*, i64** %8
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i64, i64* %13, i64 %15
%17 = load i64, i64* %16
%18 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12, i64 %17)
%19 = load i32*, i32** %5
%20 = load i32, i32* %7
%21 = load i8*, i8** %6
%22 = load i64*, i64** %8
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
%26 = load i64, i64* %25
%27 = uitofp i64 %26 to double
%28 = load double, double* %9
%29 = fmul double 1.000000e+03, %28
%30 = fdiv double %27, %29
%31 = fptoui double %30 to i64
%32 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %21, i64 %31)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"[%d]: %s occurences: %lu\0A\00"
@.str.1 = [30 x i8] c"[%d]: %s rate: %.0lf event/s\0A\00"
define void @account_print(i32* nocapture %0, i8* %1, i32 %2, i64* nocapture %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i64, i64* %3, i64 %5
%7 = load i64, i64* %6
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %1, i64 %7)
%9 = load i64, i64* %6
%10 = uitofp i64 %9 to double
%11 = fdiv double %10, 1.000000e+01
%12 = fptoui double %11 to i64
%13 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* %1, i64 %12)
ret void
}