#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 */
scalar_t__ CalcTime(int *, double *);
double log(double);
int /*<<< orphan*/ printf(char *, int, int, int, double);
void testsize(int M, int N, int K) {
  double mytime;
  int times = 0;
  while (CalcTime(&times, &mytime)) {
  }
  double logmytime =
      log(M) + log(N) + log(K) + log(2) + log(1e-9) - log(mytime);
  printf("%d %d %d %f \n", M, K, N, logmytime);
}


x86 assembly (clang, -O0):
<testsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <CalcTime@plt>
cmp    $0x0,%rax
je     1164 <testsize+0x34>
jmp    1148 <testsize+0x18>
cvtsi2sdl -0x4(%rbp),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe57(%rip),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe31(%rip),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
movsd  -0x28(%rbp),%xmm0
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testsize>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%r12d
movl   $0x0,0x14(%rsp)
lea    0x14(%rsp),%rbp
lea    0x18(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <CalcTime@plt>
test   %rax,%rax
jne    1160 <testsize+0x30>
cvtsi2sd %r12d,%xmm0
call   1040 <log@plt>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
call   1040 <log@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
call   1040 <log@plt>
addsd  0x8(%rsp),%xmm0
addsd  0xe4c(%rip),%xmm0
addsd  0xe4c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <log@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
lea    0xe32(%rip),%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
movapd %xmm1,%xmm0
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d %d %d %f \0A\00"
define void @testsize(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
br label %10
10: ; preds = %13, %3
%11 = call i64 @CalcTime(i32* %8, double* %7)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %10
14: ; preds = %10
%15 = load i32, i32* %4
%16 = sitofp i32 %15 to double
%17 = call double @log(double %16)
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to double
%20 = call double @log(double %19)
%21 = fadd double %17, %20
%22 = load i32, i32* %6
%23 = sitofp i32 %22 to double
%24 = call double @log(double %23)
%25 = fadd double %21, %24
%26 = call double @log(double 2.000000e+00)
%27 = fadd double %25, %26
%28 = call double @log(double 1.000000e-09)
%29 = fadd double %27, %28
%30 = load double, double* %7
%31 = call double @log(double %30)
%32 = fsub double %29, %31
store double %32, double* %9
%33 = load i32, i32* %4
%34 = load i32, i32* %6
%35 = load i32, i32* %5
%36 = load double, double* %9
%37 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %34, i32 %35, double %36)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d %d %d %f \0A\00"
define void @testsize(i32 %0, i32 %1, i32 %2) {
%4 = alloca double
%5 = alloca i32
%6 = bitcast double* %4 to i8*
%7 = bitcast i32* %5 to i8*
store i32 0, i32* %5
br label %8
8: ; preds = %8, %3
%9 = call i64 @CalcTime(i32* %5, double* %4)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = sitofp i32 %0 to double
%13 = call double @log(double %12)
%14 = sitofp i32 %1 to double
%15 = call double @log(double %14)
%16 = fadd double %13, %15
%17 = sitofp i32 %2 to double
%18 = call double @log(double %17)
%19 = fadd double %16, %18
%20 = fadd double %19, 0x3FE62E42FEFA39EF
%21 = fadd double %20, 0xC034B927F32BFFB8
%22 = load double, double* %4
%23 = call double @log(double %22)
%24 = fsub double %21, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2, i32 %1, double %24)
ret void
}