#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 exp(double);
void osborne(double *p, double *x, int m, int n, void *data) {
  register int i;
  double t;
  for (i = 0; i < n; ++i) {
    t = 10 * i;
    x[i] = p[0] + p[1] * exp(-p[3] * t) + p[2] * exp(-p[4] * t);
  }
}


x86 assembly (clang, -O0):
<osborne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1211 <osborne+0x101>
imul   $0xa,-0x24(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <osborne+0x21>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osborne>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %ecx,%ecx
jle    11d5 <osborne+0xc5>
mov    %rsi,%r12
mov    %rdi,%r14
mov    %ecx,%eax
add    %rax,%rax
lea    (%rax,%rax,4),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  (%r14),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%r14),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%r14),%xmm0
movapd 0xe8f(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%r14),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x20(%r14),%xmm0
xorpd  0xe58(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r12)
add    $0xa,%rbx
add    $0x8,%r12
cmp    %rbx,%r15
jne    1140 <osborne+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @osborne(double* %0, double* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i32 0, i32* %11
br label %13
13: ; preds = %50, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %9
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %53
17: ; preds = %13
%18 = load i32, i32* %11
%19 = mul nsw i32 10, %18
%20 = sitofp i32 %19 to double
store double %20, double* %12
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 3
%29 = load double, double* %28
%30 = fneg double %29
%31 = load double, double* %12
%32 = fmul double %30, %31
%33 = call double @exp(double %32)
%34 = call double @llvm.fmuladd.f64(double %26, double %33, double %23)
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 4
%40 = load double, double* %39
%41 = fneg double %40
%42 = load double, double* %12
%43 = fmul double %41, %42
%44 = call double @exp(double %43)
%45 = call double @llvm.fmuladd.f64(double %37, double %44, double %34)
%46 = load double*, double** %7
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double %45, double* %49
br label %50
50: ; preds = %17
%51 = load i32, i32* %11
%52 = add nsw i32 %51, 1
store i32 %52, i32* %11
br label %13
53: ; preds = %13
ret void
}

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