#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 pow(double, int);
void PT(double *u_init, double *x, double *u_future, int n_points, double c,
        double L, double dt) {
  int i;
  double dx = x[1] - x[0];
  double r = c * dt / dx;
  for (i = 1; i < n_points - 1; i++) {
    u_future[i] =
        u_init[i] +
        pow(r, 2) / 2.0 * (u_init[i + 1] - 2 * u_init[i] - u_init[i - 1]);
  }
}


x86 assembly (clang, -O0):
<PT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1206 <PT+0xf6>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x58(%rbp),%xmm1
movsd  0xe5a(%rip),%xmm2
divsd  %xmm2,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
addsd  %xmm3,%xmm3
subsd  %xmm3,%xmm2
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1167 <PT+0x57>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PT>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%ecx
jl     11ac <PT+0x9c>
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rdi,%r12
movsd  0x8(%rsi),%xmm1
subsd  (%rsi),%xmm1
mulsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0xffffffff,%r15d
mov    $0x1,%ebx
nopl   (%rax)
movsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0xe8c(%rip),%xmm0
movsd  (%r12,%rbx,8),%xmm1
movsd  0x8(%r12,%rbx,8),%xmm2
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm2
subsd  -0x8(%r12,%rbx,8),%xmm2
mulsd  %xmm0,%xmm2
addsd  0x10(%rsp),%xmm2
movsd  %xmm2,(%r14,%rbx,8)
lea    0x1(%rbx),%rax
mov    %rax,%rbx
cmp    %rax,%r15
jne    1150 <PT+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @PT(double* %0, double* %1, double* %2, i32 %3, double %4, double %5, double %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca double
%17 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%18 = load double*, double** %9
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = load double*, double** %9
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = fsub double %20, %23
store double %24, double* %16
%25 = load double, double* %12
%26 = load double, double* %14
%27 = fmul double %25, %26
%28 = load double, double* %16
%29 = fdiv double %27, %28
store double %29, double* %17
store i32 1, i32* %15
br label %30
30: ; preds = %68, %7
%31 = load i32, i32* %15
%32 = load i32, i32* %11
%33 = sub nsw i32 %32, 1
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %71
35: ; preds = %30
%36 = load double*, double** %8
%37 = load i32, i32* %15
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = load double, double* %17
%42 = call double @pow(double %41, i32 2)
%43 = fdiv double %42, 2.000000e+00
%44 = load double*, double** %8
%45 = load i32, i32* %15
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %44, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %8
%51 = load i32, i32* %15
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %54, double %49)
%56 = load double*, double** %8
%57 = load i32, i32* %15
%58 = sub nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %56, i64 %59
%61 = load double, double* %60
%62 = fsub double %55, %61
%63 = call double @llvm.fmuladd.f64(double %43, double %62, double %40)
%64 = load double*, double** %10
%65 = load i32, i32* %15
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
store double %63, double* %67
br label %68
68: ; preds = %35
%69 = load i32, i32* %15
%70 = add nsw i32 %69, 1
store i32 %70, i32* %15
br label %30
71: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @PT(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2, i32 %3, double %4, double %5, double %6) {
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = load double, double* %1
%11 = fsub double %9, %10
%12 = fmul double %4, %6
%13 = fdiv double %12, %11
%14 = icmp sgt i32 %3, 2
br i1 %14, label %15, label %36
15: ; preds = %7
%16 = add nsw i32 %3, -1
%17 = zext i32 %16 to i64
br label %18
18: ; preds = %15, %18
%19 = phi i64 [ 1, %15 ], [ %24, %18 ]
%20 = getelementptr inbounds double, double* %0, i64 %19
%21 = load double, double* %20
%22 = tail call double @pow(double %13, i32 2)
%23 = fmul double %22, 5.000000e-01
%24 = add nuw nsw i64 %19, 1
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = load double, double* %25
%27 = load double, double* %20
%28 = tail call double @llvm.fmuladd.f64(double %27, double -2.000000e+00, double %26)
%29 = add nsw i64 %19, -1
%30 = getelementptr inbounds double, double* %0, i64 %29
%31 = load double, double* %30
%32 = fsub double %28, %31
%33 = tail call double @llvm.fmuladd.f64(double %23, double %32, double %21)
%34 = getelementptr inbounds double, double* %2, i64 %19
store double %33, double* %34
%35 = icmp eq i64 %24, %17
br i1 %35, label %36, label %18
36: ; preds = %18, %7
ret void
}