// File: /workspace/github_cpp_makefile_star2_O2/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 $0x168, %rsp            # imm = 0x168
movl %ecx, %ebp
movq %rdx, 0xd8(%rsp)
movq %rsi, 0xd0(%rsp)
movq %rdi, %r13
movslq %ecx, %r14
pushq $0x1
popq %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4120
movq %rax, 0x28(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4120
movq %rax, 0x48(%rsp)
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x4120
leaq (,%r14,8), %rdx
movq %rax, 0x68(%rsp)
movq %rax, %rdi
movq %r13, %rsi
callq 0x41c0
xorl %r12d, %r12d
movl %ebp, 0xc(%rsp)
testb %bpl, %bpl
cmovlel %r12d, %r14d
movslq %r14d, %rbp
leaq 0x26c64(%rip), %r14     # 0x2ca6b
pushq $0x17
popq %r15
cmpq %r12, %rbp
je 0x5e3c
movsd (%r13,%r12,8), %xmm0
ucomisd %xmm0, %xmm0
jp 0x5e22
incq %r12
jmp 0x5e0b
movq 0x331af(%rip), %rax     # 0x38fd8
movq (%rax), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x44b0
jmp 0x5e1d
movsbl 0xc(%rsp), %r12d
xorl %r14d, %r14d
movq 0x48(%rsp), %r15
movq %rbp, 0x50(%rsp)
movq %r13, 0x20(%rsp)
movq %r12, 0x58(%rsp)
movq %r13, %rdi
movq 0xd0(%rsp), %rbp
movq %rbp, %rsi
movq 0xd8(%rsp), %rbx
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x5424
testb %al, %al
jne 0x6316
movq %r14, 0xe0(%rsp)
xorl %r12d, %r12d
movq %rbx, %r14
xorl %esi, %esi
movsd 0x26a4e(%rip), %xmm3    # 0x2c8e8
xorl %edx, %edx
cmpq %r12, 0x50(%rsp)
je 0x5fc0
movsd (%r13), %xmm0
movsd (%rbp), %xmm1
ucomisd %xmm0, %xmm1
setae %cl
setae (%r15,%r12)
movapd %xmm1, %xmm2
jae 0x5ec8
movapd %xmm0, %xmm2
ucomisd %xmm2, %xmm2
jp 0x5f22
movsd %xmm2, (%r13)
ucomisd (%r14), %xmm2
setae %r15b
movq 0x28(%rsp), %rax
setae (%rax,%r12)
movq %r14, %rbx
jae 0x5eef
movq %r13, %rbx
movsd (%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x5f75
addb %cl, %sil
movsd %xmm0, (%r13)
addb %r15b, %dl
addsd %xmm0, %xmm3
incq %r12
addq $0x8, %r14
addq $0x8, %rbp
addq $0x8, %r13
movq 0x48(%rsp), %r15
jmp 0x5e9c
movb %cl, 0x30(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, %r15
movsd %xmm3, (%rsp)
ucomisd %xmm0, %xmm1
movq %rbp, %rbx
jae 0x5f3f
movq %r13, %rbx
movq 0x33092(%rip), %rax     # 0x38fd8
movq (%rax), %rcx
leaq 0x26b33(%rip), %rdi     # 0x2ca83
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x44b0
movsd (%rbx), %xmm2
movsd (%rsp), %xmm3
movq %r15, %rdx
movq 0x10(%rsp), %rsi
movb 0x30(%rsp), %cl
jmp 0x5ece
movq 0x3305c(%rip), %rax     # 0x38fd8
movb %cl, 0x30(%rsp)
movq (%rax), %rcx
leaq 0x26af9(%rip), %rdi     # 0x2ca83
movq %rsi, 0x10(%rsp)
pushq $0x18
popq %rsi
movq %rdx, 0x60(%rsp)
pushq $0x1
popq %rdx
movsd %xmm3, (%rsp)
callq 0x44b0
movb 0x30(%rsp), %cl
movq 0x10(%rsp), %rsi
movq 0x60(%rsp), %rdx
movsd (%rsp), %xmm3
movsd (%rbx), %xmm0
jmp 0x5ef9
ucomisd 0x26938(%rip), %xmm3    # 0x2c900
movsbl %dl, %ecx
movsbl %sil, %eax
jbe 0x5ffa
cmpb 0xc(%rsp), %sil
jge 0x5ffa
movq 0x58(%rsp), %r12
movl %r12d, %edx
subl %eax, %edx
cvtsi2sd %edx, %xmm0
movapd %xmm3, %xmm2
divsd %xmm0, %xmm2
movq 0x20(%rsp), %r13
movq 0x50(%rsp), %r14
jmp 0x602a
xorpd %xmm2, %xmm2
ucomisd %xmm3, %xmm2
movq 0x20(%rsp), %r13
movq 0x50(%rsp), %r14
movq 0x58(%rsp), %r12
jbe 0x602a
cmpb 0xc(%rsp), %dl
jge 0x602a
movl %r12d, %edx
subl %ecx, %edx
cvtsi2sd %edx, %xmm0
movapd %xmm3, %xmm2
divsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %edx, %edx
cmpq %rsi, %r14
je 0x6061
cmpb $0x0, (%r15,%rsi)
jne 0x605c
movq 0x28(%rsp), %rdi
cmpb $0x0, (%rdi,%rsi)
jne 0x605c
movsd (%r13,%rsi,8), %xmm1
ucomisd %xmm1, %xmm2
jbe 0x605c
incl %edx
addsd %xmm1, %xmm0
incq %rsi
jmp 0x6032
testl %edx, %edx
movapd %xmm2, 0x10(%rsp)
je 0x610e
subsd %xmm0, %xmm3
addl %ecx, %eax
addl %edx, %eax
movl %r12d, %ecx
subl %eax, %ecx
cvtsi2sd %ecx, %xmm0
divsd %xmm0, %xmm3
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x6203
cmpb $0x0, (%r15,%rbx)
jne 0x60cc
movq 0x28(%rsp), %rax
cmpb $0x0, (%rax,%rbx)
jne 0x60cc
movsd (%r13,%rbx,8), %xmm0
ucomisd %xmm0, %xmm2
movapd %xmm0, %xmm1
subsd %xmm3, %xmm1
ja 0x60bc
ucomisd %xmm1, %xmm1
jp 0x60d1
cmpltsd %xmm2, %xmm0
andnpd %xmm1, %xmm0
movlpd %xmm0, (%r13,%rbx,8)
incq %rbx
jmp 0x6086
movq 0x32f00(%rip), %rax     # 0x38fd8
movq (%rax), %rcx
leaq 0x269a1(%rip), %rdi     # 0x2ca83
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
movsd %xmm3, (%rsp)
callq 0x44b0
movapd 0x10(%rsp), %xmm2
movsd (%rsp), %xmm3
movsd (%r13,%rbx,8), %xmm0
movapd %xmm0, %xmm1
subsd %xmm3, %xmm1
jmp 0x60bc
xorl %ebx, %ebx
movsd %xmm3, (%rsp)
cmpq %rbx, %r14
je 0x6203
cmpb $0x0, (%r15,%rbx)
xorpd %xmm4, %xmm4
movapd %xmm2, %xmm1
je 0x6131
xorpd %xmm1, %xmm1
movsd (%r13,%rbx,8), %xmm0
cmpltsd %xmm3, %xmm4
andpd %xmm1, %xmm4
subsd %xmm4, %xmm0
ucomisd %xmm0, %xmm0
jp 0x6188
movsd %xmm0, (%r13,%rbx,8)
movq 0x28(%rsp), %rax
cmpb $0x0, (%rax,%rbx)
xorpd %xmm4, %xmm4
jne 0x6172
movapd %xmm3, %xmm1
cmpltsd %xmm4, %xmm1
andpd %xmm2, %xmm1
movapd %xmm1, %xmm4
subsd %xmm4, %xmm0
ucomisd %xmm0, %xmm0
jp 0x61c4
movsd %xmm0, (%r13,%rbx,8)
incq %rbx
jmp 0x6115
movq 0x32e49(%rip), %rax     # 0x38fd8
movq (%rax), %rcx
leaq 0x268ea(%rip), %rdi     # 0x2ca83
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
movapd %xmm4, 0x30(%rsp)
callq 0x44b0
movapd 0x10(%rsp), %xmm2
movsd (%rsp), %xmm3
movsd (%r13,%rbx,8), %xmm0
subsd 0x30(%rsp), %xmm0
jmp 0x614b
movq 0x32e0d(%rip), %rax     # 0x38fd8
movq (%rax), %rcx
leaq 0x268ae(%rip), %rdi     # 0x2ca83
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
movsd %xmm4, 0x30(%rsp)
callq 0x44b0
movapd 0x10(%rsp), %xmm2
movsd (%rsp), %xmm3
movsd (%r13,%rbx,8), %xmm0
subsd 0x30(%rsp), %xmm0
jmp 0x617c
movq 0xe0(%rsp), %r14
incl %r14d
cmpl $0x64, %r14d
jne 0x5e59
leaq 0x27a28(%rip), %rsi     # 0x2dc47
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x7dea
leal -0x1(%r12), %eax
xorl %r13d, %r13d
testl %r12d, %r12d
movl $0x0, %ecx
cmovgl %r12d, %ecx
movq %rcx, 0x10(%rsp)
cltq
movq %rax, (%rsp)
leaq 0x108(%rsp), %rbx
leaq 0x90(%rsp), %r14
leaq 0x128(%rsp), %r12
leaq 0xe8(%rsp), %rbp
leaq 0xb0(%rsp), %r15
cmpq %r13, 0x10(%rsp)
je 0x6590
movq 0x68(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
callq 0x7eb0
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
pushq $0x5
popq %rcx
callq 0x4240
movq %r12, %rdi
leaq 0x70(%rsp), %rsi
movq %r14, %rdx
callq 0x7e8c
cmpq (%rsp), %r13
pushq $0x20
popq %rsi
pushq $0x2c
popq %rax
cmovll %eax, %esi
movq %rbp, %rdi
callq 0x7ed3
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x7e25
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40f0
movq %rbp, %rdi
callq 0x40f0
movq %r12, %rdi
callq 0x40f0
movq %r14, %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x40f0
incq %r13
jmp 0x6278
leal -0x1(%r12), %eax
cltq
movq %rax, (%rsp)
movl %r12d, %eax
movq %rax, 0x10(%rsp)
leaq 0xb0(%rsp), %r13
leaq 0x128(%rsp), %r14
leaq 0xe8(%rsp), %rbx
leaq 0x108(%rsp), %r12
leaq 0x90(%rsp), %rbp
xorl %ecx, %ecx
cmpq 0x50(%rsp), %rcx
je 0x656c
movq 0x20(%rsp), %rax
movq %rcx, 0x60(%rsp)
movsd (%rax,%rcx,8), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x638b
ucomisd 0x26571(%rip), %xmm0    # 0x2c8f0
ja 0x638b
movq 0x60(%rsp), %rcx
incq %rcx
jmp 0x6353
leaq 0x70(%rsp), %rdi
leaq 0x278b0(%rip), %rsi     # 0x2dc47
movq %r13, %rdx
callq 0x7dea
xorl %r15d, %r15d
cmpq %r15, 0x10(%rsp)
je 0x6440
movq 0x68(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %r12, %rdi
callq 0x7eb0
movq %rbp, %rdi
movq %r12, %rsi
xorl %edx, %edx
pushq $0x5
popq %rcx
callq 0x4240
movq %r14, %rdi
leaq 0x70(%rsp), %rsi
movq %rbp, %rdx
callq 0x7e8c
cmpq (%rsp), %r15
pushq $0x20
popq %rsi
pushq $0x2c
popq %rax
cmovll %eax, %esi
movq %rbx, %rdi
callq 0x7ed3
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7e25
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x42b0
movq %r13, %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x40f0
movq %r14, %rdi
callq 0x40f0
movq %rbp, %rdi
callq 0x40f0
movq %r12, %rdi
callq 0x40f0
incq %r15
jmp 0x63a2
movq %r13, %rdi
leaq 0x277fd(%rip), %rsi     # 0x2dc47
movq %r14, %rdx
callq 0x7dea
xorl %ebp, %ebp
cmpq %rbp, 0x10(%rsp)
je 0x6523
movq 0x20(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %rbx, %rdi
callq 0x7eb0
leaq 0x90(%rsp), %r15
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
pushq $0x5
popq %rcx
callq 0x4240
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x7e8c
movq %rbp, %rax
movq %rbx, %rbp
movq %r13, %rbx
movq %rax, 0x30(%rsp)
cmpq (%rsp), %rax
pushq $0x20
popq %rsi
pushq $0x2c
popq %rax
cmovll %eax, %esi
leaq 0x148(%rsp), %r13
movq %r13, %rdi
callq 0x7ed3
movq %r14, %rdi
leaq 0x90(%rsp), %r15
movq %r15, %rsi
movq %r13, %rdx
callq 0x7e25
movq %rbx, %rdi
movq %r14, %rsi
callq 0x42b0
movq %r14, %rdi
callq 0x40f0
leaq 0x148(%rsp), %rdi
movq %rbx, %r13
callq 0x40f0
movq %r15, %rdi
callq 0x40f0
movq %r12, %rdi
callq 0x40f0
movq %rbp, %rbx
movq %rbp, %rdi
callq 0x40f0
movq 0x30(%rsp), %rbp
incq %rbp
jmp 0x6454
movq 0x32aae(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
movq 0x70(%rsp), %rdx
movq 0xb0(%rsp), %rcx
leaq 0x264dd(%rip), %rsi     # 0x2ca1e
xorl %eax, %eax
callq 0x4350
movq %r13, %rdi
callq 0x40f0
leaq 0x70(%rsp), %rdi
callq 0x40f0
movq 0x48(%rsp), %r15
leaq 0x90(%rsp), %rbp
jmp 0x6381
movq 0x28(%rsp), %rdi
callq 0x4290
movq %r15, %rdi
callq 0x4290
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x276b0(%rip), %rsi     # 0x2dc47
leaq 0xb0(%rsp), %rdi
leaq 0x128(%rsp), %rdx
callq 0x7dea
xorl %r13d, %r13d
leaq 0xe8(%rsp), %rbx
leaq 0x108(%rsp), %r14
leaq 0x90(%rsp), %r12
leaq 0x148(%rsp), %rbp
leaq 0x128(%rsp), %r15
cmpq %r13, 0x10(%rsp)
je 0x667b
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
callq 0x7eb0
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
pushq $0x5
popq %rcx
callq 0x4240
movq %r12, %rdi
leaq 0xb0(%rsp), %rsi
movq %r14, %rdx
callq 0x7e8c
cmpq (%rsp), %r13
pushq $0x20
popq %rsi
pushq $0x2c
popq %rax
cmovll %eax, %esi
movq %rbp, %rdi
callq 0x7ed3
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x7e25
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
callq 0x42b0
movq %r15, %rdi
callq 0x40f0
movq %rbp, %rdi
callq 0x40f0
movq %r12, %rdi
callq 0x40f0
movq %r14, %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x40f0
incq %r13
jmp 0x65d7
movq 0x32956(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
leaq 0x70(%rsp), %rbx
movq (%rbx), %rdx
leaq 0xb0(%rsp), %r14
movq (%r14), %rcx
leaq 0x263fd(%rip), %rsi     # 0x2ca9c
xorl %eax, %eax
callq 0x4350
movq %r14, %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x40f0
movq 0x48(%rsp), %r15
movq 0x58(%rsp), %r12
jmp 0x6321
jmp 0x677e
jmp 0x66d1
jmp 0x677e
movq %rax, %rbx
jmp 0x679d
jmp 0x66f3
jmp 0x6705
jmp 0x670a
jmp 0x6729
jmp 0x673b
jmp 0x6748
jmp 0x675a
jmp 0x675f
jmp 0x6783
jmp 0x677e
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x40f0
jmp 0x670d
movq %rax, %rbx
jmp 0x671a
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x40f0
leaq 0x108(%rsp), %rdi
callq 0x40f0
jmp 0x672c
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x40f0
jmp 0x673e
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0x678e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x40f0
jmp 0x6762
movq %rax, %rbx
jmp 0x676f
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x40f0
leaq 0x90(%rsp), %rdi
callq 0x40f0
jmp 0x6786
movq %rax, %rbx
jmp 0x6793
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x40f0
leaq 0x70(%rsp), %rdi
callq 0x40f0
movq %rbx, %rdi
callq 0x4450