#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 */
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, double);
main() {
  int i;
  float a[100000], b[100000], c[100000];
  for (i = 0; i < 100000; i++)
    a[i] = b[i] = i * 1.0;
  double start = omp_get_wtime();
  for (i = 0; i < 100000; i++)
    c[i] = a[i] + b[i];
  double end = omp_get_wtime();
  printf("start time = %f\n", start);
  printf("end time = %f\n", end);
  printf("diff time = %f\n", end - start);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x124fa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    1183 <main+0x63>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xead(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0xc3510(%rbp,%rax,4)
f3 ff
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x61a90(%rbp,%rax,4)
f9 ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x124f98(%rbp)
ff
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    11db <main+0xbb>
movslq -0x8(%rbp),%rax
movss  -0x61a90(%rbp,%rax,4),%xmm0
f9 ff
movslq -0x8(%rbp),%rax
addss  -0xc3510(%rbp,%rax,4),%xmm0
f3 ff
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x124f90(%rbp,%rax,4)
ed ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x79>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x124fa0(%rbp)
ff
movsd  -0x124f98(%rbp),%xmm0
ff
lea    0xe0f(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x124fa0(%rbp),%xmm0
ff
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x124fa0(%rbp),%xmm0
ff
subsd  -0x124f98(%rbp),%xmm0
ff
lea    0xdff(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x124fa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xebb(%rip),%rdi
movsd  0x10(%rsp),%xmm0
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"start time = %f\0A\00"
@.str.1 = [15 x i8] c"end time = %f\0A\00"
@.str.2 = [16 x i8] c"diff time = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100000 x float]
%4 = alloca [100000 x float]
%5 = alloca [100000 x float]
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 100000
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 1.000000e+00
%15 = fptrunc double %14 to float
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100000 x float], [100000 x float]* %4, i64 0, i64 %17
store float %15, float* %18
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100000 x float], [100000 x float]* %3, i64 0, i64 %20
store float %15, float* %21
br label %22
22: ; preds = %11
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %8
25: ; preds = %8
%26 = call double (...) @omp_get_wtime()
store double %26, double* %6
store i32 0, i32* %2
br label %27
27: ; preds = %43, %25
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 100000
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100000 x float], [100000 x float]* %3, i64 0, i64 %32
%34 = load float, float* %33
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100000 x float], [100000 x float]* %4, i64 0, i64 %36
%38 = load float, float* %37
%39 = fadd float %34, %38
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100000 x float], [100000 x float]* %5, i64 0, i64 %41
store float %39, float* %42
br label %43
43: ; preds = %30
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %27
46: ; preds = %27
%47 = call double (...) @omp_get_wtime()
store double %47, double* %7
%48 = load double, double* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %48)
%50 = load double, double* %7
%51 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %50)
%52 = load double, double* %7
%53 = load double, double* %6
%54 = fsub double %52, %53
%55 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %54)
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@.str = [17 x i8] c"start time = %f\0A\00"
@.str.1 = [15 x i8] c"end time = %f\0A\00"
@.str.2 = [16 x i8] c"diff time = %f\0A\00"
define i32 @main() {
%1 = tail call double (...) @omp_get_wtime()
%2 = tail call double (...) @omp_get_wtime()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %2)
%5 = fsub double %2, %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %5)
ret i32 0
}