// File: /workspace/github_cpp_makefile_star2_O1/myudelson[P]hmm-scalable/utils.cpp
// Function: projectsimplex(double*, signed char)
void projectsimplex(NUMBER* ar, 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;
    NUMBER* ar_copy = Calloc(NUMBER, (size_t)size);
    memcpy(ar_copy, ar, sizeof(NUMBER)*(size_t)size);
    int iter = 0;
    while( !issimplex(ar, size) ) {
        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]*/0)?1:0;
            ar[i] = (at_lo[i]==1)?/*lb[i]*/0:ar[i];
            num_at_lo = (NPAR)( num_at_lo + at_lo[i] );
            
            at_hi[i] = (ar[i]>=/*ub[i]*/1)?1:0;
            ar[i] = (at_hi[i]==1)?/*ub[i]*/1:ar[i];
            num_at_hi = (NPAR)( num_at_hi + at_hi[i] );
            
            err += ar[i];
        }
        //		if (size > (num_at_hi + num_at_lo) )
        //			lambda = err / (size - (num_at_hi + num_at_lo));
        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++) {
                ar[i] -= (at_lo[i]==0 && err>0)?lambda:0;
                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 ) {
                    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 projectsimplex()! ar was %s and now is %s.\n",ar_was.c_str(),ar_is.c_str());
            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 $0x128, %rsp            # imm = 0x128
movl %esi, %r12d
movq %rdi, %r15
movslq %esi, %rbx
movl $0x1, %esi
movq %rbx, %rdi
callq 0x4130
movq %rax, %r14
movl $0x1, %esi
movq %rbx, %rdi
callq 0x4130
movq %rax, %rbp
movl $0x8, %esi
movq %rbx, %rdi
callq 0x4130
leaq (,%rbx,8), %rdx
movq %rax, 0x120(%rsp)
movq %rax, %rdi
movq %r15, %rsi
callq 0x41c0
movl %r12d, %r9d
movq %r14, %rdi
testb %r9b, %r9b
setle %r10b
movzbl %r9b, %r8d
leaq 0x58(%rsp), %r14
leal -0x1(%rbx), %eax
cltq
movq %rax, 0xd8(%rsp)
movl %ebx, %eax
movq %rax, 0x88(%rsp)
movq %rbp, %rbx
movsd 0x2df29(%rip), %xmm5    # 0x348f0
movapd 0x2df61(%rip), %xmm6    # 0x34930
movsd 0x2df21(%rip), %xmm7    # 0x348f8
movsd 0x2df08(%rip), %xmm8    # 0x348e8
xorpd %xmm9, %xmm9
leaq 0xb0(%rsp), %r12
leaq 0x68(%rsp), %rdx
xorl %r11d, %r11d
movq %rdi, 0x118(%rsp)
movq %rbp, 0x110(%rsp)
movq %r8, 0x108(%rsp)
movl %r9d, 0xd0(%rsp)
movb %r10b, 0x7(%rsp)
movl %r10d, %eax
movapd %xmm5, %xmm0
testb %r9b, %r9b
jle 0x6a70
movsd (%r15), %xmm1
movapd %xmm5, %xmm0
subsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm9
ja 0x6a70
ucomisd %xmm5, %xmm1
ja 0x6a70
movl $0x1, %ecx
movq %rcx, %rax
cmpq %rcx, %r8
je 0x6a6a
movsd (%r15,%rax,8), %xmm1
subsd %xmm1, %xmm0
ucomisd %xmm1, %xmm9
ja 0x6a6a
leaq 0x1(%rax), %rcx
ucomisd %xmm5, %xmm1
jbe 0x6a47
cmpq %r8, %rax
setae %al
testb %al, %al
je 0x6a82
andpd %xmm6, %xmm0
ucomisd %xmm0, %xmm7
ja 0x7226
movq %rdx, %rbp
testb %r9b, %r9b
jle 0x6ae5
xorl %ecx, %ecx
movapd %xmm8, %xmm0
xorl %eax, %eax
xorl %edx, %edx
movsd (%r15,%rcx,8), %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
setae %sil
setae (%rbx,%rcx)
jae 0x6ab1
movapd %xmm2, %xmm1
addb %sil, %dl
ucomisd %xmm5, %xmm1
movsd %xmm1, (%r15,%rcx,8)
setae (%rdi,%rcx)
setae %sil
movapd %xmm5, %xmm2
minsd %xmm1, %xmm2
movsd %xmm2, (%r15,%rcx,8)
addb %sil, %al
addsd %xmm2, %xmm0
incq %rcx
cmpq %rcx, %r8
jne 0x6a95
jmp 0x6aee
xorl %edx, %edx
xorl %eax, %eax
movapd %xmm8, %xmm0
ucomisd %xmm9, %xmm0
movsbl %dl, %ecx
jbe 0x6b10
cmpb %r9b, %dl
jge 0x6b10
movq 0x88(%rsp), %rdx
subl %ecx, %edx
xorps %xmm2, %xmm2
cvtsi2sd %edx, %xmm2
jmp 0x6b3f
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %dl
cmpb %r9b, %al
setl %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x6b47
movsbl %al, %edx
movq 0x88(%rsp), %rsi
subl %edx, %esi
xorps %xmm2, %xmm2
cvtsi2sd %esi, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
testb %r9b, %r9b
jle 0x6b7c
xorl %esi, %esi
xorpd %xmm2, %xmm2
xorl %edx, %edx
cmpb $0x0, (%rbx,%rsi)
jne 0x6b72
cmpb $0x0, (%rdi,%rsi)
jne 0x6b72
movsd (%r15,%rsi,8), %xmm3
ucomisd %xmm3, %xmm1
jbe 0x6b72
incl %edx
addsd %xmm3, %xmm2
incq %rsi
cmpq %rsi, %r8
jne 0x6b54
jmp 0x6b82
xorpd %xmm2, %xmm2
xorl %edx, %edx
testl %edx, %edx
je 0x6be4
testb %r9b, %r9b
jle 0x6c43
movsbl %al, %eax
addl %eax, %ecx
addl %edx, %ecx
movq 0x88(%rsp), %rax
subl %ecx, %eax
subsd %xmm2, %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm0
xorl %eax, %eax
cmpb $0x0, (%rbx,%rax)
jne 0x6bda
cmpb $0x0, (%rdi,%rax)
jne 0x6bda
movsd (%r15,%rax,8), %xmm2
movapd %xmm2, %xmm3
subsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andnpd %xmm3, %xmm2
movlpd %xmm2, (%r15,%rax,8)
incq %rax
cmpq %rax, %r8
jne 0x6bb1
jmp 0x6c43
testb %r9b, %r9b
jle 0x6c43
xorl %eax, %eax
cmpb $0x0, (%rbx,%rax)
xorpd %xmm2, %xmm2
movapd %xmm1, %xmm3
je 0x6bfd
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
cmpltsd %xmm0, %xmm4
andpd %xmm3, %xmm4
movsd (%r15,%rax,8), %xmm3
subsd %xmm4, %xmm3
movsd %xmm3, (%r15,%rax,8)
cmpb $0x0, (%rdi,%rax)
jne 0x6c31
movapd %xmm0, %xmm4
cmpltsd %xmm2, %xmm4
andpd %xmm1, %xmm4
movapd %xmm4, %xmm2
subsd %xmm2, %xmm3
movsd %xmm3, (%r15,%rax,8)
incq %rax
cmpq %rax, %r8
jne 0x6beb
incl %r11d
cmpl $0x64, %r11d
movq %rbp, %rdx
jne 0x6a1a
movl %r11d, 0x104(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0x2ef2d(%rip), %rdx     # 0x35ba7
movq %rdx, %rsi
callq 0xa7c0
cmpb $0x0, 0xd0(%rsp)
jle 0x6ed7
xorl %ebx, %ebx
movq 0x120(%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %r12, %rdi
movq 0x39312(%rip), %rsi     # 0x3ffc0
leaq 0x2de7d(%rip), %rcx     # 0x34b32
movb $0x1, %al
callq 0xa610
movl $0x5, %ecx
movq %r12, %rsi
movq %rbp, %r12
movq %rbp, %rdi
movq %rsi, %r13
xorl %edx, %edx
callq 0x4230
movq 0xe0(%rsp), %rcx
movq 0xe8(%rsp), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6d13
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x6d1c
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq %r13, %r12
leaq 0x8(%rsp), %rdi
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x2, %esi
movl $0x2d, %edx
callq 0x4280
cmpq 0xd8(%rsp), %rbx
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x8(%rsp), %rdi
movl $0x2, %esi
callq 0xa752
movq 0x48(%rsp), %rcx
movl $0xf, %esi
cmpq %r14, %rcx
je 0x6d8d
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x6dbb
movl $0xf, %esi
leaq 0x18(%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x6db6
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x6dcc
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x40d0
jmp 0x6dda
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
leaq 0x38(%rsp), %rsi
movq %rsi, 0x28(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x6dff
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x6e07
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xe0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x42c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x6e52
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6e6e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x6e85
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x6ea1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x6ec6
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
incq %rbx
cmpq %rbx, 0x88(%rsp)
jne 0x6c92
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x28(%rsp), %rdi
leaq 0x2ecba(%rip), %rdx     # 0x35ba7
movq %rdx, %rsi
callq 0xa7c0
cmpb $0x0, 0xd0(%rsp)
jle 0x7160
xorl %ebx, %ebx
movsd (%r15,%rbx,8), %xmm0
movl $0x148, %edx            # imm = 0x148
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq 0x390a1(%rip), %rsi     # 0x3ffc0
leaq 0x2dc0c(%rip), %rcx     # 0x34b32
movb $0x1, %al
callq 0xa610
movl $0x5, %ecx
movq %r12, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x4230
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
leaq 0x78(%rsp), %rsi
movq %rsi, 0x68(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6f7d
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x6f85
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movl $0x2, %esi
leaq 0x90(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq 0xd8(%rsp), %rbx
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x90(%rsp), %rdi
movl $0x2, %esi
callq 0xa752
movq 0x68(%rsp), %rcx
movl $0xf, %esi
leaq 0x78(%rsp), %rax
cmpq %rax, %rcx
je 0x7004
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %r8
movq 0x98(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x703e
movl $0xf, %esi
leaq 0xa0(%rsp), %rdi
cmpq %rdi, 0x90(%rsp)
je 0x7039
movq 0xa0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x7050
movq 0x90(%rsp), %rsi
movq %rbp, %rdi
callq 0x40d0
jmp 0x7061
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x7081
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x708a
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x42c0
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x70cd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x70f2
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x710e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7133
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x714f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
incq %rbx
cmpq %rbx, 0x88(%rsp)
jne 0x6f05
movq 0x38e71(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
movq 0xe0(%rsp), %rdx
movq 0x28(%rsp), %rcx
leaq 0x2d7d2(%rip), %rsi     # 0x34950
xorl %eax, %eax
callq 0x4330
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x71a1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
movq 0x110(%rsp), %rbx
je 0x71ce
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4220
movl 0x104(%rsp), %r11d
cmpl $0x64, %r11d
movq 0x118(%rsp), %rdi
movq 0x108(%rsp), %r8
movl 0xd0(%rsp), %r9d
movb 0x7(%rsp), %r10b
movsd 0x2d6f1(%rip), %xmm5    # 0x348f0
movapd 0x2d729(%rip), %xmm6    # 0x34930
movsd 0x2d6e9(%rip), %xmm7    # 0x348f8
movsd 0x2d6d0(%rip), %xmm8    # 0x348e8
xorpd %xmm9, %xmm9
movq %rbp, %rdx
jne 0x6a1a
testb %r9b, %r9b
jle 0x778a
leaq -0x1(%r8), %rax
movq %rax, 0xd8(%rsp)
xorl %eax, %eax
xorpd %xmm1, %xmm1
leaq 0xb0(%rsp), %rbp
leaq 0x68(%rsp), %r12
movsd 0x2d69a(%rip), %xmm2    # 0x348f0
movsd (%r15,%rax,8), %xmm0
ucomisd %xmm0, %xmm1
ja 0x7275
ucomisd %xmm2, %xmm0
ja 0x7275
incq %rax
cmpq %r8, %rax
jne 0x7256
jmp 0x778a
movq %rax, 0xd0(%rsp)
leaq 0x38(%rsp), %rbx
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0x2e906(%rip), %rdx     # 0x35ba7
movq %rdx, %rsi
callq 0xa7c0
xorl %r13d, %r13d
movq 0x120(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %rbp, %rdi
movq 0x38cf7(%rip), %rsi     # 0x3ffc0
leaq 0x2d862(%rip), %rcx     # 0x34b32
movb $0x1, %al
callq 0xa610
movl $0x5, %ecx
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x4230
movq 0xe0(%rsp), %rcx
movq 0xe8(%rsp), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7328
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x7331
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x2, %esi
leaq 0x8(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq 0xd8(%rsp), %r13
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x8(%rsp), %rdi
movl $0x2, %esi
callq 0xa752
movq 0x48(%rsp), %rcx
movl $0xf, %esi
cmpq %r14, %rcx
je 0x739f
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x73cd
movl $0xf, %esi
leaq 0x18(%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x73c8
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x73de
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x40d0
jmp 0x73ec
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %rbx, 0x28(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x740c
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x7414
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xe0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x42c0
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x745a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7476
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x748d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x74a9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x74ce
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
incq %r13
cmpq %r13, 0x88(%rsp)
jne 0x72ac
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x2e6a9(%rip), %rdx     # 0x35ba7
movq %rdx, %rsi
callq 0xa7c0
xorl %r13d, %r13d
movsd (%r15,%r13,8), %xmm0
movl $0x148, %edx            # imm = 0x148
movq %rbp, %rdi
movq 0x38aa2(%rip), %rsi     # 0x3ffc0
leaq 0x2d60d(%rip), %rcx     # 0x34b32
movb $0x1, %al
callq 0xa610
movl $0x5, %ecx
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x4230
movq 0x90(%rsp), %rcx
movq 0x98(%rsp), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %r14, 0x48(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x757d
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x7586
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x2, %esi
leaq 0x8(%rsp), %rdi
movl $0x2d, %edx
callq 0x4280
cmpq 0xd8(%rsp), %r13
movl $0x20, %edx
movl $0x2c, %eax
cmovll %eax, %edx
movq 0x8(%rsp), %rdi
movl $0x2, %esi
callq 0xa752
movq 0x48(%rsp), %rcx
movl $0xf, %esi
cmpq %r14, %rcx
je 0x75f4
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x7622
movl $0xf, %esi
leaq 0x18(%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x761d
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x7633
movq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x40d0
jmp 0x7641
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4260
movq %rbx, 0x28(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x7661
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x7669
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x42c0
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0x76af
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x76cb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x76e2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x76fe
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7723
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
incq %r13
cmpq %r13, 0x88(%rsp)
jne 0x7509
leaq 0xe0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0xf0(%rsp), %rcx
callq 0x461b
movq 0x118(%rsp), %rdi
movq 0x110(%rsp), %rbx
movq 0x108(%rsp), %r8
movq 0xd0(%rsp), %rax
xorpd %xmm1, %xmm1
movsd 0x2d16b(%rip), %xmm2    # 0x348f0
jmp 0x7268
callq 0x42a0
movq %rbx, %rdi
callq 0x42a0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x799b
jmp 0x77b5
jmp 0x799b
movq %rax, %rbx
jmp 0x79ed
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x77ef
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x77ef
movq %rax, %rbx
jmp 0x780b
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq 0x68(%rsp), %rdi
cmpq %rax, %rdi
je 0x780b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7835
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x7835
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7856
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x7856
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x79c8
movq 0x38(%rsp), %rsi
jmp 0x79c0
jmp 0x793d
jmp 0x7963
jmp 0x795e
jmp 0x799b
jmp 0x79a0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x78b0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x78b0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x78cc
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x78cc
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq 0x68(%rsp), %rdi
cmpq %rax, %rdi
je 0x78f2
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x78f2
movq %rax, %rbx
jmp 0x7917
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x7917
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x79c8
movq 0xa0(%rsp), %rsi
jmp 0x79c0
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7966
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x7966
movq %rax, %rbx
jmp 0x797d
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x797d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4220
leaq 0x78(%rsp), %rax
movq 0x68(%rsp), %rdi
cmpq %rax, %rdi
je 0x79a3
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4220
jmp 0x79a3
movq %rax, %rbx
jmp 0x79c8
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x79c8
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4220
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x79ed
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4220
movq %rbx, %rdi
callq 0x4430