// File: chhylp123[P]hifiasm/Correct.cpp
// Function: ul_raw_aln(overlap_region*, Candidates_list*, ul_idx_t const*, char*, UC_Read*, bit_extz_t*, double, long, unsigned long, unsigned long, unsigned long, overlap_region*)
int64_t ul_raw_aln(overlap_region *z, Candidates_list *cl, const ul_idx_t *udb, char* qstr, UC_Read *tu, 
bit_extz_t *exz, double e_rate, int64_t w_l, uint64_t ql, uint64_t rid, uint64_t khit, overlap_region *aux_o)
{   
    return_t_chain(z, cl);
    int64_t ch_idx = z->shared_seed, ch_n;
    int64_t i, tl, id = z->y_id, m; ul_ov_t ov;
    k_mer_hit *ch_a = cl->list + ch_idx;
    tl = udb->ug->u.a[id].len;
    for (i = ch_idx; i < cl->length && cl->list[i].readID == cl->list[ch_idx].readID; i++); ch_n = i-ch_idx;

    // if(z->x_id == 57 && z->y_id == 2175) {
    //     fprintf(stderr, "\n-*-[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\tch_idx::%ld\tch_n::%ld\n", 
    //         __func__, 
	// 		z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
	// 		"+-"[z->y_pos_strand],
	// 		z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], udb->ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1,
    //         ch_idx, ch_n);
    //     for (i = ch_idx; i < cl->length && cl->list[i].readID == cl->list[ch_idx].readID; i++) {
    //         fprintf(stderr, "i::%ld[M::%s]\treadID::%u\tself_offset::%u\toffset::%u\t%c\n", 
    //             i, __func__, cl->list[i].readID, cl->list[i].self_offset, cl->list[i].offset, 
    //             "+-"[cl->list[i].strand]);
    //     }
    // }

    // on = fusion_chain_ovlp(z, ch_a, ch_n, ov, on, wl, ql, tl);
    aux_o->w_list.n = aux_o->w_list.c.n = 0; 
    aux_o->y_id = z->y_id; aux_o->y_pos_strand = z->y_pos_strand;
    aux_o->x_pos_s = z->x_pos_s; aux_o->x_pos_e = z->x_pos_e;
    aux_o->y_pos_s = z->y_pos_s; aux_o->y_pos_e = z->y_pos_e;

    memset(&ov, 0, sizeof(ov)); ov.sec = 3;
    ov.ts = ov.te = (uint32_t)-1;
    ov.qs = 0; ov.qn = (uint32_t)-1; //extension to left
    ov.qe = ql; ov.tn = ch_n; //extension to right

    ovlp_base_direct(z, ch_a, ch_n, &ov, w_l, udb, NULL, NULL, qstr, tu, exz, aux_o, e_rate, ql, tl, rid);

    int64_t aux_n = aux_o->w_list.n;


    // if(z->x_id == 57 && z->y_id == 2175) {
    //     fprintf(stderr, "\n-0-[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", 
    //         __func__, 
	// 		z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
	// 		"+-"[z->y_pos_strand],
	// 		z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], udb->ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1);
    //     for (i = 0; i < aux_n; i++) {
    //         window_list *m = &(aux_o->w_list.a[i]);
    //         fprintf(stderr, "i::%ld[M::%s]\tutg%.6u%c\twx::[%u,\t%u)\t%c\tutg%.6u%c\twy::[%u,\t%u)\terr::%d\tualn::%u\test::%u\n", i, __func__, 
	// 			z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], m->x_start, m->x_end+1,
	// 			"+-"[z->y_pos_strand], 
	// 			z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], m->y_start, m->y_end+1, m->error, 
	// 			(is_ualn_win((*m))), (is_est_aln((*m))));
    //     }
    //     fprintf(stderr, "\n");
    // }
    

    for (i = 0; i < aux_n; i++) {
        if(!(is_ualn_win(aux_o->w_list.a[i]))) continue;
        //will overwrite ch_a; does not matter
        rechain_aln(z, cl, aux_o, i, w_l, udb, NULL, NULL, qstr, tu, exz, e_rate, ql, tl, khit, rid);
    }

    // if(z->x_id == 57 && z->y_id == 2175) {
    //     fprintf(stderr, "\n-1-[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", 
    //         __func__, 
	// 		z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
	// 		"+-"[z->y_pos_strand],
	// 		z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], udb->ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1);
    //     for (i = 0; i < ((int64_t)aux_o->w_list.n); i++) {
    //         window_list *m = &(aux_o->w_list.a[i]);
    //         fprintf(stderr, "i::%ld[M::%s]\tutg%.6u%c\twx::[%u,\t%u)\t%c\tutg%.6u%c\twy::[%u,\t%u)\terr::%d\tualn::%u\test::%u\n", i, __func__, 
	// 			z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], m->x_start, m->x_end+1,
	// 			"+-"[z->y_pos_strand], 
	// 			z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], m->y_start, m->y_end+1, m->error, 
	// 			(is_ualn_win((*m))), (is_est_aln((*m))));
    //     }
    //     fprintf(stderr, "\n");
    // }
    
    if(((int64_t)aux_o->w_list.n) > aux_n) {
        for (i = m = 0; i < ((int64_t)aux_o->w_list.n); i++) {
            if((i < aux_n) && (is_ualn_win(aux_o->w_list.a[i]))) continue;
            aux_o->w_list.a[m++] = aux_o->w_list.a[i];
        }
        aux_o->w_list.n = m;
        radix_sort_window_list_xs_srt(aux_o->w_list.a, aux_o->w_list.a+aux_o->w_list.n);
    }

    ///update z by aux_o
    update_overlap_region(z, aux_o, ql, tl);
    assert((z->x_pos_e>=z->x_pos_s) && (z->y_pos_e>=z->y_pos_s));

    int64_t zwn = z->w_list.n, zerr = 0, zlen = z->x_pos_e+1-z->x_pos_s;
    for (i = 0; i < zwn; i++) {
        if(is_ualn_win(z->w_list.a[i])) {
            zerr += MAX((z->w_list.a[i].x_end+1-z->w_list.a[i].x_start), 
                                (z->w_list.a[i].y_end+1-z->w_list.a[i].y_start));
        } else {
            zerr += z->w_list.a[i].error;
        }
    }
    z->non_homopolymer_errors = zerr;

    // if(z->x_id == 57 && z->y_id == 2175) {
    //     fprintf(stderr, "\n-2-[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", 
    //         __func__, 
	// 		z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
	// 		"+-"[z->y_pos_strand],
	// 		z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], udb->ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1);
    //     for (i = 0; i < zwn; i++) {
    //         window_list *m = &(z->w_list.a[i]);
    //         fprintf(stderr, "i::%ld[M::%s]\tutg%.6u%c\twx::[%u,\t%u)\t%c\tutg%.6u%c\twy::[%u,\t%u)\terr::%d\tualn::%u\test::%u\n", i, __func__, 
	// 			z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], m->x_start, m->x_end+1,
	// 			"+-"[z->y_pos_strand], 
	// 			z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], m->y_start, m->y_end+1, m->error, 
	// 			(is_ualn_win((*m))), (is_est_aln((*m))));
    //     }
    //     fprintf(stderr, "\n");
    // }

    // if(z->x_id == 57 && z->y_id == 2175) {
    //     fprintf(stderr, "\n-3-[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\tzerr::%ld\tzlen::%ld\te_rate::%f\n", 
    //         __func__, 
	// 		z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
	// 		"+-"[z->y_pos_strand],
	// 		z->y_id+1, "lc"[udb->ug->u.a[z->y_id].circ], udb->ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1,
    //         zerr, zlen, e_rate);
    // }

    if(zerr >= zlen) return 0;
    if(zerr <= 0 && zlen > 0) return 1;
    if(zerr > (zlen*e_rate)) return 0;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movsd %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x8db80
movq -0x38(%rbp), %rax
movslq 0x24(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x90(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movq %rax, -0x88(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rcx
movq -0x40(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0xe1(%rbp)
jge 0x98317
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
movq -0x70(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
sete %al
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x98323
jmp 0x98333
jmp 0x98325
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x982c3
movq -0x80(%rbp), %rax
subq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x30(%rbp), %rax
movq $0x0, 0x60(%rax)
movq 0x30(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl 0x14(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
movq 0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
leaq -0xb4(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2100
movl -0x9c(%rbp), %eax
andl $0xc0000000, %eax       # imm = 0xC0000000
orl $0x3, %eax
movl %eax, -0x9c(%rbp)
movl $0xffffffff, -0xa0(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0xa4(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0xb0(%rbp)
movl $0xffffffff, -0xb4(%rbp) # imm = 0xFFFFFFFF
movq 0x18(%rbp), %rax
movl %eax, -0xac(%rbp)
movq -0x78(%rbp), %rax
movl %eax, -0xa8(%rbp)
movq -0x38(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq 0x10(%rbp), %r8
movq -0x48(%rbp), %r9
movq -0x50(%rbp), %r12
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %r14
movq 0x30(%rbp), %rbx
movsd -0x68(%rbp), %xmm0
movq 0x18(%rbp), %r11
movq -0x88(%rbp), %r10
movq 0x20(%rbp), %rax
leaq -0xb4(%rbp), %rcx
xorl %r13d, %r13d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x67cc0
movq 0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xc8(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jge 0x98592
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x98507
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x98507
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jl 0x98509
jmp 0x98581
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq 0x30(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq 0x10(%rbp), %r8
movq -0x48(%rbp), %r9
movq -0x50(%rbp), %r12
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %r14
movsd -0x68(%rbp), %xmm0
movq 0x18(%rbp), %rbx
movq -0x88(%rbp), %r11
movq 0x28(%rbp), %r10
movq 0x20(%rbp), %rax
xorl %r13d, %r13d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x66760
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x984a3
movq 0x30(%rbp), %rax
movq 0x48(%rax), %rax
cmpq -0xc8(%rbp), %rax
jle 0x986c7
movq $0x0, -0x98(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq 0x30(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jge 0x98694
movq -0x80(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jge 0x9862e
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x9862e
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x9862e
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jge 0x9862e
jmp 0x98683
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x80(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x98(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x98(%rbp)
shlq $0x5, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x985ba
movq -0x98(%rbp), %rcx
movq 0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rdi
movq 0x30(%rbp), %rax
movq 0x58(%rax), %rsi
movq 0x30(%rbp), %rax
movq 0x48(%rax), %rax
shlq $0x5, %rax
addq %rax, %rsi
callq 0x2f3b0
movq -0x38(%rbp), %rdi
movq 0x30(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq -0x88(%rbp), %rcx
callq 0x673f0
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x38(%rbp), %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0xe2(%rbp)
jb 0x9870e
movq -0x38(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl 0x14(%rcx), %eax
setae %al
movb %al, -0xe2(%rbp)
movb -0xe2(%rbp), %al
testb $0x1, %al
jne 0x9871a
jmp 0x9871c
jmp 0x9873b
leaq 0x2edb9e(%rip), %rdi    # 0x3862c1
leaq 0x2e9bf1(%rip), %rsi    # 0x38231b
movl $0x61ad, %edx           # imm = 0x61AD
leaq 0x2edbc0(%rip), %rcx    # 0x3862f6
callq 0x2130
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0xe0(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jge 0x98904
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x988cb
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x988cb
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jge 0x988cb
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x80(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movq -0x38(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x80(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
movq -0x38(%rbp), %rdx
movq 0x58(%rdx), %rdx
movq -0x80(%rbp), %rsi
shlq $0x5, %rsi
addq %rsi, %rdx
subl 0x8(%rdx), %ecx
cmpl %ecx, %eax
jl 0x9887e
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x80(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
movl %eax, -0xe8(%rbp)
jmp 0x988b3
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x80(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
cltq
addq -0xd8(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x988f1
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x80(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x14(%rax), %rax
addq -0xd8(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x988f3
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x98777
movq -0xd8(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0xd8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jl 0x9892e
movq $0x0, -0x30(%rbp)
jmp 0x9897b
cmpq $0x0, -0xd8(%rbp)
jg 0x9894c
cmpq $0x0, -0xe0(%rbp)
jle 0x9894c
movq $0x1, -0x30(%rbp)
jmp 0x9897b
cvtsi2sdq -0xd8(%rbp), %xmm0
cvtsi2sdq -0xe0(%rbp), %xmm1
mulsd -0x68(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x98973
movq $0x0, -0x30(%rbp)
jmp 0x9897b
movq $0x1, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)