// File: chhylp123[P]hifiasm/inter.cpp
// Function: cal_s_interval(ma_ug_t*, asg_arc_t*, ul_ov_t*)
void cal_s_interval(ma_ug_t *ug, asg_arc_t *p, ul_ov_t *res)
{
	memset(res, 0, sizeof((*res)));
	res->rev = (((p->ul>>32)^(p->v))&((uint32_t)1));
	res->qn = p->ul>>33; res->tn = p->v>>1;
	uint32_t ql = ug->g->seq[res->qn].len, tl = ug->g->seq[res->tn].len;
	if((p->ul>>32)&1) {
		res->qs = 0; res->qe = ((p->ol<=ql)?(p->ol):(ql));
	} else {
		res->qe = ql; res->qs = ((p->ol<=res->qe)?(res->qe-p->ol):(0));
	}

	if(p->v&1) {
		res->te = tl; res->ts = ((p->ol<=res->te)?(res->te-p->ol):(0));
	} else {
		res->ts = 0; res->te = ((p->ol<=tl)?(p->ol):(tl));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2100
movq -0x10(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
xorq %rcx, %rax
andq $0x1, %rax
movl %eax, %edx
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
shrq $0x21, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
shrl %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x2c4b39
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x1c(%rbp), %eax
ja 0x2c4b27
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x24(%rbp)
jmp 0x2c4b2d
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x2c4b84
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2c4b73
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, -0x28(%rbp)
jmp 0x2c4b7a
xorl %eax, %eax
movl %eax, -0x28(%rbp)
jmp 0x2c4b7a
movl -0x28(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2c4be0
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0x18(%rbp), %rcx
cmpl 0x14(%rcx), %eax
ja 0x2c4bcd
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2c4bd4
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2c4bd4
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x2c4c1d
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x20(%rbp), %eax
ja 0x2c4c0d
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x30(%rbp)
jmp 0x2c4c13
movl -0x20(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)