#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 *, ...);
double runtest(int, int, int, size_t, void *(*)());
void run_two_tests(int num_pcores, int num_lcores, size_t cache_kb,
                   void *test()) {
  double lcores_elapsedtime =
      runtest(num_lcores, num_pcores, num_lcores, cache_kb * 1024, test);
  double pcores_elapsedtime =
      runtest(num_lcores / 2, num_pcores, num_lcores, cache_kb * 1024, test);
  printf("lcores_elapsedtime = %f\n", lcores_elapsedtime);
  printf("pcores_elapsedtime = %f\n", pcores_elapsedtime);
  printf("lcores_elapsedtime / pcores_elapsedtime = %f\n",
         lcores_elapsedtime / pcores_elapsedtime);
  printf("---------------------------------------------------------------------"
         "------\n");
}


x86 assembly (clang, -O0):
<run_two_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
shl    $0xa,%rcx
mov    -0x18(%rbp),%r8
call   1040 <runtest@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
shl    $0xa,%rcx
mov    -0x18(%rbp),%r8
call   1040 <runtest@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_two_tests>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r15d
shl    $0xa,%rbx
mov    %esi,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <runtest@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
shr    $0x1f,%edi
add    %ebp,%edi
sar    %edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <runtest@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe79(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"lcores_elapsedtime = %f\0A\00"
@.str.1 = [25 x i8] c"pcores_elapsedtime = %f\0A\00"
@.str.2 = [46 x i8] c"lcores_elapsedtime / pcores_elapsedtime = %f\0A\00"
@.str.3 = [77 x i8] c"---------------------------------------------------------------------------\0A\00"
define void @run_two_tests(i32 %0, i32 %1, i64 %2, i8* (...)* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8* (...)*
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i8* (...)* %3, i8* (...)** %8
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = load i64, i64* %7
%15 = mul i64 %14, 1024
%16 = load i8* (...)*, i8* (...)** %8
%17 = call double @runtest(i32 %11, i32 %12, i32 %13, i64 %15, i8* (...)* %16)
store double %17, double* %9
%18 = load i32, i32* %6
%19 = sdiv i32 %18, 2
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = load i64, i64* %7
%23 = mul i64 %22, 1024
%24 = load i8* (...)*, i8* (...)** %8
%25 = call double @runtest(i32 %19, i32 %20, i32 %21, i64 %23, i8* (...)* %24)
store double %25, double* %10
%26 = load double, double* %9
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %26)
%28 = load double, double* %10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %28)
%30 = load double, double* %9
%31 = load double, double* %10
%32 = fdiv double %30, %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"lcores_elapsedtime = %f\0A\00"
@.str.1 = [25 x i8] c"pcores_elapsedtime = %f\0A\00"
@.str.2 = [46 x i8] c"lcores_elapsedtime / pcores_elapsedtime = %f\0A\00"
@str = [76 x i8] c"---------------------------------------------------------------------------\00"
define void @run_two_tests(i32 %0, i32 %1, i64 %2, i8* (...)* %3) {
%5 = shl i64 %2, 10
%6 = tail call double @runtest(i32 %1, i32 %0, i32 %1, i64 %5, i8* (...)* %3)
%7 = sdiv i32 %1, 2
%8 = tail call double @runtest(i32 %7, i32 %0, i32 %1, i64 %5, i8* (...)* %3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %6)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %8)
%11 = fdiv double %6, %8
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), double %11)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str, i64 0, i64 0))
ret void
}