#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*/ add(float *, float *, float *, int);
float *calloc(int, int);
int /*<<< orphan*/ copy(float *, float *, int);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
unsigned long long read_tsc_counter();
int /*<<< orphan*/ scale(float *, float *, scalar_t__, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ triad(float *, float *, float *, scalar_t__, int);
int /*<<< orphan*/ xmm_add(float *, float *, float *, int);
int /*<<< orphan*/ xmm_copy(float *, float *, int);
int /*<<< orphan*/ xmm_scale(float *, float *, scalar_t__, int);
int /*<<< orphan*/ xmm_triad(float *, float *, float *, scalar_t__, int);
int main() {
  int i;
  unsigned long long start, end;
  float *a = calloc(sizeof(float), 4000000);
  float *b = calloc(sizeof(float), 4000000);
  float *c = calloc(sizeof(float), 4000000);
  srand(time(NULL));
  for (i = 0; i < 4000000; i++) {
    a[i] = (float)rand();
    b[i] = (float)rand();
    c[i] = (float)rand();
  }
  printf("\n");
  printf("[*] Testing Copy with %d samples\n", 4000000);
  start = read_tsc_counter();
  copy(a, b, 4000000);
  end = read_tsc_counter();
  printf("[*] Regular Copy: %llu clock ticks\n", end - start);
  start = read_tsc_counter();
  xmm_copy(a, b, 4000000);
  end = read_tsc_counter();
  printf("[*] XMM Copy: %llu clock ticks\n", end - start);
  printf("\n");
  printf("[*] Testing Scale with %d samples\n", 4000000);
  start = read_tsc_counter();
  scale(a, b, rand(), 4000000);
  end = read_tsc_counter();
  printf("[*] Regular Scale: %llu clock ticks\n", end - start);
  start = read_tsc_counter();
  xmm_scale(a, b, rand(), 4000000);
  end = read_tsc_counter();
  printf("[*] XMM Scale: %llu clock ticks\n", end - start);
  printf("\n");
  printf("[*] Testing Add with %d samples\n", 4000000);
  start = read_tsc_counter();
  add(a, b, c, 4000000);
  end = read_tsc_counter();
  printf("[*] Regular Add: %llu clock ticks\n", end - start);
  start = read_tsc_counter();
  xmm_add(a, b, c, 4000000);
  end = read_tsc_counter();
  printf("[*] XMM Add: %llu clock ticks\n", end - start);
  printf("\n");
  printf("[*] Testing Triad with %d samples\n", 4000000);
  start = read_tsc_counter();
  triad(a, b, c, rand(), 4000000);
  end = read_tsc_counter();
  printf("[*] Regular Triad: %llu clock ticks\n", end - start);
  start = read_tsc_counter();
  xmm_triad(a, b, c, rand(), 4000000);
  end = read_tsc_counter();
  printf("[*] XMM Triad: %llu clock ticks\n", end - start);
  printf("\n");
  free(a);
  free(b);
  free(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   1090 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   1090 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   1090 <calloc@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3d0900,-0x8(%rbp)
jge    12b8 <main+0xc8>
mov    $0x0,%al
call   1110 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    $0x0,%al
call   1110 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    $0x0,%al
call   1110 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1252 <main+0x62>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd33(%rip),%rdi
mov    $0x3d0900,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x3d0900,%edx
call   1080 <copy@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x3d0900,%edx
call   10a0 <xmm_copy@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcfc(%rip),%rdi
mov    $0x3d0900,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    %rax,%rdx
mov    $0x3d0900,%ecx
call   10e0 <scale@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xcc2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %rax,%rdx
mov    $0x3d0900,%ecx
call   10d0 <xmm_scale@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc94(%rip),%rdi
mov    $0x3d0900,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x3d0900,%ecx
call   1040 <add@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x3d0900,%ecx
call   1060 <xmm_add@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xc4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc52(%rip),%rdi
mov    $0x3d0900,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    %rax,%rcx
mov    $0x3d0900,%r8d
call   10b0 <triad@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xc0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1110 <rand@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
mov    $0x3d0900,%r8d
call   1100 <xmm_triad@plt>
mov    $0x0,%al
call   10f0 <read_tsc_counter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xbcb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   10a0 <calloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   10a0 <calloc@plt>
mov    %rax,%r13
mov    $0x4,%edi
mov    $0x3d0900,%esi
call   10a0 <calloc@plt>
mov    %rax,%r15
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1120 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14,%rbx,4)
xor    %eax,%eax
call   1120 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x0(%r13,%rbx,4)
xor    %eax,%eax
call   1120 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    $0x3d0900,%rbx
jne    1250 <main+0x50>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd52(%rip),%rdi
mov    $0x3d0900,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x3d0900,%edx
call   1090 <copy@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xd3d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x3d0900,%edx
call   10b0 <xmm_copy@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xd2c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd31(%rip),%rdi
mov    $0x3d0900,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1120 <rand@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rax,%rdx
mov    $0x3d0900,%ecx
call   10f0 <scale@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xd13(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1120 <rand@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rax,%rdx
mov    $0x3d0900,%ecx
call   10e0 <xmm_scale@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xcf9(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcff(%rip),%rdi
mov    $0x3d0900,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    $0x3d0900,%ecx
call   1050 <add@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xce6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    $0x3d0900,%ecx
call   1070 <xmm_add@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xcd1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcd5(%rip),%rdi
mov    $0x3d0900,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1120 <rand@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
mov    $0x3d0900,%r8d
call   10c0 <triad@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xcb3(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1120 <rand@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %rax,%rcx
mov    $0x3d0900,%r8d
call   1110 <xmm_triad@plt>
xor    %eax,%eax
call   1100 <read_tsc_counter@plt>
sub    %r12,%rax
lea    0xc95(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [34 x i8] c"[*] Testing Copy with %d samples\0A\00"
@.str.2 = [36 x i8] c"[*] Regular Copy: %llu clock ticks\0A\00"
@.str.3 = [32 x i8] c"[*] XMM Copy: %llu clock ticks\0A\00"
@.str.4 = [35 x i8] c"[*] Testing Scale with %d samples\0A\00"
@.str.5 = [37 x i8] c"[*] Regular Scale: %llu clock ticks\0A\00"
@.str.6 = [33 x i8] c"[*] XMM Scale: %llu clock ticks\0A\00"
@.str.7 = [33 x i8] c"[*] Testing Add with %d samples\0A\00"
@.str.8 = [35 x i8] c"[*] Regular Add: %llu clock ticks\0A\00"
@.str.9 = [31 x i8] c"[*] XMM Add: %llu clock ticks\0A\00"
@.str.10 = [35 x i8] c"[*] Testing Triad with %d samples\0A\00"
@.str.11 = [37 x i8] c"[*] Regular Triad: %llu clock ticks\0A\00"
@.str.12 = [33 x i8] c"[*] XMM Triad: %llu clock ticks\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
store i32 0, i32* %1
%8 = call float* @calloc(i32 4, i32 4000000)
store float* %8, float** %5
%9 = call float* @calloc(i32 4, i32 4000000)
store float* %9, float** %6
%10 = call float* @calloc(i32 4, i32 4000000)
store float* %10, float** %7
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
store i32 0, i32* %2
br label %13
13: ; preds = %35, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 4000000
br i1 %15, label %16, label %38
16: ; preds = %13
%17 = call i64 (...) @rand()
%18 = sitofp i64 %17 to float
%19 = load float*, float** %5
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
store float %18, float* %22
%23 = call i64 (...) @rand()
%24 = sitofp i64 %23 to float
%25 = load float*, float** %6
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %25, i64 %27
store float %24, float* %28
%29 = call i64 (...) @rand()
%30 = sitofp i64 %29 to float
%31 = load float*, float** %7
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
store float %30, float* %34
br label %35
35: ; preds = %16
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %13
38: ; preds = %13
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 4000000)
%41 = call i64 (...) @read_tsc_counter()
store i64 %41, i64* %3
%42 = load float*, float** %5
%43 = load float*, float** %6
%44 = call i32 @copy(float* %42, float* %43, i32 4000000)
%45 = call i64 (...) @read_tsc_counter()
store i64 %45, i64* %4
%46 = load i64, i64* %4
%47 = load i64, i64* %3
%48 = sub i64 %46, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 %48)
%50 = call i64 (...) @read_tsc_counter()
store i64 %50, i64* %3
%51 = load float*, float** %5
%52 = load float*, float** %6
%53 = call i32 @xmm_copy(float* %51, float* %52, i32 4000000)
%54 = call i64 (...) @read_tsc_counter()
store i64 %54, i64* %4
%55 = load i64, i64* %4
%56 = load i64, i64* %3
%57 = sub i64 %55, %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i64 %57)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 4000000)
%61 = call i64 (...) @read_tsc_counter()
store i64 %61, i64* %3
%62 = load float*, float** %5
%63 = load float*, float** %6
%64 = call i64 (...) @rand()
%65 = call i32 @scale(float* %62, float* %63, i64 %64, i32 4000000)
%66 = call i64 (...) @read_tsc_counter()
store i64 %66, i64* %4
%67 = load i64, i64* %4
%68 = load i64, i64* %3
%69 = sub i64 %67, %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i64 %69)
%71 = call i64 (...) @read_tsc_counter()
store i64 %71, i64* %3
%72 = load float*, float** %5
%73 = load float*, float** %6
%74 = call i64 (...) @rand()
%75 = call i32 @xmm_scale(float* %72, float* %73, i64 %74, i32 4000000)
%76 = call i64 (...) @read_tsc_counter()
store i64 %76, i64* %4
%77 = load i64, i64* %4
%78 = load i64, i64* %3
%79 = sub i64 %77, %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i64 %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 4000000)
%83 = call i64 (...) @read_tsc_counter()
store i64 %83, i64* %3
%84 = load float*, float** %5
%85 = load float*, float** %6
%86 = load float*, float** %7
%87 = call i32 @add(float* %84, float* %85, float* %86, i32 4000000)
%88 = call i64 (...) @read_tsc_counter()
store i64 %88, i64* %4
%89 = load i64, i64* %4
%90 = load i64, i64* %3
%91 = sub i64 %89, %90
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i64 %91)
%93 = call i64 (...) @read_tsc_counter()
store i64 %93, i64* %3
%94 = load float*, float** %5
%95 = load float*, float** %6
%96 = load float*, float** %7
%97 = call i32 @xmm_add(float* %94, float* %95, float* %96, i32 4000000)
%98 = call i64 (...) @read_tsc_counter()
store i64 %98, i64* %4
%99 = load i64, i64* %4
%100 = load i64, i64* %3
%101 = sub i64 %99, %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i64 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 4000000)
%105 = call i64 (...) @read_tsc_counter()
store i64 %105, i64* %3
%106 = load float*, float** %5
%107 = load float*, float** %6
%108 = load float*, float** %7
%109 = call i64 (...) @rand()
%110 = call i32 @triad(float* %106, float* %107, float* %108, i64 %109, i32 4000000)
%111 = call i64 (...) @read_tsc_counter()
store i64 %111, i64* %4
%112 = load i64, i64* %4
%113 = load i64, i64* %3
%114 = sub i64 %112, %113
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i64 %114)
%116 = call i64 (...) @read_tsc_counter()
store i64 %116, i64* %3
%117 = load float*, float** %5
%118 = load float*, float** %6
%119 = load float*, float** %7
%120 = call i64 (...) @rand()
%121 = call i32 @xmm_triad(float* %117, float* %118, float* %119, i64 %120, i32 4000000)
%122 = call i64 (...) @read_tsc_counter()
store i64 %122, i64* %4
%123 = load i64, i64* %4
%124 = load i64, i64* %3
%125 = sub i64 %123, %124
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i64 %125)
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%128 = load float*, float** %5
%129 = call i32 @free(float* %128)
%130 = load float*, float** %6
%131 = call i32 @free(float* %130)
%132 = load float*, float** %7
%133 = call i32 @free(float* %132)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [34 x i8] c"[*] Testing Copy with %d samples\0A\00"
@.str.2 = [36 x i8] c"[*] Regular Copy: %llu clock ticks\0A\00"
@.str.3 = [32 x i8] c"[*] XMM Copy: %llu clock ticks\0A\00"
@.str.4 = [35 x i8] c"[*] Testing Scale with %d samples\0A\00"
@.str.5 = [37 x i8] c"[*] Regular Scale: %llu clock ticks\0A\00"
@.str.6 = [33 x i8] c"[*] XMM Scale: %llu clock ticks\0A\00"
@.str.7 = [33 x i8] c"[*] Testing Add with %d samples\0A\00"
@.str.8 = [35 x i8] c"[*] Regular Add: %llu clock ticks\0A\00"
@.str.9 = [31 x i8] c"[*] XMM Add: %llu clock ticks\0A\00"
@.str.10 = [35 x i8] c"[*] Testing Triad with %d samples\0A\00"
@.str.11 = [37 x i8] c"[*] Regular Triad: %llu clock ticks\0A\00"
@.str.12 = [33 x i8] c"[*] XMM Triad: %llu clock ticks\0A\00"
define i32 @main() {
%1 = tail call float* @calloc(i32 4, i32 4000000)
%2 = tail call float* @calloc(i32 4, i32 4000000)
%3 = tail call float* @calloc(i32 4, i32 4000000)
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
br label %6
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %17, %6 ]
%8 = tail call i64 (...) @rand()
%9 = sitofp i64 %8 to float
%10 = getelementptr inbounds float, float* %1, i64 %7
store float %9, float* %10
%11 = tail call i64 (...) @rand()
%12 = sitofp i64 %11 to float
%13 = getelementptr inbounds float, float* %2, i64 %7
store float %12, float* %13
%14 = tail call i64 (...) @rand()
%15 = sitofp i64 %14 to float
%16 = getelementptr inbounds float, float* %3, i64 %7
store float %15, float* %16
%17 = add nuw nsw i64 %7, 1
%18 = icmp eq i64 %17, 4000000
br i1 %18, label %19, label %6
19: ; preds = %6
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 4000000)
%22 = tail call i64 (...) @read_tsc_counter()
%23 = tail call i32 @copy(float* %1, float* %2, i32 4000000)
%24 = tail call i64 (...) @read_tsc_counter()
%25 = sub i64 %24, %22
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 %25)
%27 = tail call i64 (...) @read_tsc_counter()
%28 = tail call i32 @xmm_copy(float* %1, float* %2, i32 4000000)
%29 = tail call i64 (...) @read_tsc_counter()
%30 = sub i64 %29, %27
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i64 %30)
%32 = tail call i32 @putchar(i32 10)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 4000000)
%34 = tail call i64 (...) @read_tsc_counter()
%35 = tail call i64 (...) @rand()
%36 = tail call i32 @scale(float* %1, float* %2, i64 %35, i32 4000000)
%37 = tail call i64 (...) @read_tsc_counter()
%38 = sub i64 %37, %34
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i64 %38)
%40 = tail call i64 (...) @read_tsc_counter()
%41 = tail call i64 (...) @rand()
%42 = tail call i32 @xmm_scale(float* %1, float* %2, i64 %41, i32 4000000)
%43 = tail call i64 (...) @read_tsc_counter()
%44 = sub i64 %43, %40
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i64 %44)
%46 = tail call i32 @putchar(i32 10)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i32 4000000)
%48 = tail call i64 (...) @read_tsc_counter()
%49 = tail call i32 @add(float* %1, float* %2, float* %3, i32 4000000)
%50 = tail call i64 (...) @read_tsc_counter()
%51 = sub i64 %50, %48
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i64 %51)
%53 = tail call i64 (...) @read_tsc_counter()
%54 = tail call i32 @xmm_add(float* %1, float* %2, float* %3, i32 4000000)
%55 = tail call i64 (...) @read_tsc_counter()
%56 = sub i64 %55, %53
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i64 %56)
%58 = tail call i32 @putchar(i32 10)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 4000000)
%60 = tail call i64 (...) @read_tsc_counter()
%61 = tail call i64 (...) @rand()
%62 = tail call i32 @triad(float* %1, float* %2, float* %3, i64 %61, i32 4000000)
%63 = tail call i64 (...) @read_tsc_counter()
%64 = sub i64 %63, %60
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i64 %64)
%66 = tail call i64 (...) @read_tsc_counter()
%67 = tail call i64 (...) @rand()
%68 = tail call i32 @xmm_triad(float* %1, float* %2, float* %3, i64 %67, i32 4000000)
%69 = tail call i64 (...) @read_tsc_counter()
%70 = sub i64 %69, %66
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i64 %70)
%72 = tail call i32 @putchar(i32 10)
%73 = tail call i32 @free(float* %1)
%74 = tail call i32 @free(float* %2)
%75 = tail call i32 @free(float* %3)
ret i32 0
}