#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 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 T, R, K2sum, K2diff, K2, k2a, v, gamma, tau, dt, DVR;
  T = Params[0];
  R = Params[1];
  K2 = Params[2];
  k2a = Params[3];
  gamma = Params[4];
  tau = Params[5];
  DVR = K2 / k2a;
  Derived[0] = DVR;
  for (CurEntry = 0; CurEntry < *TotalDataValues; CurEntry++) {
    tindex = 2 * CurEntry;
    cindex = 2 * CurEntry + 1;
    if (Adirissa[tindex] > T) {
      v = 1.0;
    } else {
      v = 0.0;
    }
    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 + gamma * v * exp(-tau * (Adirissa[tindex] - T)));
    }
  }
  return;
}


x86 assembly (clang, -O0):
<model_>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
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,-0x68(%rbp)
mov    0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x20(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    0x20(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    13dc <model_+0x2cc>
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)
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1218 <model_+0x108>
movsd  0xdf2(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1220 <model_+0x110>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    1263 <model_+0x153>
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%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    13c9 <model_+0x2b9>
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,-0x90(%rbp)
ff
mov    0x38(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x50(%rbp),%xmm1
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,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
mov    0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
mov    0x38(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0xb8(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm4
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm4,%xmm2
addsd  %xmm3,%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    13ce <model_+0x2be>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ca <model_+0xba>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<model_>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rcx,%r15
mov    0xa8(%rsp),%rax
mov    0xa0(%rsp),%rcx
movsd  (%rcx),%xmm4
movsd  0x8(%rcx),%xmm8
movsd  0x10(%rcx),%xmm9
movsd  0x18(%rcx),%xmm1
movsd  0x20(%rcx),%xmm10
movsd  0x28(%rcx),%xmm7
movapd %xmm9,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x0,(%r15)
jle    12ba <model_+0x1aa>
mov    0xb8(%rsp),%r14
mov    0xb0(%rsp),%r12
movsd  0x8(%r12),%xmm0
mulsd  %xmm8,%xmm0
movsd  %xmm0,(%r14)
cmpl   $0x2,(%r15)
jl     12ba <model_+0x1aa>
xorpd  0xe68(%rip),%xmm7
add    $0x18,%r12
mov    $0x1,%ebx
movsd  %xmm4,0x20(%rsp)
movsd  %xmm8,0x18(%rsp)
movsd  %xmm9,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm10,(%rsp)
movapd %xmm7,0x40(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  -0x10(%r12),%xmm1
movsd  -0x8(%r12),%xmm0
movapd %xmm4,%xmm3
cmpltsd %xmm0,%xmm3
movapd %xmm0,%xmm2
subsd  -0x18(%r12),%xmm2
movapd %xmm2,%xmm5
movsd  %xmm2,0x30(%rsp)
movsd  0xe0c(%rip),%xmm2
andpd  %xmm2,%xmm3
movsd  -0x8(%r14,%rbx,8),%xmm6
movsd  %xmm6,0x38(%rsp)
movsd  (%r12),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm8,%xmm2
addsd  %xmm6,%xmm2
mulsd  %xmm5,%xmm9
mulsd  %xmm1,%xmm9
addsd  %xmm2,%xmm9
movsd  %xmm9,0x28(%rsp)
mulsd  %xmm10,%xmm3
movapd %xmm3,0x50(%rsp)
subsd  %xmm4,%xmm0
mulsd  %xmm7,%xmm0
call   1030 <exp@plt>
movapd 0x40(%rsp),%xmm7
movsd  (%rsp),%xmm10
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm9
movsd  0x18(%rsp),%xmm8
movsd  0x20(%rsp),%xmm4
mulsd  0x50(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  0x30(%rsp),%xmm2
mulsd  0x38(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x28(%rsp),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
movslq (%r15),%rax
add    $0x10,%r12
cmp    %rax,%rbx
jl     11d0 <model_+0xc0>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = 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
%39 = load double*, double** %21
%40 = getelementptr inbounds double, double* %39, i64 0
%41 = load double, double* %40
store double %41, double* %28
%42 = load double*, double** %21
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double, double* %43
store double %44, double* %29
%45 = load double*, double** %21
%46 = getelementptr inbounds double, double* %45, i64 2
%47 = load double, double* %46
store double %47, double* %32
%48 = load double*, double** %21
%49 = getelementptr inbounds double, double* %48, i64 3
%50 = load double, double* %49
store double %50, double* %33
%51 = load double*, double** %21
%52 = getelementptr inbounds double, double* %51, i64 4
%53 = load double, double* %52
store double %53, double* %35
%54 = load double*, double** %21
%55 = getelementptr inbounds double, double* %54, i64 5
%56 = load double, double* %55
store double %56, double* %36
%57 = load double, double* %32
%58 = load double, double* %33
%59 = fdiv double %57, %58
store double %59, double* %38
%60 = load double, double* %38
%61 = load double*, double** %22
%62 = getelementptr inbounds double, double* %61, i64 0
store double %60, double* %62
store i32 0, i32* %25
br label %63
63: ; preds = %177, %12
%64 = load i32, i32* %25
%65 = load i32*, i32** %16
%66 = load i32, i32* %65
%67 = icmp slt i32 %64, %66
br i1 %67, label %68, label %180
68: ; preds = %63
%69 = load i32, i32* %25
%70 = mul nsw i32 2, %69
store i32 %70, i32* %26
%71 = load i32, i32* %25
%72 = mul nsw i32 2, %71
%73 = add nsw i32 %72, 1
store i32 %73, i32* %27
%74 = load double*, double** %23
%75 = load i32, i32* %26
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %74, i64 %76
%78 = load double, double* %77
%79 = load double, double* %28
%80 = fcmp ogt double %78, %79
br i1 %80, label %81, label %82
81: ; preds = %68
store double 1.000000e+00, double* %34
br label %83
82: ; preds = %68
store double 0.000000e+00, double* %34
br label %83
83: ; preds = %82, %81
%84 = load i32, i32* %25
%85 = icmp slt i32 %84, 1
br i1 %85, label %86, label %103
86: ; preds = %83
%87 = load double*, double** %23
%88 = load i32, i32* %26
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
%91 = load double, double* %90
store double %91, double* %37
%92 = load double, double* %29
%93 = load double*, double** %23
%94 = load i32, i32* %27
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = fmul double %92, %97
%99 = load double*, double** %24
%100 = load i32, i32* %25
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
store double %98, double* %102
br label %176
103: ; preds = %83
%104 = load double*, double** %23
%105 = load i32, i32* %26
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = load double*, double** %23
%110 = load i32, i32* %26
%111 = sub nsw i32 %110, 2
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %109, i64 %112
%114 = load double, double* %113
%115 = fsub double %108, %114
store double %115, double* %37
%116 = load double*, double** %24
%117 = load i32, i32* %25
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %116, i64 %119
%121 = load double, double* %120
%122 = load double, double* %29
%123 = load double*, double** %23
%124 = load i32, i32* %27
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = load double*, double** %23
%129 = load i32, i32* %27
%130 = sub nsw i32 %129, 2
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %128, i64 %131
%133 = load double, double* %132
%134 = fsub double %127, %133
%135 = call double @llvm.fmuladd.f64(double %122, double %134, double %121)
%136 = load double, double* %32
%137 = load double, double* %37
%138 = fmul double %136, %137
%139 = load double*, double** %23
%140 = load i32, i32* %27
%141 = sub nsw i32 %140, 2
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %139, i64 %142
%144 = load double, double* %143
%145 = call double @llvm.fmuladd.f64(double %138, double %144, double %135)
%146 = load double, double* %37
%147 = load double*, double** %24
%148 = load i32, i32* %25
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %147, i64 %150
%152 = load double, double* %151
%153 = fmul double %146, %152
%154 = load double, double* %33
%155 = load double, double* %35
%156 = load double, double* %34
%157 = fmul double %155, %156
%158 = load double, double* %36
%159 = fneg double %158
%160 = load double*, double** %23
%161 = load i32, i32* %26
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %160, i64 %162
%164 = load double, double* %163
%165 = load double, double* %28
%166 = fsub double %164, %165
%167 = fmul double %159, %166
%168 = call double @exp(double %167)
%169 = call double @llvm.fmuladd.f64(double %157, double %168, double %154)
%170 = fneg double %153
%171 = call double @llvm.fmuladd.f64(double %170, double %169, double %145)
%172 = load double*, double** %24
%173 = load i32, i32* %25
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
store double %171, double* %175
br label %176
176: ; preds = %103, %86
br label %177
177: ; preds = %176
%178 = load i32, i32* %25
%179 = add nsw i32 %178, 1
store i32 %179, i32* %25
br label %63
180: ; preds = %63
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 = getelementptr inbounds double, double* %8, i64 3
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %8, i64 4
%21 = load double, double* %20
%22 = getelementptr inbounds double, double* %8, i64 5
%23 = load double, double* %22
%24 = fdiv double %17, %19
store double %24, double* %9
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %72
27: ; preds = %12
%28 = fneg double %23
%29 = getelementptr inbounds double, double* %10, i64 1
%30 = load double, double* %29
%31 = fmul double %15, %30
store double %31, double* %11
%32 = load i32, i32* %3
%33 = icmp sgt i32 %32, 1
br i1 %33, label %34, label %72
34: ; preds = %27, %34
%35 = phi i64 [ %68, %34 ], [ 1, %27 ]
%36 = shl nuw nsw i64 %35, 1
%37 = getelementptr inbounds double, double* %10, i64 %36
%38 = load double, double* %37
%39 = or i64 %36, 1
%40 = fcmp ogt double %38, %13
%41 = select i1 %40, double 1.000000e+00, double 0.000000e+00
%42 = add nsw i64 %36, -2
%43 = getelementptr inbounds double, double* %10, i64 %42
%44 = load double, double* %43
%45 = fsub double %38, %44
%46 = add nuw i64 %35, 4294967295
%47 = and i64 %46, 4294967295
%48 = getelementptr inbounds double, double* %11, i64 %47
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %10, i64 %39
%51 = load double, double* %50
%52 = add nsw i64 %36, -1
%53 = getelementptr inbounds double, double* %10, i64 %52
%54 = load double, double* %53
%55 = fsub double %51, %54
%56 = tail call double @llvm.fmuladd.f64(double %15, double %55, double %49)
%57 = fmul double %17, %45
%58 = tail call double @llvm.fmuladd.f64(double %57, double %54, double %56)
%59 = fmul double %21, %41
%60 = fsub double %38, %13
%61 = fmul double %60, %28
%62 = tail call double @exp(double %61)
%63 = tail call double @llvm.fmuladd.f64(double %59, double %62, double %19)
%64 = fneg double %45
%65 = fmul double %49, %64
%66 = tail call double @llvm.fmuladd.f64(double %65, double %63, double %58)
%67 = getelementptr inbounds double, double* %11, i64 %35
store double %66, double* %67
%68 = add nuw nsw i64 %35, 1
%69 = load i32, i32* %3
%70 = sext i32 %69 to i64
%71 = icmp slt i64 %68, %70
br i1 %71, label %34, label %72
72: ; preds = %34, %27, %12
ret void
}