// File: /workspace/github_cpp_makefile_star2_O3/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 0x1231e(%rip), %r15     # 0x1b320
leaq 0x12357(%rip), %r13     # 0x1b360
movq %r12, -0x30(%rbp)
movq %r12, %rdi
callq 0x9feb
movq %r12, %rdi
callq 0xa049
cmpl $0x0, (%rbx)
js 0x900d
movq %r15, %rdi
callq 0x3380
movq (%r13), %rax
cmpb $0x0, 0x4(%rax)
movq %r13, %r14
leaq 0x122b4(%rip), %r13     # 0x1b2f0
jne 0x9052
movq %r13, %rdi
movq %r15, %rsi
callq 0x3390
movq (%r14), %rax
cmpb $0x1, 0x4(%rax)
jne 0x903e
movq %r14, %r13
movq %r15, %rdi
callq 0x31e0
leaq 0x12304(%rip), %rax     # 0x1b368
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x7f98
movq %rax, %r15
leaq 0x68(%rax), %rsi
leaq 0x12be4(%rip), %rdi     # 0x1bc60
cmpq %rdi, %rsi
je 0x9086
callq 0x927a
movq %r12, %rdi
callq 0xa049
leaq 0x12323(%rip), %rax     # 0x1b3b8
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x90b1
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x43a4
addq $0x8, %r14
jmp 0x909c
leaq 0x12318(%rip), %rax     # 0x1b3d0
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x90d4
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x43a4
addq $0x8, %r14
jmp 0x90bf
leaq 0x1230d(%rip), %rax     # 0x1b3e8
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x90f7
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x43a4
addq $0x8, %r14
jmp 0x90e2
leaq 0x12302(%rip), %rax     # 0x1b400
movq (%rax), %r14
movq 0x8(%rax), %r12
cmpq %r12, %r14
je 0x911a
movq (%r14), %rdi
movl (%rbx), %esi
callq 0x43a4
addq $0x8, %r14
jmp 0x9105
leaq 0x1228f(%rip), %rax     # 0x1b3b0
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x69d4
movl (%rbx), %esi
leaq 0x12bf4(%rip), %rdi     # 0x1bd28
callq 0xfa02
movl (%rbx), %esi
leaq 0x122d6(%rip), %rdi     # 0x1b418
callq 0x3d24
movb $0x1, (%r15)
leaq 0x12216(%rip), %rax     # 0x1b368
movq (%rax), %rdi
movl (%rbx), %esi
callq 0x80d6
movq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x9feb
movq (%r13), %rdi
movl 0x4(%rbx), %esi
callq 0xcc4c
leaq -0x40(%rbp), %r14
movq %r14, -0x50(%rbp)
leaq -0x50(%rbp), %r15
movq %r15, %rdi
leaq 0xc101(%rip), %rsi      # 0x1528b
leaq 0xc109(%rip), %rdx      # 0x1529a
callq 0x721e
movq %r15, %rdi
movl $0x3, %esi
callq 0x9f0f
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x91b1
callq 0x3230
movq %r12, %rdi
callq 0xa049
movq %r12, %rdi
callq 0x9feb
movq (%r13), %rax
movb $0x0, 0x4(%rax)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0xa049
leaq 0x12142(%rip), %r15     # 0x1b320
jmp 0x900d
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x91f4
callq 0x3230
movq %rbx, %rdi
callq 0x3440