// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/utils.cpp
// Function: projectsimplexbounded(double*, double*, double*, signed char)
void projectsimplexbounded(NUMBER* ar, NUMBER *lb, NUMBER *ub, NPAR size) {
	NPAR i, num_at_hi, num_at_lo; // number of elements at lower,upper boundary
	NPAR *at_hi = Calloc(NPAR, (size_t)size);
	NPAR *at_lo = Calloc(NPAR, (size_t)size);
	NUMBER err, lambda, v;
    NUMBER* ar_copy = Calloc(NUMBER, (size_t)size);
    memcpy(ar_copy, ar, sizeof(NUMBER)*(size_t)size);
    int iter = 0;
    for(i=0; i<size; i++)
        if(ar[i]!=ar[i]) {
            fprintf(stderr,"WARNING! NaN detected!\n");
        }
    bool doexit = false;
	while( !issimplexbounded(ar, lb, ub, size) && !doexit ) {
        lambda = 0;
		num_at_hi = 0;
		num_at_lo = 0;
		err = -1;
		// threshold
		for(i=0; i<size; i++) {
			at_lo[i] = (ar[i]<=lb[i])?1:0;
            
            v = (at_lo[i]==1)?lb[i]:ar[i];
            if(v!=v) {
                fprintf(stderr,"WARNING! NaN to be set!\n");
            }
			
            ar[i] = (at_lo[i]==1)?lb[i]:ar[i];
			num_at_lo = (NPAR)( num_at_lo + at_lo[i] );
			
			at_hi[i] = (ar[i]>=ub[i])?1:0;
            
            v = (at_hi[i]==1)?ub[i]:ar[i];
            if(v!=v) {
                fprintf(stderr,"WARNING! NaN to be set!\n");
            }
            
			ar[i] = (at_hi[i]==1)?ub[i]:ar[i];
			num_at_hi = (NPAR)( num_at_hi + at_hi[i] );
			
			err += ar[i];
		}
        if ( err > 0 && size > num_at_lo )
            lambda = err / (size - num_at_lo);
        else if ( err < 0 && size > num_at_hi )
            lambda = err / (size - num_at_hi);

        int will_suffer_from_lambda = 0; // those values that, if lessened by lambda, will be below 0 or over 1
        NUMBER err2 = 0.0, lambda2 = 0.0;
        for(i=0; i<size; i++) {
            if( (at_lo[i]==0 && at_hi[i]==0) ) {
                if( ar[i] < lambda ) {
                    will_suffer_from_lambda++;
                    err2 += ar[i];
                }
            }
        }
        
        if( will_suffer_from_lambda == 0 ) {
            for(i=0; i<size; i++) {

                v = ar[i] - ((at_lo[i]==0 && err>0)?lambda:0);
                if(v!=v) {
                    fprintf(stderr,"WARNING! NaN to be set!\n");
                }

                ar[i] -= (at_lo[i]==0 && err>0)?lambda:0;

                v = ar[i] - ((at_hi[i]==0 && err<0)?lambda:0);
                if(v!=v) {
                    fprintf(stderr,"WARNING! NaN to be set!\n");
                }

                ar[i] -= (at_hi[i]==0 && err<0)?lambda:0;
            }
        } else {
            lambda2 = (err-err2) / ( size - (num_at_hi + num_at_lo) - will_suffer_from_lambda );
            for(i=0; i<size; i++) {
                if( at_lo[i]==0 && at_hi[i]==0 ) {

                    v = (ar[i]<lambda)?0:(ar[i]-lambda2);
                    if(v!=v) {
                        fprintf(stderr,"WARNING! NaN to be set!\n");
                    }
                    
                    ar[i] = (ar[i]<lambda)?0:(ar[i]-lambda2);
                }
            }
        }
        iter++;
        if(iter==100) {
            string ar_was = "";
            for(int i=0; i<size; i++) ar_was = ar_was + std::to_string(ar_copy[i]).substr(0,5) + std::to_string((i<(size-1))?',':' ');
            string ar_is = "";
            for(int i=0; i<size; i++) ar_is = ar_is + std::to_string(ar[i]).substr(0,5) + std::to_string((i<(size-1))?',':' ');
            fprintf(stderr,"WARNING! Stuck in projectsimplexbounded()! ar was %s and now is %s.\n",ar_was.c_str(),ar_is.c_str());
//            doexit = true;
            break;//exit(1);
        }
	} // until satisfied
    // force last to be 1 - sum of all but last -- this code, actually breaks things
//    err = 0;
//    for(i=0; i<(size); i++) {
//        err += ar[i];
//    }
//    err = 1;
//    for(i=0; i<(size-1); i++) {
//        err -= ar[i];
//    }
//    ar[size-1] = err;
//    err = 1;
//    for(i=1; i<(size-0); i++) {
//        err -= ar[i];
//    }
//    ar[0] = err;
    
    NUMBER sum = 0.0;
    for(i=0; i<size; i++) {
        sum += ar[i];
        if(ar[i]<0 || ar[i] >1) {
            string ar_was = "";
            for(int i=0; i<size; i++) ar_was = ar_was + std::to_string(ar_copy[i]).substr(0,5) + std::to_string((i<(size-1))?',':' ');
            string ar_is = "";
            for(int i=0; i<size; i++) ar_is = ar_is + std::to_string(ar[i]).substr(0,5) + std::to_string((i<(size-1))?',':' ');
            fprintf(stderr, "ERROR! projected value is not within [0, 1] range! ar was %s and now is %s.\n",ar_was.c_str(),ar_is.c_str());
        }
    }
//    if( fabs(sum-1)>SAFETY) {
//        fprintf(stderr, "ERROR! projected simplex does not sum to 1!\n");
//    }
	
	free(at_hi);
	free(at_lo);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %ecx, %r14d
movq %rdx, %r15
movq %rsi, 0x130(%rsp)
movq %rdi, %rbx
movslq %ecx, %r12
movl $0x1, %esi
movq %r12, %rdi
callq 0x4130
movq %rax, 0x80(%rsp)
movl $0x1, %esi
movq %r12, %rdi
callq 0x4130
movq %rax, 0x78(%rsp)
movl $0x8, %esi
movq %r12, %rdi
callq 0x4130
shlq $0x3, %r12
movq %rax, 0x140(%rsp)
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rbx, %r12
callq 0x41c0
movzbl %r14b, %r8d
testb %r14b, %r14b
movq %r8, 0x88(%rsp)
jle 0x7a45
xorl %ebx, %ebx
movsd (%r12,%rbx,8), %xmm0
ucomisd %xmm0, %xmm0
jp 0x7a36
incq %rbx
cmpq %rbx, %r8
jne 0x7a20
jmp 0x7a45
callq 0x46e5
movq 0x88(%rsp), %r8
jmp 0x7a2c
movsbl %r14b, %eax
movq %rax, 0xe0(%rsp)
xorl %edx, %edx
movq %r12, 0xe8(%rsp)
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movl %r14d, 0x34(%rsp)
movq %r15, 0x138(%rsp)
testb %r14b, %r14b
movq %rdx, 0x188(%rsp)
jle 0x7ab5
movsd (%r12), %xmm1
movq 0x130(%rsp), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
ja 0x7b24
movsd 0x2be4a(%rip), %xmm0    # 0x338f0
subsd %xmm1, %xmm0
ucomisd (%r15), %xmm1
jbe 0x7ac1
xorl %eax, %eax
jmp 0x7afd
movb $0x1, %al
movsd 0x2be31(%rip), %xmm0    # 0x338f0
jmp 0x7afd
movl $0x1, %ecx
movq %rcx, %rax
cmpq %rcx, %r8
je 0x7af7
movsd (%r12,%rax,8), %xmm1
subsd %xmm1, %xmm0
movq 0x130(%rsp), %rcx
movsd (%rcx,%rax,8), %xmm2
ucomisd %xmm1, %xmm2
ja 0x7af7
leaq 0x1(%rax), %rcx
ucomisd (%r15,%rax,8), %xmm1
jbe 0x7ac6
cmpq %r8, %rax
setae %al
testb %al, %al
je 0x7b1b
andpd 0x2be27(%rip), %xmm0    # 0x33930
movsd 0x2bde7(%rip), %xmm1    # 0x338f8
ucomisd %xmm0, %xmm1
ja 0x853c
testb %r14b, %r14b
jle 0x7cc6
xorl %ebp, %ebp
movq %r12, %rbx
movq 0x130(%rsp), %r14
xorl %edx, %edx
movsd 0x2bdad(%rip), %xmm3    # 0x338e8
xorl %r9d, %r9d
movsd (%rbx), %xmm0
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
setae %al
setae (%rsi,%rbp)
movapd %xmm1, %xmm2
jae 0x7b5c
movapd %xmm0, %xmm2
ucomisd %xmm2, %xmm2
jp 0x7bb2
movsd %xmm2, (%rbx)
ucomisd (%r15), %xmm2
setae %r12b
setae (%rdi,%rbp)
movq %r15, %r13
jae 0x7b7b
movq %rbx, %r13
movsd (%r13), %xmm0
ucomisd %xmm0, %xmm0
jp 0x7c26
addb %al, %r9b
movsd %xmm0, (%rbx)
addb %r12b, %dl
addsd %xmm0, %xmm3
incq %rbp
addq $0x8, %r15
addq $0x8, %r14
addq $0x8, %rbx
cmpq %rbp, %r8
jne 0x7b3e
jmp 0x7c98
movb %al, 0x28(%rsp)
movq %r9, 0x90(%rsp)
movq %rdx, %r13
movsd %xmm3, (%rsp)
ucomisd %xmm0, %xmm1
movq %r14, %r12
jae 0x7bd2
movq %rbx, %r12
movq 0x373ff(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
movl $0x18, %esi
movl $0x1, %edx
leaq 0x2be96(%rip), %rdi     # 0x33a83
callq 0x4480
movsd (%r12), %xmm2
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x88(%rsp), %r8
movsd (%rsp), %xmm3
movq %r13, %rdx
movq 0x90(%rsp), %r9
movb 0x28(%rsp), %al
jmp 0x7b62
movb %al, 0x28(%rsp)
movq 0x373a7(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
movl $0x18, %esi
movq %rdx, 0x190(%rsp)
movl $0x1, %edx
leaq 0x2be36(%rip), %rdi     # 0x33a83
movsd %xmm3, (%rsp)
movq %r9, 0x90(%rsp)
callq 0x4480
movb 0x28(%rsp), %al
movq 0x90(%rsp), %r9
movq 0x190(%rsp), %rdx
movsd (%rsp), %xmm3
movq 0x88(%rsp), %r8
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdi
movsd (%r13), %xmm0
jmp 0x7b8b
ucomisd 0x2bc60(%rip), %xmm3    # 0x33900
seta %bpl
jbe 0x7cd7
movl 0x34(%rsp), %r14d
cmpb %r14b, %r9b
movq 0xe8(%rsp), %r12
movq 0x138(%rsp), %r15
jge 0x7cec
movsbl %r9b, %eax
jmp 0x7cfe
xorl %ebp, %ebp
xorl %edx, %edx
movsd 0x2bc16(%rip), %xmm3    # 0x338e8
xorl %r9d, %r9d
jmp 0x7cec
movq 0xe8(%rsp), %r12
movl 0x34(%rsp), %r14d
movq 0x138(%rsp), %r15
xorpd %xmm2, %xmm2
ucomisd %xmm3, %xmm2
jbe 0x7d17
cmpb %r14b, %dl
jge 0x7d17
movsbl %dl, %eax
movq 0xe0(%rsp), %rcx
subl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movapd %xmm3, %xmm2
divsd %xmm0, %xmm2
testb %r14b, %r14b
jle 0x7f5a
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
xorl %eax, %eax
cmpb $0x0, (%rsi,%rcx)
jne 0x7d46
cmpb $0x0, (%rdi,%rcx)
jne 0x7d46
movsd (%r12,%rcx,8), %xmm1
ucomisd %xmm1, %xmm2
jbe 0x7d46
incl %eax
addsd %xmm1, %xmm0
incq %rcx
cmpq %rcx, %r8
jne 0x7d28
testl %eax, %eax
je 0x7e28
testb %r14b, %r14b
jle 0x7f5a
movsbl %dl, %ecx
movsbl %r9b, %edx
addl %ecx, %edx
addl %eax, %edx
movq 0xe0(%rsp), %rax
subl %edx, %eax
subsd %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm3
xorl %ebx, %ebx
cmpb $0x0, (%rsi,%rbx)
jne 0x7dba
cmpb $0x0, (%rdi,%rbx)
jne 0x7dba
movsd (%r12,%rbx,8), %xmm0
ucomisd %xmm0, %xmm2
movapd %xmm0, %xmm1
subsd %xmm3, %xmm1
ja 0x7dab
ucomisd %xmm1, %xmm1
jp 0x7dc7
cmpltsd %xmm2, %xmm0
andnpd %xmm1, %xmm0
movlpd %xmm0, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r8
jne 0x7d85
jmp 0x7f5a
movq 0x3720a(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
movl $0x18, %esi
movl $0x1, %edx
leaq 0x2bca1(%rip), %rdi     # 0x33a83
movsd %xmm3, (%rsp)
movapd %xmm2, 0x90(%rsp)
callq 0x4480
movapd 0x90(%rsp), %xmm2
movsd (%rsp), %xmm3
movq 0x88(%rsp), %r8
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdi
movsd (%r12,%rbx,8), %xmm0
movapd %xmm0, %xmm1
subsd %xmm3, %xmm1
jmp 0x7dab
testb %r14b, %r14b
jle 0x7f5a
xorl %ebx, %ebx
movsd %xmm3, (%rsp)
movapd %xmm2, 0x90(%rsp)
cmpb $0x0, (%rsi,%rbx)
movapd %xmm2, %xmm1
je 0x7e4f
xorpd %xmm1, %xmm1
testb %bpl, %bpl
jne 0x7e58
xorpd %xmm1, %xmm1
movsd (%r12,%rbx,8), %xmm0
subsd %xmm1, %xmm0
ucomisd %xmm0, %xmm0
jp 0x7ea6
movsd %xmm0, (%r12,%rbx,8)
cmpb $0x0, (%rdi,%rbx)
xorpd %xmm4, %xmm4
jne 0x7e89
movapd %xmm3, %xmm1
cmpltsd %xmm4, %xmm1
andpd %xmm2, %xmm1
movapd %xmm1, %xmm4
subsd %xmm4, %xmm0
ucomisd %xmm0, %xmm0
jp 0x7f00
movsd %xmm0, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r8
jne 0x7e41
jmp 0x7f5a
movq 0x3712b(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
movl $0x18, %esi
movl $0x1, %edx
leaq 0x2bbc2(%rip), %rdi     # 0x33a83
movsd %xmm1, 0x28(%rsp)
callq 0x4480
movapd 0x90(%rsp), %xmm2
movsd (%rsp), %xmm3
movq 0x88(%rsp), %r8
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdi
movsd (%r12,%rbx,8), %xmm0
subsd 0x28(%rsp), %xmm0
jmp 0x7e68
movq 0x370d1(%rip), %rax     # 0x3efd8
movq (%rax), %rcx
movl $0x18, %esi
movl $0x1, %edx
leaq 0x2bb68(%rip), %rdi     # 0x33a83
movsd %xmm4, 0x28(%rsp)
callq 0x4480
movapd 0x90(%rsp), %xmm2
movsd (%rsp), %xmm3
movq 0x88(%rsp), %r8
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdi
movsd (%r12,%rbx,8), %xmm0
subsd 0x28(%rsp), %xmm0
jmp 0x7e93
movq 0x188(%rsp), %rdx
incl %edx
cmpl $0x64, %edx
jne 0x7a75
leaq 0x178(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x2cd07(%rip), %rdx     # 0x34c87
leaq 0x168(%rsp), %rdi
movq %rdx, %rsi
callq 0xa7c0
leaq 0xd0(%rsp), %rax
testb %r14b, %r14b
jle 0x824f
leaq 0x68(%rsp), %r15
movq 0xe0(%rsp), %rcx
leal -0x1(%rcx), %eax
leaq 0xb0(%rsp), %r12
cltq
movq %rax, (%rsp)
movl %ecx, %eax
movq %rax, 0x90(%rsp)
xorl %ebx, %ebx
leaq 0x38(%rsp), %r14
leaq 0x8(%rsp), %r13
leaq 0xa0(%rsp), %rbp
movq 0x140(%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %r14, %rdi
movq 0x36fc7(%rip), %rsi     # 0x3efc0
leaq 0x2bbc2(%rip), %rcx     # 0x33bc2
movb $0x1, %al
callq 0xa60d
movl $0x5, %ecx
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x4230
movq 0x168(%rsp), %rcx
movq 0x170(%rsp), %r8
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r15, 0x58(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8058
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x8061
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, 0xa0(%rsp)
movl $0x2, %esi
movq %rbp, %rdi
movl $0x2d, %edx
callq 0x4280
cmpq (%rsp), %rbx
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0xa0(%rsp), %rdi
movl $0x2, %esi
callq 0xa753
movq 0x58(%rsp), %rcx
movl $0xf, %edi
cmpq %r15, %rcx
je 0x80ca
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %r8
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x80ff
movl $0xf, %edi
cmpq %r12, %rsi
je 0x80fa
movq 0xb0(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x810b
leaq 0x58(%rsp), %rdi
callq 0x40d0
jmp 0x8117
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
leaq 0xd0(%rsp), %rsi
movq %rsi, 0xc0(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x8148
movq %rdx, 0xc0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd0(%rsp)
jmp 0x8150
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0xc8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x168(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x42c0
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x81b2
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0xd0(%rsp), %rax
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x81d7
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0xd0(%rsp), %rax
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x81f6
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0xd0(%rsp), %rax
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rcx
cmpq %rcx, %rdi
je 0x821a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0xd0(%rsp), %rax
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rcx
cmpq %rcx, %rdi
je 0x823e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0xd0(%rsp), %rax
incq %rbx
cmpq %rbx, 0x90(%rsp)
jne 0x7fdd
leaq 0xc0(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x2ca26(%rip), %rdx     # 0x34c87
movq %rdx, %rsi
callq 0xa7c0
cmpb $0x0, 0x34(%rsp)
jle 0x84f5
leaq 0x18(%rsp), %r15
movq 0xe0(%rsp), %rcx
leal -0x1(%rcx), %eax
leaq 0x100(%rsp), %r12
cltq
movq %rax, (%rsp)
movl %ecx, %eax
movq %rax, 0x90(%rsp)
xorl %r14d, %r14d
leaq 0xa0(%rsp), %r13
leaq 0x38(%rsp), %rbx
movq 0xe8(%rsp), %rax
movsd (%rax,%r14,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %r13, %rdi
movq 0x36cf7(%rip), %rsi     # 0x3efc0
leaq 0x2b8f2(%rip), %rcx     # 0x33bc2
movb $0x1, %al
callq 0xa60d
movl $0x5, %ecx
movq %rbx, %rdi
movq %r13, %rbp
movq %r13, %rsi
xorl %edx, %edx
callq 0x4230
movq 0xc0(%rsp), %rcx
movq 0xc8(%rsp), %r8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x832b
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x8334
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, 0xf0(%rsp)
movl $0x2, %esi
leaq 0xf0(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq (%rsp), %r14
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0xf0(%rsp), %rdi
movl $0x2, %esi
callq 0xa753
movq 0x8(%rsp), %rcx
movl $0xf, %edi
cmpq %r15, %rcx
je 0x83a2
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r8
movq 0xf0(%rsp), %rsi
movq 0xf8(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x83d7
movl $0xf, %edi
cmpq %r12, %rsi
je 0x83d2
movq 0x100(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x83e3
leaq 0x8(%rsp), %rdi
callq 0x40d0
jmp 0x83f4
leaq 0xf0(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
leaq 0x68(%rsp), %rsi
movq %rsi, 0x58(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x8419
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0x8421
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xc0(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x42c0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x846c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x8489
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x84a0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x84bc
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x84e1
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
incq %r14
cmpq %r14, 0x90(%rsp)
movq %rbp, %r13
jne 0x82ac
leaq 0x168(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
leaq 0x178(%rsp), %rcx
callq 0x4701
movq 0xe8(%rsp), %r12
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x88(%rsp), %r8
movl 0x34(%rsp), %r14d
testb %r14b, %r14b
jle 0x8ad0
leaq 0x48(%rsp), %r13
movq 0xe0(%rsp), %rcx
leal -0x1(%rcx), %eax
leaq 0x120(%rsp), %r14
leaq 0x18(%rsp), %r15
cltq
movq %rax, (%rsp)
movl %ecx, %eax
movq %rax, 0x90(%rsp)
xorl %eax, %eax
xorpd %xmm1, %xmm1
leaq 0xf0(%rsp), %rbp
movsd 0x2b368(%rip), %xmm2    # 0x338f0
leaq 0xa0(%rsp), %rbx
movsd (%r12,%rax,8), %xmm0
ucomisd %xmm0, %xmm1
ja 0x85af
ucomisd %xmm2, %xmm0
ja 0x85af
incq %rax
cmpq %r8, %rax
jne 0x8590
jmp 0x8ad0
movq %rax, 0x28(%rsp)
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x2c6bd(%rip), %rdx     # 0x34c87
movq %rdx, %rsi
callq 0xa7c0
xorl %r12d, %r12d
movq 0x140(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %rbp, %rdi
movq 0x369ce(%rip), %rsi     # 0x3efc0
leaq 0x2b5c9(%rip), %rcx     # 0x33bc2
movb $0x1, %al
callq 0xa60d
movl $0x5, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x4230
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %r8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r13, 0x38(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x864b
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x8655
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, 0x110(%rsp)
movl $0x2, %esi
leaq 0x110(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq (%rsp), %r12
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x110(%rsp), %rdi
movl $0x2, %esi
callq 0xa753
movq 0x38(%rsp), %rcx
movl $0xf, %edi
cmpq %r13, %rcx
je 0x86c3
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %r8
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x86f8
movl $0xf, %edi
cmpq %r14, %rsi
je 0x86f3
movq 0x120(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x8704
leaq 0x38(%rsp), %rdi
callq 0x40d0
jmp 0x8715
leaq 0x110(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x8735
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x873e
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x42c0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8781
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x879e
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x87b5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x87da
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x87ff
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
incq %r12
cmpq %r12, 0x90(%rsp)
jne 0x85d5
leaq 0x158(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x2c458(%rip), %rdx     # 0x34c87
movq %rdx, %rsi
callq 0xa7c0
xorl %r12d, %r12d
movq 0xe8(%rsp), %rax
movsd (%rax,%r12,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %rbp, %rdi
movq 0x36769(%rip), %rsi     # 0x3efc0
leaq 0x2b364(%rip), %rcx     # 0x33bc2
movb $0x1, %al
callq 0xa60d
movl $0x5, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x4230
movq 0x148(%rsp), %rcx
movq 0x150(%rsp), %r8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r13, 0x38(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x88b6
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0x88c0
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, 0x110(%rsp)
movl $0x2, %esi
leaq 0x110(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq (%rsp), %r12
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x110(%rsp), %rdi
movl $0x2, %esi
callq 0xa753
movq 0x38(%rsp), %rcx
movl $0xf, %edi
cmpq %r13, %rcx
je 0x892e
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %r8
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x8963
movl $0xf, %edi
cmpq %r14, %rsi
je 0x895e
movq 0x120(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x896f
leaq 0x38(%rsp), %rdi
callq 0x40d0
jmp 0x8980
leaq 0x110(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x89a0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x89a9
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x148(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x42c0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x89ef
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x8a0c
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x8a23
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8a48
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x8a6d
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
incq %r12
cmpq %r12, 0x90(%rsp)
jne 0x883a
leaq 0x58(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0x158(%rsp), %rdx
leaq 0x68(%rsp), %rcx
callq 0x4766
movq 0xe8(%rsp), %r12
movq 0x80(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x88(%rsp), %r8
movq 0x28(%rsp), %rax
xorpd %xmm1, %xmm1
movsd 0x2ae25(%rip), %xmm2    # 0x338f0
jmp 0x85a2
movq %rsi, %rbx
callq 0x42a0
movq %rbx, %rdi
callq 0x42a0
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8c14
jmp 0x8afe
jmp 0x8d81
movq %rax, %rbx
jmp 0x8dca
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r12, %rdi
je 0x8b2b
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8b2b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b47
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8b47
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x8b6d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8b6d
movq %rax, %rbx
jmp 0x8b92
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8b92
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x8c38
movq 0xd0(%rsp), %rsi
jmp 0x8c30
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x8bda
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8bda
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x8bf6
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8bf6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8c1c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8c1c
movq %rax, %rbx
jmp 0x8c38
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x8c38
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0x178(%rsp), %rax
movq 0x168(%rsp), %rdi
cmpq %rax, %rdi
je 0x8dca
movq 0x178(%rsp), %rsi
jmp 0x8dc2
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x8c83
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8c83
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x8c9f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8c9f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8cce
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8cce
movq %rax, %rbx
jmp 0x8cf3
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x8cf3
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x8dae
movq 0x158(%rsp), %rsi
jmp 0x8da6
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x8d43
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8d43
movq %rax, %rbx
jmp 0x8d5a
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x8d5a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8d89
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x8d89
movq %rax, %rbx
jmp 0x8dae
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x8dae
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x8dca
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4220
movq %rbx, %rdi
callq 0x4430