// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/anchor.cpp
// Function: recalu_minimizer_bd(unsigned long, anchor1_t*, asg16_v*, long*, long*, long*, long*, long*, unsigned long, unsigned long, tiny_queue_t*, All_reads*, UC_Read*, char*, unsigned long, unsigned long)
uint64_t recalu_minimizer_bd(uint64_t rid, anchor1_t *z, asg16_v *sc, int64_t *iok, int64_t *ink, int64_t *ick, int64_t *str_s, int64_t *str_e, uint64_t mz_k, uint64_t mz_h, tiny_queue_t *tq, All_reads *rref, UC_Read *tu, char *qstr, uint64_t qs, uint64_t qe)
{
	int64_t id = z->srt>>33; char *str = NULL; uint64_t rpos, rspan;
	int64_t ok = *iok, nk = *ink, ck = *ick, cn = sc->n, s0, e0, s1, e1, si, ei, os, oe, ots, ote, ol, wo[2], wn[2], weo[2], wen[2], ovlp, len = Get_READ_LENGTH((*rref), id); uint16_t op, bq, bt; uint32_t cl;
	e0 = ((uint32_t)z->srt) + 1; s0 = e0 - z->other_off; s1 = e1 = si = ei = -1; weo[0] = weo[1] = wen[0] = wen[1] = -1; 
	if(e0 <= s0) return 0;

	///debug
	// ok = nk = ck = 0;

	if((ck < 0) || (ck > cn)) {//(*ck) == cn is allowed
        ck = ok = nk = 0;
    }

	// if(id == 1/**s0 == 10260 && e0 == 10334**/) {
	// 	fprintf(stderr, "\n\n-0-qk::%ld,\ttk::%ld,\tck::%ld,\ts0::%ld,\te0::%ld\n", ok, nk, ck, s0, e0);
	// }

	while (ck > 0 && ok >= s0) {///x -> t; y -> p; first insertion and then match/mismatch
        --ck;
        op = sc->a[ck]>>14;
        // ol = (((op == 1) || (op == 2))?(sc->a[ck]&(0xfff)):(sc->a[ck]&(0x3fff)));
		if((op == 2) || (op == 3)) {
            ol = sc->a[ck]&(0xfff);
        } else if(op == 1) {
            ol = sc->a[ck]&(0x3ff);
        } else {
            ol = sc->a[ck]&(0x3fff);
        }
        if(op != 2) ok -= ol;
        if(op != 3) nk -= ol;
    }

	// char cm[4]; cm[0] = 'M'; cm[1] = 'S'; cm[2] = 'I'; cm[3] = 'D';  
	// if(id == 1/**s0 == 10260 && e0 == 10334**/) {
	// 	fprintf(stderr, "-1-qk::%ld,\ttk::%ld,\tck::%ld\n", ok, nk, ck);
	// }
	while (ck < cn && ok < e0) { ///[s0, e0)
        wo[0] = ok; wn[0] = nk; 
        // ck = pop_trace_bp(sc, ck, &op, &b, &cl);
		ck = pop_trace_bp_f(sc, ck, &op, &bq, &bt, &cl);
        if(op != 2) ok += cl;
        if(op != 3) nk += cl;
        wo[1] = ok; wn[1] = nk;  

		os = ((s0 >= wo[0])? s0 : wo[0]);
		oe = ((e0 <= wo[1])? e0 : wo[1]);
		// os = MAX(s0, wo[0]); oe = MIN(e0, wo[1]);
        ovlp = ((oe>os)? (oe-os):0);
		// if(id == 1/**s0 == 10260 && e0 == 10334**/) {
		// 	fprintf(stderr, "%u%c(q::[%ld,%ld))(t::[%ld,%ld))(ck::%ld)\n", cl, cm[op], wo[0], wo[1], wn[0], wn[1], ck);
		// }

		if(op != 2) {
			if(!ovlp) continue;
		} else {///wo[0] == wo[1]
			if(wo[0] < s0 || wo[0] >= e0) continue;
		}

		if(op < 2) {
            ots = os - wo[0] + wn[0]; ote = oe - wo[0] + wn[0];
        } else {///op == 2: more y; p == 3: more x
            ots = wn[0]; ote = wn[1];
        } 

		if(s1 == -1) {
			s1 = ots;
			// if((op == 0) && (wn[1] > ots) && ((wn[0] < ots) || (ots == 0))) si = 1;
			if((op == 0) && (wo[1] > s0) && ((wo[0] < s0) || (s1 == 0))) si = 1;
		}
		
		e1 = ote;
		if((op == 0) && (wo[0] < e0) && ((wo[1] > e0) || (e1 == len))) ei = 1;

        if((op == 0) && (ovlp > 0) && (ovlp > weo[1] - weo[0])) {
			weo[0] = os; weo[1] = oe;
			wen[0] = ots; wen[1] = ote;
        }
    }

	while (ck < cn && ok <= e0) { ///[s0, e0)
        wo[0] = ok; wn[0] = nk; 
        // pop_trace_bp(sc, ck, &op, &b, &cl);
		pop_trace_bp_f(sc, ck, &op, &bq, &bt, &cl);
		if(op != 2) break;
		// ck = pop_trace_bp(sc, ck, &op, &b, &cl);
		ck = pop_trace_bp_f(sc, ck, &op, &bq, &bt, &cl);
        // if(op != 2) ok += cl;
        // if(op != 3) nk += cl;
		nk += cl;
        wo[1] = ok; wn[1] = nk;  

		// if(id == 1/**s0 == 10260 && e0 == 10334**/) {
		// 	fprintf(stderr, "%u%c(q::[%ld,%ld))(t::[%ld,%ld))(ck::%ld)\n", cl, cm[op], wo[0], wo[1], wn[0], wn[1], ck);
		// }

		if(wo[0] >= s0 && wo[0] <= e0) {
			ots = wn[0]; ote = wn[1];
			if(s1 == -1) s1 = ots;
			e1 = ote;
		}
    }

	assert(wen[1] <= len);
	assert(e1 <= len);

	*iok = ok; *ink = nk; *ick = ck; 
	if(e1 <= s1) return 0;
	rpos = rspan = ((uint64_t)-1);

	if(weo[0] == s0 && weo[1] == e0) {
		rpos = wen[1]-1; rspan = e0 - s0;
		/** 
		if(si == 1 && ei == 1) {
			z->srt >>= 32; z->srt <<= 32; z->srt |= ((uint64_t)(wen[1]-1));
			///debug
			// char sstr[256]; recover_UC_Read_sub_region(sstr, wen[0], wen[1] - wen[0], 0, rref, id);
			// if(recalu_minimizer0(sstr, wen[1] - wen[0], !(asm_opt.flag & HA_F_NO_HPC), mz_k, mz_h, tq, &rpos, &rspan) && (rpos + 1 == ((uint64_t)(wen[1] - wen[0]))) && (((uint64_t)(wen[1] - wen[0])) == rspan)) {
			// 	// fprintf(stderr, "-0-[M::%s]\n", __func__);
			// } else {
			// 	// if(((z->srt>>32)&1) == 0) {
			// 		fprintf(stderr, "-1-[M::%s]\trid::%lu\ttid::%ld\t%c\trg1::[%ld,%ld)\trg0::[%ld,%ld)\tspan::%ld\n", __func__, rid, id, "+-"[(z->srt>>32)&1], wen[0], wen[1], s0, e0, e0 - s0);
			// 		fprintf(stderr, "tstr::%.*s\n", ((uint32_t)(wen[1] - wen[0])), sstr);
			// 		fprintf(stderr, "qstr::%.*s\n", ((uint32_t)(qe - qs)), qstr + qs);
			// 		exit(1);
			// 	// }
			// }
			// if(rid == 3196 && id == 3199) fprintf(stderr, "-full-[M::%s]\n", __func__);
			return 1;
		} 
		**/
	} else {
		if(s1 >= (*str_s) && e1 <= (*str_e)) {
			str = tu->seq + s1 - (*str_s);
		} else {
			if(s1 >= (*str_s) && (s1 < (*str_e)) && (e1 > (*str_e))) {
				UC_Read_resize((*tu), (e1 - (*str_s))); 
				recover_UC_Read_sub_region(tu->seq + (*str_e) - (*str_s), (*str_e), e1 - (*str_e), 0, rref, id);
				str = tu->seq + s1 - (*str_s); (*str_e) = e1;
			} else {
				UC_Read_resize((*tu), (e1 - s1)); 
				recover_UC_Read_sub_region(tu->seq, s1, e1 - s1, 0, rref, id);
				str = tu->seq; (*str_s) = s1; (*str_e) = e1;
			}
		}

		if(recalu_minimizer0(str, e1 - s1, !(asm_opt.flag & HA_F_NO_HPC), mz_k, mz_h, tq, &rpos, &rspan)) {
			rpos += s1;
		}
	}

	if(rpos != ((uint64_t)-1) && rspan != ((uint64_t)-1)) {
        e0 = rpos + 1; s0 = e0 - rspan;
        if(!(asm_opt.flag & HA_F_NO_HPC)) {
			if(si == -1) {
				s0 -= hpc_minimizer_test(id, rref, tu, *str_s, *str_e, s0, len, 1, 8);
				assert(s0 >= 0 && s0 < len && s0 < e0);
			}

			if(ei == -1) {
				e0 += hpc_minimizer_test(id, rref, tu, *str_s, *str_e, e0-1, len, 0, 8);
				assert(e0 >= 0 && e0 < len && s0 < e0);
			}
        }
        
        rpos = e0 - 1; rspan = e0 - s0;
        if(rspan < 256) {
            z->srt >>= 32; z->srt <<= 32; z->srt |= rpos; z->other_off = rspan;
            return 1;
        }
    }
	/**
	if(recalu_minimizer0(str, e1 - s1, !(asm_opt.flag & HA_F_NO_HPC), mz_k, mz_h, tq, &rpos, &rspan)) {
		rpos += s1;
		z->srt >>= 32; z->srt <<= 32; z->srt |= rpos; z->other_off = rspan;
		// fprintf(stderr, "-1-[M::%s]\trid::%lu\ttid::%ld\t%c\trg1::[%ld,%ld)\trg0::[%ld,%ld)\tspan::%ld\n", __func__, rid, id, "+-"[(z->srt>>32)&1], s1, e1, s0, e0, e0 - s0);
		// if(rid == 3196 && id == 3199) fprintf(stderr, "-part-[M::%s]\n", __func__);
		return 1;
	}
	// fprintf(stderr, "-0-[M::%s]\trid::%lu\ttid::%ld\t%c\trg1::[%ld,%ld)\trg0::[%ld,%ld)\tspan::%ld\n", __func__, rid, id, "+-"[(z->srt>>32)&1], s1, e1, s0, e0, e0 - s0);
	**/

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl 0xc(%rsi), %r10d
testq %r10, %r10
je 0x132109
movq 0x108(%rsp), %rbx
movq %rsi, 0x70(%rsp)
movq (%rsi), %rax
movq %rax, %r12
shrq $0x21, %r12
movq (%r9), %rsi
movq (%rdx), %r11
incl %eax
movq %rax, 0x28(%rsp)
movq %rax, %r13
subq %r10, %r13
testq %rsi, %rsi
sets %al
cmpq %r11, %rsi
setg %bpl
xorl %edi, %edi
orb %al, %bpl
movq %rsi, %r15
cmovneq %rdi, %r15
movq 0x18(%rbx), %rbx
movq (%r8), %rax
cmovneq %rdi, %rax
cmoveq (%rcx), %rdi
testq %r15, %r15
movq %rdx, 0x18(%rsp)
movq %r10, 0x78(%rsp)
movq %r9, 0x90(%rsp)
movq %r8, 0x88(%rsp)
movq %rcx, 0x80(%rsp)
jle 0x131974
cmpq %r13, %rdi
jl 0x131974
movq 0x10(%rdx), %rcx
movl $0xfff, %r8d            # imm = 0xFFF
xorl %r9d, %r9d
movq %rbx, %rdx
movzwl -0x2(%rcx,%rsi,2), %ebp
movl %ebp, %r10d
shrl $0xe, %r10d
movl $0x3ff, %ebx            # imm = 0x3FF
cmpw $0x1, %r10w
je 0x13193c
movl $0x3fff, %ebx           # imm = 0x3FFF
testw %bp, %bp
cmovsl %r8d, %ebx
leaq -0x1(%rsi), %r15
andl %ebp, %ebx
cmpw $0x2, %r10w
movq %rbx, %r14
cmoveq %r9, %r14
subq %r14, %rdi
cmpw $0x3, %r10w
cmoveq %r9, %rbx
subq %rbx, %rax
cmpq $0x2, %rsi
jb 0x131977
movq %r15, %rsi
cmpq %r13, %rdi
jge 0x13191f
jmp 0x131977
movq %rbx, %rdx
movq %r13, 0x30(%rsp)
movq %r12, 0x98(%rsp)
movq (%rdx,%r12,8), %rdx
movq %rdx, 0x68(%rsp)
movq $-0x1, 0x58(%rsp)
movq $-0x1, 0x50(%rsp)
movq $-0x1, 0x20(%rsp)
movq $-0x1, 0x48(%rsp)
movq $-0x1, 0x40(%rsp)
movq $-0x1, 0x10(%rsp)
movq $-0x1, %rbx
movq %rdi, %rbp
movq %rax, %r13
movq %rdi, 0x38(%rsp)
cmpq %r11, %r15
jge 0x131c7d
cmpq 0x28(%rsp), %rbp
jge 0x131c7d
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rsi
movl %r15d, %ecx
movzwl (%rsi,%rcx,2), %r9d
movl %r9d, %r12d
shrl $0xe, %r12d
movw $0xffff, %cx            # imm = 0xFFFF
movw %cx, 0xc(%rsp)
movw %cx, 0xe(%rsp)
leal -0x2(%r12), %ecx
cmpl $0x2, %ecx
jae 0x131a28
movw $0xfff, %dx             # imm = 0xFFF
movw $0xc, %cx
leaq 0xc(%rsp), %rdi
jmp 0x131a4c
movw $0x3fff, %dx            # imm = 0x3FFF
testl %r12d, %r12d
je 0x131a5b
movl %r9d, %ecx
shrl $0xc, %ecx
andl $0x3, %ecx
movw %cx, 0xc(%rsp)
movw $0x3ff, %dx             # imm = 0x3FF
movw $0xa, %cx
leaq 0xe(%rsp), %rdi
movzwl %r9w, %r8d
shrl %cl, %r8d
andl $0x3, %r8d
movw %r8w, (%rdi)
movzwl %dx, %ecx
andl %r9d, %ecx
incl %r15d
cmpq %r15, %r11
jbe 0x131af2
movzwl 0xe(%rsp), %edx
movzwl 0xc(%rsp), %edi
movzwl (%rsi,%r15,2), %ebp
movl %ebp, %r8d
shrl $0xe, %r8d
cmpl %r12d, %r8d
jne 0x131af2
movzwl %r12w, %r8d
leal -0x2(%r8), %r10d
cmpl $0x2, %r10d
jae 0x131aa9
movl %ebp, %r14d
shrl $0xc, %r14d
andl $0x3, %r14d
andl $0xfff, %ebp            # imm = 0xFFF
jmp 0x131ab9
testl %r8d, %r8d
jne 0x131ac1
andl $0x3fff, %ebp           # imm = 0x3FFF
movw $0xffff, %r14w          # imm = 0xFFFF
movl $0xffff, %r8d           # imm = 0xFFFF
jmp 0x131add
movl %ebp, %r14d
shrl $0xc, %r14d
andl $0x3, %r14d
movl %ebp, %r8d
shrl $0xa, %r8d
andl $0x3, %r8d
andl $0x3ff, %ebp            # imm = 0x3FF
cmpl %edx, %r8d
jne 0x131af2
cmpw %r14w, %di
jne 0x131af2
addl %ebp, %ecx
incl %r15d
cmpq %r15, %r11
ja 0x131a77
cmpw $0x3, %r12w
je 0x131b67
movl %r15d, %r15d
movl %ecx, %edi
leaq (%rdi,%r13), %rsi
cmpw $0x2, %r12w
movq 0x38(%rsp), %rbp
jne 0x131b87
movq %rsi, %r13
cmpq 0x30(%rsp), %rbp
jl 0x1319d5
movq %rbp, %rcx
movq %rax, %r13
movq %rbp, %rdi
movq %rbp, %r12
xorl %edx, %edx
movq %rcx, %rax
subq %rbp, %rax
movq %r12, %r8
subq %rbp, %r8
addq %r13, %r8
addq %r13, %rax
testw %r9w, %r9w
cmovnsq %r8, %r13
movq %rsi, %r10
cmovnsq %rax, %r10
movq %r10, 0x10(%rsp)
movzwl %r9w, %r9d
cmpq $-0x1, %rbx
je 0x131bc5
movq %rbx, %r13
movq 0x20(%rsp), %rbx
jmp 0x131bfb
movzwl 0xc(%rsp), %eax
movw %ax, 0xe(%rsp)
movw $0xffff, 0xc(%rsp)      # imm = 0xFFFF
movl %r15d, %r15d
movl %ecx, %edi
movq %r13, %rax
movq 0x38(%rsp), %rbp
jmp 0x131b8a
movq %rsi, %rax
addq %rbp, %rdi
movq 0x30(%rsp), %rcx
cmpq %rbp, %rcx
movq %rbp, %r12
cmovgq %rcx, %r12
movq 0x28(%rsp), %rdx
cmpq %rdi, %rdx
movq %rdi, %rcx
cmovlq %rdx, %rcx
movq %rcx, %rdx
subq %r12, %rdx
jle 0x1319ca
movq %rax, %rsi
je 0x1319ca
jmp 0x131b2a
cmpl $0x3fff, %r9d           # imm = 0x3FFF
ja 0x131b5d
movq 0x30(%rsp), %r10
cmpq %r10, %rdi
movq 0x20(%rsp), %rbx
jle 0x131bfb
testq %r8, %r8
movq 0x40(%rsp), %r8
movl $0x1, %r14d
cmoveq %r14, %r8
cmpq %r10, %rbp
cmovlq %r14, %r8
movq %r8, 0x40(%rsp)
movq 0x10(%rsp), %r8
cmpq 0x68(%rsp), %r8
movq 0x48(%rsp), %r10
movq %r10, %r8
movl $0x1, %r14d
cmoveq %r14, %r8
cmpq 0x28(%rsp), %rdi
cmovgq %r14, %r8
cmpl $0x4000, %r9d           # imm = 0x4000
setb %r9b
cmovbq %r8, %r10
movq %r10, 0x48(%rsp)
testq %rdx, %rdx
setg %r8b
movq %rbx, %r10
movq 0x50(%rsp), %r14
subq %r14, %r10
cmpq %r10, %rdx
setg %dl
andb %r8b, %dl
testb %dl, %r9b
cmovneq %rcx, %rbx
movq %rbx, 0x20(%rsp)
cmovneq %r12, %r14
movq %r14, 0x50(%rsp)
movq 0x58(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x58(%rsp)
movq %r13, %rbx
movq %rsi, %rax
jmp 0x1319ca
cmpq %r11, %r15
jge 0x131e0f
cmpq 0x28(%rsp), %rbp
jg 0x131e0f
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movl %r15d, %ecx
movzwl (%rax,%rcx,2), %r14d
movl %r14d, %r12d
shrl $0xe, %r12d
movw $0xffff, %cx            # imm = 0xFFFF
movw %cx, 0xc(%rsp)
movw %cx, 0xe(%rsp)
movw $0xc, %cx
leal -0x2(%r12), %esi
leaq 0xc(%rsp), %rdx
cmpl $0x2, %esi
jb 0x131ce6
testl %r12d, %r12d
je 0x131cf1
movl %r14d, %ecx
shrl $0xc, %ecx
andl $0x3, %ecx
movw %cx, 0xc(%rsp)
movw $0xa, %cx
leaq 0xe(%rsp), %rdx
movl %r14d, %esi
shrl %cl, %esi
andl $0x3, %esi
movw %si, (%rdx)
movq %rbx, 0x18(%rsp)
leal 0x1(%r15), %ecx
cmpq %rcx, %r11
jbe 0x131d73
movzwl 0xe(%rsp), %edi
movzwl 0xc(%rsp), %r9d
leal 0x2(%r15), %esi
movzwl %r12w, %edx
leal -0x2(%rdx), %ebp
movq %rcx, %r8
movzwl (%rax,%r8,2), %r10d
movl %r10d, %r8d
shrl $0xe, %r8d
cmpw %r12w, %r8w
jne 0x131d73
movl $0xffff, %r8d           # imm = 0xFFFF
cmpl $0x2, %ebp
jae 0x131d42
shrl $0xc, %r10d
andl $0x3, %r10d
movl %r10d, %ebx
jmp 0x131d5e
movw $0xffff, %bx            # imm = 0xFFFF
testl %edx, %edx
je 0x131d5e
movl %r10d, %ebx
shrl $0xc, %ebx
andl $0x3, %ebx
shrl $0xa, %r10d
andl $0x3, %r10d
movl %r10d, %r8d
cmpl %edi, %r8d
jne 0x131d73
cmpw %bx, %r9w
jne 0x131d73
movl %esi, %r8d
incl %esi
cmpq %r8, %r11
ja 0x131d18
cmpw $0x2, %r12w
jne 0x131e17
movl %r14d, %edx
shrl $0xc, %edx
andl $0x3, %edx
andl $0xfff, %r14d           # imm = 0xFFF
movw $0xffff, 0xe(%rsp)      # imm = 0xFFFF
movw %dx, 0xc(%rsp)
cmpq %rcx, %r11
movq 0x18(%rsp), %rbx
movq 0x38(%rsp), %rbp
jbe 0x131dd9
movzwl (%rax,%rcx,2), %esi
movl %esi, %edi
andl $0xc000, %edi           # imm = 0xC000
negw %di
jno 0x131dd7
movl %esi, %edi
shrl $0xc, %edi
andl $0x3, %edi
cmpw %di, %dx
jne 0x131dd7
andl $0xfff, %esi            # imm = 0xFFF
addl %esi, %r14d
incl %ecx
cmpq %rcx, %r11
ja 0x131da9
movl %ecx, %ecx
movl %r14d, %edx
addq %r13, %rdx
cmpq $-0x1, %rbx
cmovneq %rbx, %r13
cmpq 0x30(%rsp), %rbp
cmovgeq %r13, %rbx
movq 0x10(%rsp), %rsi
cmovgeq %rdx, %rsi
movq %rsi, 0x10(%rsp)
movq %rdx, %r13
movq %rcx, %r15
cmpq %rcx, %r11
jg 0x131c9a
jmp 0x131e27
movq %r15, %rcx
movq %r13, %rdx
jmp 0x131e27
movq %r15, %rcx
movq %r13, %rdx
movq 0x18(%rsp), %rbx
movq 0x38(%rsp), %rbp
movq 0x68(%rsp), %r13
movq 0x58(%rsp), %rsi
cmpq %r13, %rsi
jg 0x13218e
movq 0x10(%rsp), %r10
cmpq %r13, %r10
movq 0x98(%rsp), %r12
jg 0x1321ad
movq 0x80(%rsp), %rax
movq %rbp, (%rax)
movq 0x88(%rsp), %rax
movq %rdx, (%rax)
movq 0x90(%rsp), %rax
movq %rcx, (%rax)
movq %r10, %r15
subq %rbx, %r15
jle 0x132109
movq $-0x1, %rax
movq %rax, 0x60(%rsp)
movq %rax, 0xa0(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x131ebe
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x131ebe
decq %rsi
movq 0x78(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rsi, %rbx
jmp 0x13203a
movq 0xe0(%rsp), %rbp
movq (%rbp), %rcx
cmpq %rcx, %rbx
jge 0x131f01
movq %rbx, %rbp
movq 0x110(%rsp), %rbx
movq (%rbx), %rdi
cmpq %r15, 0x10(%rbx)
jge 0x131f9f
movq %r15, %rsi
movq %rbx, %r14
callq 0x2370
movq %rax, %rdi
movq %rax, (%rbx)
movq %r15, 0x10(%rbx)
jmp 0x131fa2
movq 0xe8(%rsp), %rax
movq (%rax), %rsi
cmpq %rsi, %r10
jle 0x131fdd
cmpq %rsi, %rbx
jge 0x131ecf
movq %rbx, 0x18(%rsp)
movq 0x110(%rsp), %rbx
movq (%rbx), %rdi
movq %r10, %rax
subq %rcx, %rax
cmpq %rax, 0x10(%rbx)
jge 0x131f62
movq %rax, %rsi
callq 0x2370
movq 0x10(%rsp), %r10
movq %rax, %rdi
movq %rax, (%rbx)
movq (%rbp), %rcx
movq %r10, %rax
subq %rcx, %rax
movq %rax, 0x10(%rbx)
movq 0xe8(%rsp), %r14
movq (%r14), %rsi
addq %rsi, %rdi
subq %rcx, %rdi
movq %r10, %rdx
subq %rsi, %rdx
xorl %ecx, %ecx
movq 0x108(%rsp), %r8
movq %r12, %r9
movq %r10, %r14
callq 0x32ef8
movq (%rbx), %rdi
movq 0x18(%rsp), %rbx
addq %rbx, %rdi
subq (%rbp), %rdi
movq 0xe8(%rsp), %rax
movq %r14, (%rax)
jmp 0x131fee
movq %rbx, %r14
movq %rbp, %rbx
movq %rbp, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movq 0x108(%rsp), %r8
movq %r12, %r9
callq 0x32ef8
movq (%r14), %rdi
movq 0xe0(%rsp), %rax
movq %rbp, (%rax)
movq 0xe8(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x131fee
movq 0x110(%rsp), %rax
movq (%rax), %rdi
addq %rbx, %rdi
subq %rcx, %rdi
leaq 0x163763(%rip), %rax    # 0x295758
movl (%rax), %edx
notl %edx
andl $0x1, %edx
leaq 0x60(%rsp), %rax
leaq 0xa0(%rsp), %r14
movq %r15, %rsi
movq 0xf0(%rsp), %rcx
movq 0xf8(%rsp), %r8
movq 0x100(%rsp), %r9
pushq %rax
pushq %r14
callq 0x13009f
addq $0x10, %rsp
testq %rax, %rax
cmoveq %rax, %rbx
addq (%r14), %rbx
cmpq $-0x1, %rbx
setne %cl
movq 0x60(%rsp), %rax
cmpq $-0x1, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x132109
leaq 0x1(%rbx), %r14
movq %r14, %rbp
subq %rax, %rbp
leaq 0x1636ef(%rip), %rax    # 0x295758
testb $0x1, (%rax)
jne 0x1320d8
cmpq $-0x1, 0x40(%rsp)
jne 0x1320d0
movq 0xe0(%rsp), %rax
movq (%rax), %rcx
movq 0xe8(%rsp), %rax
movq (%rax), %r8
subq $0x8, %rsp
movq %r12, %rdi
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq %rbp, %r9
pushq $0x8
pushq $0x1
pushq %r13
callq 0x1314a3
addq $0x20, %rsp
subq %rax, %rbp
js 0x1321cc
cmpq %r13, %rbp
jge 0x1321cc
cmpq %r14, %rbp
jge 0x1321cc
cmpq $-0x1, 0x48(%rsp)
je 0x13211d
movq %r14, %rax
movq %rax, %rcx
subq %rbp, %rcx
cmpq $0xff, %rcx
ja 0x132109
decq %rax
movq 0x70(%rsp), %rsi
movl 0x4(%rsi), %edx
shlq $0x20, %rdx
orq %rax, %rdx
movq %rdx, (%rsi)
movl %ecx, 0xc(%rsi)
movl $0x1, %eax
jmp 0x13210b
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xe0(%rsp), %rax
movq (%rax), %rcx
movq 0xe8(%rsp), %rax
movq (%rax), %r8
subq $0x8, %rsp
movq %r12, %rdi
movq 0x110(%rsp), %rsi
movq 0x118(%rsp), %rdx
movq %rbx, %r9
pushq $0x8
pushq $0x0
pushq %r13
callq 0x1314a3
addq $0x20, %rsp
addq %r14, %rax
js 0x13216f
cmpq %r13, %rax
jge 0x13216f
cmpq %rax, %rbp
jl 0x1320db
leaq 0x108f25(%rip), %rdi    # 0x23b09b
leaq 0x108a86(%rip), %rsi    # 0x23ac03
leaq 0x108e2a(%rip), %rcx    # 0x23afae
movl $0xb52, %edx            # imm = 0xB52
callq 0x2110
leaq 0x108d36(%rip), %rdi    # 0x23aecb
leaq 0x108a67(%rip), %rsi    # 0x23ac03
leaq 0x108e0b(%rip), %rcx    # 0x23afae
movl $0xb18, %edx            # imm = 0xB18
callq 0x2110
leaq 0x108df0(%rip), %rdi    # 0x23afa4
leaq 0x108a48(%rip), %rsi    # 0x23ac03
leaq 0x108dec(%rip), %rcx    # 0x23afae
movl $0xb19, %edx            # imm = 0xB19
callq 0x2110
leaq 0x108ea9(%rip), %rdi    # 0x23b07c
leaq 0x108a29(%rip), %rsi    # 0x23ac03
leaq 0x108dcd(%rip), %rcx    # 0x23afae
movl $0xb4d, %edx            # imm = 0xB4D
callq 0x2110