// File: chhylp123[P]hifiasm/inter.cpp
// Function: debug_update_uovlp_chain_qse(ma_ug_t*, mg_lchain_t*, long, long)
void debug_update_uovlp_chain_qse(ma_ug_t *ug, mg_lchain_t *a, int64_t a_n, int64_t ulid)
{
	if(a_n <= 2) return;
	int64_t r0_s, r0_e, q0_s, q0_e, k;
	int64_t r1_s, r1_e, q1_s, q1_e;
	get_u_offset(ug, &(a[0]), &r0_s, &r0_e, &q0_s, &q0_e);
	get_u_offset(ug, &(a[a_n-1]), &r1_s, &r1_e, &q1_s, &q1_e);
	/**if(r0_s <= r1_s && r0_e <= r1_e && q0_s <= q1_s && q0_e <= q1_e)**/ {
		for (k = 1; k + 1 < a_n; k++) a[k].qs = a[k].qe = -1;
		update_uovlp_chain_qse(ug, 0, a_n-1, a, a_n);
		for (k = 1; k < a_n; k++) {
			get_u_offset(ug, a + k - 1, &r0_s, &r0_e, &q0_s, &q0_e);
			get_u_offset(ug, a + k, &r1_s, &r1_e, &q1_s, &q1_e);
			// if(!(r0_s <= r1_s && r0_e <= r1_e && q0_s <= q1_s && q0_e <= q1_e)) {
			// 	fprintf(stderr, "ulid:%ld, r0_s:%ld, r1_s:%ld, r0_e:%ld, r1_e:%ld, q0_s:%ld, q1_s:%ld, q0_e:%ld, q1_e:%ld\n", ulid, 
			// 	r0_s, r1_s, r0_e, r1_e, q0_s, q1_s, q0_e, q1_e);
			// }
			// assert(q0_s <= q1_s && q0_e <= q1_e && q0_s <= q0_e && q1_s <= q1_e);
			if(r0_s <= r1_s) assert(q0_s <= q1_s);
			if(r0_e <= r1_e) assert(q0_e <= q1_e);
			// assert(r0_s <= r1_s && r0_e <= r1_e && q0_s <= q1_s && q0_e <= q1_e);
			assert(q0_s>=0 && q0_e>=0 && q1_s>=0 && q1_e>=0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x2, -0x18(%rbp)
jg 0x29ac74
jmp 0x29ae62
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x28(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x40(%rbp), %r9
callq 0x2985f0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
subq $0x1, %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdx
leaq -0x58(%rbp), %rcx
leaq -0x60(%rbp), %r8
leaq -0x68(%rbp), %r9
callq 0x2985f0
movq $0x1, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jge 0x29ad07
movq -0x10(%rbp), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x29acc5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
subq $0x1, %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
xorl %eax, %eax
movl %eax, %esi
callq 0x29a420
movq $0x1, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x29ae62
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
imulq $0x28, -0x48(%rbp), %rax
addq %rax, %rsi
addq $-0x28, %rsi
leaq -0x28(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x40(%rbp), %r9
callq 0x2985f0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
imulq $0x28, -0x48(%rbp), %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdx
leaq -0x58(%rbp), %rcx
leaq -0x60(%rbp), %r8
leaq -0x68(%rbp), %r9
callq 0x2985f0
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jg 0x29adbf
movq -0x38(%rbp), %rax
cmpq -0x60(%rbp), %rax
jg 0x29ad9e
jmp 0x29adbd
leaq 0xf6d38(%rip), %rdi     # 0x391add
leaq 0xf5a83(%rip), %rsi     # 0x39082f
movl $0x1348, %edx           # imm = 0x1348
leaq 0xf6d32(%rip), %rcx     # 0x391aea
callq 0x2130
jmp 0x29adbf
movq -0x30(%rbp), %rax
cmpq -0x58(%rbp), %rax
jg 0x29adf6
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jg 0x29add5
jmp 0x29adf4
leaq 0xf6d5c(%rip), %rdi     # 0x391b38
leaq 0xf5a4c(%rip), %rsi     # 0x39082f
movl $0x1349, %edx           # imm = 0x1349
leaq 0xf6cfb(%rip), %rcx     # 0x391aea
callq 0x2130
jmp 0x29adf6
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x69(%rbp)
jl 0x29ae25
xorl %eax, %eax
cmpq $0x0, -0x40(%rbp)
movb %al, -0x69(%rbp)
jl 0x29ae25
xorl %eax, %eax
cmpq $0x0, -0x60(%rbp)
movb %al, -0x69(%rbp)
jl 0x29ae25
cmpq $0x0, -0x68(%rbp)
setge %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x29ae2e
jmp 0x29ae30
jmp 0x29ae4f
leaq 0xf6d0e(%rip), %rdi     # 0x391b45
leaq 0xf59f1(%rip), %rsi     # 0x39082f
movl $0x134b, %edx           # imm = 0x134B
leaq 0xf6ca0(%rip), %rcx     # 0x391aea
callq 0x2130
jmp 0x29ae51
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x29ad2c
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)