// File: /workspace/github_cpp_makefile_star2_O3/jmfenner92[P]Log-Parser/src/CmdList.cpp
// Function: CmdList::Display() const
void CmdList::Display() const
{
	CmdNode *temp = head;
	
	// loop thru list and display
	while(temp != NULL)
	{
		// display line number
		std::cout << "Line " << temp->info.Get_Line_Number() << ": ";

		// display Read or Write
		if(temp->info.Get_Cycle() == "Wr")
		{
			std::cout << "Write ";
		}
		else
		{
			std::cout << "Read ";
		}
		
		// display command type
		if(temp->info.Get_Address() == "40000810")
		{
            		std::cout << "S-to-D command: " << temp->info.Get_Total_Words() << " words" << "\n";
		}
		else
		{
            		std::cout << "D-to-S command: " << temp->info.Get_Total_Words() << " words" << "\n";
		}
        int begin = 0;
	int end = 0;
	std::vector<std::string> record_data;
	record_data = temp->info.Get_Data();
	for(int i = 0; i < temp->info.Get_Total_Words(); i++)
	{
		switch(i)
		{
		case 0: begin = 13; end = 14; break;
		case 1: begin = 13; end = 15; break;
		case 4: begin = 0; end = 0; break;
		case 5: begin = 0; end = 6; break;
		case 10: begin = 11; end = 15; break;
		case 15: begin = 2; end = 2; break;
		case 22: begin = 3; end = 3; break;
		case 32: begin = 0; end = 14; break;
		case 37: begin = 15; end = 15; break;
		case 38: begin = 14; end = 14; break;
		case 40: begin = 7; end = 7; break;
		case 41: begin = 8; end = 14; break;
		}
		std::string printString = temp->info.LookUpTable(i, temp->info.lookAndAdd(temp->info.HexToBit(record_data[i]), begin, end));
		if(printString != "")
		{
		std::cout << printString << "\n";
		}
	}

        //while ()  //is this right im not sure, what arg shall this while loop take
        //{
            //cout << "Line" << current->info.Get_Line_Number() << " : " << info.LoopUpTable(data_address,bit_string)<< endl;
        //}
        //Display number of words
        //std::cout << info.Get_Total_Words << " words" << endl;

		//Display data...
        
        //while loop?
        {
            //Display line number for individual word commands
		    //std::cout << temp->info.Get_Line_Number() << ": ";
            //Display word number (i.e. Word 41:)
            //std::cout << " Word " <<  WORD NUMBER << ": ";
            //std::cout << COMMAND << endl;
        }
        
        //create blank line for next command
        //std::cout << endl;
	temp = temp->next;
	std::cout << "\n";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x5029
leaq -0xb0(%rbp), %r15
movl $0x5, %edx
movq 0x43d5(%rip), %r14      # 0x8fd0
movq %r14, %rdi
leaq 0x1861(%rip), %rsi      # 0x6466
callq 0x21c0
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x3850
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x21c0
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1855(%rip), %rsi      # 0x648a
callq 0x21c0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4c53
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3930
movq %r14, %rdi
leaq 0x1800(%rip), %rsi      # 0x646c
callq 0x2060
movl %eax, %r14d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4c8d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
testl %r14d, %r14d
je 0x4ca7
movl $0x5, %edx
movq 0x4332(%rip), %rdi      # 0x8fd0
leaq 0x17d1(%rip), %rsi      # 0x6476
jmp 0x4cba
movl $0x6, %edx
movq 0x431d(%rip), %rdi      # 0x8fd0
leaq 0x17b5(%rip), %rsi      # 0x646f
callq 0x21c0
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x388a
movq %r14, %rdi
leaq 0x13dd(%rip), %rsi      # 0x60b5
callq 0x2060
movl %eax, %r14d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4cf9
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
testl %r14d, %r14d
leaq 0x1791(%rip), %rsi      # 0x6494
leaq 0x1772(%rip), %rax      # 0x647c
cmoveq %rax, %rsi
movl $0x10, %edx
movq 0x42b6(%rip), %r14      # 0x8fd0
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x39b2
movq %r14, %rdi
movl %eax, %esi
callq 0x2290
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1747(%rip), %rsi      # 0x648d
callq 0x21c0
movl $0x1, %edx
movq %r14, %rdi
leaq 0x170a(%rip), %rsi      # 0x6464
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x38ca
movaps -0x70(%rbp), %xmm0
movq -0x60(%rbp), %rax
movaps -0xb0(%rbp), %xmm1
movaps %xmm1, -0x70(%rbp)
movq -0xa0(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movups %xmm0, -0x50(%rbp)
movq %rax, -0x40(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
movq $0x0, -0xa0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x33c2
movq %r15, %rdi
callq 0x33c2
xorl %r14d, %r14d
movl $0x8, %r12d
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq %rbx, %rdi
callq 0x39b2
cltq
cmpq %rax, %r14
jge 0x4ff1
cmpl $0x15, %r14d
jg 0x4e1a
cmpl $0xa, %r14d
ja 0x4e3c
movl %r14d, %eax
leaq 0x160b(%rip), %rcx      # 0x6410
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xe, -0x2c(%rbp)
jmp 0x4eba
leal -0x20(%r14), %eax
cmpl $0x9, %eax
ja 0x4e59
leaq 0x1612(%rip), %rcx      # 0x643c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xe, -0x2c(%rbp)
jmp 0x4e9a
cmpl $0xf, %r14d
jne 0x4ef1
movl $0x2, -0x30(%rbp)
movl $0x2, -0x2c(%rbp)
jmp 0x4ef1
cmpl $0x16, %r14d
jne 0x4ef1
movl $0x3, -0x30(%rbp)
movl $0x3, -0x2c(%rbp)
jmp 0x4ef1
movl $0xf, -0x2c(%rbp)
movl $0xb, -0x30(%rbp)
jmp 0x4ef1
movl $0xe, -0x2c(%rbp)
movl $0x8, -0x30(%rbp)
jmp 0x4ef1
movl $0x6, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x4ef1
movl $0x7, -0x30(%rbp)
movl $0x7, -0x2c(%rbp)
jmp 0x4ef1
movl $0xf, -0x2c(%rbp)
movl $0xd, -0x30(%rbp)
jmp 0x4ef1
movl $0xf, -0x30(%rbp)
movl $0xf, -0x2c(%rbp)
jmp 0x4ef1
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x4ef1
movl $0xe, -0x30(%rbp)
movl $0xe, -0x2c(%rbp)
movq -0x70(%rbp), %rax
leaq -0x80(%rbp), %rcx
movq %rcx, -0x90(%rbp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %r15
movq %r15, %rdi
callq 0x3520
leaq -0xd0(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x39be
movq %rbx, %rdi
movq %r13, %rsi
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x4310
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl %eax, %ecx
callq 0x3a7a
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x4f74
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2170
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x4f90
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x50(%rbp), %rdi
leaq 0x14ca(%rip), %rsi      # 0x6465
callq 0x2060
testl %eax, %eax
je 0x4fcc
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x401d(%rip), %rdi      # 0x8fd0
callq 0x21c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x149d(%rip), %rsi      # 0x6464
callq 0x21c0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4fe5
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
incq %r14
addq $0x20, %r12
jmp 0x4ddc
movq 0xc0(%rbx), %rbx
movl $0x1, %edx
movq 0x3fcc(%rip), %rdi      # 0x8fd0
leaq 0x1459(%rip), %rsi      # 0x6464
callq 0x21c0
leaq -0x70(%rbp), %rdi
callq 0x33c2
testq %rbx, %rbx
leaq -0xb0(%rbp), %r15
jne 0x4bef
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5064
jmp 0x5064
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x50c9
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
jmp 0x50c9
jmp 0x5064
movq %rax, %rbx
jmp 0x50a4
movq %rax, %rbx
jmp 0x50c0
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x50c0
movq -0x40(%rbp), %rsi
jmp 0x50b8
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x50a4
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2170
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x50c0
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x70(%rbp), %rdi
callq 0x33c2
movq %rbx, %rdi
callq 0x22b0