#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 log(int);
double pow(double, 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, time_j, cp_j, time_previous, cp_previous, emax_i;
  double Ce[*TotalDataValues], ke0, thalf_effect, nHill, q, ec50, conc, emax,
      dt;
  ke0 = Params[0];
  nHill = Params[1];
  q = Params[2];
  thalf_effect = log(2) / ke0;
  Derived[0] = thalf_effect;
  ec50 = pow(10.0, q);
  Derived[1] = ec50;
  for (CurEntry = 0; CurEntry < *TotalDataValues; CurEntry++) {
    time_j = 2 * CurEntry;
    cp_j = 2 * CurEntry + 1;
    if (CurEntry == 0) {
      dt = Adirissa[time_j];
      Ce[CurEntry] = 0;
    } else {
      time_previous = time_j - *NoOfAdirissaCols;
      cp_previous = cp_j - *NoOfAdirissaCols;
      dt = Adirissa[time_j] - Adirissa[time_previous];
      Ce[CurEntry] = Ce[CurEntry - 1] +
                     dt * ke0 * (Adirissa[cp_previous] - Ce[CurEntry - 1]);
    }
    emax_i = CurEntry;
    conc = Ce[CurEntry];
    Signal[emax_i] = pow(conc, nHill) / (pow(ec50, nHill) + pow(conc, nHill));
  }
  return;
}


x86 assembly (clang, -O0):
<model_>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%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
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x78(%rbp),%xmm1
movsd  0xe21(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    1378 <model_+0x258>
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   $0x0,-0x34(%rbp)
jne    1259 <model_+0x139>
mov    -0xa0(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12e1 <model_+0x1c1>
mov    -0xa0(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    0x10(%rbp),%rdx
sub    (%rdx),%ecx
mov    %ecx,-0x40(%rbp)
mov    -0x3c(%rbp),%ecx
mov    0x10(%rbp),%rdx
sub    (%rdx),%ecx
mov    %ecx,-0x44(%rbp)
mov    0x30(%rbp),%rcx
movslq -0x38(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    0x30(%rbp),%rcx
movslq -0x40(%rbp),%rdx
subsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0x60(%rbp),%xmm0
mov    0x30(%rbp),%rcx
movslq -0x44(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm2
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa0(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %ecx,-0x48(%rbp)
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x70(%rbp),%xmm1
call   1040 <pow@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    0x38(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11fe <model_+0xde>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<model_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%r15
mov    0x88(%rsp),%rbx
mov    0x80(%rsp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
divsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0xe83(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  %xmm0,0x8(%rbx)
cmpl   $0x0,(%r15)
jle    12ca <model_+0x1aa>
mov    0x98(%rsp),%r14
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
addsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
cmpl   $0x2,(%r15)
jl     12ca <model_+0x1aa>
mov    0x90(%rsp),%r13
mov    0x70(%rsp),%r12
mov    $0x1,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    (%r12),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
lea    0x2(%rcx),%eax
add    $0x3,%ecx
movsd  0x10(%r13,%rbp,8),%xmm2
cltq
subsd  0x0(%r13,%rax,8),%xmm2
mulsd  0x30(%rsp),%xmm2
movslq %ecx,%rax
movsd  0x0(%r13,%rax,8),%xmm1
movsd  0x10(%rsp),%xmm0
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
addsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14,%rbp,4)
add    $0x1,%rbx
movslq (%r15),%rax
add    $0x2,%rbp
cmp    %rax,%rbx
jl     1220 <model_+0x100>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i8*
%32 = alloca i64
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
%40 = 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
%41 = load i32*, i32** %16
%42 = load i32, i32* %41
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
store i8* %44, i8** %31
%45 = alloca double, i64 %43
store i64 %43, i64* %32
%46 = load double*, double** %21
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
store double %48, double* %33
%49 = load double*, double** %21
%50 = getelementptr inbounds double, double* %49, i64 1
%51 = load double, double* %50
store double %51, double* %35
%52 = load double*, double** %21
%53 = getelementptr inbounds double, double* %52, i64 2
%54 = load double, double* %53
store double %54, double* %36
%55 = call double @log(i32 2)
%56 = load double, double* %33
%57 = fdiv double %55, %56
store double %57, double* %34
%58 = load double, double* %34
%59 = load double*, double** %22
%60 = getelementptr inbounds double, double* %59, i64 0
store double %58, double* %60
%61 = load double, double* %36
%62 = call double @pow(double 1.000000e+01, double %61)
store double %62, double* %37
%63 = load double, double* %37
%64 = load double*, double** %22
%65 = getelementptr inbounds double, double* %64, i64 1
store double %63, double* %65
store i32 0, i32* %25
br label %66
66: ; preds = %152, %12
%67 = load i32, i32* %25
%68 = load i32*, i32** %16
%69 = load i32, i32* %68
%70 = icmp slt i32 %67, %69
br i1 %70, label %71, label %155
71: ; preds = %66
%72 = load i32, i32* %25
%73 = mul nsw i32 2, %72
store i32 %73, i32* %26
%74 = load i32, i32* %25
%75 = mul nsw i32 2, %74
%76 = add nsw i32 %75, 1
store i32 %76, i32* %27
%77 = load i32, i32* %25
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %88
79: ; preds = %71
%80 = load double*, double** %23
%81 = load i32, i32* %26
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
store double %84, double* %40
%85 = load i32, i32* %25
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %45, i64 %86
store double 0.000000e+00, double* %87
br label %131
88: ; preds = %71
%89 = load i32, i32* %26
%90 = load i32*, i32** %19
%91 = load i32, i32* %90
%92 = sub nsw i32 %89, %91
store i32 %92, i32* %28
%93 = load i32, i32* %27
%94 = load i32*, i32** %19
%95 = load i32, i32* %94
%96 = sub nsw i32 %93, %95
store i32 %96, i32* %29
%97 = load double*, double** %23
%98 = load i32, i32* %26
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
%101 = load double, double* %100
%102 = load double*, double** %23
%103 = load i32, i32* %28
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
%106 = load double, double* %105
%107 = fsub double %101, %106
store double %107, double* %40
%108 = load i32, i32* %25
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %45, i64 %110
%112 = load double, double* %111
%113 = load double, double* %40
%114 = load double, double* %33
%115 = fmul double %113, %114
%116 = load double*, double** %23
%117 = load i32, i32* %29
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = load i32, i32* %25
%122 = sub nsw i32 %121, 1
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %45, i64 %123
%125 = load double, double* %124
%126 = fsub double %120, %125
%127 = call double @llvm.fmuladd.f64(double %115, double %126, double %112)
%128 = load i32, i32* %25
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %45, i64 %129
store double %127, double* %130
br label %131
131: ; preds = %88, %79
%132 = load i32, i32* %25
store i32 %132, i32* %30
%133 = load i32, i32* %25
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %45, i64 %134
%136 = load double, double* %135
store double %136, double* %38
%137 = load double, double* %38
%138 = load double, double* %35
%139 = call double @pow(double %137, double %138)
%140 = load double, double* %37
%141 = load double, double* %35
%142 = call double @pow(double %140, double %141)
%143 = load double, double* %38
%144 = load double, double* %35
%145 = call double @pow(double %143, double %144)
%146 = fadd double %142, %145
%147 = fdiv double %139, %146
%148 = load double*, double** %24
%149 = load i32, i32* %30
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %148, i64 %150
store double %147, double* %151
br label %152
152: ; preds = %131
%153 = load i32, i32* %25
%154 = add nsw i32 %153, 1
store i32 %154, i32* %25
br label %66
155: ; preds = %66
%156 = load i8*, i8** %31
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 %6, i32* nocapture readnone %7, double* nocapture %8, double* nocapture writeonly %9, double* nocapture %10, double* nocapture writeonly %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 = tail call double @log(i32 2)
%19 = fdiv double %18, %13
store double %19, double* %9
%20 = tail call double @pow(double 1.000000e+01, double %17)
%21 = getelementptr inbounds double, double* %9, i64 1
store double %20, double* %21
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %64
24: ; preds = %12
%25 = tail call double @pow(double 0.000000e+00, double %15)
%26 = tail call double @pow(double %20, double %15)
%27 = tail call double @pow(double 0.000000e+00, double %15)
%28 = fadd double %26, %27
%29 = fdiv double %25, %28
store double %29, double* %11
%30 = load i32, i32* %3
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %64
32: ; preds = %24, %32
%33 = phi double [ %53, %32 ], [ 0.000000e+00, %24 ]
%34 = phi i64 [ %60, %32 ], [ 1, %24 ]
%35 = shl nuw nsw i64 %34, 1
%36 = load i32, i32* %6
%37 = trunc i64 %35 to i32
%38 = sub nsw i32 %37, %36
%39 = trunc i64 %35 to i32
%40 = or i32 %39, 1
%41 = sub i32 %40, %36
%42 = getelementptr inbounds double, double* %10, i64 %35
%43 = load double, double* %42
%44 = sext i32 %38 to i64
%45 = getelementptr inbounds double, double* %10, i64 %44
%46 = load double, double* %45
%47 = fsub double %43, %46
%48 = fmul double %13, %47
%49 = sext i32 %41 to i64
%50 = getelementptr inbounds double, double* %10, i64 %49
%51 = load double, double* %50
%52 = fsub double %51, %33
%53 = tail call double @llvm.fmuladd.f64(double %48, double %52, double %33)
%54 = tail call double @pow(double %53, double %15)
%55 = tail call double @pow(double %20, double %15)
%56 = tail call double @pow(double %53, double %15)
%57 = fadd double %55, %56
%58 = fdiv double %54, %57
%59 = getelementptr inbounds double, double* %11, i64 %34
store double %58, double* %59
%60 = add nuw nsw i64 %34, 1
%61 = load i32, i32* %3
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %60, %62
br i1 %63, label %32, label %64
64: ; preds = %32, %24, %12
ret void
}