#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*/ deriv(double *, double *, void *, int, double);
void euler(double y[], double dydt[], void *p, int n, double t, double h) {
  deriv(y, dydt, p, n, t);
  for (int i = 0; i < n; i++)
    y[i] += h * dydt[i];
}


x86 assembly (clang, -O0):
<euler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
movsd  -0x28(%rbp),%xmm0
call   1030 <deriv@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1197 <euler+0x87>
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1151 <euler+0x41>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<euler>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movapd %xmm1,(%rsp)
mov    %ecx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <deriv@plt>
movapd (%rsp),%xmm6
test   %ebp,%ebp
jle    12a5 <euler+0x195>
mov    %ebp,%eax
cmp    $0x4,%ebp
jb     1150 <euler+0x40>
lea    (%r14,%rax,8),%rcx
cmp    %rbx,%rcx
jbe    11b9 <euler+0xa9>
lea    (%rbx,%rax,8),%rcx
cmp    %r14,%rcx
jbe    11b9 <euler+0xa9>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     1174 <euler+0x64>
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm6,%xmm0
addsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     12a5 <euler+0x195>
nopl   (%rax)
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm6,%xmm0
addsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
mulsd  %xmm6,%xmm0
addsd  0x8(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    1180 <euler+0x70>
jmp    12a5 <euler+0x195>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm6,%xmm0
unpcklpd %xmm6,%xmm0
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     12ae <euler+0x19e>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movupd (%r14,%rdx,8),%xmm1
movupd 0x10(%r14,%rdx,8),%xmm2
mulpd  %xmm0,%xmm1
movupd (%rbx,%rdx,8),%xmm3
addpd  %xmm1,%xmm3
movupd 0x10(%rbx,%rdx,8),%xmm1
movupd 0x20(%rbx,%rdx,8),%xmm4
movupd 0x30(%rbx,%rdx,8),%xmm5
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
movupd %xmm3,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
movupd 0x20(%r14,%rdx,8),%xmm1
movupd 0x30(%r14,%rdx,8),%xmm2
mulpd  %xmm0,%xmm1
addpd  %xmm4,%xmm1
mulpd  %xmm0,%xmm2
addpd  %xmm5,%xmm2
movupd %xmm1,0x20(%rbx,%rdx,8)
movupd %xmm2,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11f0 <euler+0xe0>
test   $0x1,%sil
je     129c <euler+0x18c>
movupd (%r14,%rdx,8),%xmm1
movupd 0x10(%r14,%rdx,8),%xmm2
movupd (%rbx,%rdx,8),%xmm3
movupd 0x10(%rbx,%rdx,8),%xmm4
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
mulpd  %xmm0,%xmm2
addpd  %xmm4,%xmm2
movupd %xmm1,(%rbx,%rdx,8)
movupd %xmm2,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
jne    1152 <euler+0x42>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1269 <euler+0x159>
jmp    129c <euler+0x18c>

LLVM IR (-O0):
define void @euler(double* %0, double* %1, i8* %2, i32 %3, double %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca i32
store double* %0, double** %7
store double* %1, double** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store double %4, double* %11
store double %5, double* %12
%14 = load double*, double** %7
%15 = load double*, double** %8
%16 = load i8*, i8** %9
%17 = load i32, i32* %10
%18 = load double, double* %11
%19 = call i32 @deriv(double* %14, double* %15, i8* %16, i32 %17, double %18)
store i32 0, i32* %13
br label %20
20: ; preds = %37, %6
%21 = load i32, i32* %13
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %40
24: ; preds = %20
%25 = load double, double* %12
%26 = load double*, double** %8
%27 = load i32, i32* %13
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %7
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %25, double %30, double %35)
store double %36, double* %34
br label %37
37: ; preds = %24
%38 = load i32, i32* %13
%39 = add nsw i32 %38, 1
store i32 %39, i32* %13
br label %20
40: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @euler(double* %0, double* %1, i8* %2, i32 %3, double %4, double %5) {
%7 = tail call i32 @deriv(double* %0, double* %1, i8* %2, i32 %3, double %4)
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %108
9: ; preds = %6
%10 = zext i32 %3 to i64
%11 = icmp ult i32 %3, 4
br i1 %11, label %92, label %12
12: ; preds = %9
%13 = getelementptr double, double* %0, i64 %10
%14 = getelementptr double, double* %1, i64 %10
%15 = icmp ugt double* %14, %0
%16 = icmp ugt double* %13, %1
%17 = and i1 %15, %16
br i1 %17, label %92, label %18
18: ; preds = %12
%19 = and i64 %10, 4294967292
%20 = insertelement <2 x double> poison, double %5, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %5, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = add nsw i64 %19, -4
%25 = lshr exact i64 %24, 2
%26 = add nuw nsw i64 %25, 1
%27 = and i64 %26, 1
%28 = icmp eq i64 %24, 0
br i1 %28, label %70, label %29
29: ; preds = %18
%30 = and i64 %26, 9223372036854775806
br label %31
31: ; preds = %31, %29
%32 = phi i64 [ 0, %29 ], [ %67, %31 ]
%33 = phi i64 [ 0, %29 ], [ %68, %31 ]
%34 = getelementptr inbounds double, double* %1, i64 %32
%35 = bitcast double* %34 to <2 x double>*
%36 = load <2 x double>, <2 x double>* %35
%37 = getelementptr inbounds double, double* %34, i64 2
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %0, i64 %32
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %40, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %36, <2 x double> %42)
%47 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %39, <2 x double> %45)
%48 = bitcast double* %40 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = bitcast double* %43 to <2 x double>*
store <2 x double> %47, <2 x double>* %49
%50 = or i64 %32, 4
%51 = getelementptr inbounds double, double* %1, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %51, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %0, i64 %50
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %53, <2 x double> %59)
%64 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %56, <2 x double> %62)
%65 = bitcast double* %57 to <2 x double>*
store <2 x double> %63, <2 x double>* %65
%66 = bitcast double* %60 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = add nuw i64 %32, 8
%68 = add i64 %33, 2
%69 = icmp eq i64 %68, %30
br i1 %69, label %70, label %31
70: ; preds = %31, %18
%71 = phi i64 [ 0, %18 ], [ %67, %31 ]
%72 = icmp eq i64 %27, 0
br i1 %72, label %90, label %73
73: ; preds = %70
%74 = getelementptr inbounds double, double* %1, i64 %71
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %74, i64 2
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %0, i64 %71
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = getelementptr inbounds double, double* %80, i64 2
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %76, <2 x double> %82)
%87 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %23, <2 x double> %79, <2 x double> %85)
%88 = bitcast double* %80 to <2 x double>*
store <2 x double> %86, <2 x double>* %88
%89 = bitcast double* %83 to <2 x double>*
store <2 x double> %87, <2 x double>* %89
br label %90
90: ; preds = %70, %73
%91 = icmp eq i64 %19, %10
br i1 %91, label %108, label %92
92: ; preds = %12, %9, %90
%93 = phi i64 [ 0, %12 ], [ 0, %9 ], [ %19, %90 ]
%94 = xor i64 %93, -1
%95 = and i64 %10, 1
%96 = icmp eq i64 %95, 0
br i1 %96, label %104, label %97
97: ; preds = %92
%98 = getelementptr inbounds double, double* %1, i64 %93
%99 = load double, double* %98
%100 = getelementptr inbounds double, double* %0, i64 %93
%101 = load double, double* %100
%102 = tail call double @llvm.fmuladd.f64(double %5, double %99, double %101)
store double %102, double* %100
%103 = or i64 %93, 1
br label %104
104: ; preds = %97, %92
%105 = phi i64 [ %93, %92 ], [ %103, %97 ]
%106 = sub nsw i64 0, %10
%107 = icmp eq i64 %94, %106
br i1 %107, label %108, label %109
108: ; preds = %104, %109, %90, %6
ret void
109: ; preds = %104, %109
%110 = phi i64 [ %122, %109 ], [ %105, %104 ]
%111 = getelementptr inbounds double, double* %1, i64 %110
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %0, i64 %110
%114 = load double, double* %113
%115 = tail call double @llvm.fmuladd.f64(double %5, double %112, double %114)
store double %115, double* %113
%116 = add nuw nsw i64 %110, 1
%117 = getelementptr inbounds double, double* %1, i64 %116
%118 = load double, double* %117
%119 = getelementptr inbounds double, double* %0, i64 %116
%120 = load double, double* %119
%121 = tail call double @llvm.fmuladd.f64(double %5, double %118, double %120)
store double %121, double* %119
%122 = add nuw nsw i64 %110, 2
%123 = icmp eq i64 %122, %10
br i1 %123, label %108, label %109
}