#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*/ do_test(int const, float *, float *);
int /*<<< orphan*/ free(float *);
scalar_t__ ov_malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int const n = 1 << 19;
  float *x, *y;
  printf("OV_PLATFORM: "
         "C"
         " "
         "GCC"
         " COMPILER SSE 2"
         "\n");
  printf("OV_FLOAT_WIDTH %d\n", 4);
  x = (float *)ov_malloc(sizeof(float) * n);
  y = (float *)ov_malloc(sizeof(float) * n);
  for (int i = 0; i < n; i++) {
    y[i] = i;
    x[i] = i * 100.0f;
  }
  printf("CSV, plat, size, GFlops/s\n");
  do_test(1 << 9, x, y);
  do_test(1 << 14, x, y);
  do_test(n, x, y);
  free(x);
  free(y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x80000,-0x14(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x200000,%edi
call   1060 <ov_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x200000,%edi
call   1060 <ov_malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x80000,-0x2c(%rbp)
jge    11ec <main+0xac>
cvtsi2ssl -0x2c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
cvtsi2ssl -0x2c(%rbp),%xmm0
movss  0xe33(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a1 <main+0x61>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x200,%edi
call   1050 <do_test@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x4000,%edi
call   1050 <do_test@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x80000,%edi
call   1050 <do_test@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf1c(%rip),%rdi
call   1040 <puts@plt>
lea    0xefd(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x200000,%edi
call   1070 <ov_malloc@plt>
mov    %rax,%r14
mov    $0x200000,%edi
call   1070 <ov_malloc@plt>
mov    %rax,%rbx
lea    0x200000(%r14),%rax
cmp    %rax,%rbx
jae    1202 <main+0xb2>
mov    %rbx,%rax
add    $0x200000,%rax
cmp    %rax,%r14
jae    1202 <main+0xb2>
xor    %eax,%eax
movss  0xeaf(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  %xmm1,(%rbx,%rax,4)
mulss  %xmm0,%xmm1
movss  %xmm1,(%r14,%rax,4)
lea    0x1(%rax),%ecx
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
movss  %xmm1,0x4(%rbx,%rax,4)
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%r14,%rax,4)
add    $0x2,%rax
cmp    $0x80000,%rax
jne    11c0 <main+0x70>
jmp    12aa <main+0x15a>
movdqa 0xdf6(%rip),%xmm0
xor    %eax,%eax
movdqa 0xdfc(%rip),%xmm1
movaps 0xe05(%rip),%xmm2
movdqa 0xe0d(%rip),%xmm3
movdqa 0xe15(%rip),%xmm4
movdqa 0xe1d(%rip),%xmm5
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm6
paddd  %xmm1,%xmm6
cvtdq2ps %xmm0,%xmm7
cvtdq2ps %xmm6,%xmm6
movups %xmm7,(%rbx,%rax,4)
movups %xmm6,0x10(%rbx,%rax,4)
mulps  %xmm2,%xmm7
mulps  %xmm2,%xmm6
movups %xmm7,(%r14,%rax,4)
movups %xmm6,0x10(%r14,%rax,4)
movdqa %xmm0,%xmm6
paddd  %xmm3,%xmm6
movdqa %xmm0,%xmm7
paddd  %xmm4,%xmm7
cvtdq2ps %xmm6,%xmm6
cvtdq2ps %xmm7,%xmm7
movups %xmm6,0x20(%rbx,%rax,4)
movups %xmm7,0x30(%rbx,%rax,4)
mulps  %xmm2,%xmm6
mulps  %xmm2,%xmm7
movups %xmm6,0x20(%r14,%rax,4)
movups %xmm7,0x30(%r14,%rax,4)
add    $0x10,%rax
paddd  %xmm5,%xmm0
cmp    $0x80000,%rax
jne    1240 <main+0xf0>
lea    0xde8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x200,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <do_test@plt>
mov    $0x4000,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <do_test@plt>
mov    $0x80000,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <do_test@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [35 x i8] c"OV_PLATFORM: C GCC COMPILER SSE 2\0A\00"
@.str.1 = [19 x i8] c"OV_FLOAT_WIDTH %d\0A\00"
@.str.2 = [27 x i8] c"CSV, plat, size, GFlops/s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 524288, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = call i64 @ov_malloc(i32 2097152)
%13 = inttoptr i64 %12 to float*
store float* %13, float** %7
%14 = call i64 @ov_malloc(i32 2097152)
%15 = inttoptr i64 %14 to float*
store float* %15, float** %8
store i32 0, i32* %9
br label %16
16: ; preds = %33, %2
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 524288
br i1 %18, label %19, label %36
19: ; preds = %16
%20 = load i32, i32* %9
%21 = sitofp i32 %20 to float
%22 = load float*, float** %8
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
store float %21, float* %25
%26 = load i32, i32* %9
%27 = sitofp i32 %26 to float
%28 = fmul float %27, 1.000000e+02
%29 = load float*, float** %7
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
store float %28, float* %32
br label %33
33: ; preds = %19
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %16
36: ; preds = %16
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%38 = load float*, float** %7
%39 = load float*, float** %8
%40 = call i32 @do_test(i32 512, float* %38, float* %39)
%41 = load float*, float** %7
%42 = load float*, float** %8
%43 = call i32 @do_test(i32 16384, float* %41, float* %42)
%44 = load float*, float** %7
%45 = load float*, float** %8
%46 = call i32 @do_test(i32 524288, float* %44, float* %45)
%47 = load float*, float** %7
%48 = call i32 @free(float* %47)
%49 = load float*, float** %8
%50 = call i32 @free(float* %49)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"OV_FLOAT_WIDTH %d\0A\00"
@str = [34 x i8] c"OV_PLATFORM: C GCC COMPILER SSE 2\00"
@str.3 = [26 x i8] c"CSV, plat, size, GFlops/s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 4)
%5 = tail call i64 @ov_malloc(i32 2097152)
%6 = inttoptr i64 %5 to float*
%7 = tail call i64 @ov_malloc(i32 2097152)
%8 = inttoptr i64 %7 to float*
%9 = inttoptr i64 %7 to i8*
%10 = inttoptr i64 %5 to i8*
%11 = getelementptr float, float* %8, i64 524288
%12 = bitcast float* %11 to i8*
%13 = getelementptr float, float* %6, i64 524288
%14 = bitcast float* %13 to i8*
%15 = icmp ult i8* %9, %14
%16 = icmp ult i8* %10, %12
%17 = and i1 %15, %16
br i1 %17, label %59, label %18
18: ; preds = %2, %18
%19 = phi i64 [ %49, %18 ], [ 0, %2 ]
%20 = phi <4 x i32> [ %50, %18 ], [ <i32 0, i32 1, i32 2, i32 3>, %2 ]
%21 = add <4 x i32> %20, <i32 4, i32 4, i32 4, i32 4>
%22 = sitofp <4 x i32> %20 to <4 x float>
%23 = sitofp <4 x i32> %21 to <4 x float>
%24 = getelementptr inbounds float, float* %8, i64 %19
%25 = bitcast float* %24 to <4 x float>*
store <4 x float> %22, <4 x float>* %25
%26 = getelementptr inbounds float, float* %24, i64 4
%27 = bitcast float* %26 to <4 x float>*
store <4 x float> %23, <4 x float>* %27
%28 = fmul <4 x float> %22, <float 1.000000e+02, float 1.000000e+02, float 1.000000e+02, float 1.000000e+02>
%29 = fmul <4 x float> %23, <float 1.000000e+02, float 1.000000e+02, float 1.000000e+02, float 1.000000e+02>
%30 = getelementptr inbounds float, float* %6, i64 %19
%31 = bitcast float* %30 to <4 x float>*
store <4 x float> %28, <4 x float>* %31
%32 = getelementptr inbounds float, float* %30, i64 4
%33 = bitcast float* %32 to <4 x float>*
store <4 x float> %29, <4 x float>* %33
%34 = or i64 %19, 8
%35 = add <4 x i32> %20, <i32 8, i32 8, i32 8, i32 8>
%36 = add <4 x i32> %20, <i32 12, i32 12, i32 12, i32 12>
%37 = sitofp <4 x i32> %35 to <4 x float>
%38 = sitofp <4 x i32> %36 to <4 x float>
%39 = getelementptr inbounds float, float* %8, i64 %34
%40 = bitcast float* %39 to <4 x float>*
store <4 x float> %37, <4 x float>* %40
%41 = getelementptr inbounds float, float* %39, i64 4
%42 = bitcast float* %41 to <4 x float>*
store <4 x float> %38, <4 x float>* %42
%43 = fmul <4 x float> %37, <float 1.000000e+02, float 1.000000e+02, float 1.000000e+02, float 1.000000e+02>
%44 = fmul <4 x float> %38, <float 1.000000e+02, float 1.000000e+02, float 1.000000e+02, float 1.000000e+02>
%45 = getelementptr inbounds float, float* %6, i64 %34
%46 = bitcast float* %45 to <4 x float>*
store <4 x float> %43, <4 x float>* %46
%47 = getelementptr inbounds float, float* %45, i64 4
%48 = bitcast float* %47 to <4 x float>*
store <4 x float> %44, <4 x float>* %48
%49 = add nuw nsw i64 %19, 16
%50 = add <4 x i32> %20, <i32 16, i32 16, i32 16, i32 16>
%51 = icmp eq i64 %49, 524288
br i1 %51, label %52, label %18
52: ; preds = %18, %59
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
%54 = tail call i32 @do_test(i32 512, float* %6, float* %8)
%55 = tail call i32 @do_test(i32 16384, float* %6, float* %8)
%56 = tail call i32 @do_test(i32 524288, float* %6, float* %8)
%57 = tail call i32 @free(float* %6)
%58 = tail call i32 @free(float* %8)
ret i32 0
59: ; preds = %2, %59
%60 = phi i64 [ %72, %59 ], [ 0, %2 ]
%61 = trunc i64 %60 to i32
%62 = sitofp i32 %61 to float
%63 = getelementptr inbounds float, float* %8, i64 %60
store float %62, float* %63
%64 = fmul float %62, 1.000000e+02
%65 = getelementptr inbounds float, float* %6, i64 %60
store float %64, float* %65
%66 = or i64 %60, 1
%67 = trunc i64 %66 to i32
%68 = sitofp i32 %67 to float
%69 = getelementptr inbounds float, float* %8, i64 %66
store float %68, float* %69
%70 = fmul float %68, 1.000000e+02
%71 = getelementptr inbounds float, float* %6, i64 %66
store float %70, float* %71
%72 = add nuw nsw i64 %60, 2
%73 = icmp eq i64 %72, 524288
br i1 %73, label %52, label %59
}