// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, 0x18(%rsp)
movq 0x10(%rsi), %rcx
imulq $0x48, %rax, %rsi
movq 0x10(%rcx,%rsi), %r12
movl 0x18(%rcx,%rsi), %r15d
testq %r15, %r15
leaq (%r12,%r15,4), %rax
movl 0x1c(%rcx,%rsi), %edx
cmoveq %r15, %r12
testq %rdx, %rdx
cmoveq %rdx, %rax
movq %rax, 0x20(%rsp)
movq %rsi, 0x10(%rsp)
movl 0x24(%rcx,%rsi), %eax
cmpl $-0x1, %eax
je 0x10caa4
testl %eax, %eax
je 0x10ca9e
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x10caa8
movl 0x18(%r14), %ebp
jmp 0x10caa8
movl 0x20(%r14), %ebp
jmp 0x10caa8
movl 0x1c(%r14), %ebp
xorl %ebx, %ebx
movq %rdx, 0x8(%rsp)
cmpq %rbx, %r15
je 0x10cb0b
movl (%r12,%rbx,4), %r13d
movq 0x10(%r14), %rax
movl (%rax,%r13,4), %ecx
movl %ecx, %r8d
andl $0x7, %r8d
cmpl %r8d, %ebp
jne 0x10cada
andl $-0x8, %ecx
orl %ebp, %ecx
movl %ecx, (%rax,%r13,4)
incq %rbx
jmp 0x10caaf
movq 0x1464ff(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0xe1328(%rip), %rsi     # 0x1ede13
movl 0x4(%rsp), %edx
movl %r13d, %ecx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdx
movq 0x10(%r14), %rax
movl (%rax,%r13,4), %ecx
jmp 0x10cacc
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rsp), %rcx
movl 0x28(%rax,%rcx), %eax
addl $0x2, %eax
cmpl $0x3, %eax
movq 0x20(%rsp), %r15
ja 0x10cb4e
leaq 0xe064b(%rip), %rcx     # 0x1ed17c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
jmp 0x10cb4e
movl 0x20(%r14), %ebp
jmp 0x10cb4e
movl 0x18(%r14), %ebp
jmp 0x10cb4e
movl 0x1c(%r14), %ebp
leaq 0xe12ef(%rip), %r13     # 0x1ede44
xorl %ebx, %ebx
cmpq %rbx, %rdx
je 0x10cbaf
movl (%r15,%rbx,4), %r12d
movq 0x10(%r14), %rax
movl (%rax,%r12,4), %ecx
movl %ecx, %r8d
andl $0x7, %r8d
cmpl %r8d, %ebp
jne 0x10cb82
andl $-0x8, %ecx
orl %ebp, %ecx
movl %ecx, (%rax,%r12,4)
incq %rbx
jmp 0x10cb57
movq 0x146457(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq %r13, %rsi
movl 0x4(%rsp), %edx
movl %r12d, %ecx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdx
movq 0x10(%r14), %rax
movl (%rax,%r12,4), %ecx
jmp 0x10cb74
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq