// File: /workspace/github_c_makefile_star2_O2/debbiemarkslab[P]plmc/src/lib/lbfgs.c
// Function: lbfgs
int lbfgs(
    int n,
    lbfgsfloatval_t *x,
    lbfgsfloatval_t *ptr_fx,
    lbfgs_evaluate_t proc_evaluate,
    lbfgs_progress_t proc_progress,
    void *instance,
    lbfgs_parameter_t *_param
    )
{
    int ret;
    int i, j, k, ls, end, bound;
    lbfgsfloatval_t step;

    /* Constant parameters and their default values. */
    lbfgs_parameter_t param = (_param != NULL) ? (*_param) : _defparam;
    const int m = param.m;

    lbfgsfloatval_t *xp = NULL;
    lbfgsfloatval_t *g = NULL, *gp = NULL, *pg = NULL;
    lbfgsfloatval_t *d = NULL, *w = NULL, *pf = NULL;
    iteration_data_t *lm = NULL, *it = NULL;
    lbfgsfloatval_t ys, yy;
    lbfgsfloatval_t xnorm, gnorm, beta;
    lbfgsfloatval_t fx = 0.;
    lbfgsfloatval_t rate = 0.;
    line_search_proc linesearch = line_search_morethuente;

    /* Construct a callback data. */
    callback_data_t cd;
    cd.n = n;
    cd.instance = instance;
    cd.proc_evaluate = proc_evaluate;
    cd.proc_progress = proc_progress;

#if     defined(USE_SSE) && (defined(__SSE__) || defined(__SSE2__))
    /* Round out the number of variables. */
    n = round_out_variables(n);
#endif/*defined(USE_SSE)*/

    /* Check the input parameters for errors. */
    if (n <= 0) {
        return LBFGSERR_INVALID_N;
    }
#if     defined(USE_SSE) && (defined(__SSE__) || defined(__SSE2__))
    if (n % 8 != 0) {
        return LBFGSERR_INVALID_N_SSE;
    }
    if ((uintptr_t)(const void*)x % 16 != 0) {
        return LBFGSERR_INVALID_X_SSE;
    }
#endif/*defined(USE_SSE)*/
    if (param.epsilon < 0.) {
        return LBFGSERR_INVALID_EPSILON;
    }
    if (param.past < 0) {
        return LBFGSERR_INVALID_TESTPERIOD;
    }
    if (param.delta < 0.) {
        return LBFGSERR_INVALID_DELTA;
    }
    if (param.min_step < 0.) {
        return LBFGSERR_INVALID_MINSTEP;
    }
    if (param.max_step < param.min_step) {
        return LBFGSERR_INVALID_MAXSTEP;
    }
    if (param.ftol < 0.) {
        return LBFGSERR_INVALID_FTOL;
    }
    if (param.linesearch == LBFGS_LINESEARCH_BACKTRACKING_WOLFE ||
        param.linesearch == LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE) {
        if (param.wolfe <= param.ftol || 1. <= param.wolfe) {
            return LBFGSERR_INVALID_WOLFE;
        }
    }
    if (param.gtol < 0.) {
        return LBFGSERR_INVALID_GTOL;
    }
    if (param.xtol < 0.) {
        return LBFGSERR_INVALID_XTOL;
    }
    if (param.max_linesearch <= 0) {
        return LBFGSERR_INVALID_MAXLINESEARCH;
    }
    if (param.orthantwise_c < 0.) {
        return LBFGSERR_INVALID_ORTHANTWISE;
    }
    if (param.orthantwise_start < 0 || n < param.orthantwise_start) {
        return LBFGSERR_INVALID_ORTHANTWISE_START;
    }
    if (param.orthantwise_end < 0) {
        param.orthantwise_end = n;
    }
    if (n < param.orthantwise_end) {
        return LBFGSERR_INVALID_ORTHANTWISE_END;
    }
    if (param.orthantwise_c != 0.) {
        switch (param.linesearch) {
        case LBFGS_LINESEARCH_BACKTRACKING:
            linesearch = line_search_backtracking_owlqn;
            break;
        default:
            /* Only the backtracking method is available. */
            return LBFGSERR_INVALID_LINESEARCH;
        }
    } else {
        switch (param.linesearch) {
        case LBFGS_LINESEARCH_MORETHUENTE:
            linesearch = line_search_morethuente;
            break;
        case LBFGS_LINESEARCH_BACKTRACKING_ARMIJO:
        case LBFGS_LINESEARCH_BACKTRACKING_WOLFE:
        case LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE:
            linesearch = line_search_backtracking;
            break;
        default:
            return LBFGSERR_INVALID_LINESEARCH;
        }
    }

    /* Allocate working space. */
    xp = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
    g = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
    gp = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
    d = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
    w = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
    if (xp == NULL || g == NULL || gp == NULL || d == NULL || w == NULL) {
        ret = LBFGSERR_OUTOFMEMORY;
        goto lbfgs_exit;
    }

    if (param.orthantwise_c != 0.) {
        /* Allocate working space for OW-LQN. */
        pg = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
        if (pg == NULL) {
            ret = LBFGSERR_OUTOFMEMORY;
            goto lbfgs_exit;
        }
    }

    /* Allocate limited memory storage. */
    lm = (iteration_data_t*)vecalloc(m * sizeof(iteration_data_t));
    if (lm == NULL) {
        ret = LBFGSERR_OUTOFMEMORY;
        goto lbfgs_exit;
    }

    /* Initialize the limited memory. */
    for (i = 0;i < m;++i) {
        it = &lm[i];
        it->alpha = 0;
        it->ys = 0;
        it->s = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
        it->y = (lbfgsfloatval_t*)vecalloc(n * sizeof(lbfgsfloatval_t));
        if (it->s == NULL || it->y == NULL) {
            ret = LBFGSERR_OUTOFMEMORY;
            goto lbfgs_exit;
        }
    }

    /* Allocate an array for storing previous values of the objective function. */
    if (0 < param.past) {
        pf = (lbfgsfloatval_t*)vecalloc(param.past * sizeof(lbfgsfloatval_t));
    }

    /* Evaluate the function value and its gradient. */
    fx = cd.proc_evaluate(cd.instance, x, g, cd.n, 0);
    if (0. != param.orthantwise_c) {
        /* Compute the L1 norm of the variable and add it to the object value. */
        xnorm = owlqn_x1norm(x, param.orthantwise_start, param.orthantwise_end);
        fx += xnorm * param.orthantwise_c;
        owlqn_pseudo_gradient(
            pg, x, g, n,
            param.orthantwise_c, param.orthantwise_start, param.orthantwise_end
            );
    }

    /* Store the initial value of the objective function. */
    if (pf != NULL) {
        pf[0] = fx;
    }

    /*
        Compute the direction;
        we assume the initial hessian matrix H_0 as the identity matrix.
     */
    if (param.orthantwise_c == 0.) {
        vecncpy(d, g, n);
    } else {
        vecncpy(d, pg, n);
    }

    /*
       Make sure that the initial variables are not a minimizer.
     */
    vec2norm(&xnorm, x, n);
    if (param.orthantwise_c == 0.) {
        vec2norm(&gnorm, g, n);
    } else {
        vec2norm(&gnorm, pg, n);
    }
    if (xnorm < 1.0) xnorm = 1.0;
    if (gnorm / xnorm <= param.epsilon) {
        ret = LBFGS_ALREADY_MINIMIZED;
        goto lbfgs_exit;
    }

    /* Compute the initial step:
        step = 1.0 / sqrt(vecdot(d, d, n))
     */
    vec2norminv(&step, d, n);

    k = 1;
    end = 0;
    for (;;) {
        /* Store the current position and gradient vectors. */
        veccpy(xp, x, n);
        veccpy(gp, g, n);

        /* Search for an optimal step. */
        if (param.orthantwise_c == 0.) {
            ls = linesearch(n, x, &fx, g, d, &step, xp, gp, w, &cd, &param);
        } else {
            ls = linesearch(n, x, &fx, g, d, &step, xp, pg, w, &cd, &param);
            owlqn_pseudo_gradient(
                pg, x, g, n,
                param.orthantwise_c, param.orthantwise_start, param.orthantwise_end
                );
        }
        if (ls < 0) {
            /* Revert to the previous point. */
            veccpy(x, xp, n);
            veccpy(g, gp, n);
            ret = ls;
            goto lbfgs_exit;
        }

        /* Compute x and g norms. */
        vec2norm(&xnorm, x, n);
        if (param.orthantwise_c == 0.) {
            vec2norm(&gnorm, g, n);
        } else {
            vec2norm(&gnorm, pg, n);
        }

        /* Report the progress. */
        if (cd.proc_progress) {
            if ((ret = cd.proc_progress(cd.instance, x, g, fx, xnorm, gnorm, step, cd.n, k, ls))) {
                goto lbfgs_exit;
            }
        }

        /*
            Convergence test.
            The criterion is given by the following formula:
                |g(x)| / \max(1, |x|) < \epsilon
         */
        if (xnorm < 1.0) xnorm = 1.0;
        if (gnorm / xnorm <= param.epsilon) {
            /* Convergence. */
            ret = LBFGS_SUCCESS;
            break;
        }

        /*
            Test for stopping criterion.
            The criterion is given by the following formula:
                (f(past_x) - f(x)) / f(x) < \delta
         */
        if (pf != NULL) {
            /* We don't test the stopping criterion while k < past. */
            if (param.past <= k) {
                /* Compute the relative improvement from the past. */
                rate = (pf[k % param.past] - fx) / fx;

                /* The stopping criterion. */
                if (rate < param.delta) {
                    ret = LBFGS_STOP;
                    break;
                }
            }

            /* Store the current value of the objective function. */
            pf[k % param.past] = fx;
        }

        if (param.max_iterations != 0 && param.max_iterations < k+1) {
            /* Maximum number of iterations. */
            ret = LBFGSERR_MAXIMUMITERATION;
            break;
        }

        /*
            Update vectors s and y:
                s_{k+1} = x_{k+1} - x_{k} = \step * d_{k}.
                y_{k+1} = g_{k+1} - g_{k}.
         */
        it = &lm[end];
        vecdiff(it->s, x, xp, n);
        vecdiff(it->y, g, gp, n);

        /*
            Compute scalars ys and yy:
                ys = y^t \cdot s = 1 / \rho.
                yy = y^t \cdot y.
            Notice that yy is used for scaling the hessian matrix H_0 (Cholesky factor).
         */
        vecdot(&ys, it->y, it->s, n);
        vecdot(&yy, it->y, it->y, n);
        it->ys = ys;

        /*
            Recursive formula to compute dir = -(H \cdot g).
                This is described in page 779 of:
                Jorge Nocedal.
                Updating Quasi-Newton Matrices with Limited Storage.
                Mathematics of Computation, Vol. 35, No. 151,
                pp. 773--782, 1980.
         */
        bound = (m <= k) ? m : k;
        ++k;
        end = (end + 1) % m;

        /* Compute the steepest direction. */
        if (param.orthantwise_c == 0.) {
            /* Compute the negative of gradients. */
            vecncpy(d, g, n);
        } else {
            vecncpy(d, pg, n);
        }

        j = end;
        for (i = 0;i < bound;++i) {
            j = (j + m - 1) % m;    /* if (--j == -1) j = m-1; */
            it = &lm[j];
            /* \alpha_{j} = \rho_{j} s^{t}_{j} \cdot q_{k+1}. */
            vecdot(&it->alpha, it->s, d, n);
            it->alpha /= it->ys;
            /* q_{i} = q_{i+1} - \alpha_{i} y_{i}. */
            vecadd(d, it->y, -it->alpha, n);
        }

        vecscale(d, ys / yy, n);

        for (i = 0;i < bound;++i) {
            it = &lm[j];
            /* \beta_{j} = \rho_{j} y^t_{j} \cdot \gamma_{i}. */
            vecdot(&beta, it->y, d, n);
            beta /= it->ys;
            /* \gamma_{i+1} = \gamma_{i} + (\alpha_{j} - \beta_{j}) s_{j}. */
            vecadd(d, it->s, it->alpha - beta, n);
            j = (j + 1) % m;        /* if (++j == m) j = 0; */
        }

        /*
            Constrain the search direction for orthant-wise updates.
         */
        if (param.orthantwise_c != 0.) {
            for (i = param.orthantwise_start;i < param.orthantwise_end;++i) {
                if (d[i] * pg[i] >= 0) {
                    d[i] = 0;
                }
            }
        }

        /*
            Now the search direction d is ready. We try step = 1 first.
         */
        step = 1.0;
    }

lbfgs_exit:
    /* Return the final value of the objective function. */
    if (ptr_fx != NULL) {
        *ptr_fx = fx;
    }

    vecfree(pf);

    /* Free memory blocks used by this function. */
    if (lm != NULL) {
        for (i = 0;i < m;++i) {
            vecfree(lm[i].s);
            vecfree(lm[i].y);
        }
        vecfree(lm);
    }
    vecfree(pg);
    vecfree(w);
    vecfree(d);
    vecfree(gp);
    vecfree(g);
    vecfree(xp);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, %r12
movq %rcx, %r13
movq %rsi, %r14
movl %edi, %ebp
movq 0x1a0(%rsp), %rsi
testq %rsi, %rsi
je 0x1701
pushq $0xe
popq %rcx
leaq 0xc0(%rsp), %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl (%rax), %esi
jmp 0x1719
leaq 0xa9b8(%rip), %rsi      # 0xc0c0
pushq $0xe
popq %rcx
leaq 0xc0(%rsp), %rdi
rep  movsq (%rsi), %es:(%rdi)
pushq $0x6
popq %rsi
andq $0x0, 0x48(%rsp)
movl %ebp, 0x130(%rsp)
movq %r12, 0x138(%rsp)
movq %r13, 0x140(%rsp)
movq %r8, 0x148(%rsp)
testl %ebp, %ebp
jle 0x1871
movl $0xfffffc07, %r15d      # imm = 0xFFFFFC07
xorpd %xmm0, %xmm0
ucomisd 0xc8(%rsp), %xmm0
ja 0x187f
movslq 0xd0(%rsp), %rbx
testq %rbx, %rbx
js 0x1879
movl $0xfffffc09, %r15d      # imm = 0xFFFFFC09
xorpd %xmm1, %xmm1
ucomisd 0xd8(%rsp), %xmm1
ja 0x187f
movsd 0xf0(%rsp), %xmm0
movl $0xfffffc0b, %r15d      # imm = 0xFFFFFC0B
ucomisd %xmm0, %xmm1
ja 0x187f
movl $0xfffffc0c, %r15d      # imm = 0xFFFFFC0C
ucomisd 0xf8(%rsp), %xmm0
ja 0x187f
movsd 0x100(%rsp), %xmm0
movl $0xfffffc0d, %r15d      # imm = 0xFFFFFC0D
ucomisd %xmm0, %xmm1
ja 0x187f
movl 0xe4(%rsp), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
jne 0x1804
movsd 0x108(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl $0xfffffc0e, %r15d      # imm = 0xFFFFFC0E
jae 0x187f
ucomisd 0xa866(%rip), %xmm1     # 0xc068
jae 0x187f
movl $0xfffffc0f, %r15d      # imm = 0xFFFFFC0F
xorpd %xmm0, %xmm0
ucomisd 0x110(%rsp), %xmm0
ja 0x187f
movl $0xfffffc10, %r15d      # imm = 0xFFFFFC10
ucomisd 0x118(%rsp), %xmm0
ja 0x187f
cmpl $0x0, 0xe8(%rsp)
jle 0x1894
movsd 0x120(%rsp), %xmm1
movl $0xfffffc12, %r15d      # imm = 0xFFFFFC12
ucomisd %xmm1, %xmm0
ja 0x187f
movl 0x128(%rsp), %ecx
movl $0xfffffc13, %r15d      # imm = 0xFFFFFC13
cmpl %ebp, %ecx
ja 0x187f
movl 0x12c(%rsp), %edi
testl %edi, %edi
js 0x189c
movl $0xfffffc14, %r15d      # imm = 0xFFFFFC14
cmpl %ebp, %edi
ja 0x187f
jmp 0x18a5
movl $0xfffffc04, %r15d      # imm = 0xFFFFFC04
jmp 0x187f
movl $0xfffffc08, %r15d      # imm = 0xFFFFFC08
movl %r15d, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffc11, %r15d      # imm = 0xFFFFFC11
jmp 0x187f
movl %ebp, 0x12c(%rsp)
movl %ebp, %edi
movl $0xfffffc0a, %r15d      # imm = 0xFFFFFC0A
ucomisd %xmm0, %xmm1
jne 0x18b3
jnp 0x18df
cmpl $0x2, %eax
jne 0x187f
movl %edi, 0x7c(%rsp)
movl %ecx, 0x80(%rsp)
movsd %xmm1, 0x30(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rsi, 0x28(%rsp)
leaq 0xf9a(%rip), %rax       # 0x2877
jmp 0x190d
cmpl $0x3, %eax
ja 0x187f
movl %edi, 0x7c(%rsp)
movl %ecx, 0x80(%rsp)
movsd %xmm1, 0x30(%rsp)
movq %rdx, 0xb0(%rsp)
movq %rsi, 0x28(%rsp)
leaq 0xe49f(%rip), %rcx      # 0xfda8
movq (%rcx,%rax,8), %rax
movq %rax, 0x98(%rsp)
movl %ebp, %eax
movq %rax, 0x150(%rsp)
leaq (,%rax,8), %r15
movq %r15, %rdi
callq 0x16a5
movq %rax, 0x60(%rsp)
movq %r15, %rdi
callq 0x16a5
movq %rax, 0x18(%rsp)
movq %r15, %rdi
callq 0x16a5
movq %rax, 0x50(%rsp)
movq %r15, %rdi
callq 0x16a5
movq %rax, 0x38(%rsp)
movq %r15, 0x58(%rsp)
movq %r15, %rdi
callq 0x16a5
cmpq $0x0, 0x60(%rsp)
sete %dl
cmpq $0x0, 0x18(%rsp)
sete %cl
orb %dl, %cl
cmpq $0x0, 0x50(%rsp)
sete %sil
cmpq $0x0, 0x38(%rsp)
sete %dl
orb %sil, %dl
orb %cl, %dl
movq %rax, 0xa0(%rsp)
testq %rax, %rax
sete %al
orb %dl, %al
movl $0xfffffc02, %r15d      # imm = 0xFFFFFC02
je 0x19bf
movq $0x0, 0x20(%rsp)
xorl %edi, %edi
xorl %r12d, %r12d
jmp 0x214e
xorpd %xmm0, %xmm0
movsd 0x30(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x19d1
jnp 0x19e7
movq 0x58(%rsp), %rdi
callq 0x16a5
movq %rax, 0x20(%rsp)
testq %rax, %rax
jne 0x19f0
jmp 0x19ac
movq $0x0, 0x20(%rsp)
movslq 0x28(%rsp), %rdi
shlq $0x5, %rdi
callq 0x16a5
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1aa5
movq 0x28(%rsp), %rax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
shlq $0x5, %rcx
addq $0x20, %rcx
movq %rcx, 0x68(%rsp)
xorl %ecx, %ecx
leaq 0x20(%rcx), %rax
movq %rax, 0xa8(%rsp)
cmpq %rax, 0x68(%rsp)
je 0x1aaf
movq 0x8(%rsp), %rax
andq $0x0, (%rax,%rcx)
andq $0x0, 0x18(%rax,%rcx)
movq 0x58(%rsp), %rdi
movq %rcx, (%rsp)
callq 0x16a5
movq %rax, %rdx
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
movq %rdx, 0x8(%rax,%rcx)
movq 0x58(%rsp), %rdi
callq 0x16a5
movq 0x8(%rsp), %rcx
movq (%rsp), %rdx
movq %rax, 0x10(%rcx,%rdx)
cmpq $0x0, 0x40(%rsp)
je 0x1a9e
movq 0xa8(%rsp), %rcx
testq %rax, %rax
jne 0x1a2a
movq 0x8(%rsp), %r12
jmp 0x1aa8
xorl %r12d, %r12d
xorl %edi, %edi
jmp 0x214e
testl %ebx, %ebx
je 0x1ac6
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x16a5
movq %rax, 0x10(%rsp)
jmp 0x1acf
movq $0x0, 0x10(%rsp)
xorpd %xmm0, %xmm0
movq %r12, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
movl %ebp, %ecx
callq *%r13
movapd %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
ucomisd 0xa57b(%rip), %xmm0     # 0xc070
movsd %xmm1, (%rsp)
movsd %xmm1, 0x48(%rsp)
jne 0x1b04
jnp 0x1b5f
movq %r14, %rdi
movl 0x80(%rsp), %ebx
movl %ebx, %esi
movl 0x7c(%rsp), %r15d
movl %r15d, %edx
callq 0x2c71
movsd %xmm0, 0x70(%rsp)
movsd 0x30(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd (%rsp), %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, (%rsp)
movsd %xmm2, 0x48(%rsp)
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
movl %ebp, %ecx
movapd %xmm1, %xmm0
movl %ebx, %r8d
movl %r15d, %r9d
callq 0x2c9b
cmpq $0x0, 0x10(%rsp)
je 0x1b75
movq 0x10(%rsp), %rax
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
xorpd %xmm1, %xmm1
movsd 0x30(%rsp), %xmm0
ucomisd %xmm1, %xmm0
movq 0x18(%rsp), %r15
movq %r15, %rsi
movq 0x20(%rsp), %r12
cmovneq %r12, %rsi
cmovpq %r12, %rsi
movq 0x38(%rsp), %rdi
movl %ebp, %edx
callq 0x2d40
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2d65
xorpd %xmm0, %xmm0
ucomisd 0x120(%rsp), %xmm0
movq %r15, %rsi
cmovneq %r12, %rsi
cmovpq %r12, %rsi
leaq 0x88(%rsp), %rdi
movl %ebp, %edx
callq 0x2d65
movsd (%rbx), %xmm0
movsd 0xa47f(%rip), %xmm1     # 0xc068
ucomisd %xmm0, %xmm1
jbe 0x1c06
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x70(%rsp)
movsd 0xa462(%rip), %xmm0     # 0xc068
movsd 0x88(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd 0xc8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x2140
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq 0x38(%rsp), %r12
movq %r12, %rsi
movl %ebp, %edx
callq 0x2d65
movsd 0xa420(%rip), %xmm0     # 0xc068
divsd (%rbx), %xmm0
movq 0x28(%rsp), %rax
decl %eax
movl %eax, 0xa8(%rsp)
pushq $0x1
popq %rax
leaq 0xc0(%rsp), %rcx
movsd 0x60(%rcx), %xmm1
movsd %xmm1, 0x68(%rsp)
movl %eax, 0x40(%rsp)
movl $0x0, 0x30(%rsp)
movq 0x28(%rsp), %rax
movl 0x40(%rsp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
testl %ecx, %ecx
movl $0x0, %eax
cmovlel %eax, %ecx
movl %ecx, 0x58(%rsp)
movsd %xmm0, 0x90(%rsp)
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2d92
movq 0x50(%rsp), %rdi
movq 0x18(%rsp), %r15
movq %r15, %rsi
movl %ebp, %edx
callq 0x2d92
movsd 0x68(%rsp), %xmm0
ucomisd 0xa39b(%rip), %xmm0     # 0xc070
jne 0x1d23
jp 0x1d23
subq $0x8, %rsp
movl %ebp, %edi
movq %r14, %rsi
leaq 0x50(%rsp), %rdx
movq %r15, %rcx
movq %r12, %r8
leaq 0x98(%rsp), %r9
leaq 0xc8(%rsp), %rax
pushq %rax
leaq 0x140(%rsp), %rax
pushq %rax
pushq 0xb8(%rsp)
pushq 0x70(%rsp)
pushq %rbx
callq *0xc8(%rsp)
addq $0x30, %rsp
movl %eax, %r15d
jmp 0x1d97
subq $0x8, %rsp
movl %ebp, %edi
movq %r14, %rsi
leaq 0x50(%rsp), %rdx
movq %r15, %rcx
movq %r12, %r8
leaq 0x98(%rsp), %r9
leaq 0xc8(%rsp), %rax
pushq %rax
leaq 0x140(%rsp), %rax
pushq %rax
pushq 0xb8(%rsp)
movq 0x40(%rsp), %r12
pushq %r12
pushq %rbx
callq *0xc8(%rsp)
addq $0x30, %rsp
movq %r15, %rdx
movl %eax, %r15d
movsd 0x120(%rsp), %xmm0
movl 0x128(%rsp), %r8d
movl 0x12c(%rsp), %r9d
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %ecx
callq 0x2c9b
testl %r15d, %r15d
js 0x21f8
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2d65
xorpd %xmm0, %xmm0
ucomisd 0x120(%rsp), %xmm0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
cmovneq %rax, %rsi
cmovpq %rax, %rsi
leaq 0x88(%rsp), %rdi
movl %ebp, %edx
callq 0x2d65
movq 0x148(%rsp), %rax
movsd 0x70(%rsp), %xmm1
testq %rax, %rax
je 0x1e40
movq 0x138(%rsp), %rdi
movsd 0x48(%rsp), %xmm0
movsd 0x88(%rsp), %xmm2
movsd 0x90(%rsp), %xmm3
movl 0x130(%rsp), %ecx
movq %r14, %rsi
movq 0x18(%rsp), %rdx
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm1
movl 0x40(%rsp), %r8d
movl %r15d, %r9d
callq *%rax
movsd (%rsp), %xmm1
testl %eax, %eax
jne 0x2230
movsd 0xa220(%rip), %xmm0     # 0xc068
ucomisd %xmm1, %xmm0
jbe 0x1e65
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x70(%rsp)
movsd 0xa203(%rip), %xmm1     # 0xc068
movsd 0x88(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd 0xc8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x221d
cmpq $0x0, 0x10(%rsp)
je 0x1ed6
movl 0xd0(%rsp), %ecx
movl 0x40(%rsp), %esi
movl %esi, %eax
cltd
idivl %ecx
movsd 0x48(%rsp), %xmm0
cmpl %esi, %ecx
jg 0x1ecc
movq 0x10(%rsp), %rax
movsd (%rax,%rdx,8), %xmm1
subsd %xmm0, %xmm1
divsd %xmm0, %xmm1
movsd 0xd8(%rsp), %xmm2
ucomisd %xmm1, %xmm2
ja 0x2238
movq 0x10(%rsp), %rax
movsd %xmm0, (%rax,%rdx,8)
movl 0xe0(%rsp), %eax
testl %eax, %eax
sete %cl
cmpl 0x40(%rsp), %eax
setg %al
orb %cl, %al
cmpb $0x1, %al
jne 0x2225
movslq 0x30(%rsp), %r15
movq %r15, %rbx
shlq $0x5, %rbx
movq 0x8(%rsp), %r13
movq 0x8(%r13,%rbx), %rdi
movq %rdi, (%rsp)
movq %r14, %rsi
movq 0x60(%rsp), %rdx
movl %ebp, %ecx
callq 0x2dae
movq 0x10(%r13,%rbx), %r12
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x50(%rsp), %rdx
movl %ebp, %ecx
callq 0x2dae
leaq 0x160(%rsp), %rdi
movq %r12, %rsi
movq (%rsp), %rdx
movl %ebp, %ecx
callq 0x2dcf
leaq 0x158(%rsp), %rdi
movq %r12, %rsi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x2dcf
movsd 0x160(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd %xmm0, 0x18(%r13,%rbx)
incl 0x40(%rsp)
incl %r15d
movl %r15d, %eax
cltd
idivl 0x28(%rsp)
movl %edx, %ebx
movsd 0x120(%rsp), %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, 0x68(%rsp)
ucomisd %xmm1, %xmm0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
cmovneq %rax, %rsi
cmovpq %rax, %rsi
movq 0x38(%rsp), %rdi
movl %ebp, %edx
callq 0x2d40
movl 0x58(%rsp), %r15d
movl %ebx, 0x30(%rsp)
movl %ebx, (%rsp)
subl $0x1, %r15d
jb 0x2033
movl (%rsp), %eax
addl 0xa8(%rsp), %eax
cltd
idivl 0x28(%rsp)
movl %edx, (%rsp)
movslq %edx, %r12
shlq $0x5, %r12
movq 0x8(%rsp), %rbx
leaq (%rbx,%r12), %rdi
movq 0x8(%rbx,%r12), %rsi
movq 0x38(%rsp), %r13
movq %r13, %rdx
movl %ebp, %ecx
callq 0x2dcf
movsd (%rbx,%r12), %xmm0
divsd 0x18(%rbx,%r12), %xmm0
movsd %xmm0, (%rbx,%r12)
movq 0x10(%rbx,%r12), %rsi
xorpd 0xa079(%rip), %xmm0     # 0xc0a0
movq %r13, %rdi
movl %ebp, %edx
callq 0x2dfb
jmp 0x1fcb
movsd 0x80(%rsp), %xmm1
divsd 0x158(%rsp), %xmm1
xorl %eax, %eax
movq 0x38(%rsp), %r12
movq 0x150(%rsp), %rcx
cmpq %rax, %rcx
je 0x206e
movsd (%r12,%rax,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%r12,%rax,8)
incq %rax
jmp 0x2054
movq 0x8(%rsp), %r13
movl (%rsp), %edx
subl $0x1, 0x58(%rsp)
jb 0x20dc
movslq %edx, %rbx
movq %rbx, %r15
shlq $0x5, %r15
movq 0x10(%r13,%r15), %rsi
leaq 0xb8(%rsp), %rdi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x2dcf
movsd 0xb8(%rsp), %xmm1
divsd 0x18(%r13,%r15), %xmm1
movsd %xmm1, 0xb8(%rsp)
movq 0x8(%r13,%r15), %rsi
movsd (%r13,%r15), %xmm0
subsd %xmm1, %xmm0
movq %r12, %rdi
movl %ebp, %edx
callq 0x2dfb
incl %ebx
movl %ebx, %eax
cltd
idivl 0x28(%rsp)
jmp 0x2076
movsd 0x68(%rsp), %xmm0
ucomisd 0x9f86(%rip), %xmm0     # 0xc070
movsd 0x9f76(%rip), %xmm0     # 0xc068
jne 0x20fa
jnp 0x1c7c
movslq 0x128(%rsp), %rax
movslq 0x12c(%rsp), %rcx
movq 0x20(%rsp), %rdx
xorpd %xmm1, %xmm1
cmpq %rcx, %rax
jge 0x2133
movsd (%r12,%rax,8), %xmm0
mulsd (%rdx,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jb 0x212e
andq $0x0, (%r12,%rax,8)
incq %rax
jmp 0x2113
movsd 0x9f2d(%rip), %xmm0     # 0xc068
jmp 0x1c7c
pushq $0x2
popq %r15
movq 0x8(%rsp), %r12
movq 0x10(%rsp), %rdi
movq 0xb0(%rsp), %rax
testq %rax, %rax
movq 0x38(%rsp), %rbx
je 0x216a
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rax)
callq 0x1050
testq %r12, %r12
je 0x21b6
xorl %ebx, %ebx
movq 0x28(%rsp), %rax
testl %eax, %eax
cmovlel %ebx, %eax
shlq $0x5, %rax
cmpq %rbx, %rax
je 0x21a9
movq %rax, %r14
movq 0x8(%r12,%rbx), %rdi
callq 0x1050
movq 0x10(%r12,%rbx), %rdi
callq 0x1050
addq $0x20, %rbx
movq %r14, %rax
jmp 0x2184
movq %r12, %rdi
callq 0x1050
movq 0x38(%rsp), %rbx
movq 0x20(%rsp), %rdi
callq 0x1050
movq 0xa0(%rsp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1050
movq 0x50(%rsp), %rdi
callq 0x1050
movq 0x18(%rsp), %rdi
callq 0x1050
movq 0x60(%rsp), %rdi
callq 0x1050
jmp 0x187f
movq %r14, %rdi
movq 0x60(%rsp), %rsi
movl %ebp, %edx
callq 0x2d92
movq 0x18(%rsp), %rdi
movq 0x50(%rsp), %rsi
movl %ebp, %edx
callq 0x2d92
jmp 0x2144
xorl %r15d, %r15d
jmp 0x2144
movl $0xfffffc1b, %r15d      # imm = 0xFFFFFC1B
jmp 0x2144
movl %eax, %r15d
jmp 0x2144
pushq $0x1
jmp 0x2142