// File: chhylp123[P]hifiasm/inter.cpp
// Function: get_trans_ul_ov_t(ug_trans_t*, unsigned int, unsigned int)
ul_ov_t* get_trans_ul_ov_t(ug_trans_t *s, uint32_t qn, uint32_t tn)
{
	ha_mzl_t *f = &(s->srt_a.a[qn]);
	if(!(f->rev)) return NULL;
	kv_ul_ov_t *bl = &(s->ll[(uint32_t)(f->x)].tk);
	uint64_t k = f->rid; k <<= 32; k += f->pos;
	// if(!(bl->a[k].qn == (f->x>>32))) {
	// 	fprintf(stderr, "[M::%s::] k::%lu, qn::%u, tn::%u, x>>32::%lu, (uint32_t)x::%u\n", 
	// 	__func__, k, qn, tn, (f->x>>32), (uint32_t)(f->x));
	// }
	// if(!(bl->a[k].qn == (f->x>>32))) {
	// 	fprintf(stderr, "[M::%s::] k::%lu, bl->a[k].qn::%u, (f->x>>32)::%lu, (uint32_t)(f->x)::%u\n", 
	// 				__func__, k, bl->a[k].qn, (f->x>>32), (uint32_t)(f->x));
	// }
	assert(bl->a[k].qn == (f->x>>32));
	for (; (k < bl->n) && (bl->a[k].qn == (f->x>>32)); k++) {
		if(bl->a[k].qn == bl->a[k].tn) continue;
		if(bl->a[k].tn == tn) return &(bl->a[k]);
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x98(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x2cdcce
movq $0x0, -0x8(%rbp)
jmp 0x2cde13
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movl %ecx, %ecx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
andq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0x2cdd43
jmp 0x2cdd62
leaq 0xc4f3b(%rip), %rdi     # 0x392c85
leaq 0xc2ade(%rip), %rsi     # 0x39082f
movl $0x310a, %edx           # imm = 0x310A
leaq 0xc4f42(%rip), %rcx     # 0x392c9f
callq 0x2130
jmp 0x2cdd64
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x31(%rbp)
jae 0x2cdd9c
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x2cdda5
jmp 0x2cde0b
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x30(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x2cddcc
jmp 0x2cddfa
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x18(%rbp), %eax
jne 0x2cddf8
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x2cde13
jmp 0x2cddfa
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x2cdd64
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)