// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: update_partition_flag_debug(H_partition*, G_partition*, hc_links*, unsigned int)
void update_partition_flag_debug(H_partition* h, G_partition* g_p, hc_links* link, uint32_t id)
{
    uint32_t k, *h0, h0_n, *h1, h1_n, uID, flag = 0;
    int status;
    get_phased_block(g_p, NULL, id, NULL, NULL, &h0, &h0_n, &h1, &h1_n, NULL, NULL);

    status = g_p->a[id].status[0];
    if(status == 1) flag = h->m[0];
    else if(status == -1) flag = h->m[1];
    else if(status == 0) flag = h->m[2];
    else if(status == -2) flag = 0;
    for (k = 0; k < h0_n; k++)
    {
        uID = h0[k];
        if(flag != (h->hap[uID]&7)) fprintf(stderr, "h0, id: %u, uID: %u, pre_flag: %u, cur_flag: %u\n", id, uID, (h->hap[uID]&7), flag);
        h->hap[uID] >>= 3;
        h->hap[uID] <<= 3;
        h->hap[uID] |= flag;
    }

    status = g_p->a[id].status[1];
    if(status == 1) flag = h->m[0];
    else if(status == -1) flag = h->m[1];
    else if(status == 0) flag = h->m[2];
    else if(status == -2) flag = 0;
    for (k = 0; k < h1_n; k++)
    {
        uID = h1[k];
        if(flag != (h->hap[uID]&7)) fprintf(stderr, "h1, id: %u, uID: %u, pre_flag: %u, cur_flag: %u\n", id, uID, (h->hap[uID]&7), flag);
        h->hap[uID] >>= 3;
        h->hap[uID] <<= 3;
        h->hap[uID] |= flag;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movl %ecx, 0x4(%rsp)
movl %ecx, %eax
movq 0x10(%rsi), %rcx
leaq (%rax,%rax,8), %r8
movq 0x10(%rcx,%r8,8), %r12
movl 0x18(%rcx,%r8,8), %ebx
testq %rbx, %rbx
leaq (%r12,%rbx,4), %rdx
movl 0x1c(%rcx,%r8,8), %edi
cmoveq %rbx, %r12
testq %rdi, %rdi
cmoveq %rdi, %rdx
movl 0x24(%rcx,%r8,8), %eax
cmpl $-0x1, %eax
movq %rsi, 0x20(%rsp)
movq %r8, 0x18(%rsp)
je 0x14dad5
testl %eax, %eax
je 0x14dacf
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x14dad9
movl 0x18(%r14), %ebp
jmp 0x14dad9
movl 0x20(%r14), %ebp
jmp 0x14dad9
movl 0x1c(%r14), %ebp
testq %rbx, %rbx
movq %rdx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
je 0x14db49
xorl %r15d, %r15d
movl (%r12,%r15,4), %r13d
movq 0x10(%r14), %rax
movl (%rax,%r13,4), %r8d
andl $0x7, %r8d
cmpl %r8d, %ebp
jne 0x14db1b
movq 0x10(%r14), %rax
movl (%rax,%r13,4), %ecx
andl $-0x8, %ecx
orl %ebp, %ecx
movl %ecx, (%rax,%r13,4)
incq %r15
cmpq %r15, %rbx
jne 0x14daeb
jmp 0x14db49
movq 0x13c4be(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xe21eb(%rip), %rsi     # 0x22fd17
movl 0x4(%rsp), %edx
movl %r13d, %ecx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
jmp 0x14db00
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
movl 0x28(%rax,%rcx,8), %eax
addl $0x2, %eax
cmpl $0x3, %eax
ja 0x14db87
leaq 0xe14d2(%rip), %rcx     # 0x22f03c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
jmp 0x14db87
movl 0x20(%r14), %ebp
jmp 0x14db87
movl 0x18(%r14), %ebp
jmp 0x14db87
movl 0x1c(%r14), %ebp
testq %rdi, %rdi
je 0x14dbf0
movq 0x13c44d(%rip), %rbx    # 0x289fe0
leaq 0xe21ae(%rip), %r13     # 0x22fd48
xorl %r15d, %r15d
movl (%rdx,%r15,4), %r12d
movq 0x10(%r14), %rax
movl (%rax,%r12,4), %r8d
andl $0x7, %r8d
cmpl %r8d, %ebp
jne 0x14dbcd
movq 0x10(%r14), %rax
movl (%rax,%r12,4), %ecx
andl $-0x8, %ecx
orl %ebp, %ecx
movl %ecx, (%rax,%r12,4)
incq %r15
cmpq %r15, %rdi
jne 0x14db9d
jmp 0x14dbf0
movq (%rbx), %rdi
movq %r13, %rsi
movl 0x4(%rsp), %edx
movl %r12d, %ecx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
jmp 0x14dbb2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq