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


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

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

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

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