// File: /workspace/github_cpp_makefile_star2_O1/Ziang95[P]Tomasulo_simulator/FU.cpp
// Function: ldsdUnit::FU_automat()
void ldsdUnit::FU_automat()
{
    next_vdd = 0;
    while (true)
    {
A:      at_rising_edge(next_vdd);
        if (squash_p.flag)
        {
            squash_p.flag = false;
            at_falling_edge(next_vdd);
            continue;
        }
        auto newTask = queue.deQ();
        if (newTask)
        {
            task = *newTask;
            ROBEntry *R = CPU_ROB->get_entry(task.dest);
            R->output.exe = sys_clk.get_prog_cyc();
            for (int i = 0; ;i++)
            {
                if (squash_p.flag)
                {
                    squash_p.flag = false;
                    if (is_prev_index(squash_p.ROB_i, task.dest, squash_p.R_f, squash_p.R_r))
                        break;
                }
                msg_log("Calculating address "+to_string(task.oprnd1->i)+" + "+to_string(task.offset) + ", ROB = " + to_string(task.dest), 3);
                if (i == CPU_cfg->ld_str->exe_time - 1)
                {
                    task.lsqe->addr = task.oprnd1->i + task.offset;
                    if (task.code == SD)
                    {
                        *task.busy = false;
                        if (task.lsqe->SD_source == -1)
                        {
                            at_falling_edge(next_vdd);
                            task.lsqe->ready = true;
                            R->finished = true;
                            goto A;
                        }
                    }
                    else
                    {
                        at_falling_edge(next_vdd);
                        task.lsqe->ready = true;
                        goto A;
                    }
                    break;
                }
                at_falling_edge(next_vdd);
                at_rising_edge(next_vdd);
            }
        }
        at_falling_edge(next_vdd);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x3888(%rdi), %r14
movl $0x0, 0x3888(%rdi)
leaq 0x8(%rdi), %rax
movq %rax, -0x118(%rbp)
leaq 0x3838(%rdi), %rax
movq %rax, -0x120(%rbp)
movq %r14, -0x130(%rbp)
movq %r14, %rdi
callq 0x9fdf
cmpb $0x0, 0x38a4(%rbx)
je 0x61a4
movb $0x0, 0x38a4(%rbx)
movq %r14, %rdi
callq 0xa03d
jmp 0x6182
movslq 0x3808(%rbx), %rcx
cmpl 0x380c(%rbx), %ecx
jne 0x61b7
xorl %eax, %eax
jmp 0x61e2
imulq $0x38, %rcx, %rax
addq -0x118(%rbp), %rax
leal 0x1(%rcx), %edx
leal 0x100(%rcx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
andl $0xffffff00, %esi       # imm = 0xFFFFFF00
negl %esi
addl %esi, %ecx
incl %ecx
movl %ecx, 0x3808(%rbx)
testq %rax, %rax
je 0x619a
movq 0x30(%rax), %rcx
movq -0x120(%rbp), %rdx
movq %rcx, 0x30(%rdx)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rdx)
movups %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
leaq 0x15155(%rip), %rax     # 0x1b368
movq (%rax), %rdi
movl 0x383c(%rbx), %esi
callq 0x7f30
movq %rax, %r15
leaq 0x15a75(%rip), %rdi     # 0x1bca0
callq 0x9674
movq %r15, -0x128(%rbp)
movl %eax, 0x54(%r15)
xorl %r15d, %r15d
cmpb $0x1, 0x38a4(%rbx)
jne 0x6273
movb $0x0, 0x38a4(%rbx)
movl 0x38a0(%rbx), %edi
movl 0x383c(%rbx), %esi
movl 0x3898(%rbx), %edx
movl 0x389c(%rbx), %ecx
callq 0xf729
testb %al, %al
jne 0x619a
movl %r15d, -0x4c(%rbp)
movq 0x3848(%rbx), %rax
movl (%rax), %r13d
movl %r13d, %r15d
negl %r15d
cmovsl %r13d, %r15d
movl $0x1, %r12d
cmpl $0xa, %r15d
jb 0x62de
movl $0x4, %r12d
movl %r15d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x62d5
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x62db
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x62de
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x62a5
addl $-0x3, %r12d
jmp 0x62de
addl $-0x2, %r12d
jmp 0x62de
decl %r12d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r12d, %esi
leaq -0x140(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0x150(%rbp), %r14
movq %r14, %rdi
movl $0x2d, %edx
callq 0x32b0
movq -0x150(%rbp), %rdi
addq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x703e
movl $0x14, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0xed5c(%rip), %rcx      # 0x1508f
callq 0x3280
leaq -0x100(%rbp), %rsi
movq %rsi, -0x110(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6368
movq %rdx, -0x110(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x100(%rbp)
jmp 0x636e
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
leaq -0x38(%rbp), %r15
movq 0x8(%rax), %rdx
movq %rdx, -0x108(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x110(%rbp), %rdi
leaq 0xecba(%rip), %rsi      # 0x15054
callq 0x34a0
movq %r15, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x63bf
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x63c6
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x3860(%rbx), %r15d
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x6441
movl $0x4, %r12d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x6438
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x643e
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x6441
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x6408
addl $-0x3, %r12d
jmp 0x6441
addl $-0x2, %r12d
jmp 0x6441
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
movl $0x2d, %edx
callq 0x32b0
addq -0x90(%rbp), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x703e
movq -0x48(%rbp), %rcx
movl $0xf, %esi
leaq -0x38(%rbp), %r15
cmpq %r15, %rcx
je 0x6490
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %r8
movq -0x88(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq -0xa0(%rbp), %r12
leaq -0xc0(%rbp), %r13
jbe 0x64cd
movl $0xf, %esi
leaq -0x80(%rbp), %rdi
cmpq %rdi, -0x90(%rbp)
je 0x64c8
movq -0x80(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x64df
movq -0x90(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x30d0
jmp 0x64ef
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
movq %r12, -0xb0(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x6515
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x651d
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xa8(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0xb0(%rbp), %rdi
leaq 0xf223(%rip), %rsi      # 0x1576d
callq 0x34a0
movq %r13, -0xd0(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6578
movq %rdx, -0xd0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc0(%rbp)
jmp 0x6580
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, -0xc8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x383c(%rbx), %r15d
movl %r15d, %r13d
negl %r13d
cmovsl %r15d, %r13d
movl $0x1, %r12d
cmpl $0xa, %r13d
jb 0x65fe
movl $0x4, %r12d
movl %r13d, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0x65f5
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0x65fb
cmpl $0x2710, %eax           # imm = 0x2710
jb 0x65fe
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0x65c5
addl $-0x3, %r12d
jmp 0x65fe
addl $-0x2, %r12d
jmp 0x65fe
decl %r12d
shrl $0x1f, %r15d
leal (%r12,%r15), %esi
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x2d, %edx
callq 0x32b0
addq -0x70(%rbp), %r15
movq %r15, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x703e
movq -0xd0(%rbp), %rcx
movl $0xf, %esi
leaq -0xc0(%rbp), %r13
cmpq %r13, %rcx
je 0x664d
movq -0xc0(%rbp), %rsi
movq -0xc8(%rbp), %r8
movq -0x68(%rbp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq -0x38(%rbp), %r15
leaq -0xa0(%rbp), %r12
leaq -0xe0(%rbp), %r14
jbe 0x668b
movl $0xf, %esi
leaq -0x60(%rbp), %rdi
cmpq %rdi, -0x70(%rbp)
je 0x6686
movq -0x60(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x669d
movq -0x70(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x30d0
jmp 0x66aa
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3280
movq %r14, -0xf0(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x66d0
movq %rdx, -0xf0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe0(%rbp)
jmp 0x66d7
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xe8(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq -0xf0(%rbp), %rdi
movl $0x3, %esi
callq 0x9f03
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x6718
callq 0x3230
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x672a
callq 0x3230
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x673b
callq 0x3230
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x674c
callq 0x3230
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
movq -0x130(%rbp), %r14
je 0x6768
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x6776
callq 0x3230
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
movl -0x4c(%rbp), %r15d
je 0x6792
callq 0x3230
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x67aa
callq 0x3230
leaq 0x14ba7(%rip), %rax     # 0x1b358
movq (%rax), %rax
movq 0x20(%rax), %rax
movl 0x4(%rax), %eax
decl %eax
cmpl %eax, %r15d
je 0x67da
movq %r14, %rdi
callq 0xa03d
movq %r14, %rdi
callq 0x9fdf
incl %r15d
jmp 0x623e
movl 0x3860(%rbx), %ecx
movq 0x3848(%rbx), %rax
addl (%rax), %ecx
movq 0x3858(%rbx), %rax
movl %ecx, 0x10(%rax)
cmpl $0x7, 0x3838(%rbx)
jne 0x682f
movq 0x3868(%rbx), %rcx
movb $0x0, (%rcx)
cmpl $-0x1, 0x4(%rax)
jne 0x619a
movq %r14, %rdi
callq 0xa03d
movq 0x3858(%rbx), %rax
movb $0x1, %cl
movb %cl, 0x14(%rax)
movq -0x128(%rbp), %rax
movb %cl, (%rax)
jmp 0x6842
movq %r14, %rdi
callq 0xa03d
movq 0x3858(%rbx), %rax
movb $0x1, 0x14(%rax)
movq %r14, %rdi
callq 0x9fdf
cmpb $0x1, 0x38a4(%rbx)
jne 0x61a4
jmp 0x6193
movq %rax, %rbx
leaq -0x38(%rbp), %r15
leaq -0xa0(%rbp), %r12
leaq -0xc0(%rbp), %r13
jmp 0x68b0
movq %rax, %rbx
jmp 0x68c1
movq %rax, %rbx
jmp 0x691b
movq %rax, %rbx
jmp 0x689e
movq %rax, %rbx
jmp 0x6903
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x689e
callq 0x3230
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x68b0
callq 0x3230
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x68c1
callq 0x3230
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x68e0
callq 0x3230
jmp 0x68e0
movq %rax, %rbx
leaq -0x38(%rbp), %r15
jmp 0x68f5
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x68f5
callq 0x3230
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x6903
callq 0x3230
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x691b
callq 0x3230
movq -0x150(%rbp), %rdi
leaq -0x140(%rbp), %rax
cmpq %rax, %rdi
je 0x6933
callq 0x3230
movq %rbx, %rdi
callq 0x3440
nop