#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 */
typedef int time_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ amoeba(float **, float *, int, float, int *, char *,
                          int /*<<< orphan*/ *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ quick(float *, float **, int, int);
float ran2(long *);
float **set_param_limits(int);
float solve_model(float *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int time(int *);
main(int argc, char *argv[]) {
  FILE *fopti;
  float **p, *y, ftol, **tmpp, *tmpy;
  unsigned int tmpnum;
  int Ninit, init, ndim, i, j, iter, try, Ntry, param;
  char runstr[512];
  char runoptstr[512];
  time_t currtime, tmptime;
  float **param_lim;
  long *ran2seed;
  if (argc != 4) {
    fprintf(stderr,
            "Usage: %s <model start script> <model optimize script> "
            "<optimization log>\n",
            argv[0]);
    fprintf(stderr, "\t<model start script> is the model run script to be used "
                    "to generate the initial random population.\n");
    fprintf(
        stderr,
        "\t<model optimize script> is the model run script for the model that "
        "is to be optimized (can be the same as the <model start script>, or "
        "may run a more computationally intensive mode of the model.\n");
    exit(0);
  }
  strcpy(runstr, argv[1]);
  strcpy(runoptstr, argv[2]);
  if ((fopti = fopen(argv[3], "w")) == NULL) {
    fprintf(stderr, "ERROR: Unable to open optimization log file %s.\n",
            argv[2]);
    exit(0);
  }
  Ntry = 15;
  Ninit = 75;
  ndim = 5;
  ftol = 1.e-3;
  p = (float **)calloc(ndim + 1, sizeof(float *));
  y = (float *)calloc(ndim + 1, sizeof(float));
  tmpp = (float **)calloc(Ninit, sizeof(float *));
  tmpy = (float *)calloc(Ninit, sizeof(float));
  for (i = 0; i < ndim + 1; i++)
    p[i] = (float *)calloc(ndim, sizeof(float));
  for (i = 0; i < Ninit; i++)
    tmpp[i] = (float *)calloc(ndim, sizeof(float));
  i = 0;
  tmptime = time(&currtime);
  tmptime *= -1;
  ran2seed = &tmptime;
  ran2(ran2seed);
  ran2seed[0] = 1;
  param_lim = set_param_limits(ndim);
  for (try = 0; try < Ntry; try++) {
    fprintf(fopti, "Determining starting parameters for %s trial %i\n", runstr,
            try);
    for (init = 0; init < Ninit; init++) {
      fprintf(fopti, "%i\t%i:\t", try, init);
      for (param = 0; param < ndim; param++) {
        tmpp[init][param] =
            ((param_lim[0][param] - param_lim[1][param]) * (ran2(ran2seed))) +
            param_lim[1][param];
      }
      tmpy[init] = solve_model(tmpp[init], runstr, fopti);
    }
    quick(tmpy, tmpp, ndim, Ninit);
    for (i = 0; i < ndim + 1; i++) {
      for (j = 0; j < ndim; j++)
        p[i][j] = tmpp[Ninit - i - 1][j];
      if (strcmp(runstr, runoptstr) == 0)
        y[i] = tmpy[Ninit - i - 1];
      else
        y[i] = solve_model(p[i], runoptstr, fopti);
    }
    fprintf(fopti, "\nInitial Parameter Set\n");
    for (i = 0; i < ndim + 1; i++) {
      fprintf(fopti, "%i:\t", i);
      for (j = 0; j < ndim; j++) {
        fprintf(fopti, "%f\t", p[i][j]);
      }
      fprintf(fopti, "=\t%f\n", y[i]);
    }
    fflush(fopti);
    amoeba(p, y, ndim, ftol, &iter, runoptstr, fopti);
    fprintf(fopti, "\nResults for Simplex Optimization %i\n", try);
    fprintf(fopti, "\tNumber of iterations needed = %i\n", iter);
    for (i = 0; i < ndim + 1; i++) {
      fprintf(fopti, "%i:\t", i);
      for (j = 0; j < ndim; j++) {
        fprintf(fopti, "%.5g\t", p[i][j]);
      }
      fprintf(fopti, "=\t%.5g\n", y[i]);
    }
    fprintf(fopti, "\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1249 <main+0x79>
mov    0x2de6(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%rdi
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    -0x270(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x470(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xef9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12ba <main+0xea>
mov    0x2d46(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
movl   $0xf,-0x64(%rbp)
movl   $0x4b,-0x48(%rbp)
movl   $0x5,-0x50(%rbp)
movss  0xd29(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x50(%rbp),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x50(%rbp),%edi
add    $0x1,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x48(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1368 <main+0x198>
mov    -0x50(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    132d <main+0x15d>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    13a5 <main+0x1d5>
mov    -0x50(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    136f <main+0x19f>
movl   $0x0,-0x54(%rbp)
lea    -0x474(%rbp),%rdi
call   10a0 <time@plt>
mov    %eax,-0x478(%rbp)
imul   $0xffffffff,-0x478(%rbp),%eax
mov    %eax,-0x478(%rbp)
lea    -0x478(%rbp),%rax
mov    %rax,-0x488(%rbp)
mov    -0x488(%rbp),%rdi
call   1050 <ran2@plt>
mov    -0x488(%rbp),%rax
movq   $0x1,(%rax)
mov    -0x50(%rbp),%edi
call   1040 <set_param_limits@plt>
mov    %rax,-0x480(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1806 <main+0x636>
mov    -0x18(%rbp),%rdi
lea    -0x270(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    152b <main+0x35b>
mov    -0x18(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    14f4 <main+0x324>
mov    -0x480(%rbp),%rax
mov    (%rax),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x480(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x68(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x48c(%rbp)
ff
mov    -0x488(%rbp),%rdi
call   1050 <ran2@plt>
movaps %xmm0,%xmm2
movss  -0x48c(%rbp),%xmm0
ff
mov    -0x480(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x68(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x68(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1463 <main+0x293>
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x270(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10f0 <solve_model@plt>
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1438 <main+0x268>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%edx
mov    -0x48(%rbp),%ecx
call   10d0 <quick@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1629 <main+0x459>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    15a9 <main+0x3d9>
mov    -0x38(%rbp),%rax
mov    -0x48(%rbp),%ecx
sub    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    155d <main+0x38d>
lea    -0x270(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    15ed <main+0x41d>
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%ecx
sub    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1616 <main+0x446>
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x470(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10f0 <solve_model@plt>
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    161b <main+0x44b>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1545 <main+0x375>
mov    -0x18(%rbp),%rdi
lea    0xbb1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    16e5 <main+0x515>
mov    -0x18(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xb7f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    16b4 <main+0x4e4>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb5e(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    166f <main+0x49f>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb31(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1642 <main+0x472>
mov    -0x18(%rbp),%rdi
call   10b0 <fflush@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x50(%rbp),%edx
movss  -0x2c(%rbp),%xmm0
lea    -0x470(%rbp),%r8
mov    -0x18(%rbp),%r9
lea    -0x5c(%rbp),%rcx
call   1060 <amoeba@plt>
mov    -0x18(%rbp),%rdi
mov    -0x60(%rbp),%edx
lea    0xae7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x5c(%rbp),%edx
lea    0xaf8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    17e6 <main+0x616>
mov    -0x18(%rbp),%rdi
mov    -0x54(%rbp),%edx
lea    0xa7e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    17b5 <main+0x5e5>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xab0(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1770 <main+0x5a0>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa85(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1743 <main+0x573>
mov    -0x18(%rbp),%rdi
lea    0x986(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1409 <main+0x239>
mov    -0x4(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
mov    %rsi,%rbp
cmp    $0x4,%edi
jne    17e7 <main+0x5f7>
mov    0x8(%rbp),%rsi
lea    0x40(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbp),%rsi
lea    0x240(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x18(%rbp),%rdi
lea    0xf42(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     183c <main+0x64c>
mov    %rax,%rbx
mov    $0x6,%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,%r14
mov    $0x6,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,%r15
mov    $0x4b,%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,%r12
mov    $0x4b,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x18(%rsp)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,(%r14)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x8(%r14)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x10(%r14)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x18(%r14)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x20(%r14)
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,0x28(%r14)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x5,%edi
mov    $0x4,%esi
call   1080 <calloc@plt>
mov    %rax,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    $0x4b,%rbp
jne    1310 <main+0x120>
lea    0x3c(%rsp),%rdi
call   10b0 <time@plt>
neg    %eax
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1050 <ran2@plt>
movq   $0x1,0x10(%rsp)
mov    $0x5,%edi
call   1040 <set_param_limits@plt>
mov    %rax,%r13
lea    0x40(%rsp),%rdx
xor    %eax,%eax
mov    %r15,0x20(%rsp)
mov    %r12,0x30(%rsp)
xchg   %ax,%ax
mov    %rbx,%rdi
lea    0xe32(%rip),%rsi
mov    %eax,%ecx
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %ebp,%ebp
lea    0x10(%rsp),%r15
xchg   %ax,%ax
mov    %rbx,%rdi
lea    0xe43(%rip),%rsi
mov    0x14(%rsp),%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x0(%r13),%rax
mov    0x8(%r13),%rcx
movss  (%rax),%xmm0
subss  (%rcx),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <ran2@plt>
mov    0x8(%r13),%rax
mulss  0xc(%rsp),%xmm0
addss  (%rax),%xmm0
mov    (%r12,%rbp,8),%rcx
movss  %xmm0,(%rcx)
mov    0x0(%r13),%rcx
movss  0x4(%rcx),%xmm0
subss  0x4(%rax),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <ran2@plt>
mov    0x8(%r13),%rax
mulss  0xc(%rsp),%xmm0
addss  0x4(%rax),%xmm0
mov    (%r12,%rbp,8),%rcx
movss  %xmm0,0x4(%rcx)
mov    0x0(%r13),%rcx
movss  0x8(%rcx),%xmm0
subss  0x8(%rax),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <ran2@plt>
mov    0x8(%r13),%rax
mulss  0xc(%rsp),%xmm0
addss  0x8(%rax),%xmm0
mov    (%r12,%rbp,8),%rcx
movss  %xmm0,0x8(%rcx)
mov    0x0(%r13),%rcx
movss  0xc(%rcx),%xmm0
subss  0xc(%rax),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <ran2@plt>
mov    0x8(%r13),%rax
mulss  0xc(%rsp),%xmm0
addss  0xc(%rax),%xmm0
mov    (%r12,%rbp,8),%rcx
movss  %xmm0,0xc(%rcx)
mov    0x0(%r13),%rcx
movss  0x10(%rcx),%xmm0
subss  0x10(%rax),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <ran2@plt>
mov    0x8(%r13),%rax
mulss  0xc(%rsp),%xmm0
addss  0x10(%rax),%xmm0
mov    (%r12,%rbp,8),%rdi
movss  %xmm0,0x10(%rdi)
lea    0x40(%rsp),%rsi
mov    %rbx,%rdx
call   1110 <solve_model@plt>
mov    0x18(%rsp),%rax
movss  %xmm0,(%rax,%rbp,4)
add    $0x1,%rbp
cmp    $0x4b,%rbp
jne    1390 <main+0x1a0>
mov    0x18(%rsp),%rdi
mov    %r12,%rsi
mov    $0x5,%edx
mov    $0x4b,%ecx
call   10e0 <quick@plt>
mov    $0x94,%ebp
xor    %r15d,%r15d
lea    0x240(%rsp),%r12
jmp    1530 <main+0x340>
nopl   0x0(%rax)
mov    (%r14,%r15,2),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1110 <solve_model@plt>
mov    0x20(%rsp),%rax
movss  %xmm0,(%rax,%r15,1)
add    $0x4,%r15
add    $0xfffffffffffffffe,%rbp
cmp    $0x18,%r15
lea    0x240(%rsp),%r12
je     1590 <main+0x3a0>
mov    0x30(%rsp),%rax
mov    (%rax,%rbp,4),%rax
mov    (%r14,%r15,2),%rcx
movss  (%rax),%xmm0
movss  %xmm0,(%rcx)
movss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rcx)
movss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rcx)
movss  0xc(%rax),%xmm0
movss  %xmm0,0xc(%rcx)
movss  0x10(%rax),%xmm0
movss  %xmm0,0x10(%rcx)
lea    0x40(%rsp),%rdi
mov    %r12,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1500 <main+0x310>
mov    0x18(%rsp),%rax
movss  (%rax,%rbp,2),%xmm0
jmp    150f <main+0x31f>
nopl   0x0(%rax,%rax,1)
mov    $0x17,%esi
mov    $0x1,%edx
lea    0xc44(%rip),%rdi
mov    %rbx,%rcx
call   1100 <fwrite@plt>
xor    %ebp,%ebp
mov    0x20(%rsp),%r15
lea    0xc46(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xc16(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0xc(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x10(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
movss  (%r15,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
lea    0xb99(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
add    $0x1,%rbp
cmp    $0x6,%rbp
jne    15c0 <main+0x3d0>
mov    %rbx,%rdi
call   10c0 <fflush@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
movss  0x968(%rip),%xmm0
lea    0x2c(%rsp),%rcx
lea    0x240(%rsp),%r8
mov    %rbx,%r9
call   1060 <amoeba@plt>
mov    %rbx,%rdi
lea    0xb50(%rip),%rsi
mov    0x14(%rsp),%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2c(%rsp),%edx
mov    %rbx,%rdi
lea    0xb5d(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %ebp,%ebp
mov    0x30(%rsp),%r12
lea    0xb6b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xae6(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0xc(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    (%r14,%rbp,8),%rax
movss  0x10(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    0x20(%rsp),%rax
movss  (%rax,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
lea    0xaba(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
add    $0x1,%rbp
cmp    $0x6,%rbp
jne    16f0 <main+0x500>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1070 <fputc@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
cmp    $0xf,%eax
lea    0x40(%rsp),%rdx
jne    1370 <main+0x180>
xor    %eax,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x27f2(%rip),%rbx
mov    (%rbx),%rdi
mov    0x0(%rbp),%rdx
lea    0x808(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%rcx
lea    0x842(%rip),%rdi
mov    $0x64,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
mov    (%rbx),%rcx
lea    0x88e(%rip),%rdi
mov    $0xc4,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x279d(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rdx
lea    0x92a(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [75 x i8] c"Usage: %s <model start script> <model optimize script> <optimization log>\0A\00"
@.str.1 = [101 x i8] c"\09<model start script> is the model run script to be used to generate the initial random population.\0A\00"
@.str.2 = [197 x i8] c"\09<model optimize script> is the model run script for the model that is to be optimized (can be the same as the <model start script>, or may run a more computationally intensive mode of the model.\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [49 x i8] c"ERROR: Unable to open optimization log file %s.\0A\00"
@.str.5 = [49 x i8] c"Determining starting parameters for %s trial %i\0A\00"
@.str.6 = [8 x i8] c"%i\09%i:\09\00"
@.str.7 = [24 x i8] c"\0AInitial Parameter Set\0A\00"
@.str.8 = [5 x i8] c"%i:\09\00"
@.str.9 = [4 x i8] c"%f\09\00"
@.str.10 = [6 x i8] c"=\09%f\0A\00"
@.str.11 = [38 x i8] c"\0AResults for Simplex Optimization %i\0A\00"
@.str.12 = [35 x i8] c"\09Number of iterations needed = %i\0A\00"
@.str.13 = [6 x i8] c"%.5g\09\00"
@.str.14 = [8 x i8] c"=\09%.5g\0A\00"
@.str.15 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca float**
%8 = alloca float*
%9 = alloca float
%10 = alloca float**
%11 = alloca float*
%12 = alloca i32
%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 i32
%22 = alloca [512 x i8]
%23 = alloca [512 x i8]
%24 = alloca i32
%25 = alloca i32
%26 = alloca float**
%27 = alloca i64*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 4
br i1 %29, label %30, label %41
30: ; preds = %2
%31 = load i32*, i32** @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i32*, i32** @stderr
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32*, i32** @stderr
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0))
%40 = call i32 @exit(i32 0)
unreachable
41: ; preds = %2
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strcpy(i8* %42, i8* %45)
%47 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %47, i8* %50)
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %55, i32** %6
%56 = icmp eq i32* %55, null
br i1 %56, label %57, label %64
57: ; preds = %41
%58 = load i32*, i32** @stderr
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 2
%61 = load i8*, i8** %60
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %61)
%63 = call i32 @exit(i32 0)
unreachable
64: ; preds = %41
store i32 15, i32* %20
store i32 75, i32* %13
store i32 5, i32* %15
store float 0x3F50624DE0000000, float* %9
%65 = load i32, i32* %15
%66 = add nsw i32 %65, 1
%67 = call i64 @calloc(i32 %66, i32 8)
%68 = inttoptr i64 %67 to float**
store float** %68, float*** %7
%69 = load i32, i32* %15
%70 = add nsw i32 %69, 1
%71 = call i64 @calloc(i32 %70, i32 4)
%72 = inttoptr i64 %71 to float*
store float* %72, float** %8
%73 = load i32, i32* %13
%74 = call i64 @calloc(i32 %73, i32 8)
%75 = inttoptr i64 %74 to float**
store float** %75, float*** %10
%76 = load i32, i32* %13
%77 = call i64 @calloc(i32 %76, i32 4)
%78 = inttoptr i64 %77 to float*
store float* %78, float** %11
store i32 0, i32* %16
br label %79
79: ; preds = %92, %64
%80 = load i32, i32* %16
%81 = load i32, i32* %15
%82 = add nsw i32 %81, 1
%83 = icmp slt i32 %80, %82
br i1 %83, label %84, label %95
84: ; preds = %79
%85 = load i32, i32* %15
%86 = call i64 @calloc(i32 %85, i32 4)
%87 = inttoptr i64 %86 to float*
%88 = load float**, float*** %7
%89 = load i32, i32* %16
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds float*, float** %88, i64 %90
store float* %87, float** %91
br label %92
92: ; preds = %84
%93 = load i32, i32* %16
%94 = add nsw i32 %93, 1
store i32 %94, i32* %16
br label %79
95: ; preds = %79
store i32 0, i32* %16
br label %96
96: ; preds = %108, %95
%97 = load i32, i32* %16
%98 = load i32, i32* %13
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %111
100: ; preds = %96
%101 = load i32, i32* %15
%102 = call i64 @calloc(i32 %101, i32 4)
%103 = inttoptr i64 %102 to float*
%104 = load float**, float*** %10
%105 = load i32, i32* %16
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds float*, float** %104, i64 %106
store float* %103, float** %107
br label %108
108: ; preds = %100
%109 = load i32, i32* %16
%110 = add nsw i32 %109, 1
store i32 %110, i32* %16
br label %96
111: ; preds = %96
store i32 0, i32* %16
%112 = call i32 @time(i32* %24)
store i32 %112, i32* %25
%113 = load i32, i32* %25
%114 = mul nsw i32 %113, -1
store i32 %114, i32* %25
%115 = bitcast i32* %25 to i64*
store i64* %115, i64** %27
%116 = load i64*, i64** %27
%117 = call float @ran2(i64* %116)
%118 = load i64*, i64** %27
%119 = getelementptr inbounds i64, i64* %118, i64 0
store i64 1, i64* %119
%120 = load i32, i32* %15
%121 = call float** @set_param_limits(i32 %120)
store float** %121, float*** %26
store i32 0, i32* %19
br label %122
122: ; preds = %376, %111
%123 = load i32, i32* %19
%124 = load i32, i32* %20
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %379
126: ; preds = %122
%127 = load i32*, i32** %6
%128 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%129 = load i32, i32* %19
%130 = call i32 (i32*, i8*, ...) @fprintf(i32* %127, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i8* %128, i32 %129)
store i32 0, i32* %14
br label %131
131: ; preds = %194, %126
%132 = load i32, i32* %14
%133 = load i32, i32* %13
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %197
135: ; preds = %131
%136 = load i32*, i32** %6
%137 = load i32, i32* %19
%138 = load i32, i32* %14
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %136, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %137, i32 %138)
store i32 0, i32* %21
br label %140
140: ; preds = %178, %135
%141 = load i32, i32* %21
%142 = load i32, i32* %15
%143 = icmp slt i32 %141, %142
br i1 %143, label %144, label %181
144: ; preds = %140
%145 = load float**, float*** %26
%146 = getelementptr inbounds float*, float** %145, i64 0
%147 = load float*, float** %146
%148 = load i32, i32* %21
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds float, float* %147, i64 %149
%151 = load float, float* %150
%152 = load float**, float*** %26
%153 = getelementptr inbounds float*, float** %152, i64 1
%154 = load float*, float** %153
%155 = load i32, i32* %21
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds float, float* %154, i64 %156
%158 = load float, float* %157
%159 = fsub float %151, %158
%160 = load i64*, i64** %27
%161 = call float @ran2(i64* %160)
%162 = load float**, float*** %26
%163 = getelementptr inbounds float*, float** %162, i64 1
%164 = load float*, float** %163
%165 = load i32, i32* %21
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds float, float* %164, i64 %166
%168 = load float, float* %167
%169 = call float @llvm.fmuladd.f32(float %159, float %161, float %168)
%170 = load float**, float*** %10
%171 = load i32, i32* %14
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds float*, float** %170, i64 %172
%174 = load float*, float** %173
%175 = load i32, i32* %21
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds float, float* %174, i64 %176
store float %169, float* %177
br label %178
178: ; preds = %144
%179 = load i32, i32* %21
%180 = add nsw i32 %179, 1
store i32 %180, i32* %21
br label %140
181: ; preds = %140
%182 = load float**, float*** %10
%183 = load i32, i32* %14
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds float*, float** %182, i64 %184
%186 = load float*, float** %185
%187 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%188 = load i32*, i32** %6
%189 = call float @solve_model(float* %186, i8* %187, i32* %188)
%190 = load float*, float** %11
%191 = load i32, i32* %14
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds float, float* %190, i64 %192
store float %189, float* %193
br label %194
194: ; preds = %181
%195 = load i32, i32* %14
%196 = add nsw i32 %195, 1
store i32 %196, i32* %14
br label %131
197: ; preds = %131
%198 = load float*, float** %11
%199 = load float**, float*** %10
%200 = load i32, i32* %15
%201 = load i32, i32* %13
%202 = call i32 @quick(float* %198, float** %199, i32 %200, i32 %201)
store i32 0, i32* %16
br label %203
203: ; preds = %269, %197
%204 = load i32, i32* %16
%205 = load i32, i32* %15
%206 = add nsw i32 %205, 1
%207 = icmp slt i32 %204, %206
br i1 %207, label %208, label %272
208: ; preds = %203
store i32 0, i32* %17
br label %209
209: ; preds = %234, %208
%210 = load i32, i32* %17
%211 = load i32, i32* %15
%212 = icmp slt i32 %210, %211
br i1 %212, label %213, label %237
213: ; preds = %209
%214 = load float**, float*** %10
%215 = load i32, i32* %13
%216 = load i32, i32* %16
%217 = sub nsw i32 %215, %216
%218 = sub nsw i32 %217, 1
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds float*, float** %214, i64 %219
%221 = load float*, float** %220
%222 = load i32, i32* %17
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds float, float* %221, i64 %223
%225 = load float, float* %224
%226 = load float**, float*** %7
%227 = load i32, i32* %16
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds float*, float** %226, i64 %228
%230 = load float*, float** %229
%231 = load i32, i32* %17
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds float, float* %230, i64 %232
store float %225, float* %233
br label %234
234: ; preds = %213
%235 = load i32, i32* %17
%236 = add nsw i32 %235, 1
store i32 %236, i32* %17
br label %209
237: ; preds = %209
%238 = getelementptr inbounds [512 x i8], [512 x i8]* %22, i64 0, i64 0
%239 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%240 = call i64 @strcmp(i8* %238, i8* %239)
%241 = icmp eq i64 %240, 0
br i1 %241, label %242, label %255
242: ; preds = %237
%243 = load float*, float** %11
%244 = load i32, i32* %13
%245 = load i32, i32* %16
%246 = sub nsw i32 %244, %245
%247 = sub nsw i32 %246, 1
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds float, float* %243, i64 %248
%250 = load float, float* %249
%251 = load float*, float** %8
%252 = load i32, i32* %16
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds float, float* %251, i64 %253
store float %250, float* %254
br label %268
255: ; preds = %237
%256 = load float**, float*** %7
%257 = load i32, i32* %16
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds float*, float** %256, i64 %258
%260 = load float*, float** %259
%261 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%262 = load i32*, i32** %6
%263 = call float @solve_model(float* %260, i8* %261, i32* %262)
%264 = load float*, float** %8
%265 = load i32, i32* %16
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds float, float* %264, i64 %266
store float %263, float* %267
br label %268
268: ; preds = %255, %242
br label %269
269: ; preds = %268
%270 = load i32, i32* %16
%271 = add nsw i32 %270, 1
store i32 %271, i32* %16
br label %203
272: ; preds = %203
%273 = load i32*, i32** %6
%274 = call i32 (i32*, i8*, ...) @fprintf(i32* %273, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %16
br label %275
275: ; preds = %313, %272
%276 = load i32, i32* %16
%277 = load i32, i32* %15
%278 = add nsw i32 %277, 1
%279 = icmp slt i32 %276, %278
br i1 %279, label %280, label %316
280: ; preds = %275
%281 = load i32*, i32** %6
%282 = load i32, i32* %16
%283 = call i32 (i32*, i8*, ...) @fprintf(i32* %281, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %282)
store i32 0, i32* %17
br label %284
284: ; preds = %301, %280
%285 = load i32, i32* %17
%286 = load i32, i32* %15
%287 = icmp slt i32 %285, %286
br i1 %287, label %288, label %304
288: ; preds = %284
%289 = load i32*, i32** %6
%290 = load float**, float*** %7
%291 = load i32, i32* %16
%292 = sext i32 %291 to i64
%293 = getelementptr inbounds float*, float** %290, i64 %292
%294 = load float*, float** %293
%295 = load i32, i32* %17
%296 = sext i32 %295 to i64
%297 = getelementptr inbounds float, float* %294, i64 %296
%298 = load float, float* %297
%299 = fpext float %298 to double
%300 = call i32 (i32*, i8*, ...) @fprintf(i32* %289, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %299)
br label %301
301: ; preds = %288
%302 = load i32, i32* %17
%303 = add nsw i32 %302, 1
store i32 %303, i32* %17
br label %284
304: ; preds = %284
%305 = load i32*, i32** %6
%306 = load float*, float** %8
%307 = load i32, i32* %16
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds float, float* %306, i64 %308
%310 = load float, float* %309
%311 = fpext float %310 to double
%312 = call i32 (i32*, i8*, ...) @fprintf(i32* %305, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), double %311)
br label %313
313: ; preds = %304
%314 = load i32, i32* %16
%315 = add nsw i32 %314, 1
store i32 %315, i32* %16
br label %275
316: ; preds = %275
%317 = load i32*, i32** %6
%318 = call i32 @fflush(i32* %317)
%319 = load float**, float*** %7
%320 = load float*, float** %8
%321 = load i32, i32* %15
%322 = load float, float* %9
%323 = getelementptr inbounds [512 x i8], [512 x i8]* %23, i64 0, i64 0
%324 = load i32*, i32** %6
%325 = call i32 @amoeba(float** %319, float* %320, i32 %321, float %322, i32* %18, i8* %323, i32* %324)
%326 = load i32*, i32** %6
%327 = load i32, i32* %19
%328 = call i32 (i32*, i8*, ...) @fprintf(i32* %326, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %327)
%329 = load i32*, i32** %6
%330 = load i32, i32* %18
%331 = call i32 (i32*, i8*, ...) @fprintf(i32* %329, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %330)
store i32 0, i32* %16
br label %332
332: ; preds = %370, %316
%333 = load i32, i32* %16
%334 = load i32, i32* %15
%335 = add nsw i32 %334, 1
%336 = icmp slt i32 %333, %335
br i1 %336, label %337, label %373
337: ; preds = %332
%338 = load i32*, i32** %6
%339 = load i32, i32* %16
%340 = call i32 (i32*, i8*, ...) @fprintf(i32* %338, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %339)
store i32 0, i32* %17
br label %341
341: ; preds = %358, %337
%342 = load i32, i32* %17
%343 = load i32, i32* %15
%344 = icmp slt i32 %342, %343
br i1 %344, label %345, label %361
345: ; preds = %341
%346 = load i32*, i32** %6
%347 = load float**, float*** %7
%348 = load i32, i32* %16
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds float*, float** %347, i64 %349
%351 = load float*, float** %350
%352 = load i32, i32* %17
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds float, float* %351, i64 %353
%355 = load float, float* %354
%356 = fpext float %355 to double
%357 = call i32 (i32*, i8*, ...) @fprintf(i32* %346, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %356)
br label %358
358: ; preds = %345
%359 = load i32, i32* %17
%360 = add nsw i32 %359, 1
store i32 %360, i32* %17
br label %341
361: ; preds = %341
%362 = load i32*, i32** %6
%363 = load float*, float** %8
%364 = load i32, i32* %16
%365 = sext i32 %364 to i64
%366 = getelementptr inbounds float, float* %363, i64 %365
%367 = load float, float* %366
%368 = fpext float %367 to double
%369 = call i32 (i32*, i8*, ...) @fprintf(i32* %362, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double %368)
br label %370
370: ; preds = %361
%371 = load i32, i32* %16
%372 = add nsw i32 %371, 1
store i32 %372, i32* %16
br label %332
373: ; preds = %332
%374 = load i32*, i32** %6
%375 = call i32 (i32*, i8*, ...) @fprintf(i32* %374, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
br label %376
376: ; preds = %373
%377 = load i32, i32* %19
%378 = add nsw i32 %377, 1
store i32 %378, i32* %19
br label %122
379: ; preds = %122
%380 = load i32, i32* %3
ret i32 %380
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [75 x i8] c"Usage: %s <model start script> <model optimize script> <optimization log>\0A\00"
@.str.1 = [101 x i8] c"\09<model start script> is the model run script to be used to generate the initial random population.\0A\00"
@.str.2 = [197 x i8] c"\09<model optimize script> is the model run script for the model that is to be optimized (can be the same as the <model start script>, or may run a more computationally intensive mode of the model.\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [49 x i8] c"ERROR: Unable to open optimization log file %s.\0A\00"
@.str.5 = [49 x i8] c"Determining starting parameters for %s trial %i\0A\00"
@.str.6 = [8 x i8] c"%i\09%i:\09\00"
@.str.7 = [24 x i8] c"\0AInitial Parameter Set\0A\00"
@.str.8 = [5 x i8] c"%i:\09\00"
@.str.9 = [4 x i8] c"%f\09\00"
@.str.10 = [6 x i8] c"=\09%f\0A\00"
@.str.11 = [38 x i8] c"\0AResults for Simplex Optimization %i\0A\00"
@.str.12 = [35 x i8] c"\09Number of iterations needed = %i\0A\00"
@.str.13 = [6 x i8] c"%.5g\09\00"
@.str.14 = [8 x i8] c"=\09%.5g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = icmp eq i32 %0, 4
br i1 %13, label %23, label %14
14: ; preds = %2
%15 = load i32*, i32** @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** @stderr
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.1, i64 0, i64 0), i64 100, i64 1, i32* %18)
%20 = load i32*, i32** @stderr
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.2, i64 0, i64 0), i64 196, i64 1, i32* %20)
%22 = tail call i32 @exit(i32 0)
unreachable
23: ; preds = %2
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %9, i8* %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %10, i8* %28)
%30 = getelementptr inbounds i8*, i8** %1, i64 3
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %39
34: ; preds = %23
%35 = load i32*, i32** @stderr
%36 = load i8*, i8** %27
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %23
%40 = call i64 @calloc(i32 6, i32 8)
%41 = inttoptr i64 %40 to float**
%42 = call i64 @calloc(i32 6, i32 4)
%43 = call i64 @calloc(i32 75, i32 8)
%44 = call i64 @calloc(i32 75, i32 4)
%45 = call i64 @calloc(i32 5, i32 4)
%46 = inttoptr i64 %45 to float*
store float* %46, float** %41
%47 = call i64 @calloc(i32 5, i32 4)
%48 = inttoptr i64 %47 to float*
%49 = getelementptr inbounds float*, float** %41, i64 1
store float* %48, float** %49
%50 = call i64 @calloc(i32 5, i32 4)
%51 = inttoptr i64 %50 to float*
%52 = getelementptr inbounds float*, float** %41, i64 2
store float* %51, float** %52
%53 = call i64 @calloc(i32 5, i32 4)
%54 = inttoptr i64 %53 to float*
%55 = getelementptr inbounds float*, float** %41, i64 3
store float* %54, float** %55
%56 = call i64 @calloc(i32 5, i32 4)
%57 = inttoptr i64 %56 to float*
%58 = getelementptr inbounds float*, float** %41, i64 4
store float* %57, float** %58
%59 = call i64 @calloc(i32 5, i32 4)
%60 = inttoptr i64 %59 to float*
%61 = getelementptr inbounds float*, float** %41, i64 5
store float* %60, float** %61
%62 = inttoptr i64 %43 to float**
br label %63
63: ; preds = %39, %63
%64 = phi i64 [ 0, %39 ], [ %68, %63 ]
%65 = call i64 @calloc(i32 5, i32 4)
%66 = inttoptr i64 %65 to float*
%67 = getelementptr inbounds float*, float** %62, i64 %64
store float* %66, float** %67
%68 = add nuw nsw i64 %64, 1
%69 = icmp eq i64 %68, 75
br i1 %69, label %70, label %63
70: ; preds = %63
%71 = inttoptr i64 %42 to float*
%72 = inttoptr i64 %44 to float*
%73 = call i32 @time(i32* %6)
%74 = sub nsw i32 0, %73
store i32 %74, i32* %7
%75 = bitcast i32* %7 to i64*
%76 = call float @ran2(i64* %75)
store i64 1, i64* %75
%77 = call float** @set_param_limits(i32 5)
%78 = getelementptr inbounds float*, float** %77, i64 1
br label %79
79: ; preds = %70, %266
%80 = phi i32 [ 0, %70 ], [ %268, %266 ]
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i8* %9, i32 %80)
br label %82
82: ; preds = %79, %82
%83 = phi i64 [ 0, %79 ], [ %151, %82 ]
%84 = trunc i64 %83 to i32
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %80, i32 %84)
%86 = getelementptr inbounds float*, float** %62, i64 %83
%87 = load float*, float** %77
%88 = load float, float* %87
%89 = load float*, float** %78
%90 = load float, float* %89
%91 = fsub float %88, %90
%92 = call float @ran2(i64* %75)
%93 = load float*, float** %78
%94 = load float, float* %93
%95 = call float @llvm.fmuladd.f32(float %91, float %92, float %94)
%96 = load float*, float** %86
store float %95, float* %96
%97 = load float*, float** %77
%98 = getelementptr inbounds float, float* %97, i64 1
%99 = load float, float* %98
%100 = getelementptr inbounds float, float* %93, i64 1
%101 = load float, float* %100
%102 = fsub float %99, %101
%103 = call float @ran2(i64* %75)
%104 = load float*, float** %78
%105 = getelementptr inbounds float, float* %104, i64 1
%106 = load float, float* %105
%107 = call float @llvm.fmuladd.f32(float %102, float %103, float %106)
%108 = load float*, float** %86
%109 = getelementptr inbounds float, float* %108, i64 1
store float %107, float* %109
%110 = load float*, float** %77
%111 = getelementptr inbounds float, float* %110, i64 2
%112 = load float, float* %111
%113 = getelementptr inbounds float, float* %104, i64 2
%114 = load float, float* %113
%115 = fsub float %112, %114
%116 = call float @ran2(i64* %75)
%117 = load float*, float** %78
%118 = getelementptr inbounds float, float* %117, i64 2
%119 = load float, float* %118
%120 = call float @llvm.fmuladd.f32(float %115, float %116, float %119)
%121 = load float*, float** %86
%122 = getelementptr inbounds float, float* %121, i64 2
store float %120, float* %122
%123 = load float*, float** %77
%124 = getelementptr inbounds float, float* %123, i64 3
%125 = load float, float* %124
%126 = getelementptr inbounds float, float* %117, i64 3
%127 = load float, float* %126
%128 = fsub float %125, %127
%129 = call float @ran2(i64* %75)
%130 = load float*, float** %78
%131 = getelementptr inbounds float, float* %130, i64 3
%132 = load float, float* %131
%133 = call float @llvm.fmuladd.f32(float %128, float %129, float %132)
%134 = load float*, float** %86
%135 = getelementptr inbounds float, float* %134, i64 3
store float %133, float* %135
%136 = load float*, float** %77
%137 = getelementptr inbounds float, float* %136, i64 4
%138 = load float, float* %137
%139 = getelementptr inbounds float, float* %130, i64 4
%140 = load float, float* %139
%141 = fsub float %138, %140
%142 = call float @ran2(i64* %75)
%143 = load float*, float** %78
%144 = getelementptr inbounds float, float* %143, i64 4
%145 = load float, float* %144
%146 = call float @llvm.fmuladd.f32(float %141, float %142, float %145)
%147 = load float*, float** %86
%148 = getelementptr inbounds float, float* %147, i64 4
store float %146, float* %148
%149 = call float @solve_model(float* %147, i8* %9, i32* %32)
%150 = getelementptr inbounds float, float* %72, i64 %83
store float %149, float* %150
%151 = add nuw nsw i64 %83, 1
%152 = icmp eq i64 %151, 75
br i1 %152, label %153, label %82
153: ; preds = %82
%154 = call i32 @quick(float* %72, float** %62, i32 5, i32 75)
br label %155
155: ; preds = %153, %183
%156 = phi i64 [ 0, %153 ], [ %186, %183 ]
%157 = sub nuw nsw i64 74, %156
%158 = getelementptr inbounds float*, float** %62, i64 %157
%159 = load float*, float** %158
%160 = getelementptr inbounds float*, float** %41, i64 %156
%161 = load float*, float** %160
%162 = load float, float* %159
store float %162, float* %161
%163 = getelementptr inbounds float, float* %159, i64 1
%164 = load float, float* %163
%165 = getelementptr inbounds float, float* %161, i64 1
store float %164, float* %165
%166 = getelementptr inbounds float, float* %159, i64 2
%167 = load float, float* %166
%168 = getelementptr inbounds float, float* %161, i64 2
store float %167, float* %168
%169 = getelementptr inbounds float, float* %159, i64 3
%170 = load float, float* %169
%171 = getelementptr inbounds float, float* %161, i64 3
store float %170, float* %171
%172 = getelementptr inbounds float, float* %159, i64 4
%173 = load float, float* %172
%174 = getelementptr inbounds float, float* %161, i64 4
store float %173, float* %174
%175 = call i64 @strcmp(i8* %9, i8* %10)
%176 = icmp eq i64 %175, 0
br i1 %176, label %177, label %180
177: ; preds = %155
%178 = getelementptr inbounds float, float* %72, i64 %157
%179 = load float, float* %178
br label %183
180: ; preds = %155
%181 = load float*, float** %160
%182 = call float @solve_model(float* %181, i8* %10, i32* %32)
br label %183
183: ; preds = %177, %180
%184 = phi float [ %179, %177 ], [ %182, %180 ]
%185 = getelementptr inbounds float, float* %71, i64 %156
store float %184, float* %185
%186 = add nuw nsw i64 %156, 1
%187 = icmp eq i64 %186, 6
br i1 %187, label %188, label %155
188: ; preds = %183
%189 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i64 23, i64 1, i32* %32)
br label %190
190: ; preds = %188, %190
%191 = phi i64 [ 0, %188 ], [ %223, %190 ]
%192 = trunc i64 %191 to i32
%193 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %192)
%194 = getelementptr inbounds float*, float** %41, i64 %191
%195 = load float*, float** %194
%196 = load float, float* %195
%197 = fpext float %196 to double
%198 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %197)
%199 = load float*, float** %194
%200 = getelementptr inbounds float, float* %199, i64 1
%201 = load float, float* %200
%202 = fpext float %201 to double
%203 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %202)
%204 = load float*, float** %194
%205 = getelementptr inbounds float, float* %204, i64 2
%206 = load float, float* %205
%207 = fpext float %206 to double
%208 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %207)
%209 = load float*, float** %194
%210 = getelementptr inbounds float, float* %209, i64 3
%211 = load float, float* %210
%212 = fpext float %211 to double
%213 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %212)
%214 = load float*, float** %194
%215 = getelementptr inbounds float, float* %214, i64 4
%216 = load float, float* %215
%217 = fpext float %216 to double
%218 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double %217)
%219 = getelementptr inbounds float, float* %71, i64 %191
%220 = load float, float* %219
%221 = fpext float %220 to double
%222 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), double %221)
%223 = add nuw nsw i64 %191, 1
%224 = icmp eq i64 %223, 6
br i1 %224, label %225, label %190
225: ; preds = %190
%226 = call i32 @fflush(i32* %32)
%227 = call i32 @amoeba(float** %41, float* %71, i32 5, float 0x3F50624DE0000000, i32* %3, i8* %10, i32* %32)
%228 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %80)
%229 = load i32, i32* %3
%230 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %229)
br label %231
231: ; preds = %225, %231
%232 = phi i64 [ 0, %225 ], [ %264, %231 ]
%233 = trunc i64 %232 to i32
%234 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 %233)
%235 = getelementptr inbounds float*, float** %41, i64 %232
%236 = load float*, float** %235
%237 = load float, float* %236
%238 = fpext float %237 to double
%239 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %238)
%240 = load float*, float** %235
%241 = getelementptr inbounds float, float* %240, i64 1
%242 = load float, float* %241
%243 = fpext float %242 to double
%244 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %243)
%245 = load float*, float** %235
%246 = getelementptr inbounds float, float* %245, i64 2
%247 = load float, float* %246
%248 = fpext float %247 to double
%249 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %248)
%250 = load float*, float** %235
%251 = getelementptr inbounds float, float* %250, i64 3
%252 = load float, float* %251
%253 = fpext float %252 to double
%254 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %253)
%255 = load float*, float** %235
%256 = getelementptr inbounds float, float* %255, i64 4
%257 = load float, float* %256
%258 = fpext float %257 to double
%259 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), double %258)
%260 = getelementptr inbounds float, float* %71, i64 %232
%261 = load float, float* %260
%262 = fpext float %261 to double
%263 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double %262)
%264 = add nuw nsw i64 %232, 1
%265 = icmp eq i64 %264, 6
br i1 %265, label %266, label %231
266: ; preds = %231
%267 = call i32 @fputc(i32 10, i32* %32)
%268 = add nuw nsw i32 %80, 1
%269 = icmp eq i32 %268, 15
br i1 %269, label %270, label %79
270: ; preds = %266
ret i32 0
}