// File: chhylp123[P]hifiasm/inter.cpp
// Function: update_ug_arch_ul(void*, long, int)
static void update_ug_arch_ul(void *data, long i, int tid) // callback for kt_for()
{
	const ma_ug_t *ug = (ma_ug_t *)data;
	asg_arc_t *e = &(ug->g->arc[i]); e->ou = 0;
	uint32_t v = e->ul>>32, w = e->v, k, uv, uw;
	uint64_t *a, a_n; uc_block_t *p, *n;
	a = UL_INF.ridx.occ.a + UL_INF.ridx.idx.a[v>>1];
	a_n = UL_INF.ridx.idx.a[(v>>1)+1] - UL_INF.ridx.idx.a[v>>1]; 
	for (k = 0; k < a_n; k++) {
		p = &(UL_INF.a[a[k]>>32].bb.a[(uint32_t)(a[k])]);
		if(p->base || (!p->el) || (!p->pchain)) continue;
		uv = (((uint32_t)(p->hid))<<1)|((uint32_t)(p->rev));
		if((uv == v) && (p->aidx != (uint32_t)-1)) {
			n = &(UL_INF.a[a[k]>>32].bb.a[p->aidx]);
			assert((!n->base)&&(n->el)&&(n->pchain)&&(n->pidx==((uint32_t)(a[k]))));
			uw = (((uint32_t)(n->hid))<<1)|((uint32_t)(n->rev));
			if(uw == w) e->ou++;
		}

		if(((uv^1) == v) && (p->pidx != (uint32_t)-1)) {
			n = &(UL_INF.a[a[k]>>32].bb.a[p->pidx]);
			// if(!((!n->base)&&(n->el)&&(n->pchain)&&(n->aidx==((uint32_t)(a[k]))))) {
			// 	fprintf(stderr, "ulid->%ld, n->base::%u, n->el::%u, n->pchain::%u, n->aidx::%u, ((uint32_t)(a[k]))::%u\n", 
			// 	i, n->base, n->el, n->pchain, n->aidx, ((uint32_t)(a[k])));
			// }
			assert((!n->base)&&(n->el)&&(n->pchain)&&(n->aidx==((uint32_t)(a[k]))));
			uw = (((uint32_t)(n->hid))<<1)|((uint32_t)(n->rev)); uw ^= 1;
			if(uw == w) e->ou++;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movw 0x10(%rax), %cx
andw $0xc000, %cx            # imm = 0xC000
orw $0x0, %cx
movw %cx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0xd4141(%rip), %rax     # 0x3c53b8
movq 0x40(%rax), %rax
leaq 0xd4136(%rip), %rcx     # 0x3c53b8
movq 0x28(%rcx), %rcx
movl -0x2c(%rbp), %edx
shrl %edx
movl %edx, %edx
movl (%rcx,%rdx,4), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
leaq 0xd4116(%rip), %rax     # 0x3c53b8
movq 0x28(%rax), %rax
movl -0x2c(%rbp), %ecx
shrl %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
leaq 0xd40fe(%rip), %rcx     # 0x3c53b8
movq 0x28(%rcx), %rcx
movl -0x2c(%rbp), %edx
shrl %edx
movl %edx, %edx
subl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpq -0x50(%rbp), %rax
jae 0x2f15ca
leaq 0xd40cf(%rip), %rax     # 0x3c53b8
movq 0x48(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movb 0x20(%rax), %al
shrb $0x6, %al
andb $0x1, %al
cmpb $0x0, %al
jne 0x2f134a
movq -0x58(%rbp), %rax
movb 0x20(%rax), %al
shrb $0x7, %al
cmpb $0x0, %al
je 0x2f134a
movq -0x58(%rbp), %rax
movb 0x20(%rax), %al
andb $0x1f, %al
cmpb $0x0, %al
jne 0x2f134f
jmp 0x2f15bc
movq -0x58(%rbp), %rax
movl (%rax), %eax
shll %eax
movq -0x58(%rbp), %rcx
movb 0x20(%rcx), %cl
shrb $0x5, %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x2f148d
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x1c(%rax)
je 0x2f148d
leaq 0xd402b(%rip), %rax     # 0x3c53b8
movq 0x48(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq -0x58(%rbp), %rcx
movl 0x1c(%rcx), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
shrb $0x6, %cl
andb $0x1, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x61(%rbp)
jne 0x2f1416
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
shrb $0x7, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x61(%rbp)
je 0x2f1416
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
andb $0x1f, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x61(%rbp)
je 0x2f1416
movq -0x60(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
sete %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x2f141f
jmp 0x2f1421
jmp 0x2f1440
leaq 0xa4698(%rip), %rdi     # 0x395ac0
leaq 0x9f400(%rip), %rsi     # 0x39082f
movl $0x4cab, %edx           # imm = 0x4CAB
leaq 0xa46c5(%rip), %rcx     # 0x395b00
callq 0x2130
movq -0x60(%rbp), %rax
movl (%rax), %eax
shll %eax
movq -0x60(%rbp), %rcx
movb 0x20(%rcx), %cl
shrb $0x5, %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x2f148b
movq -0x28(%rbp), %rax
movw 0x10(%rax), %dx
andw $0x3fff, %dx            # imm = 0x3FFF
addw $0x1, %dx
movw 0x10(%rax), %cx
andw $0x3fff, %dx            # imm = 0x3FFF
andw $0xc000, %cx            # imm = 0xC000
orw %dx, %cx
movw %cx, 0x10(%rax)
jmp 0x2f148d
movl -0x38(%rbp), %eax
xorl $0x1, %eax
cmpl -0x2c(%rbp), %eax
jne 0x2f15ba
movq -0x58(%rbp), %rax
cmpl $-0x1, 0x14(%rax)
je 0x2f15ba
leaq 0xd3f07(%rip), %rax     # 0x3c53b8
movq 0x48(%rax), %rax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq -0x58(%rbp), %rcx
movl 0x14(%rcx), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
shrb $0x6, %cl
andb $0x1, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x62(%rbp)
jne 0x2f153a
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
shrb $0x7, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x62(%rbp)
je 0x2f153a
movq -0x60(%rbp), %rax
movb 0x20(%rax), %cl
andb $0x1f, %cl
xorl %eax, %eax
cmpb $0x0, %cl
movb %al, -0x62(%rbp)
je 0x2f153a
movq -0x60(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x48(%rbp), %rcx
movl -0x34(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
sete %al
movb %al, -0x62(%rbp)
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0x2f1543
jmp 0x2f1545
jmp 0x2f1564
leaq 0xa45de(%rip), %rdi     # 0x395b2a
leaq 0x9f2dc(%rip), %rsi     # 0x39082f
movl $0x4cb6, %edx           # imm = 0x4CB6
leaq 0xa45a1(%rip), %rcx     # 0x395b00
callq 0x2130
movq -0x60(%rbp), %rax
movl (%rax), %eax
shll %eax
movq -0x60(%rbp), %rcx
movb 0x20(%rcx), %cl
shrb $0x5, %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x2f15b8
movq -0x28(%rbp), %rax
movw 0x10(%rax), %dx
andw $0x3fff, %dx            # imm = 0x3FFF
addw $0x1, %dx
movw 0x10(%rax), %cx
andw $0x3fff, %dx            # imm = 0x3FFF
andw $0xc000, %cx            # imm = 0xC000
orw %dx, %cx
movw %cx, 0x10(%rax)
jmp 0x2f15ba
jmp 0x2f15bc
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x2f12d5
addq $0x70, %rsp
popq %rbp
retq