// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: shrink_1b(ma_ug_t*, uc_block_t*, uc_block_t*, unsigned int)
void shrink_1b(ma_ug_t *ug, uc_block_t *z, uc_block_t *lim, uint32_t is_forward)
{
    if(z->ts != 0 || z->te != ug->g->seq[z->hid].len) return;
    uc_block_t bc = *z;
    if(z->ts + 1 < z->te && z->qs + 1 < z->qe) {
        uint32_t off = get_offset_adjust(1, z->te-z->ts, z->qe-z->qs);
        if(is_forward) {
            if((!z->rev)) {
                z->ts += 1; z->qs += off;
            } else {
                z->te -= 1; z->qs += off;
            }
            if((lim) && (!((z->qs <= lim->qs) && (z->qe <= lim->qe)))) *z = bc;
        } else {
            if((!z->rev)) {
                z->te -= 1; z->qe -= off;
            } else {
                z->ts += 1; z->qe -= off;
            }
            if((lim) && (!((z->qs >= lim->qs) && (z->qe >= lim->qe)))) *z = bc;
        }
        if((ugl_cover_check(bc.ts, bc.te, &(ug->u.a[bc.hid]))) && 
                                            (!ugl_cover_check(z->ts, z->te, &(ug->u.a[z->hid])))) {
            *z = bc;
        }
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x33d317
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
movq -0x10(%rbp), %rdx
movl (%rdx), %edx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
je 0x33d31c
jmp 0x33d503
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movl $0x24, %edx
callq 0x2180
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x33d503
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x33d503
movq -0x10(%rbp), %rax
movl 0x10(%rax), %esi
movq -0x10(%rbp), %rax
subl 0xc(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rax
subl 0x4(%rax), %edx
movl $0x1, %edi
callq 0xc14d0
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x33d413
movq -0x10(%rbp), %rax
movb 0x20(%rax), %al
shrb $0x5, %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x33d3bb
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
jmp 0x33d3d5
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x10(%rax)
movl -0x44(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x33d40e
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x33d3fc
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x33d40e
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x24, %edx
callq 0x2180
jmp 0x33d498
movq -0x10(%rbp), %rax
movb 0x20(%rax), %al
shrb $0x5, %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x33d441
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x10(%rax)
movl -0x44(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
jmp 0x33d45d
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movl -0x44(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x33d496
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x33d484
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x33d496
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x24, %edx
callq 0x2180
jmp 0x33d498
movl -0x34(%rbp), %eax
movl %eax, %edi
movl -0x30(%rbp), %eax
movl %eax, %esi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
movl -0x40(%rbp), %eax
imulq $0x28, %rax, %rax
addq %rax, %rdx
callq 0x2f10d0
cmpl $0x0, %eax
je 0x33d501
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %esi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rax
movl (%rax), %eax
imulq $0x28, %rax, %rax
addq %rax, %rdx
callq 0x2f10d0
cmpl $0x0, %eax
jne 0x33d501
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x24, %edx
callq 0x2180
jmp 0x33d503
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)