// File: chhylp123[P]hifiasm/Correct.cpp
// Function: cluster_ul_advance(char*, long long, long long, overlap_region_alloc*, Correct_dumy*, ul_idx_t const*, haplotype_evdience_alloc*, UC_Read*, int, long long, void*)
void cluster_ul_advance(char* r_string, long long window_start, long long window_end, 
overlap_region_alloc* overlap_list, Correct_dumy* dumy, const ul_idx_t *uref, 
haplotype_evdience_alloc* hap, UC_Read* overlap_read, int snp_threshold, long long blockLen, void *km)
{
    window_list* beg_cigar;
    window_list* end_cigar;
    ///window_start, window_end, and useful_length correspond to x, instead of y
    long long useful_length = window_end - window_start + 1;
    long long x_start, x_length, ll = hap->length, lr;
    char* x_string;
    char* y_string;
    long long i;
    long long y_start, y_length;
    long long overlapID, windowID;

    long long correct_x_pos_s;


    ///all overlaps related to the current window [window_start, window_end]
    ///first mark all snp pos
    for (i = 0; i < (long long)dumy->length; i++)
    {
        ///overlap id, instead of the window id or the y id
        overlapID = dumy->overlapID[i];

        ///overlap_list->list[overlapID].x_pos_s is the begining of the whole overlap
        correct_x_pos_s = (overlap_list->list[overlapID].x_pos_s / blockLen) * blockLen;
        ///window_start is the begining of this window in the whole x_read
        windowID = (window_start - correct_x_pos_s) / blockLen;

        ///skip if this window is not matched
        if (overlap_list->list[overlapID].w_list.a[windowID].y_end == -1)
        {
            continue;
        }
        
        ///both x_start and y_start are the offsets of the whole x_read and y_read
        ///instead of the offsets of window
        x_start = overlap_list->list[overlapID].w_list.a[windowID].x_start;
        x_length = overlap_list->list[overlapID].w_list.a[windowID].x_end 
                - overlap_list->list[overlapID].w_list.a[windowID].x_start + 1;

        y_start = overlap_list->list[overlapID].w_list.a[windowID].y_start;
        y_length = overlap_list->list[overlapID].w_list.a[windowID].y_end
                - overlap_list->list[overlapID].w_list.a[windowID].y_start + 1;

        beg_cigar = end_cigar = NULL;
        
        if(windowID >= 1)
        {
            beg_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID-1]);
        }

        if(windowID < (long long)(overlap_list->list[overlapID].w_list.n) - 1)
        {
            end_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID]);
        }
            

        markSNP_advance(window_start, x_start, x_length, y_start, y_length, 
        &(overlap_list->list[overlapID].w_list.a[windowID]), &(overlap_list->list[overlapID].w_list),
        beg_cigar, &(overlap_list->list[overlapID].boundary_cigars),
        end_cigar, &(overlap_list->list[overlapID].boundary_cigars), 
        hap, uref, overlap_list->list[overlapID].y_pos_strand, overlap_list->list[overlapID].y_id);
    }


    /****************************may have bugs********************************/
    long long last_snp = -1;
    long long first_snp = -1;
    for (i = 0, lr = 0; i < useful_length; i++)
    {
        if(hap->flag[i] != 0)
        {
            last_snp = i;
            if(first_snp == -1)
            {
                first_snp = i;
            }
        }
        ///for a real snp, the coverage should be at least 2
        if(hap->flag[i] > snp_threshold)
        {
            // hap->snp++; 
            hap->nn_snp++;
            lr++;
        }
    }
    ///if there are any >0 elements, both first_snp and last_snp should be != -1
    if(first_snp == -1 || last_snp == -1)
    {
        first_snp = 0;
        last_snp = -1;
    }
    /****************************may have bugs********************************/



    ///add the information related to snp to haplotype_evdience_alloc
    for (i = 0; i < (long long)dumy->length; i++)
    {
        ///overlap ID, instead of the window ID
        overlapID = dumy->overlapID[i];

        ///overlap_list->list[overlapID].x_pos_s is the begining of the whole overlap
        correct_x_pos_s = (overlap_list->list[overlapID].x_pos_s / blockLen) * blockLen;
        ///window_start is the begining of this window in the whole x_read
        windowID = (window_start - correct_x_pos_s) / blockLen;

        ///skip if this window is not matched
        if (overlap_list->list[overlapID].w_list.a[windowID].y_end == -1)
        {
            continue;
        }
        
        ///both x_start and y_start are the offsets of the whole x_read and y_read
        ///instead of the offsets of window
        x_start = overlap_list->list[overlapID].w_list.a[windowID].x_start;
        x_length = overlap_list->list[overlapID].w_list.a[windowID].x_end 
                - overlap_list->list[overlapID].w_list.a[windowID].x_start + 1;

        y_start = overlap_list->list[overlapID].w_list.a[windowID].y_start;
        y_length = overlap_list->list[overlapID].w_list.a[windowID].y_end
                - overlap_list->list[overlapID].w_list.a[windowID].y_start + 1;

        retrieve_u_seq(overlap_read, NULL, &uref->ug->u.a[overlap_list->list[overlapID].y_id], 
        overlap_list->list[overlapID].y_pos_strand, 0, -1, km);
        
        
        x_string = r_string;
        y_string = overlap_read->seq;


        beg_cigar = end_cigar = NULL;
        if(windowID >= 1)
        {
            beg_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID-1]);
        }
        if(windowID < (long long)(overlap_list->list[overlapID].w_list.n) - 1)
        {
            end_cigar = &(overlap_list->list[overlapID].boundary_cigars.a[windowID]);
        }


        addSNPtohaplotype_advance(window_start, overlapID, x_start, x_length, y_start, y_length, 
        &(overlap_list->list[overlapID].w_list.a[windowID]), &(overlap_list->list[overlapID].w_list),
        beg_cigar, &(overlap_list->list[overlapID].boundary_cigars),
        end_cigar, &(overlap_list->list[overlapID].boundary_cigars),
        hap, snp_threshold, x_string, y_string, uref, overlap_list->list[overlapID].y_pos_strand, overlap_list->list[overlapID].y_id, km);                
    }

    RsetInitHaplotypeEvdienceFlag(hap, first_snp, last_snp + 1 - first_snp);

    if(hap->length - ll > 1 && lr > 1) radix_sort_haplotype_evdience_srt(hap->list+ll, hap->list + hap->length);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x88(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x3d456
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cqto
idivq 0x28(%rbp)
imulq 0x28(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
subq -0xd0(%rbp), %rax
cqto
idivq 0x28(%rbp)
movq %rax, -0xc8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x3d15b
jmp 0x3d43f
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb8(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
cmpq $0x1, -0xc8(%rbp)
jl 0x3d2c3
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xc8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x48(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x3d31a
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0xb0(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xb8(%rbp), %r8
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %r9
movq -0xc8(%rbp), %rax
shlq $0x5, %rax
addq %rax, %r9
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
addq $0x48, %rax
movq %rax, -0xf0(%rbp)
movq -0x60(%rbp), %r13
movq -0x48(%rbp), %rax
movq (%rax), %r12
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %r12
addq $0x78, %r12
movq -0x68(%rbp), %r15
movq -0x48(%rbp), %rax
movq (%rax), %r14
imulq $0xa8, -0xc0(%rbp), %rax
addq %rax, %r14
addq $0x78, %r14
movq 0x10(%rbp), %rbx
movq -0x58(%rbp), %r11
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %r10d
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq -0xf8(%rbp), %rcx
movl 0x10(%rax), %eax
movl %eax, -0xe4(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, (%rsp)
movl -0xe4(%rbp), %eax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movl %r10d, 0x38(%rsp)
movl %eax, 0x40(%rsp)
callq 0x3b960
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3d0b8
movq $-0x1, -0xd8(%rbp)
movq $-0x1, -0xe0(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0x90(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x3d523
movq 0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x3d4d0
movq -0xa8(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $-0x1, -0xe0(%rbp)
jne 0x3d4ce
movq -0xa8(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x3d4d0
movq 0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
cmpl 0x20(%rbp), %eax
jle 0x3d50a
movq 0x10(%rbp), %rax
movl 0x230(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x230(%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x3d50c
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3d482
cmpq $-0x1, -0xe0(%rbp)
je 0x3d537
cmpq $-0x1, -0xd8(%rbp)
jne 0x3d54d
movq $0x0, -0xe0(%rbp)
movq $-0x1, -0xd8(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x50(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jge 0x3d9ea
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cqto
idivq 0x28(%rbp)
imulq 0x28(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x38(%rbp), %rax
subq -0xd0(%rbp), %rax
cqto
idivq 0x28(%rbp)
movq %rax, -0xc8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x3d5fb
jmp 0x3d9d3
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl (%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x58(%rcx), %rcx
movq -0xc8(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb8(%rbp)
movq 0x18(%rbp), %rdi
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
imulq $0x28, %rax, %rax
addq %rax, %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movb %al, %cl
movq 0x30(%rbp), %rax
xorl %esi, %esi
movl %esi, %r8d
movq $-0x1, %r9
movq %r8, %rsi
movzbl %cl, %ecx
movq %rax, (%rsp)
callq 0x10980
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
cmpq $0x1, -0xc8(%rbp)
jl 0x3d7e3
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xc8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movq 0x48(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x3d83a
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq 0x88(%rax), %rax
movq -0xc8(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl %eax, %esi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0xb0(%rbp), %r8
movq -0xb8(%rbp), %r9
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
movq 0x58(%rax), %rax
movq -0xc8(%rbp), %r10
shlq $0x5, %r10
addq %r10, %rax
movq %rax, -0x130(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
addq $0x48, %rax
movq %rax, -0x128(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
addq $0x78, %rax
movq %rax, -0x118(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
addq $0x78, %rax
movq %rax, -0x108(%rbp)
movq 0x10(%rbp), %r13
movl 0x20(%rbp), %r12d
movq -0x98(%rbp), %r15
movq -0xa0(%rbp), %r14
movq -0x58(%rbp), %rbx
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
movl 0x1c(%rax), %r11d
movq -0x48(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0xc0(%rbp), %r10
addq %r10, %rax
movl 0x10(%rax), %r10d
movq 0x30(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x130(%rbp), %rax
movq %rax, (%rsp)
movq -0x128(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x120(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x118(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0x110(%rbp), %rax
movq %rax, 0x20(%rsp)
movq -0x108(%rbp), %rax
movq %rax, 0x28(%rsp)
movq -0x100(%rbp), %rax
movq %r13, 0x30(%rsp)
movl %r12d, 0x38(%rsp)
movq %r15, 0x40(%rsp)
movq %r14, 0x48(%rsp)
movq %rbx, 0x50(%rsp)
movl %r11d, 0x58(%rsp)
movl %r10d, 0x60(%rsp)
movq %rax, 0x68(%rsp)
callq 0x3c050
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x3d558
movq 0x10(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq $0x1, %rdx
subq -0xe0(%rbp), %rdx
callq 0xa0fe0
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
subq -0x88(%rbp), %rax
cmpq $0x1, %rax
jle 0x3da56
cmpq $0x1, -0x90(%rbp)
jle 0x3da56
movq 0x10(%rbp), %rax
movq (%rax), %rdi
imulq $0x18, -0x88(%rbp), %rax
addq %rax, %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
movq 0x10(%rbp), %rax
movl 0x10(%rax), %eax
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x2df30
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)