#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, unsigned long,
                           unsigned long, unsigned long, unsigned long);
int /*<<< orphan*/ printf(char *, char *, unsigned long, unsigned long,
                          unsigned long, unsigned long);
void report(char *msg, unsigned long data, unsigned long time,
            unsigned long dmaUsed) {
  printf("%s\t%ld\t%ld\t%f\t%d\n", msg, data, time, data * 1.0 / time, dmaUsed);
  FILE *f = fopen("report.dat", "a");
  fprintf(f, "%s\t%ld\t%ld\t%f\t%d\n", msg, data, time, data * 1.0 / time,
          dmaUsed);
  fclose(f);
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movq   %rdx,%xmm0
movaps 0xe90(%rip),%xmm3
movaps %xmm3,-0x50(%rbp)
punpckldq %xmm3,%xmm0
movapd 0xe90(%rip),%xmm2
movaps %xmm2,-0x40(%rbp)
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   %rcx,%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movaps %xmm0,%xmm1
cvttsd2si %xmm1,%r8
mov    %r8,%rdi
sar    $0x3f,%rdi
movsd  0xe5a(%rip),%xmm1
movsd  %xmm1,-0x30(%rbp)
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rdi,%rax
or     %rax,%r8
mov    -0x20(%rbp),%r9
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
lea    0xe49(%rip),%rdi
lea    0xe4d(%rip),%rsi
call   1060 <fopen@plt>
movaps -0x50(%rbp),%xmm4
movaps -0x40(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm1
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
movq   %rcx,%xmm0
punpckldq %xmm4,%xmm0
subpd  %xmm3,%xmm0
movaps %xmm0,%xmm2
unpckhpd %xmm0,%xmm0
addsd  %xmm2,%xmm0
movq   %r8,%xmm2
punpckldq %xmm4,%xmm2
subpd  %xmm3,%xmm2
movaps %xmm2,%xmm3
unpckhpd %xmm2,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
movaps %xmm0,%xmm2
cvttsd2si %xmm2,%r9
mov    %r9,%rsi
sar    $0x3f,%rsi
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
and    %rsi,%rax
or     %rax,%r9
mov    -0x20(%rbp),%rax
lea    0xdad(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
movq   %rsi,%xmm0
movdqa 0xea2(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xea6(%rip),%xmm2
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movq   %rdx,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm3
cvttsd2si %xmm3,%rax
mov    %rcx,%r13
mov    %rdi,%r12
mov    %rax,%rcx
sar    $0x3f,%rcx
subsd  0xe6f(%rip),%xmm3
cvttsd2si %xmm3,%rbx
and    %rcx,%rbx
or     %rax,%rbx
lea    0xe65(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rbx,%r8
mov    %r13,%r9
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
mov    %r13,(%rsp)
mov    %rax,%rdi
lea    0xe2d(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1050 <fprintf@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s\09%ld\09%ld\09%f\09%d\0A\00"
@.str.1 = [11 x i8] c"report.dat\00"
@.str.2 = [2 x i8] c"a\00"
define void @report(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i64, i64* %6
%14 = uitofp i64 %13 to double
%15 = fmul double %14, 1.000000e+00
%16 = load i64, i64* %7
%17 = uitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = fptoui double %18 to i64
%20 = load i64, i64* %8
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10, i64 %11, i64 %12, i64 %19, i64 %20)
%22 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %9
%23 = load i32*, i32** %9
%24 = load i8*, i8** %5
%25 = load i64, i64* %6
%26 = load i64, i64* %7
%27 = load i64, i64* %6
%28 = uitofp i64 %27 to double
%29 = fmul double %28, 1.000000e+00
%30 = load i64, i64* %7
%31 = uitofp i64 %30 to double
%32 = fdiv double %29, %31
%33 = fptoui double %32 to i64
%34 = load i64, i64* %8
%35 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %24, i64 %25, i64 %26, i64 %33, i64 %34)
%36 = load i32*, i32** %9
%37 = call i32 @fclose(i32* %36)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s\09%ld\09%ld\09%f\09%d\0A\00"
@.str.1 = [11 x i8] c"report.dat\00"
@.str.2 = [2 x i8] c"a\00"
define void @report(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = uitofp i64 %1 to double
%6 = uitofp i64 %2 to double
%7 = fdiv double %5, %6
%8 = fptoui double %7 to i64
%9 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1, i64 %2, i64 %8, i64 %3)
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1, i64 %2, i64 %8, i64 %3)
%12 = tail call i32 @fclose(i32* %10)
ret void
}