// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: region_phase(overlap_region_alloc*, ul_idx_t const*, ug_opt_t const*, kv_ul_ov_t*, asg64_v*, asg64_v*, asg64_v*, long)
void region_phase(overlap_region_alloc* ol, const ul_idx_t *uref, const ug_opt_t *uopt, kv_ul_ov_t *c_idx, asg64_v* idx, asg64_v* buf, asg64_v* buf1, int64_t ulid)
{
    int64_t on = ol->length, k, i, zwn, q[2], t[2], w[2]; 
    uint64_t m; overlap_region *z; ul_ov_t *cp;
    kv_resize(uint64_t, *idx, (ol->length<<1)); 
    kv_resize(ul_ov_t, *c_idx, ol->length);
    for (k = idx->n = c_idx->n = 0; k < on; k++) {
        z = &(ol->list[k]); zwn = z->w_list.n; 
        // prt_overlap_region_stat(z, ulid);
        // if(/**ulid == 35437 &&**/ z->y_id == 15199 || z->y_id == 31315) {
        //     fprintf(stderr, "+0+[M::%s::utg%.6dl::%c] ulid::%ld, all::%u, non-best::%ld, best::%u\n", __func__, 
        //     (int32_t)z->y_id+1, "+-"[z->y_pos_strand], ulid, z->overlapLen, zwn, z->align_length);
        //     prt_overlap_region_stat(&(ol->list[k]), ulid);
        //     // prt_overlap_region_phase_stat(&(ol->list[k]), ulid);
        // }
        // z->align_length = z->overlapLen = z->x_pos_e+1-z->x_pos_s; 
        z->align_length = 0; z->overlapLen = (uint32_t)-1;
        z->non_homopolymer_errors = 0;
        if(!zwn) continue;
        q[0] = q[1] = t[0] = t[1] = w[0] = w[1] = INT32_MIN;
        for (i = 0; i < zwn; i++) {
            if((z->w_list.a[i].x_start==(q[1]+1)) && ((z->w_list.a[i].y_start==(t[1]+1)))) {
                q[1] = z->w_list.a[i].x_end;
                t[1] = z->w_list.a[i].y_end;
                w[1] = i;
            } else {
                if(q[0] != INT32_MIN) {
                    m = ((uint64_t)q[0])<<1; m <<= 32; 
                    m += c_idx->n; kv_push(uint64_t, *idx, m);
                    m = (((uint64_t)q[1])<<1)+1; m <<= 32; 
                    m += c_idx->n; kv_push(uint64_t, *idx, m);

                    kv_pushp(ul_ov_t, *c_idx, &cp);
                    ovlp_id(*cp) = k; ///ovlp id
                    ovlp_min_wid(*cp) = w[0]; ///beg id of windows
                    ovlp_max_wid(*cp) = w[1]; ///end id of windows
                    ovlp_cur_wid(*cp) = w[0]; ///cur id of windows
                    ovlp_cur_xoff(*cp) = z->w_list.a[w[0]].x_start; ///cur xpos
                    ovlp_cur_coff(*cp) = 0; ///cur cigar off in cur window
                    ovlp_bd(*cp) = 0;
                }

                q[0] = z->w_list.a[i].x_start; q[1] = z->w_list.a[i].x_end;
                t[0] = z->w_list.a[i].y_start; t[1] = z->w_list.a[i].y_end;
                w[0] = i; w[1] = i;
            }
        }
        if(q[0] != INT32_MIN) {
            m = ((uint64_t)q[0])<<1; m <<= 32; 
            m += c_idx->n; kv_push(uint64_t, *idx, m);
            m = (((uint64_t)q[1])<<1)+1; m <<= 32; 
            m += c_idx->n; kv_push(uint64_t, *idx, m);

            kv_pushp(ul_ov_t, *c_idx, &cp);
            ovlp_id(*cp) = k; ///ovlp id
            ovlp_min_wid(*cp) = w[0]; ///beg id of windows
            ovlp_max_wid(*cp) = w[1]; ///end id of windows
            ovlp_cur_wid(*cp) = w[0]; ///cur id of windows
            ovlp_cur_xoff(*cp) = z->w_list.a[w[0]].x_start; ///cur xpos
            ovlp_cur_coff(*cp) = 0; ///cur cigar off in cur window
            ovlp_bd(*cp) = 0;
        }
        // if(ulid == 35437 && z->y_id == 109111) {
        //     fprintf(stderr, "+1+[M::%s::utg%.6dl::%c] ulid::%ld, all::%u, non-best::%ld, best::%u\n", __func__, 
        //     (int32_t)z->y_id+1, "+-"[z->y_pos_strand], ulid, z->overlapLen, zwn, z->align_length);
        //     prt_overlap_region_stat(&(ol->list[k]));
        //     prt_overlap_region_phase_stat(&(ol->list[k]));
        // }
    }
    radix_sort_bc64(idx->a, idx->a+idx->n);
    //this is used with gen_region_phase, now give up
    //gen_gov_idx(ol, uref, uopt, G_CHAIN_BW, N_GCHAIN_RATE, buf1);
    // for (m = 0; m < c_idx->n; m++) {
    //     fprintf(stderr, "+++[M::%s::utg%.6dl] q[%d, %d), t[%d, %d), wn::%d\n", __func__, 
    //     (int32_t)ol->list[ovlp_id(c_idx->a[m])].y_id+1,
    //     ol->list[ovlp_id(c_idx->a[m])].w_list.a[ovlp_min_wid(c_idx->a[m])].x_start,
    //     ol->list[ovlp_id(c_idx->a[m])].w_list.a[ovlp_max_wid(c_idx->a[m])].x_end+1,
    //     ol->list[ovlp_id(c_idx->a[m])].w_list.a[ovlp_min_wid(c_idx->a[m])].y_start,
    //     ol->list[ovlp_id(c_idx->a[m])].w_list.a[ovlp_max_wid(c_idx->a[m])].y_end+1,
    //     ovlp_max_wid(c_idx->a[m])+1-ovlp_min_wid(c_idx->a[m]));
    // }
    

    int64_t srt_n = idx->n, dp, old_dp, beg, end;
    for (i = k = 0, dp = old_dp = 0, beg = 0, end = -1; i < srt_n; ++i) {///[beg, end) but coordinates in idx is [, ]
        ///if idx->a.a[] is qe
        old_dp = dp;
        if ((idx->a[i]>>32)&1) {
            --dp; end = (idx->a[i]>>33)+1;
        }else {
            //meet a new overlap; the overlaps are pushed by the x_pos_s
            ++dp; end = (idx->a[i]>>33);
            kv_push(uint64_t, *idx, ((uint32_t)idx->a[i]));
        }
        // fprintf(stderr, "\n[M::%s::] beg::%ld, end::%ld, old_dp::%ld\n", __func__, beg, end, old_dp);
        if((end > beg) && (old_dp >= 2)) {
            // fprintf(stderr, "\n[M::%s::] beg::%ld, end::%ld, old_dp::%ld\n", __func__, beg, end, old_dp);
            // kv_resize(uint64_t, *buf, ((uint32_t)old_dp)<<1);
            // idx->n = srt_n + gen_region_phase(ol->list, idx->a+srt_n, idx->n-srt_n, beg, end, old_dp, c_idx->a, buf, buf1);   
            idx->n = srt_n + gen_region_phase_robust(ol->list, idx->a+srt_n, idx->n-srt_n, beg, end, old_dp, c_idx->a, buf);
        }
        beg = end;
    }
    ///hap->length

    for (k = 0; k < on; k++) {
        z = &(ol->list[k]); 
        // if(ulid == 35437 && z->y_id == 109111) {
        //     fprintf(stderr, "+2+[M::%s::utg%.6dl::%c] ulid::%ld, all::%u, non-best::%ld, best::%u\n", __func__, 
        //     (int32_t)z->y_id+1, "+-"[z->y_pos_strand], ulid, z->overlapLen, zwn, z->align_length);
        //     prt_overlap_region_stat(&(ol->list[k]));
        //     prt_overlap_region_phase_stat(&(ol->list[k]));
        // }



        z->overlapLen = z->x_pos_e+1-z->x_pos_s; 
        z->non_homopolymer_errors = 0; zwn = 0;
        for (i = m = 0; i < z->align_length; i++) {
            z->w_list.a[m] = z->w_list.a[z->w_list.n+i];
            if(z->w_list.a[m].clen > 0) {
                z->non_homopolymer_errors += z->w_list.a[m].clen;
                zwn += z->w_list.a[m].x_end-z->w_list.a[m].x_start;
            } 
            m++;
        }
        z->w_list.n = m; 
        // if(ulid == 35437 && z->y_id == 109111/**zwn > z->overlapLen**/) {
        //     fprintf(stderr, "+3+[M::%s::utg%.6dl::%c] ulid::%ld, all::%u, non-best::%ld, best::%u\n", __func__, 
        //     (int32_t)z->y_id+1, "+-"[z->y_pos_strand], ulid, z->overlapLen, zwn, z->align_length);
        //     prt_overlap_region_stat(&(ol->list[k]));
        //     prt_overlap_region_phase_stat(&(ol->list[k]));
        // }
        assert(zwn <= z->overlapLen);
        z->align_length = z->overlapLen - zwn;
        // /**if(ulid == 35437 && z->y_id == 15199 || z->y_id == 31315)**/ {
        //     prt_overlap_region_phase_stat(z, ulid);
        //     fprintf(stderr, "[M::%s::utg%.6dl::%c] all::%u, non-best::%ld, best::%u\n\n", __func__, 
        //     (int32_t)z->y_id+1, "+-"[z->y_pos_strand], z->overlapLen, zwn, z->align_length);
        // }
        // prt_overlap_region_phase_stat(&(ol->list[k]));
        // z = &(ol->list[k]); 
        // if(z->align_length == z->overlapLen) {///prefer alignments without any trans hit
        //     z->align_length = z->overlapLen = z->x_pos_e+1-z->x_pos_s;
        // }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x38(%rsp)
movq %rcx, %rbx
movq %rdi, %r15
movq 0x10(%rdi), %r12
leaq (%r12,%r12), %rax
cmpq %rax, 0x8(%r8)
movq %r8, (%rsp)
jae 0x6fbc6
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r8)
movq 0x10(%r8), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movq 0x10(%r15), %rax
cmpq %rax, 0x10(%rbx)
jae 0x6fc2a
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
leaq (%rax,%rax,8), %rax
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
callq 0x2370
movq (%rsp), %r8
movq %rax, (%rbx)
xorl %ebp, %ebp
movq %rbx, 0x18(%rsp)
movq %rbp, 0x8(%rbx)
movq %rbp, (%r8)
testq %r12, %r12
movq %r15, 0x20(%rsp)
movq %r12, 0x28(%rsp)
jle 0x6ffe9
xorl %edi, %edi
movq (%r15), %rax
imulq $0xa8, %rdi, %rcx
leaq (%rax,%rcx), %r9
movq 0x48(%rax,%rcx), %rdx
movl %ebp, 0x28(%rax,%rcx)
movl $0xffffffff, 0x20(%rax,%rcx) # imm = 0xFFFFFFFF
movl %ebp, 0x30(%rax,%rcx)
movq %rdx, 0x40(%rsp)
testq %rdx, %rdx
je 0x6ffdd
movq %rdi, 0x30(%rsp)
movq %r9, 0x8(%rsp)
jle 0x6fe79
movq $-0x80000000, 0x10(%rsp) # imm = 0x80000000
xorl %ebp, %ebp
movq $-0x80000000, %r15      # imm = 0x80000000
movq $-0x80000000, %rax      # imm = 0x80000000
movq $-0x80000000, %r14      # imm = 0x80000000
movq $-0x80000000, %r13      # imm = 0x80000000
xorl %r12d, %r12d
movq 0x58(%r9), %rcx
movslq (%rcx,%rbp), %rdx
leaq 0x1(%r13), %rsi
cmpq %rdx, %rsi
jne 0x6fcda
movslq 0x8(%rcx,%rbp), %rdx
incq %rax
cmpq %rdx, %rax
je 0x6fe34
cmpq $-0x80000000, %r14      # imm = 0x80000000
je 0x6fe27
shlq $0x21, %r14
movq 0x18(%rsp), %rbx
addq 0x8(%rbx), %r14
movq 0x8(%r8), %rax
cmpq %rax, (%r8)
jne 0x6fd2b
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
movq 0x10(%r8), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rax
movq 0x10(%r8), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, (%r8)
movq %r14, (%rdi,%rax,8)
shlq $0x21, %r13
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %r13
addq 0x8(%rbx), %r13
movq 0x8(%r8), %rax
cmpq %rax, (%r8)
jne 0x6fd85
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rax
movq 0x10(%r8), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r8)
movq %r13, (%rcx,%rax,8)
movq 0x10(%rbx), %rax
cmpq %rax, 0x8(%rbx)
jne 0x6fdd4
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x10(%rbx)
movq (%rbx), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movq 0x30(%rsp), %rdi
movl %edi, 0xc(%rax,%rdx)
movq 0x10(%rsp), %rsi
movl %esi, 0x10(%rax,%rdx)
movl %r15d, 0x14(%rax,%rdx)
movl %esi, (%rax,%rdx)
movq 0x58(%r9), %rcx
shlq $0x5, %rsi
movl (%rcx,%rsi), %ecx
movl %ecx, 0x4(%rax,%rdx)
movl $0x0, 0x8(%rax,%rdx)
andl $0xc0000000, 0x18(%rax,%rdx) # imm = 0xC0000000
movq 0x58(%r9), %rcx
movslq (%rcx,%rbp), %r14
movq %r12, 0x10(%rsp)
movslq 0xc(%rcx,%rbp), %rax
movslq 0x4(%rcx,%rbp), %r13
leaq 0x1(%r12), %rbx
addq $0x20, %rbp
movq %r12, %r15
movq %rbx, %r12
cmpq %rbx, 0x40(%rsp)
jne 0x6fcb8
shlq $0x21, %r13
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rax, %r13
decl %ebx
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r12
xorl %ebp, %ebp
jmp 0x6fe98
movl $0x80000000, %ebx       # imm = 0x80000000
movq $-0x80000000, %r14      # imm = 0x80000000
movabsq $0x100000000, %r13      # imm = 0x100000000
movq $-0x80000000, 0x10(%rsp) # imm = 0x80000000
cmpq $-0x80000000, %r14      # imm = 0x80000000
je 0x6ffdd
shlq $0x21, %r14
movq 0x18(%rsp), %rax
addq 0x8(%rax), %r14
movq 0x8(%r8), %rax
cmpq %rax, (%r8)
jne 0x6fee9
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
movq 0x10(%r8), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rax
movq 0x10(%r8), %rdi
leaq 0x1(%rax), %rcx
movq %rcx, (%r8)
movq %r14, (%rdi,%rax,8)
movq 0x18(%rsp), %rax
addq 0x8(%rax), %r13
movq 0x8(%r8), %rax
cmpq %rax, (%r8)
jne 0x6ff37
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rax
movq 0x10(%r8), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r8)
movq %r13, (%rcx,%rax,8)
movq 0x18(%rsp), %r14
movq 0x10(%r14), %rax
cmpq %rax, 0x8(%r14)
jne 0x6ff8b
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x10(%r14)
movq (%r14), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq (%rsp), %r8
movq %rax, (%r14)
movq (%r14), %rax
movq 0x8(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r14)
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movq 0x30(%rsp), %rdi
movl %edi, 0xc(%rax,%rdx)
movq 0x10(%rsp), %rsi
movl %esi, 0x10(%rax,%rdx)
movl %ebx, 0x14(%rax,%rdx)
movl %esi, (%rax,%rdx)
movq 0x58(%r9), %rcx
shlq $0x5, %rsi
movl (%rcx,%rsi), %ecx
movl %ecx, 0x4(%rax,%rdx)
movl $0x0, 0x8(%rax,%rdx)
andl $0xc0000000, 0x18(%rax,%rdx) # imm = 0xC0000000
incq %rdi
cmpq %r12, %rdi
jne 0x6fc4d
movq (%r8), %rax
movq 0x10(%r8), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x45d47
movq (%rsp), %r8
movq (%r8), %rbx
testq %rbx, %rbx
jle 0x700f3
xorl %r13d, %r13d
leaq (,%rbx,8), %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%r8), %rdi
movq (%rdi,%r15,8), %rax
movq %rax, %rbp
shrq $0x21, %rbp
movabsq $0x100000000, %rcx      # imm = 0x100000000
testq %rcx, %rax
jne 0x70087
movq 0x8(%r8), %rax
cmpq %rax, (%r8)
jne 0x7006b
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
shlq $0x3, %rsi
callq 0x2370
movq (%rsp), %r8
movq %rax, 0x10(%r8)
leaq 0x1(%r14), %r12
movq (%r8), %rax
movq 0x10(%r8), %rcx
movl (%rcx,%r15,8), %edx
leaq 0x1(%rax), %rsi
movq %rsi, (%r8)
movq %rdx, (%rcx,%rax,8)
jmp 0x7008e
leaq -0x1(%r14), %r12
incq %rbp
cmpq %r13, %rbp
seta %al
cmpq $0x2, %r14
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x700e1
movq 0x20(%rsp), %rax
movq (%rax), %rdi
movq 0x10(%r8), %rsi
addq 0x10(%rsp), %rsi
movq (%r8), %rdx
subq %rbx, %rdx
movq %r13, %rcx
movq %rbp, %r8
movq %r14, %r9
pushq 0x38(%rsp)
movq 0x20(%rsp), %rax
pushq (%rax)
callq 0x6c809
movq 0x10(%rsp), %r8
addq $0x10, %rsp
addq %rbx, %rax
movq %rax, (%r8)
incq %r15
movq %rbp, %r13
movq %r12, %r14
cmpq %r15, %rbx
jne 0x7001f
movq 0x28(%rsp), %rbx
testq %rbx, %rbx
movq 0x20(%rsp), %r11
jle 0x701b3
xorl %eax, %eax
movq (%r11), %rdx
imulq $0xa8, %rax, %rsi
leaq (%rdx,%rsi), %rcx
movl 0x8(%rdx,%rsi), %edi
subl 0x4(%rdx,%rsi), %edi
incl %edi
movl %edi, 0x20(%rdx,%rsi)
movl $0x0, 0x30(%rdx,%rsi)
cmpl $0x0, 0x28(%rdx,%rsi)
je 0x70192
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
movq 0x48(%rcx), %r8
movq 0x58(%rcx), %r9
shlq $0x5, %r8
leaq (%r9,%rdi), %r10
movups (%r8,%r10), %xmm0
movups 0x10(%r8,%r10), %xmm1
movups %xmm1, 0x10(%r9,%rdi)
movups %xmm0, (%r9,%rdi)
movq 0x58(%rcx), %r8
movl 0x1c(%r8,%rdi), %r9d
testl %r9d, %r9d
je 0x70180
addl %r9d, 0x30(%rcx)
movslq 0x4(%r8,%rdi), %r9
movslq (%r8,%rdi), %r8
subq %r8, %r9
addq %r9, %rdx
incq %rsi
movl 0x28(%rcx), %r8d
addq $0x20, %rdi
cmpq %r8, %rsi
jb 0x70139
jmp 0x70196
xorl %edx, %edx
xorl %esi, %esi
movq %rsi, 0x48(%rcx)
movl 0x20(%rcx), %esi
cmpq %rsi, %rdx
jg 0x701c2
subl %edx, %esi
movl %esi, 0x28(%rcx)
incq %rax
cmpq %rbx, %rax
jne 0x70108
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b7e89(%rip), %rdi    # 0x228052
leaq 0x1b5473(%rip), %rsi    # 0x225643
leaq 0x1b7e90(%rip), %rcx    # 0x228067
movl $0x4bf1, %edx           # imm = 0x4BF1
callq 0x2110