// File: /workspace/github_cpp_makefile_star2_O3/Ziang95[P]Tomasulo_simulator/FU.cpp
// Function: init_FUs()
void init_FUs()
{
    if (iAdder.size())
        for (auto &p : iAdder)
            delete p;
    if (fAdder.size())
        for (auto &p : fAdder)
            delete p;
    if (fMtplr.size())
        for (auto &p : fMtplr)
            delete p;
    if (lsUnit.size())
        for (auto &p : lsUnit)
            delete p;
    if (nopBub)
        delete nopBub;
    iAdder = {};
    fAdder = {};
    fMtplr = {};
    lsUnit = {};
    for (int i = 0; i<CPU_cfg->int_add->fu_num; i++)
    {
        auto tmp = new intAdder();
        while(pthread_create(&tmp->handle, NULL, &intAdder_thread_container, tmp));
        clk_wait_list.push_back(&tmp->next_vdd);
        iAdder.push_back(tmp);
    }
    for (int i = 0; i<CPU_cfg->fp_add->fu_num; i++)
    {
        auto tmp = new flpAdder();
        while(pthread_create(&tmp->handle, NULL, &flpAdder_thread_container, tmp));
        clk_wait_list.push_back(&tmp->next_vdd);
        fAdder.push_back(tmp);
    }
    for (int i = 0; i<CPU_cfg->fp_mul->fu_num; i++)
    {
        auto tmp = new flpMtplr();
        while(pthread_create(&tmp->handle, NULL, &flpMlptr_thread_container, tmp));
        clk_wait_list.push_back(&tmp->next_vdd);
        fMtplr.push_back(tmp);
    }
    for (int i = 0; i<CPU_cfg->ld_str->fu_num; i++)
    {
        auto tmp = new ldsdUnit();
        while(pthread_create(&tmp->handle, NULL, &ldsdUnit_thread_container, tmp));
        clk_wait_list.push_back(&tmp->next_vdd);
        lsUnit.push_back(tmp);
    }
    nopBub = new nopBublr();
    while(pthread_create(&nopBub->handle, NULL, &nopBublr_thread_container, nopBub));
    clk_wait_list.push_back(&nopBub->next_vdd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x1486f(%rip), %rax     # 0x1b3b8
movq (%rax), %r14
movq 0x8(%rax), %r15
cmpq %r14, %r15
je 0x6b76
movq (%r14), %rbx
testq %rbx, %rbx
je 0x6b65
movq %rbx, %rdi
callq 0x4546
movq %rbx, %rdi
callq 0x3230
addq $0x8, %r14
cmpq %r15, %r14
jne 0x6b55
leaq 0x14853(%rip), %rax     # 0x1b3d0
movq (%rax), %r14
movq 0x8(%rax), %r15
cmpq %r14, %r15
je 0x6baa
movq (%r14), %rbx
testq %rbx, %rbx
je 0x6b99
movq %rbx, %rdi
callq 0x52e0
movq %rbx, %rdi
callq 0x3230
addq $0x8, %r14
cmpq %r15, %r14
jne 0x6b89
leaq 0x14837(%rip), %rax     # 0x1b3e8
movq (%rax), %r14
movq 0x8(%rax), %r15
cmpq %r14, %r15
je 0x6bde
movq (%r14), %rbx
testq %rbx, %rbx
je 0x6bcd
movq %rbx, %rdi
callq 0x5a2a
movq %rbx, %rdi
callq 0x3230
addq $0x8, %r14
cmpq %r15, %r14
jne 0x6bbd
leaq 0x1481b(%rip), %rax     # 0x1b400
movq (%rax), %r14
movq 0x8(%rax), %r15
cmpq %r14, %r15
je 0x6c12
movq (%r14), %rbx
testq %rbx, %rbx
je 0x6c01
movq %rbx, %rdi
callq 0x6114
movq %rbx, %rdi
callq 0x3230
addq $0x8, %r14
cmpq %r15, %r14
jne 0x6bf1
leaq 0x14797(%rip), %rax     # 0x1b3b0
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6c26
callq 0x3230
leaq 0x1478b(%rip), %r12     # 0x1b3b8
xorl %r15d, %r15d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7530
leaq 0x1478d(%rip), %rdi     # 0x1b3d0
xorl %esi, %esi
xorl %edx, %edx
callq 0x765c
leaq 0x14795(%rip), %rdi     # 0x1b3e8
xorl %esi, %esi
xorl %edx, %edx
callq 0x7788
leaq 0x1479d(%rip), %rdi     # 0x1b400
xorl %esi, %esi
xorl %edx, %edx
callq 0x78b4
leaq 0x146e5(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x8(%rax), %rcx
cmpl $0x0, 0xc(%rcx)
jle 0x6d36
leaq -0x197(%rip), %r13      # 0x6af4
leaq 0x1507e(%rip), %rbx     # 0x1bd10
movl $0x38a8, %edi           # imm = 0x38A8
callq 0x3250
movq %rax, %r14
movq %rax, %rdi
callq 0x442a
movq %r14, -0x30(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x3890(%rcx), %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x3460
testl %eax, %eax
jne 0x6cab
movq -0x30(%rbp), %rax
movl $0x3888, %ecx           # imm = 0x3888
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6ce8
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x6cf4
movq %rbx, %rdi
leaq -0x38(%rbp), %rdx
callq 0x72bc
movq 0x8(%r12), %rsi
cmpq 0x10(%r12), %rsi
je 0x6d0f
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r12)
jmp 0x6d1b
movq %r12, %rdi
leaq -0x30(%rbp), %rdx
callq 0x79e0
incl %r15d
leaq 0x14633(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x8(%rax), %rcx
cmpl 0xc(%rcx), %r15d
jl 0x6c92
movq 0x10(%rax), %rcx
cmpl $0x0, 0xc(%rcx)
jle 0x6dfb
xorl %r15d, %r15d
leaq -0x24d(%rip), %r12      # 0x6b01
movl $0x3888, %r13d          # imm = 0x3888
leaq 0x14fb5(%rip), %rbx     # 0x1bd10
movl $0x38b0, %edi           # imm = 0x38B0
callq 0x3250
movq %rax, %r14
movq %rax, %rdi
callq 0x5164
movq %r14, -0x30(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x3890(%rcx), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3460
testl %eax, %eax
jne 0x6d74
movq -0x30(%rbp), %rax
addq %r13, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6dac
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x6db8
movq %rbx, %rdi
leaq -0x38(%rbp), %rdx
callq 0x72bc
leaq 0x14611(%rip), %rdi     # 0x1b3d0
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6dd7
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6de0
leaq -0x30(%rbp), %rdx
callq 0x7afc
incl %r15d
leaq 0x1456e(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x10(%rax), %rcx
cmpl 0xc(%rcx), %r15d
jl 0x6d5b
movq 0x18(%rax), %rcx
cmpl $0x0, 0xc(%rcx)
jle 0x6ec0
xorl %r12d, %r12d
leaq -0x305(%rip), %r15      # 0x6b0e
movl $0x3888, %r13d          # imm = 0x3888
leaq 0x14ef0(%rip), %rbx     # 0x1bd10
movl $0x38b0, %edi           # imm = 0x38B0
callq 0x3250
movq %rax, %r14
movq %rax, %rdi
callq 0x58ae
movq %r14, -0x30(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x3890(%rcx), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3460
testl %eax, %eax
jne 0x6e39
movq -0x30(%rbp), %rax
addq %r13, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6e71
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x6e7d
movq %rbx, %rdi
leaq -0x38(%rbp), %rdx
callq 0x72bc
leaq 0x14564(%rip), %rdi     # 0x1b3e8
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6e9c
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6ea5
leaq -0x30(%rbp), %rdx
callq 0x7c18
incl %r12d
leaq 0x144a9(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x18(%rax), %rcx
cmpl 0xc(%rcx), %r12d
jl 0x6e20
movq 0x20(%rax), %rax
cmpl $0x0, 0xc(%rax)
jle 0x6f85
xorl %r15d, %r15d
leaq -0x3bd(%rip), %r14      # 0x6b1b
movl $0x3888, %r12d          # imm = 0x3888
leaq 0x14e2b(%rip), %rbx     # 0x1bd10
movl $0x38a8, %edi           # imm = 0x38A8
callq 0x3250
movq %rax, %r13
movq %rax, %rdi
callq 0x5ff8
movq %r13, -0x30(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x3890(%rcx), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3460
testl %eax, %eax
jne 0x6efe
movq -0x30(%rbp), %rax
addq %r12, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6f36
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0x6f42
movq %rbx, %rdi
leaq -0x38(%rbp), %rdx
callq 0x72bc
leaq 0x144b7(%rip), %rdi     # 0x1b400
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6f61
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6f6a
leaq -0x30(%rbp), %rdx
callq 0x7d34
incl %r15d
leaq 0x143e4(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x20(%rax), %rax
cmpl 0xc(%rax), %r15d
jl 0x6ee5
movl $0x50, %edi
callq 0x3250
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rax)
movl $0x18, %ecx
movl $0xffffffff, -0x8(%rax,%rcx) # imm = 0xFFFFFFFF
movq $0x0, (%rax,%rcx)
addq $0x10, %rcx
cmpq $0x48, %rcx
jne 0x6fa2
leaq 0x143ed(%rip), %r14     # 0x1b3b0
movq %rax, (%r14)
leaq -0x4a5(%rip), %rbx      # 0x6b28
movq (%r14), %rcx
leaq 0x40(%rcx), %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x3460
testl %eax, %eax
jne 0x6fcd
movq (%r14), %rax
addq $0x48, %rax
movq %rax, -0x30(%rbp)
leaq 0x14d1c(%rip), %rcx     # 0x1bd10
movq 0x8(%rcx), %rsi
cmpq 0x10(%rcx), %rsi
je 0x7008
movq %rax, (%rsi)
addq $0x8, 0x8(%rcx)
jmp 0x7018
leaq 0x14d01(%rip), %rdi     # 0x1bd10
leaq -0x30(%rbp), %rdx
callq 0x72bc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r13, %rdi
jmp 0x7039
jmp 0x7033
jmp 0x7033
movq %rax, %rbx
movq %r14, %rdi
callq 0x3230
movq %rbx, %rdi
callq 0x3440