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


x86 assembly (clang, -O0):
<jacosborne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1296 <jacosborne+0x186>
imul   $0xa,-0x24(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%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  %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  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  0xe37(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1138 <jacosborne+0x28>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jacosborne>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %ecx,%ecx
jle    11e9 <jacosborne+0xd9>
mov    %ecx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movabs $0x3ff0000000000000,%r12
nopl   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
movsd  %xmm2,(%rsp)
movsd  0x18(%r15),%xmm0
movapd 0xea6(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%r15),%xmm0
xorpd  0xe85(%rip),%xmm0
mulsd  (%rsp),%xmm0
call   1030 <exp@plt>
mov    %r12,(%r14,%rbx,4)
movsd  0x8(%rsp),%xmm4
movsd  %xmm4,0x8(%r14,%rbx,4)
movsd  %xmm0,0x10(%r14,%rbx,4)
movsd  0x8(%r15),%xmm1
movapd 0xe55(%rip),%xmm3
xorpd  %xmm3,%xmm1
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm4,%xmm1
movsd  %xmm1,0x18(%r14,%rbx,4)
movsd  0x10(%r15),%xmm1
xorpd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%r14,%rbx,4)
add    $0xa,%rbx
add    $0xffffffff,%ebp
jne    1140 <jacosborne+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @jacosborne(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 i32
%13 = alloca double
%14 = alloca double
%15 = 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* %12
store i32 0, i32* %11
br label %16
16: ; preds = %81, %5
%17 = load i32, i32* %11
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %84
20: ; preds = %16
%21 = load i32, i32* %11
%22 = mul nsw i32 10, %21
%23 = sitofp i32 %22 to double
store double %23, double* %13
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 3
%26 = load double, double* %25
%27 = fneg double %26
%28 = load double, double* %13
%29 = fmul double %27, %28
%30 = call double @exp(double %29)
store double %30, double* %14
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 4
%33 = load double, double* %32
%34 = fneg double %33
%35 = load double, double* %13
%36 = fmul double %34, %35
%37 = call double @exp(double %36)
store double %37, double* %15
%38 = load double*, double** %7
%39 = load i32, i32* %12
%40 = add nsw i32 %39, 1
store i32 %40, i32* %12
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds double, double* %38, i64 %41
store double 1.000000e+00, double* %42
%43 = load double, double* %14
%44 = load double*, double** %7
%45 = load i32, i32* %12
%46 = add nsw i32 %45, 1
store i32 %46, i32* %12
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds double, double* %44, i64 %47
store double %43, double* %48
%49 = load double, double* %15
%50 = load double*, double** %7
%51 = load i32, i32* %12
%52 = add nsw i32 %51, 1
store i32 %52, i32* %12
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds double, double* %50, i64 %53
store double %49, double* %54
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 1
%57 = load double, double* %56
%58 = fneg double %57
%59 = load double, double* %13
%60 = fmul double %58, %59
%61 = load double, double* %14
%62 = fmul double %60, %61
%63 = load double*, double** %7
%64 = load i32, i32* %12
%65 = add nsw i32 %64, 1
store i32 %65, i32* %12
%66 = sext i32 %64 to i64
%67 = getelementptr inbounds double, double* %63, i64 %66
store double %62, double* %67
%68 = load double*, double** %6
%69 = getelementptr inbounds double, double* %68, i64 2
%70 = load double, double* %69
%71 = fneg double %70
%72 = load double, double* %13
%73 = fmul double %71, %72
%74 = load double, double* %15
%75 = fmul double %73, %74
%76 = load double*, double** %7
%77 = load i32, i32* %12
%78 = add nsw i32 %77, 1
store i32 %78, i32* %12
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds double, double* %76, i64 %79
store double %75, double* %80
br label %81
81: ; preds = %20
%82 = load i32, i32* %11
%83 = add nsw i32 %82, 1
store i32 %83, i32* %11
br label %16
84: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @jacosborne(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 %45
7: ; preds = %5
%8 = getelementptr inbounds double, double* %0, i64 3
%9 = getelementptr inbounds double, double* %0, i64 4
%10 = getelementptr inbounds double, double* %0, i64 1
%11 = getelementptr inbounds double, double* %0, i64 2
br label %12
12: ; preds = %7, %12
%13 = phi i64 [ 0, %7 ], [ %41, %12 ]
%14 = phi i32 [ 0, %7 ], [ %43, %12 ]
%15 = mul nuw nsw i32 %14, 10
%16 = sitofp i32 %15 to double
%17 = load double, double* %8
%18 = fneg double %17
%19 = fmul double %16, %18
%20 = tail call double @exp(double %19)
%21 = load double, double* %9
%22 = fneg double %21
%23 = fmul double %16, %22
%24 = tail call double @exp(double %23)
%25 = add nuw nsw i64 %13, 1
%26 = getelementptr inbounds double, double* %1, i64 %13
store double 1.000000e+00, double* %26
%27 = add nuw nsw i64 %13, 2
%28 = getelementptr inbounds double, double* %1, i64 %25
store double %20, double* %28
%29 = add nuw nsw i64 %13, 3
%30 = getelementptr inbounds double, double* %1, i64 %27
store double %24, double* %30
%31 = load double, double* %10
%32 = fneg double %31
%33 = fmul double %16, %32
%34 = fmul double %20, %33
%35 = add nuw nsw i64 %13, 4
%36 = getelementptr inbounds double, double* %1, i64 %29
store double %34, double* %36
%37 = load double, double* %11
%38 = fneg double %37
%39 = fmul double %16, %38
%40 = fmul double %24, %39
%41 = add nuw nsw i64 %13, 5
%42 = getelementptr inbounds double, double* %1, i64 %35
store double %40, double* %42
%43 = add nuw nsw i32 %14, 1
%44 = icmp eq i32 %43, %3
br i1 %44, label %45, label %12
45: ; preds = %12, %5
ret void
}