// File: /workspace/github_cpp_makefile_star2_O3/ys1998[P]spsim/src/main.cpp
// Function: print_std(std::deque<Instruction, std::allocator<Instruction>>)
void print_std(Buffer<Instruction> output_order){
	std::cout << "Space-Time Diagram\n";

	std::string IF =  "\033[1;43m  IF  \033[0m";
	std::string DE =  "\033[1;42m  DE  \033[0m";
	std::string RF1 = "\033[1;41m  RF1 \033[0m";
	std::string RF2 = "\033[1;46m  RF2 \033[0m";
	std::string EX =  "\033[1;44m EXEC \033[0m";
	std::string MEM = "\033[1;47;30m  MEM \033[0m";
	std::string WB =  "\033[1;45m  WB  \033[0m";
	std::string ST =  "\033[1;100m  STL \033[0m";
	std::string sp =  "      ";

	for(auto instr : output_order){
		int i = 1;
		std::cout << instr.text << "\t";
		while(i < instr.WB && i++ < instr.IF)
			std::cout << sp;
		std::cout << IF;
		while(i < instr.WB && i++ < instr.DE)
			std::cout << ST;
		std::cout << DE;
		while(i++ < instr.RF1)
			std::cout << ST;
		std::cout << RF1;
		while(i++ < instr.EXEC)
			std::cout << ST;
		std::cout << EX;
		if(std::get<0>(instr.type()) == OPCODE["lw"] || std::get<0>(instr.type()) == OPCODE["sw"]){
//			while(i++ < instr.EXEC + LATENCY_ADD)
//				std::cout << EX;
			while(i++ < instr.RF2)
				std::cout << ST;
			std::cout << RF2;
			while (i++ < instr.MEM)
				std::cout << ST;
			std::cout << MEM;
			while(i++ < instr.WB)
				std::cout << ST;
			std::cout << WB;
			std::cout << std::endl;
		}
		else {
			int latency = 1;
			if(std::get<0>(instr.type()) == 0){
				if(std::get<1>(instr.type()) == FUNCT["add"])
					latency = LATENCY_ADD;
				else if(std::get<1>(instr.type()) == FUNCT["sub"])
					latency = LATENCY_SUB;
				else if(std::get<1>(instr.type()) == FUNCT["mult"])
					latency = LATENCY_MULT;
				else if(std::get<1>(instr.type()) == FUNCT["div"])
					latency = LATENCY_DIV;
			}
			while(i++ < instr.EXEC + latency)
				std::cout << EX;
			while(i++ < instr.WB)
				std::cout << ST;
			std::cout << WB;
			std::cout << std::endl;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %r12
movq 0xd4fa(%rip), %rbx      # 0x1bfd8
leaq 0x78e8(%rip), %rsi      # 0x163cd
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3240
leaq 0x1d8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x78dc(%rip), %rsi      # 0x163e1
leaq 0x78e6(%rip), %rdx      # 0x163f2
leaq 0x1c8(%rsp), %rdi
callq 0x530a
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x78c7(%rip), %rsi      # 0x163f3
leaq 0x78d1(%rip), %rdx      # 0x16404
leaq 0xf0(%rsp), %rdi
callq 0x530a
leaq 0x1b8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x78b2(%rip), %rsi      # 0x16405
leaq 0x78bc(%rip), %rdx      # 0x16416
leaq 0x1a8(%rsp), %rdi
callq 0x530a
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x789d(%rip), %rsi      # 0x16417
leaq 0x78a7(%rip), %rdx      # 0x16428
leaq 0xd0(%rsp), %rdi
callq 0x530a
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7888(%rip), %rsi      # 0x16429
leaq 0x7892(%rip), %rdx      # 0x1643a
leaq 0x80(%rsp), %rdi
callq 0x530a
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7873(%rip), %rsi      # 0x1643b
leaq 0x7880(%rip), %rdx      # 0x1644f
leaq 0xb0(%rsp), %rdi
callq 0x530a
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7864(%rip), %rsi      # 0x16450
leaq 0x786e(%rip), %rdx      # 0x16461
leaq 0x60(%rsp), %rdi
callq 0x530a
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7855(%rip), %rsi      # 0x16462
leaq 0x7860(%rip), %rdx      # 0x16474
leaq 0x20(%rsp), %rdi
callq 0x530a
leaq 0x198(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7844(%rip), %rsi      # 0x16475
leaq 0x7843(%rip), %rdx      # 0x1647b
leaq 0x188(%rsp), %rdi
callq 0x530a
movq 0x10(%r12), %rdx
movq 0x30(%r12), %rax
movq %rax, 0x1e8(%rsp)
cmpq %rax, %rdx
je 0xf2d2
movq 0x20(%r12), %rax
movq %rax, 0xa8(%rsp)
movq 0x28(%r12), %rax
movq %rax, 0xa0(%rsp)
leaq 0x170(%rsp), %r12
movq %rsp, %rbp
movl $0xa, %ecx
leaq 0x110(%rsp), %rdi
movq %rdx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, 0x160(%rsp)
movq 0x50(%rdx), %rsi
movq %rdx, %r14
movq 0x58(%rdx), %rdx
addq %rsi, %rdx
leaq 0x160(%rsp), %rdi
callq 0x5274
movq %r14, 0x1f0(%rsp)
movq 0x70(%r14), %rax
movq %rax, 0x180(%rsp)
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7606(%rip), %rsi      # 0x162fc
callq 0x3240
movl $0x2, %r15d
leal -0x1(%r15), %r13d
cmpl 0x15c(%rsp), %r13d
jge 0xed39
cmpl 0x144(%rsp), %r13d
jge 0xed36
movq 0x188(%rsp), %rsi
movq 0x190(%rsp), %rdx
incl %r15d
movq %rbx, %rdi
callq 0x3240
jmp 0xed01
movl %r15d, %r13d
movq 0x1c8(%rsp), %rsi
movq 0x1d0(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
cmpl 0x15c(%rsp), %r13d
jge 0xed7f
cmpl 0x148(%rsp), %r13d
jge 0xed7c
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xed51
incl %r13d
movq 0xf0(%rsp), %rsi
movq 0xf8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
cmpl 0x14c(%rsp), %r13d
jge 0xedb8
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xed97
movq 0x1a8(%rsp), %rsi
movq 0x1b0(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
incl %r13d
cmpl 0x150(%rsp), %r13d
jge 0xedf4
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xedd3
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
leaq 0x200(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x204(%rsp), %r15d
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
leaq 0x7231(%rip), %rsi      # 0x1606d
leaq 0x722c(%rip), %rdx      # 0x1606f
callq 0x530a
leaq 0xd3c1(%rip), %rdi      # 0x1c210
movq %rbp, %r14
movq %rbp, %rsi
callq 0x5136
movb $0x1, %bpl
cmpl (%rax), %r15d
leaq 0x40(%rsp), %r15
je 0xeed4
leaq 0x1f8(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x1fc(%rsp), %ebp
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r15, %rdi
leaq 0x7186(%rip), %rsi      # 0x1601d
leaq 0x7181(%rip), %rdx      # 0x1601f
callq 0x530a
leaq 0xd366(%rip), %rdi      # 0x1c210
movq %r15, %rsi
callq 0x5136
cmpl (%rax), %ebp
sete %bpl
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xeed4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xeeef
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
incl %r13d
testb %bpl, %bpl
je 0xef1f
movq %r14, %rbp
cmpl 0x154(%rsp), %r13d
jge 0xefc1
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xeefa
movq %r14, %rbp
movq %r14, %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
cmpl $0x0, 0x4(%rsp)
movl $0x1, %r15d
jne 0xf168
leaq 0x40(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x40(%rsp), %ebp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %r12
movq %r14, %rdi
leaq 0x7095(%rip), %rsi      # 0x16004
leaq 0x7091(%rip), %rdx      # 0x16007
callq 0x530a
leaq 0xd2be(%rip), %rdi      # 0x1c240
movq %r12, %rsi
callq 0x5136
movl (%rax), %r12d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xefa8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl %r12d, %ebp
jne 0xf074
leaq 0x170(%rsp), %r12
movq %r14, %rbp
jmp 0xf168
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
incl %r13d
cmpl 0x158(%rsp), %r13d
jge 0xeffd
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xefdc
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
incl %r13d
cmpl 0x15c(%rsp), %r13d
jge 0xf036
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
jmp 0xf015
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
jmp 0xf1ec
leaq 0x40(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x40(%rsp), %ebp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %r12
movq %r14, %rdi
leaq 0x6f68(%rip), %rsi      # 0x16008
leaq 0x6f64(%rip), %rdx      # 0x1600b
callq 0x530a
leaq 0xd18d(%rip), %rdi      # 0x1c240
movq %r12, %rsi
callq 0x5136
movl (%rax), %r12d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xf0d9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl %r12d, %ebp
leaq 0x170(%rsp), %r12
movq %r14, %rbp
je 0xf168
leaq 0x40(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x40(%rsp), %ebp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %r15
movq %r14, %rdi
leaq 0x6eff(%rip), %rsi      # 0x16014
leaq 0x6efc(%rip), %rdx      # 0x16018
callq 0x530a
leaq 0xd118(%rip), %rdi      # 0x1c240
movq %r15, %rsi
callq 0x5136
movl (%rax), %r12d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xf14e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
movl $0x6, %r15d
cmpl %r12d, %ebp
leaq 0x170(%rsp), %r12
movq %r14, %rbp
jne 0xf256
movl 0x150(%rsp), %eax
addl %r15d, %eax
cmpl %eax, %r13d
jge 0xf1a6
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
incl %r13d
movq %rbx, %rdi
callq 0x3240
jmp 0xf168
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
incl %r13d
cmpl 0x15c(%rsp), %r13d
jl 0xf194
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x3240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3180
movq 0x160(%rsp), %rdi
cmpq %r12, %rdi
je 0xf209
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x1f0(%rsp), %rdx
addq $0x78, %rdx
cmpq 0xa8(%rsp), %rdx
jne 0xf246
movq 0xa0(%rsp), %rax
movq 0x8(%rax), %rdx
addq $0x8, %rax
movq %rax, 0xa0(%rsp)
leaq 0x1e0(%rdx), %rax
movq %rax, 0xa8(%rsp)
cmpq 0x1e8(%rsp), %rdx
jne 0xec85
jmp 0xf2d2
leaq 0x40(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xa8b8
movl 0x40(%rsp), %ebp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %r15
movq %r14, %rdi
leaq 0x6d97(%rip), %rsi      # 0x16019
leaq 0x6d93(%rip), %rdx      # 0x1601c
callq 0x530a
leaq 0xcfab(%rip), %rdi      # 0x1c240
movq %r15, %rsi
callq 0x5136
movl (%rax), %r15d
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xf2bb
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
cmpl %r15d, %ebp
movl $0x1, %r15d
movl $0x23, %eax
cmovel %eax, %r15d
jmp 0xefb9
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0xf2f7
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xf313
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xf32f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0xf354
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xf379
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0xf39e
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0xf3c3
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xf3e8
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0xf40d
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x3200
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf4b4
jmp 0xf4af
jmp 0xf4f5
jmp 0xf4b4
jmp 0xf4af
jmp 0xf4f5
movq %rax, %rbx
jmp 0xf53a
movq %rax, %rbx
jmp 0xf556
movq %rax, %rbx
jmp 0xf572
movq %rax, %rbx
jmp 0xf597
movq %rax, %rbx
jmp 0xf5bc
movq %rax, %rbx
jmp 0xf5e1
movq %rax, %rbx
jmp 0xf606
movq %rax, %rbx
jmp 0xf62b
jmp 0xf4b4
jmp 0xf4af
jmp 0xf4af
jmp 0xf4b4
jmp 0xf4af
jmp 0xf4f5
jmp 0xf4b4
jmp 0xf4f5
jmp 0xf4b4
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xf4b7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3200
jmp 0xf4b7
jmp 0xf4f5
movq %rax, %rbx
jmp 0xf4d2
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xf4d2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x170(%rsp), %r12
jmp 0xf4f8
movq %rax, %rbx
jmp 0xf515
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
jmp 0xf4f5
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r12, %rdi
je 0xf515
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0xf53a
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x30(%rsp), %rax
movq 0x20(%rsp), %rdi
cmpq %rax, %rdi
je 0xf556
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x70(%rsp), %rax
movq 0x60(%rsp), %rdi
cmpq %rax, %rdi
je 0xf572
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0xc0(%rsp), %rax
movq 0xb0(%rsp), %rdi
cmpq %rax, %rdi
je 0xf597
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x90(%rsp), %rax
movq 0x80(%rsp), %rdi
cmpq %rax, %rdi
je 0xf5bc
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0xe0(%rsp), %rax
movq 0xd0(%rsp), %rdi
cmpq %rax, %rdi
je 0xf5e1
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0xf606
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3200
leaq 0x100(%rsp), %rax
movq 0xf0(%rsp), %rdi
cmpq %rax, %rdi
je 0xf62b
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x3200
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0xf650
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbx, %rdi
callq 0x3340