// File: /workspace/github_cpp_makefile_star2_O2/Ziang95[P]Tomasulo_simulator/output.cpp
// Function: output_automat(void*)
void* output_automat(void *args)
{
    next_vdd = 0;
    while (true)
    {
        at_rising_edge(next_vdd);
        at_falling_edge(next_vdd);
        if (sys_clk.is_instr_ended() && sys_clk.is_mem_ended())
        {
            pthread_mutex_lock(&cout_lock);
            for (auto s : CPU_output_Q)
                cout<<s.name<<endl;
            cout<<endl;
            memCell m;
            cout<<"\tINT_REG:\t\t\t\tFLP_REG:"<<endl;
            for (int i = 0; i<REG_NUM/2; i++)
            {
                stringstream tmp;
                reg->get("R"+to_string(2*i), m);
                cout<<setw(3)<<"R"+to_string(2*i)<<"="<<m.i<<(m.i>9999?"\t":"\t\t");
                if (2*i + 1 < REG_NUM)
                {
                    reg->get("R"+to_string(2*i+1), m);
                    cout<<setw(3)<<"R"+to_string(i*2+1)<<"="<<m.i<<(m.i>9999?"\t":"\t\t");
                }
                reg->get("F"+to_string(2*i), m);
                cout<<"\t"<<setw(3)<<"F"+to_string(2*i)<<"="<<fixed<<setprecision(2)<<m.f<<"\t";
                if (2*i + 1 < REG_NUM)
                {
                    reg->get("F"+to_string(2*i+1), m);
                    cout<<setw(3)<<"F"+to_string(2*i+1)<<"="<<fixed<<setprecision(2)<<m.f<<"\t";
                }
                cout<<endl;
            }
            cout<<endl;
            for (int i = 0; i<MEM_LEN; i++)
            {
                if (abs(main_mem.getMem(i).f) > 0.001)
                    cout<<"Mem["<<i<<"]="<<fixed<<setprecision(2)<<main_mem.getMem(i).f<<", ";
            }
            cout<<endl<<endl;
            pthread_mutex_unlock(&cout_lock);
            return nullptr;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
andl $0x0, 0xca18(%rip)      # 0x19dec
leaq 0xca11(%rip), %rbx      # 0x19dec
leaq 0x98c6(%rip), %r14      # 0x16ca8
movq %rbx, %rdi
callq 0x83e0
movq %rbx, %rdi
callq 0x8437
movq %r14, %rdi
callq 0x7e2e
testb %al, %al
je 0xd3e2
movq %r14, %rdi
callq 0x7e42
testb %al, %al
je 0xd3e2
leaq 0x8e87(%rip), %rdi      # 0x16298
callq 0x3390
leaq 0xc9ab(%rip), %rax      # 0x19dc8
movq (%rax), %r15
movq 0x8(%rax), %rbx
leaq -0x270(%rbp), %r14
leaq -0x278(%rbp), %r12
cmpq %rbx, %r15
je 0xd467
movq %r12, %rdi
movq %r15, %rsi
callq 0xe0ca
movq 0x8b77(%rip), %rdi      # 0x15fc0
movq %r14, %rsi
callq 0x3260
movq %rax, %rdi
callq 0x3160
movq %r14, %rdi
callq 0x3140
addq $0x28, %r15
jmp 0xd432
movq 0x8b52(%rip), %rbx      # 0x15fc0
movq %rbx, %rdi
callq 0x3160
leaq 0x251e(%rip), %rsi      # 0xf99b
movq %rbx, %rdi
callq 0x3280
movq %rax, %rdi
callq 0x3160
xorl %r14d, %r14d
leaq -0x278(%rbp), %rbx
leaq -0x70(%rbp), %r12
leaq -0x90(%rbp), %r15
cmpl $0x20, %r14d
je 0xd88a
movq %rbx, %rdi
callq 0x31d0
leaq 0x97e5(%rip), %rax      # 0x16ca0
movq (%rax), %rbx
movq %r12, %rdi
movl %r14d, %esi
callq 0x5ab8
movq %r15, %rdi
leaq 0x24de(%rip), %rsi      # 0xf9b1
movq %r12, %rdx
callq 0x5a8a
movq %rbx, %rdi
movq %r15, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xe45c
movq %r15, %rdi
callq 0x3140
movq %r12, %rdi
callq 0x3140
movq 0x8abf(%rip), %rcx      # 0x15fc0
movq (%rcx), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rcx,%rax)
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5ab8
movq %r12, %rdi
leaq 0x2487(%rip), %rsi      # 0xf9b1
movq %rbx, %rdx
callq 0x5a8a
movq 0x8a87(%rip), %rdi      # 0x15fc0
movq %r12, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0x2470(%rip), %rsi      # 0xf9bb
callq 0x3280
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x3430
cmpl $0x2710, -0x2c(%rbp)    # imm = 0x2710
leaq 0x242f(%rip), %rsi      # 0xf998
leaq 0x2429(%rip), %rcx      # 0xf999
cmovgeq %rcx, %rsi
movq %rax, %rdi
callq 0x3280
movq %r12, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3140
leal 0x1(%r14), %r15d
leaq 0x9709(%rip), %rax      # 0x16ca0
movq (%rax), %rbx
movq %r12, %rdi
movl %r15d, %esi
callq 0x5ab8
leaq -0xf0(%rbp), %r13
movq %r13, %rdi
leaq 0x23fb(%rip), %rsi      # 0xf9b1
movq %r12, %rdx
callq 0x5a8a
movq %rbx, %rdi
movq %r13, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xe45c
movq %r13, %rdi
callq 0x3140
movq %r12, %rdi
callq 0x3140
movq 0x89dc(%rip), %rcx      # 0x15fc0
movq (%rcx), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rcx,%rax)
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x5ab8
movq %r12, %rdi
leaq 0x23a4(%rip), %rsi      # 0xf9b1
movq %rbx, %rdx
callq 0x5a8a
movq 0x89a4(%rip), %rdi      # 0x15fc0
movq %r12, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0x238d(%rip), %rsi      # 0xf9bb
callq 0x3280
movl -0x2c(%rbp), %esi
movq %rax, %rdi
callq 0x3430
cmpl $0x2710, -0x2c(%rbp)    # imm = 0x2710
leaq 0x234c(%rip), %rsi      # 0xf998
leaq 0x2346(%rip), %rcx      # 0xf999
cmovgeq %rcx, %rsi
movq %rax, %rdi
callq 0x3280
movq %r12, %rdi
callq 0x3140
leaq -0x50(%rbp), %rdi
callq 0x3140
leaq 0x9629(%rip), %rax      # 0x16ca0
movq (%rax), %rbx
movq %r12, %rdi
movl %r14d, %esi
callq 0x5ab8
leaq -0xd0(%rbp), %r13
movq %r13, %rdi
leaq 0x231d(%rip), %rsi      # 0xf9b3
movq %r12, %rdx
callq 0x5a8a
movq %rbx, %rdi
movq %r13, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xe45c
movq %r13, %rdi
callq 0x3140
movq %r12, %rdi
callq 0x3140
movq 0x88fc(%rip), %rdi      # 0x15fc0
leaq 0x22ce(%rip), %rsi      # 0xf999
callq 0x3280
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rbx,%rax)
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movl %r14d, %esi
callq 0x5ab8
movq %r12, %rdi
leaq 0x22b7(%rip), %rsi      # 0xf9b3
movq %r13, %rdx
callq 0x5a8a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0x22a2(%rip), %rsi      # 0xf9bb
callq 0x3280
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl 0x18(%rax,%rdx), %esi
movl $0xfffffefb, %edi       # imm = 0xFFFFFEFB
andl %edi, %esi
orl $0x4, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq $0x2, 0x8(%rax,%rcx)
movss -0x2c(%rbp), %xmm0
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
leaq 0x223e(%rip), %rsi      # 0xf999
callq 0x3280
movq %r12, %rdi
callq 0x3140
leaq -0x50(%rbp), %rdi
callq 0x3140
leaq 0x9528(%rip), %rax      # 0x16ca0
movq (%rax), %rbx
movq %r12, %rdi
movl %r15d, %esi
callq 0x5ab8
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
leaq 0x221c(%rip), %rsi      # 0xf9b3
movq %r12, %rdx
callq 0x5a8a
movq %rbx, %rdi
movq %r13, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xe45c
movq %r13, %rdi
callq 0x3140
movq %r12, %rdi
callq 0x3140
movq 0x87fb(%rip), %rcx      # 0x15fc0
movq (%rcx), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x10(%rcx,%rax)
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x5ab8
movq %r12, %rdi
leaq 0x21c5(%rip), %rsi      # 0xf9b3
movq %rbx, %rdx
callq 0x5a8a
movq 0x87c3(%rip), %rdi      # 0x15fc0
movq %r12, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0x21ac(%rip), %rsi      # 0xf9bb
callq 0x3280
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl 0x18(%rax,%rdx), %esi
movl $0xfffffefb, %edi       # imm = 0xFFFFFEFB
andl %edi, %esi
orl $0x4, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq $0x2, 0x8(%rax,%rcx)
movss -0x2c(%rbp), %xmm0
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
leaq 0x2148(%rip), %rsi      # 0xf999
callq 0x3280
movq %r12, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3140
movq 0x8753(%rip), %rdi      # 0x15fc0
callq 0x3160
leaq -0x278(%rbp), %rbx
movq %rbx, %rdi
callq 0x3200
addl $0x2, %r14d
jmp 0xd49b
movq 0x872f(%rip), %rdi      # 0x15fc0
callq 0x3160
xorl %r14d, %r14d
leaq 0x9490(%rip), %r15      # 0x16d30
movl $0xfffffefb, %r13d      # imm = 0xFFFFFEFB
leaq 0x1a7e(%rip), %rbx      # 0xf32b
cmpl $0x100, %r14d           # imm = 0x100
je 0xd95a
movq %r15, %rdi
movl %r14d, %esi
callq 0xc5f0
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movd %eax, %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd 0x20b6(%rip), %xmm0     # 0xf990
jbe 0xd952
movq 0x86dd(%rip), %rdi      # 0x15fc0
leaq 0x20cb(%rip), %rsi      # 0xf9b5
callq 0x3280
movq %rax, %rdi
movl %r14d, %esi
callq 0x3430
movq %rax, %rdi
leaq 0x20b6(%rip), %rsi      # 0xf9ba
callq 0x3280
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r12,%rcx), %edx
andl %r13d, %edx
orl $0x4, %edx
movl %edx, 0x18(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x2, 0x8(%r12,%rax)
movq %r15, %rdi
movl %r14d, %esi
callq 0xc5f0
movd %eax, %xmm0
movq %r12, %rdi
callq 0x31f0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3280
incl %r14d
jmp 0xd8ad
movq 0x865f(%rip), %rdi      # 0x15fc0
callq 0x3160
movq %rax, %rdi
callq 0x3160
leaq 0x8923(%rip), %rdi      # 0x16298
callq 0x3210
xorl %eax, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd9ed
jmp 0xd9ed
jmp 0xd9d1
jmp 0xd9d1
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
jmp 0xd9e2
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0xd9e2
jmp 0xd9ed
jmp 0xd9ed
jmp 0xd9ca
jmp 0xd9ca
jmp 0xd9d1
jmp 0xd9ed
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0xd9e2
jmp 0xd9ca
jmp 0xd9ed
movq %rax, %rbx
jmp 0xda11
jmp 0xd9ed
movq %rax, %rbx
jmp 0xd9e7
jmp 0xd9ed
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x3140
leaq -0x70(%rbp), %rdi
jmp 0xda15
movq %rax, %rbx
jmp 0xda1a
movq %rax, %rbx
movq %r14, %rdi
callq 0x3140
jmp 0xda26
jmp 0xda05
jmp 0xda05
jmp 0xda05
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3140
leaq -0x50(%rbp), %rdi
callq 0x3140
leaq -0x278(%rbp), %rdi
callq 0x3200
movq %rbx, %rdi
callq 0x3440