// File: /workspace/github_cpp_makefile_star2_O2/Ziang95[P]Tomasulo_simulator/branch.cpp
// Function: branchCtrl::branch_automat()
void branchCtrl::branch_automat()
{
    next_vdd = 0;
    while (true)
    {
        at_rising_edge(next_vdd);
        at_falling_edge(next_vdd);
        if (ROB_i>-1)
        {
            pthread_mutex_lock(&squash_mutex);
            while (!instr_Q->squash)
                pthread_cond_wait(&squash_cond, &squash_mutex);
            pthread_mutex_unlock(&squash_mutex);
            ROBEntry *R = CPU_ROB->get_entry(ROB_i);
            RAT = R->bkupRAT;
            at_falling_edge(next_vdd);
            for (auto fu : iAdder)
                fu->squash(ROB_i);
            for (auto fu : fAdder)
                fu->squash(ROB_i);
            for (auto fu : fMtplr)
                fu->squash(ROB_i);
            for (auto fu : lsUnit)
                fu->squash(ROB_i);
            nopBub->squash(ROB_i);
            main_mem.squash(ROB_i);
            fCDB.squash(ROB_i);
            R->finished = true;
            CPU_ROB->squash(ROB_i);
            at_rising_edge(next_vdd);
            instr_Q->move_ptr(target);
            msg_log("squash finished", 3);
            at_falling_edge(next_vdd);
            at_rising_edge(next_vdd);
            instr_Q->squash = false;
            ROB_i = -1;
            at_falling_edge(next_vdd);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
andl $0x0, 0x10(%rdi)
leaq 0xebb5(%rip), %r15      # 0x16328
leaq 0xebee(%rip), %r12      # 0x16368
leaq 0xeb77(%rip), %r13      # 0x162f8
movq %r14, -0x38(%rbp)
movq %r14, %rdi
callq 0x83e0
movq %r14, %rdi
callq 0x8437
cmpl $0x0, (%rbx)
js 0x7785
movq %r15, %rdi
callq 0x3390
movq (%r12), %rax
cmpb $0x0, 0x4(%rax)
jne 0x77b9
movq %r13, %rdi
movq %r15, %rsi
callq 0x33a0
jmp 0x77a2
movq %r15, %rdi
callq 0x3210
leaq 0xeba8(%rip), %rax      # 0x16370
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x6c7e
movq %rax, -0x40(%rbp)
leaq 0x68(%rax), %rsi
leaq 0xf487(%rip), %rdi      # 0x16c68
callq 0x79a4
movq %r14, %rdi
callq 0x8437
leaq 0xebcb(%rip), %rax      # 0x163c0
movq (%rax), %r14
movq 0x8(%rax), %r13
cmpq %r13, %r14
je 0x7811
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x3fb8
addq $0x8, %r14
jmp 0x77fc
leaq 0xebc0(%rip), %rax      # 0x163d8
movq (%rax), %r14
movq 0x8(%rax), %r13
cmpq %r13, %r14
je 0x7834
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x3fb8
addq $0x8, %r14
jmp 0x781f
leaq 0xebb5(%rip), %rax      # 0x163f0
movq (%rax), %r14
movq 0x8(%rax), %r13
cmpq %r13, %r14
je 0x7857
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x3fb8
addq $0x8, %r14
jmp 0x7842
leaq 0xebaa(%rip), %rax      # 0x16408
movq (%rax), %r14
movq 0x8(%rax), %r13
movl (%rbx), %esi
cmpq %r13, %r14
je 0x787a
movq (%r14), %rdi
callq 0x3fb8
addq $0x8, %r14
jmp 0x7865
leaq 0xeb37(%rip), %rax      # 0x163b8
movq (%rax), %rdi
callq 0x5556
movl (%rbx), %esi
leaq 0xf49e(%rip), %rdi      # 0x16d30
callq 0xc600
movl (%rbx), %esi
leaq 0xeb80(%rip), %rdi      # 0x16420
callq 0x3b3e
movq -0x40(%rbp), %rax
movb $0x1, (%rax)
leaq 0xeabd(%rip), %r13      # 0x16370
movq (%r13), %rdi
movl (%rbx), %esi
callq 0x6d9a
movq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x83e0
movq (%r12), %rdi
movl 0x4(%rbx), %esi
callq 0xa79a
leaq -0x60(%rbp), %r13
movq %r13, %rdi
leaq 0x79a7(%rip), %rsi      # 0xf28b
leaq -0x29(%rbp), %rdx
callq 0x3100
movq %r13, %rdi
pushq $0x3
popq %rsi
callq 0x8343
movq %r13, %rdi
callq 0x3140
movq %r14, %rdi
callq 0x8437
movq %r14, %rdi
callq 0x83e0
movq (%r12), %rax
movb $0x0, 0x4(%rax)
orl $-0x1, (%rbx)
movq %r14, %rdi
callq 0x8437
leaq 0xe9ce(%rip), %r13      # 0x162f8
jmp 0x7785
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3440