#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, double);
void for_test() {
  double A[1000], B[1000];
  int L = 500;
  for (int i = 0; i < L; i++) {
    A[i] = i;
  }
  for (int i = 0; i < L; i++) {
    B[i] = A[i] * 5;
    B[i]++;
    A[i] *= 7;
    A[i]++;
  }
  printf("%lf %lf\n", A[0], B[0]);
}


x86 assembly (clang, -O0):
<for_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3e90,%rsp
movl   $0x1f4,-0x3e84(%rbp)
movl   $0x0,-0x3e88(%rbp)
mov    -0x3e88(%rbp),%eax
cmp    -0x3e84(%rbp),%eax
jge    116d <for_test+0x5d>
cvtsi2sdl -0x3e88(%rbp),%xmm0
ff
movslq -0x3e88(%rbp),%rax
movsd  %xmm0,-0x1f40(%rbp,%rax,8)
ff ff
mov    -0x3e88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3e88(%rbp)
jmp    112f <for_test+0x1f>
movl   $0x0,-0x3e8c(%rbp)
mov    -0x3e8c(%rbp),%eax
cmp    -0x3e84(%rbp),%eax
jge    1228 <for_test+0x118>
movslq -0x3e8c(%rbp),%rax
movsd  0xe78(%rip),%xmm0
mulsd  -0x1f40(%rbp,%rax,8),%xmm0
ff ff
movslq -0x3e8c(%rbp),%rax
movsd  %xmm0,-0x3e80(%rbp,%rax,8)
ff ff
movslq -0x3e8c(%rbp),%rax
movsd  0xe40(%rip),%xmm0
addsd  -0x3e80(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x3e80(%rbp,%rax,8)
ff ff
movslq -0x3e8c(%rbp),%rax
movsd  0xe27(%rip),%xmm0
mulsd  -0x1f40(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1f40(%rbp,%rax,8)
ff ff
movslq -0x3e8c(%rbp),%rax
movsd  0xdfe(%rip),%xmm0
addsd  -0x1f40(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1f40(%rbp,%rax,8)
ff ff
mov    -0x3e8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3e8c(%rbp)
jmp    1177 <for_test+0x67>
movsd  -0x1f40(%rbp),%xmm0
ff
movsd  -0x3e80(%rbp),%xmm1
ff
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
add    $0x3e90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<for_test>:
sub    $0x3e08,%rsp
movdqa 0xee1(%rip),%xmm0
mov    $0x6,%eax
movdqa 0xee4(%rip),%xmm1
movdqa 0xeec(%rip),%xmm2
movdqa 0xef4(%rip),%xmm3
movdqa 0xefc(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm5
paddd  %xmm1,%xmm5
cvtdq2pd %xmm0,%xmm6
cvtdq2pd %xmm5,%xmm5
movaps %xmm6,-0xb0(%rsp,%rax,8)
ff
movaps %xmm5,-0xa0(%rsp,%rax,8)
ff
cmp    $0x1f6,%rax
je     11a9 <for_test+0x99>
movdqa %xmm0,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm0,%xmm6
paddd  %xmm3,%xmm6
cvtdq2pd %xmm5,%xmm5
cvtdq2pd %xmm6,%xmm6
movapd %xmm5,-0x90(%rsp,%rax,8)
ff ff
movapd %xmm6,-0x80(%rsp,%rax,8)
paddd  %xmm4,%xmm0
add    $0x8,%rax
jmp    1150 <for_test+0x40>
mov    $0x2,%eax
movapd 0xe9a(%rip),%xmm0
movapd 0xea2(%rip),%xmm1
movapd 0xeaa(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
movapd -0x90(%rsp,%rax,8),%xmm3
ff ff
movapd -0x80(%rsp,%rax,8),%xmm4
movapd %xmm3,%xmm5
mulpd  %xmm0,%xmm5
movapd %xmm4,%xmm6
mulpd  %xmm0,%xmm6
addpd  %xmm1,%xmm5
addpd  %xmm1,%xmm6
movapd %xmm5,0x1eb0(%rsp,%rax,8)
movapd %xmm6,0x1ec0(%rsp,%rax,8)
mulpd  %xmm2,%xmm3
mulpd  %xmm2,%xmm4
addpd  %xmm1,%xmm3
addpd  %xmm1,%xmm4
movapd %xmm3,-0x90(%rsp,%rax,8)
ff ff
movapd %xmm4,-0x80(%rsp,%rax,8)
add    $0x4,%rax
cmp    $0x1f6,%rax
jne    11d0 <for_test+0xc0>
movsd  -0x80(%rsp),%xmm0
movsd  0x1ec0(%rsp),%xmm1
lea    0xe36(%rip),%rdi
add    $0x3e08,%rsp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"%lf %lf\0A\00"
define void @for_test() {
%1 = alloca [1000 x double]
%2 = alloca [1000 x double]
%3 = bitcast [1000 x double]* %1 to i8*
%4 = bitcast [1000 x double]* %2 to i8*
br label %5
5: ; preds = %17, %0
%6 = phi i64 [ 0, %0 ], [ %26, %17 ]
%7 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %27, %17 ]
%8 = add <2 x i32> %7, <i32 2, i32 2>
%9 = sitofp <2 x i32> %7 to <2 x double>
%10 = sitofp <2 x i32> %8 to <2 x double>
%11 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %6
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> %9, <2 x double>* %12
%13 = getelementptr inbounds double, double* %11, i64 2
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> %10, <2 x double>* %14
%15 = or i64 %6, 4
%16 = icmp eq i64 %15, 500
br i1 %16, label %28, label %17
17: ; preds = %5
%18 = add <2 x i32> %7, <i32 4, i32 4>
%19 = add <2 x i32> %7, <i32 6, i32 6>
%20 = sitofp <2 x i32> %18 to <2 x double>
%21 = sitofp <2 x i32> %19 to <2 x double>
%22 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %15
%23 = bitcast double* %22 to <2 x double>*
store <2 x double> %20, <2 x double>* %23
%24 = getelementptr inbounds double, double* %22, i64 2
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> %21, <2 x double>* %25
%26 = add nuw nsw i64 %6, 8
%27 = add <2 x i32> %7, <i32 8, i32 8>
br label %5
28: ; preds = %5, %28
%29 = phi i64 [ %50, %28 ], [ 0, %5 ]
%30 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %29
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = getelementptr inbounds double, double* %30, i64 2
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = fmul <2 x double> %32, <double 5.000000e+00, double 5.000000e+00>
%37 = fmul <2 x double> %35, <double 5.000000e+00, double 5.000000e+00>
%38 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %29
%39 = fadd <2 x double> %36, <double 1.000000e+00, double 1.000000e+00>
%40 = fadd <2 x double> %37, <double 1.000000e+00, double 1.000000e+00>
%41 = bitcast double* %38 to <2 x double>*
store <2 x double> %39, <2 x double>* %41
%42 = getelementptr inbounds double, double* %38, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %40, <2 x double>* %43
%44 = fmul <2 x double> %32, <double 7.000000e+00, double 7.000000e+00>
%45 = fmul <2 x double> %35, <double 7.000000e+00, double 7.000000e+00>
%46 = fadd <2 x double> %44, <double 1.000000e+00, double 1.000000e+00>
%47 = fadd <2 x double> %45, <double 1.000000e+00, double 1.000000e+00>
%48 = bitcast double* %30 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = bitcast double* %33 to <2 x double>*
store <2 x double> %47, <2 x double>* %49
%50 = add nuw i64 %29, 4
%51 = icmp eq i64 %50, 500
br i1 %51, label %52, label %28
52: ; preds = %28
%53 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 0
%54 = load double, double* %53
%55 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 0
%56 = load double, double* %55
%57 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %54, double %56)
ret void
}