int main() {
  double a[512];
  double b[512];
  int t, i;
  for (t = 1; t <= 100; t++) {
    for (i = 2; i <= 512 - 1; i++)
      b[i] = (double)0.25 * (a[i - 1] + a[i + 1]) + (double)0.5 * a[i];
    for (i = 2; i <= 512 - 1; i++)
      a[i] = b[i];
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1fa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2014(%rbp)
cmpl   $0x64,-0x2014(%rbp)
jg     121e <main+0x11e>
movl   $0x2,-0x2018(%rbp)
cmpl   $0x1ff,-0x2018(%rbp)
jg     11b7 <main+0xb7>
mov    -0x2018(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x1010(%rbp,%rax,8),%xmm0
ff ff
mov    -0x2018(%rbp),%eax
add    $0x1,%eax
cltq
addsd  -0x1010(%rbp,%rax,8),%xmm0
ff ff
movslq -0x2018(%rbp),%rax
movsd  0xe8e(%rip),%xmm1
mulsd  -0x1010(%rbp,%rax,8),%xmm1
ff ff
movsd  0xe75(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x2018(%rbp),%rax
movsd  %xmm0,-0x2010(%rbp,%rax,8)
ff ff
mov    -0x2018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2018(%rbp)
jmp    1133 <main+0x33>
movl   $0x2,-0x2018(%rbp)
cmpl   $0x1ff,-0x2018(%rbp)
jg     1205 <main+0x105>
movslq -0x2018(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm0
ff ff
movslq -0x2018(%rbp),%rax
movsd  %xmm0,-0x1010(%rbp,%rax,8)
ff ff
mov    -0x2018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2018(%rbp)
jmp    11c1 <main+0xc1>
jmp    120a <main+0x10a>
mov    -0x2014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2014(%rbp)
jmp    111c <main+0x1c>
xor    %eax,%eax
add    $0x1fa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x2000,%rsp
lea    0x10(%rsp),%r14
mov    $0x1,%ebp
lea    0x1010(%rsp),%rbx
movsd  0xecb(%rip),%xmm5
movsd  0xecb(%rip),%xmm6
nopl   (%rax)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x18(%rsp,%rax,8),%xmm1
movsd  0x20(%rsp,%rax,8),%xmm2
addsd  %xmm1,%xmm3
movapd %xmm0,%xmm4
mulsd  %xmm5,%xmm4
mulsd  %xmm6,%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm3,0x1010(%rsp,%rax,8)
addsd  %xmm2,%xmm0
movapd %xmm1,%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm6,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x1018(%rsp,%rax,8)
movsd  0x28(%rsp,%rax,8),%xmm0
addsd  %xmm0,%xmm1
movapd %xmm2,%xmm3
mulsd  %xmm5,%xmm2
mulsd  %xmm6,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x1020(%rsp,%rax,8)
add    $0x3,%rax
cmp    $0x1fe,%rax
jne    1150 <main+0x40>
mov    $0xff0,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <memcpy@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
je     11f8 <main+0xe8>
movsd  0x10(%rsp),%xmm0
movsd  0xe15(%rip),%xmm5
movsd  0xe15(%rip),%xmm6
jmp    1140 <main+0x30>
xor    %eax,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x double]
%3 = alloca [512 x double]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
br label %6
6: ; preds = %53, %0
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 100
br i1 %8, label %9, label %56
9: ; preds = %6
store i32 2, i32* %5
br label %10
10: ; preds = %34, %9
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 511
br i1 %12, label %13, label %37
13: ; preds = %10
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %21
%23 = load double, double* %22
%24 = fadd double %18, %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %26
%28 = load double, double* %27
%29 = fmul double 5.000000e-01, %28
%30 = call double @llvm.fmuladd.f64(double 2.500000e-01, double %24, double %29)
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %32
store double %30, double* %33
br label %34
34: ; preds = %13
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %10
37: ; preds = %10
store i32 2, i32* %5
br label %38
38: ; preds = %49, %37
%39 = load i32, i32* %5
%40 = icmp sle i32 %39, 511
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %43
%45 = load double, double* %44
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %47
store double %45, double* %48
br label %49
49: ; preds = %41
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %38
52: ; preds = %38
br label %53
53: ; preds = %52
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %6
56: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [512 x double]
%2 = alloca [512 x double]
%3 = bitcast [512 x double]* %1 to i8*
%4 = bitcast [512 x double]* %2 to i8*
%5 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to i8*
%7 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 2
%8 = bitcast double* %7 to i8*
br label %9
9: ; preds = %41, %0
%10 = phi double [ undef, %0 ], [ %42, %41 ]
%11 = phi i32 [ 1, %0 ], [ %39, %41 ]
br label %12
12: ; preds = %12, %9
%13 = phi double [ %10, %9 ], [ %32, %12 ]
%14 = phi double [ undef, %9 ], [ %25, %12 ]
%15 = phi i64 [ 2, %9 ], [ %30, %12 ]
%16 = add nuw nsw i64 %15, 1
%17 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %16
%18 = load double, double* %17
%19 = fadd double %14, %18
%20 = fmul double %13, 5.000000e-01
%21 = tail call double @llvm.fmuladd.f64(double %19, double 2.500000e-01, double %20)
%22 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %15
store double %21, double* %22
%23 = add nuw nsw i64 %15, 2
%24 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %23
%25 = load double, double* %24
%26 = fadd double %13, %25
%27 = fmul double %18, 5.000000e-01
%28 = tail call double @llvm.fmuladd.f64(double %26, double 2.500000e-01, double %27)
%29 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %16
store double %28, double* %29
%30 = add nuw nsw i64 %15, 3
%31 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %30
%32 = load double, double* %31
%33 = fadd double %18, %32
%34 = fmul double %25, 5.000000e-01
%35 = tail call double @llvm.fmuladd.f64(double %33, double 2.500000e-01, double %34)
%36 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %23
store double %35, double* %36
%37 = icmp eq i64 %30, 512
br i1 %37, label %38, label %12
38: ; preds = %12
%39 = add nuw nsw i32 %11, 1
%40 = icmp eq i32 %39, 101
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = load double, double* %5
br label %9
43: ; preds = %38
ret i32 0
}