// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: test_dbug(ma_ug_t*, _IO_FILE*)
uint32_t test_dbug(ma_ug_t* ug, FILE* fp)
{
    uint32_t f_flag = 0, t, i, r_flag = 0;
    size_t tt;
    ma_utg_t ua, *ub = NULL; memset(&ua, 0, sizeof(ua));
    f_flag = fread(&tt, sizeof(tt), 1, fp);
    if(f_flag == 0 || tt != ug->u.n) goto DES;
    
    for (i = 0; i < tt; i++)
    {
        ub = &(ug->u.a[i]);
        f_flag = fread(&t, sizeof(t), 1, fp);
        if(f_flag == 0 || t != ub->len) goto DES;
        f_flag = fread(&t, sizeof(t), 1, fp);
        if(f_flag == 0 || t != ub->circ) goto DES;
        f_flag = fread(&(ua.start), sizeof(ua.start), 1, fp);
        if(f_flag == 0 || ua.start != ub->start) goto DES;
        f_flag = fread(&(ua.end), sizeof(ua.end), 1, fp);
        if(f_flag == 0 || ua.end != ub->end) goto DES;
        f_flag = fread(&(ua.n), sizeof(ua.n), 1, fp);
        if(f_flag == 0 || ua.n != ub->n) goto DES;
        t = ua.n;
        ua.n = 0;
        kv_resize(uint64_t, ua, t);
        ua.n = t;
        f_flag = fread(ua.a, sizeof(uint64_t), ua.n, fp);
        if(f_flag == 0 || memcmp(ua.a, ub->a, ua.n)) goto DES;
    }
    r_flag = 1;

    DES:
    free(ua.a);
    return r_flag;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movq $0x0, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2100
movq -0x10(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1016b3
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
je 0x1016b8
jmp 0x1018c8
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x1018c1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x18(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x101715
movl -0x18(%rbp), %eax
movq -0x58(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
je 0x10171a
jmp 0x1018c8
movq -0x10(%rbp), %rcx
leaq -0x18(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x10174a
movl -0x18(%rbp), %eax
movq -0x58(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %eax
je 0x10174f
jmp 0x1018c8
leaq -0x50(%rbp), %rdi
addq $0x4, %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x10177f
movl -0x4c(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x4(%rcx), %eax
je 0x101784
jmp 0x1018c8
leaq -0x50(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1017b4
movl -0x48(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x1017b9
jmp 0x1018c8
leaq -0x50(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1017e9
movl -0x40(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x10(%rcx), %eax
je 0x1017ee
jmp 0x1018c8
movl -0x40(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x10186c
movl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shrl %eax
orl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shrl $0x2, %eax
orl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shrl $0x4, %eax
orl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shrl $0x8, %eax
orl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shrl $0x10, %eax
orl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rdi
movl -0x44(%rbp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x38(%rbp)
jmp 0x10186e
movl -0x18(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
movq -0x10(%rbp), %rcx
movl $0x8, %esi
callq 0x22e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1018af
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rsi
movl -0x40(%rbp), %eax
movl %eax, %edx
callq 0x20b0
cmpl $0x0, %eax
je 0x1018b1
jmp 0x1018c8
jmp 0x1018b3
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1016bf
movl $0x1, -0x20(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2210
movl -0x20(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)