#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];
  emax = Params[3];
  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_previous - *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 = Adirissa[cp_j];
    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    0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
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  0xe10(%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    1386 <model_+0x266>
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    126a <model_+0x14a>
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    12f2 <model_+0x1d2>
mov    -0xa0(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    0x10(%rbp),%rdx
sub    (%rdx),%ecx
mov    %ecx,-0x40(%rbp)
mov    -0x44(%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    -0x34(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x30(%rbp),%rax
movslq -0x3c(%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    120f <model_+0xef>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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