void model_(int *CurSet, int *NoOfParams, int *NoOfDerived,
            int *TotalDataValues, int *MaxNoOfDataValues, int *NoOfDataCols,
            int *NoOfAdirissaCols, int *NoOfModelVectors, double Params[],
            double Derived[], double Adirissa[], double Signal[]) {
  int CurEntry, tindex, cindex;
  double R, K2, k2a, dt, DVR;
  R = Params[0];
  K2 = Params[1];
  k2a = Params[2];
  DVR = K2 / k2a;
  Derived[0] = DVR;
  for (CurEntry = 0; CurEntry < *TotalDataValues; CurEntry++) {
    tindex = 2 * CurEntry;
    cindex = 2 * CurEntry + 1;
    if (CurEntry < 1) {
      dt = Adirissa[tindex];
      Signal[CurEntry] = R * (Adirissa[cindex]);
    } else {
      dt = Adirissa[tindex] - Adirissa[tindex - 2];
      Signal[CurEntry] =
          Signal[CurEntry - 1] + R * (Adirissa[cindex] - Adirissa[cindex - 2]) +
          K2 * dt * Adirissa[cindex - 2] - dt * Signal[CurEntry - 1] * k2a;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<model_>:
push   %rbp
mov    %rsp,%rbp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    12c5 <model_+0x1c5>
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    11e4 <model_+0xe4>
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x38(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12b2 <model_+0x1b2>
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x30(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x38(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x48(%rbp),%xmm0
mov    0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
mov    0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mov    0x38(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x58(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x38(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12b7 <model_+0x1b7>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1180 <model_+0x80>
pop    %rbp
ret

x86 assembly (clang, -O2):
<model_>:
mov    0x20(%rsp),%rax
mov    0x18(%rsp),%rdx
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
movsd  0x10(%rdx),%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rax)
mov    (%rcx),%eax
test   %eax,%eax
jle    11dd <model_+0xdd>
mov    0x30(%rsp),%r8
mov    0x28(%rsp),%r10
movsd  0x8(%r10),%xmm3
mulsd  %xmm0,%xmm3
movsd  %xmm3,(%r8)
cmp    $0x1,%eax
je     11dd <model_+0xdd>
movabs $0x100000000,%r11
lea    0x18(%r10),%rdi
add    $0xffffffffffffffff,%rax
xor    %ecx,%ecx
movabs $0x200000000,%r9
xor    %esi,%esi
mov    %rsi,%rdx
sar    $0x1d,%rdx
movsd  -0x8(%rdi),%xmm3
subsd  (%r10,%rdx,1),%xmm3
movsd  (%rdi),%xmm4
lea    (%rcx,%r11,1),%edx
movsd  (%r8,%rdx,8),%xmm5
lea    (%rsi,%r11,1),%rdx
sar    $0x1d,%rdx
movsd  (%r10,%rdx,1),%xmm6
subsd  %xmm6,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm5,%xmm4
movapd %xmm1,%xmm7
mulsd  %xmm3,%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm5,%xmm3
mulsd  %xmm2,%xmm3
subsd  %xmm3,%xmm7
movsd  %xmm7,0x8(%r8,%rcx,8)
add    %r9,%rsi
add    $0x1,%rcx
add    $0x10,%rdi
cmp    %rcx,%rax
jne    1170 <model_+0x70>
ret

LLVM IR (-O0):
define void @model_(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, double* %8, double* %9, double* %10, double* %11) {
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
store i32* %0, i32** %13
store i32* %1, i32** %14
store i32* %2, i32** %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32* %6, i32** %19
store i32* %7, i32** %20
store double* %8, double** %21
store double* %9, double** %22
store double* %10, double** %23
store double* %11, double** %24
%33 = load double*, double** %21
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
store double %35, double* %28
%36 = load double*, double** %21
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
store double %38, double* %29
%39 = load double*, double** %21
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
store double %41, double* %30
%42 = load double, double* %29
%43 = load double, double* %30
%44 = fdiv double %42, %43
store double %44, double* %32
%45 = load double, double* %32
%46 = load double*, double** %22
%47 = getelementptr inbounds double, double* %46, i64 0
store double %45, double* %47
store i32 0, i32* %25
br label %48
48: ; preds = %137, %12
%49 = load i32, i32* %25
%50 = load i32*, i32** %16
%51 = load i32, i32* %50
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %140
53: ; preds = %48
%54 = load i32, i32* %25
%55 = mul nsw i32 2, %54
store i32 %55, i32* %26
%56 = load i32, i32* %25
%57 = mul nsw i32 2, %56
%58 = add nsw i32 %57, 1
store i32 %58, i32* %27
%59 = load i32, i32* %25
%60 = icmp slt i32 %59, 1
br i1 %60, label %61, label %78
61: ; preds = %53
%62 = load double*, double** %23
%63 = load i32, i32* %26
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
%66 = load double, double* %65
store double %66, double* %31
%67 = load double, double* %28
%68 = load double*, double** %23
%69 = load i32, i32* %27
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
%72 = load double, double* %71
%73 = fmul double %67, %72
%74 = load double*, double** %24
%75 = load i32, i32* %25
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %74, i64 %76
store double %73, double* %77
br label %136
78: ; preds = %53
%79 = load double*, double** %23
%80 = load i32, i32* %26
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
%83 = load double, double* %82
%84 = load double*, double** %23
%85 = load i32, i32* %26
%86 = sub nsw i32 %85, 2
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %84, i64 %87
%89 = load double, double* %88
%90 = fsub double %83, %89
store double %90, double* %31
%91 = load double*, double** %24
%92 = load i32, i32* %25
%93 = sub nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %91, i64 %94
%96 = load double, double* %95
%97 = load double, double* %28
%98 = load double*, double** %23
%99 = load i32, i32* %27
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = load double*, double** %23
%104 = load i32, i32* %27
%105 = sub nsw i32 %104, 2
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %103, i64 %106
%108 = load double, double* %107
%109 = fsub double %102, %108
%110 = call double @llvm.fmuladd.f64(double %97, double %109, double %96)
%111 = load double, double* %29
%112 = load double, double* %31
%113 = fmul double %111, %112
%114 = load double*, double** %23
%115 = load i32, i32* %27
%116 = sub nsw i32 %115, 2
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %114, i64 %117
%119 = load double, double* %118
%120 = call double @llvm.fmuladd.f64(double %113, double %119, double %110)
%121 = load double, double* %31
%122 = load double*, double** %24
%123 = load i32, i32* %25
%124 = sub nsw i32 %123, 1
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %122, i64 %125
%127 = load double, double* %126
%128 = fmul double %121, %127
%129 = load double, double* %30
%130 = fneg double %128
%131 = call double @llvm.fmuladd.f64(double %130, double %129, double %120)
%132 = load double*, double** %24
%133 = load i32, i32* %25
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %132, i64 %134
store double %131, double* %135
br label %136
136: ; preds = %78, %61
br label %137
137: ; preds = %136
%138 = load i32, i32* %25
%139 = add nsw i32 %138, 1
store i32 %139, i32* %25
br label %48
140: ; preds = %48
ret void
}

LLVM IR (-O2):
define void @model_(i32* nocapture readnone %0, i32* nocapture readnone %1, i32* nocapture readnone %2, i32* nocapture %3, i32* nocapture readnone %4, i32* nocapture readnone %5, i32* nocapture readnone %6, i32* nocapture readnone %7, double* nocapture %8, double* nocapture writeonly %9, double* nocapture %10, double* nocapture %11) {
%13 = load double, double* %8
%14 = getelementptr inbounds double, double* %8, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %8, i64 2
%17 = load double, double* %16
%18 = fdiv double %15, %17
store double %18, double* %9
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %60
21: ; preds = %12
%22 = zext i32 %19 to i64
%23 = getelementptr inbounds double, double* %10, i64 1
%24 = load double, double* %23
%25 = fmul double %13, %24
store double %25, double* %11
%26 = icmp eq i32 %19, 1
br i1 %26, label %60, label %27
27: ; preds = %21, %27
%28 = phi i64 [ %58, %27 ], [ 1, %21 ]
%29 = shl nuw nsw i64 %28, 1
%30 = or i64 %29, 1
%31 = getelementptr inbounds double, double* %10, i64 %29
%32 = load double, double* %31
%33 = shl i64 %28, 33
%34 = add i64 %33, -8589934592
%35 = ashr exact i64 %34, 32
%36 = getelementptr inbounds double, double* %10, i64 %35
%37 = load double, double* %36
%38 = fsub double %32, %37
%39 = add nuw i64 %28, 4294967295
%40 = and i64 %39, 4294967295
%41 = getelementptr inbounds double, double* %11, i64 %40
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %10, i64 %30
%44 = load double, double* %43
%45 = shl i64 %28, 33
%46 = add i64 %45, -4294967296
%47 = ashr exact i64 %46, 32
%48 = getelementptr inbounds double, double* %10, i64 %47
%49 = load double, double* %48
%50 = fsub double %44, %49
%51 = tail call double @llvm.fmuladd.f64(double %13, double %50, double %42)
%52 = fmul double %15, %38
%53 = tail call double @llvm.fmuladd.f64(double %52, double %49, double %51)
%54 = fneg double %38
%55 = fmul double %42, %54
%56 = tail call double @llvm.fmuladd.f64(double %55, double %17, double %53)
%57 = getelementptr inbounds double, double* %11, i64 %28
store double %56, double* %57
%58 = add nuw nsw i64 %28, 1
%59 = icmp eq i64 %58, %22
br i1 %59, label %60, label %27
60: ; preds = %27, %21, %12
ret void
}