#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*/ myfunc(double, double, double, double *, double *, double *);
void euler(double dt, double *x, double *y, double *z) {
  double x1, x2, y1, y2, z1, z2;
  myfunc(*x, *y, *z, &x1, &y1, &z1);
  myfunc(dt * x1 + *x, dt * y1 + *y, dt * z1 + *z, &x2, &y2, &z2);
  *x += 0.5 * dt * (x1 + x2);
  *y += 0.5 * dt * (y1 + y2);
  *z += 0.5 * dt * (z1 + z2);
}


x86 assembly (clang, -O0):
<euler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
lea    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   1030 <myfunc@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm3
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm4
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1030 <myfunc@plt>
movsd  0xe47(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
addsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  0xe1c(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
addsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  0xdf1(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
addsd  -0x50(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<euler>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  (%rdx),%xmm2
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <myfunc@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm3
mulsd  %xmm3,%xmm0
addsd  (%rbx),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm3,%xmm1
addsd  (%r15),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm3,%xmm2
addsd  (%r14),%xmm2
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
call   1030 <myfunc@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe64(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
movsd  0x10(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  (%r14),%xmm0
movsd  %xmm0,(%r14)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @euler(double %0, double* %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%15 = load double*, double** %6
%16 = load double, double* %15
%17 = load double*, double** %7
%18 = load double, double* %17
%19 = load double*, double** %8
%20 = load double, double* %19
%21 = call i32 @myfunc(double %16, double %18, double %20, double* %9, double* %11, double* %13)
%22 = load double, double* %5
%23 = load double, double* %9
%24 = load double*, double** %6
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double %22, double %23, double %25)
%27 = load double, double* %5
%28 = load double, double* %11
%29 = load double*, double** %7
%30 = load double, double* %29
%31 = call double @llvm.fmuladd.f64(double %27, double %28, double %30)
%32 = load double, double* %5
%33 = load double, double* %13
%34 = load double*, double** %8
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %32, double %33, double %35)
%37 = call i32 @myfunc(double %26, double %31, double %36, double* %10, double* %12, double* %14)
%38 = load double, double* %5
%39 = fmul double 5.000000e-01, %38
%40 = load double, double* %9
%41 = load double, double* %10
%42 = fadd double %40, %41
%43 = load double*, double** %6
%44 = load double, double* %43
%45 = call double @llvm.fmuladd.f64(double %39, double %42, double %44)
store double %45, double* %43
%46 = load double, double* %5
%47 = fmul double 5.000000e-01, %46
%48 = load double, double* %11
%49 = load double, double* %12
%50 = fadd double %48, %49
%51 = load double*, double** %7
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %47, double %50, double %52)
store double %53, double* %51
%54 = load double, double* %5
%55 = fmul double 5.000000e-01, %54
%56 = load double, double* %13
%57 = load double, double* %14
%58 = fadd double %56, %57
%59 = load double*, double** %8
%60 = load double, double* %59
%61 = call double @llvm.fmuladd.f64(double %55, double %58, double %60)
store double %61, double* %59
ret void
}

LLVM IR (-O2):
define void @euler(double %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = bitcast double* %8 to i8*
%15 = bitcast double* %9 to i8*
%16 = bitcast double* %10 to i8*
%17 = load double, double* %1
%18 = load double, double* %2
%19 = load double, double* %3
%20 = call i32 @myfunc(double %17, double %18, double %19, double* %5, double* %7, double* %9)
%21 = load double, double* %5
%22 = load double, double* %1
%23 = call double @llvm.fmuladd.f64(double %0, double %21, double %22)
%24 = load double, double* %7
%25 = load double, double* %2
%26 = call double @llvm.fmuladd.f64(double %0, double %24, double %25)
%27 = load double, double* %9
%28 = load double, double* %3
%29 = call double @llvm.fmuladd.f64(double %0, double %27, double %28)
%30 = call i32 @myfunc(double %23, double %26, double %29, double* %6, double* %8, double* %10)
%31 = fmul double %0, 5.000000e-01
%32 = load double, double* %5
%33 = load double, double* %6
%34 = fadd double %32, %33
%35 = load double, double* %1
%36 = call double @llvm.fmuladd.f64(double %31, double %34, double %35)
store double %36, double* %1
%37 = load double, double* %7
%38 = load double, double* %8
%39 = fadd double %37, %38
%40 = load double, double* %2
%41 = call double @llvm.fmuladd.f64(double %31, double %39, double %40)
store double %41, double* %2
%42 = load double, double* %9
%43 = load double, double* %10
%44 = fadd double %42, %43
%45 = load double, double* %3
%46 = call double @llvm.fmuladd.f64(double %31, double %44, double %45)
store double %46, double* %3
ret void
}