// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movl $0x0, 0x10(%rdi)
leaq 0x1236a(%rip), %r15     # 0x1b320
leaq 0x123a3(%rip), %r13     # 0x1b360
movq %r12, -0x30(%rbp)
movq %r12, %rdi
callq 0x9fdf
movq %r12, %rdi
callq 0xa03d
cmpl $0x0, (%rbx)
js 0x8fc1
movq %r15, %rdi
callq 0x3380
movq (%r13), %rax
cmpb $0x0, 0x4(%rax)
movq %r13, %r14
leaq 0x12300(%rip), %r13     # 0x1b2f0
jne 0x9006
movq %r13, %rdi
movq %r15, %rsi
callq 0x3390
movq (%r14), %rax
cmpb $0x1, 0x4(%rax)
jne 0x8ff2
movq %r14, %r13
movq %r15, %rdi
callq 0x31e0
leaq 0x12350(%rip), %rax     # 0x1b368
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x7f30
movq %rax, %r15
leaq 0x68(%rax), %rsi
leaq 0x12c30(%rip), %rdi     # 0x1bc60
cmpq %rdi, %rsi
je 0x903a
callq 0x922e
movq %r12, %rdi
callq 0xa03d
leaq 0x1236f(%rip), %rax     # 0x1b3b8
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x9065
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x436c
addq $0x8, %r14
jmp 0x9050
leaq 0x12364(%rip), %rax     # 0x1b3d0
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x9088
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x436c
addq $0x8, %r14
jmp 0x9073
leaq 0x12359(%rip), %rax     # 0x1b3e8
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x90ab
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x436c
addq $0x8, %r14
jmp 0x9096
leaq 0x1234e(%rip), %rax     # 0x1b400
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x90ce
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x436c
addq $0x8, %r14
jmp 0x90b9
leaq 0x122db(%rip), %rax     # 0x1b3b0
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x6994
movl (%rbx), %esi
leaq 0x12c40(%rip), %rdi     # 0x1bd28
callq 0xf98c
movl (%rbx), %esi
leaq 0x12322(%rip), %rdi     # 0x1b418
callq 0x3d22
movb $0x1, (%r15)
leaq 0x12262(%rip), %rax     # 0x1b368
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x806e
movq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x9fdf
movq (%r13), %rdi
movl 0x4(%rbx), %esi
callq 0xcc3c
leaq -0x40(%rbp), %r14
movq %r14, -0x50(%rbp)
leaq -0x50(%rbp), %r15
movq %r15, %rdi
leaq 0xc14d(%rip), %rsi      # 0x1528b
leaq 0xc155(%rip), %rdx      # 0x1529a
callq 0x7202
movq %r15, %rdi
movl $0x3, %esi
callq 0x9f03
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x9165
callq 0x3230
movq %r12, %rdi
callq 0xa03d
movq %r12, %rdi
callq 0x9fdf
movq (%r13), %rax
movb $0x0, 0x4(%rax)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0xa03d
leaq 0x1218e(%rip), %r15     # 0x1b320
jmp 0x8fc1
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x91a8
callq 0x3230
movq %rbx, %rdi
callq 0x3440