// File: /workspace/github_cpp_makefile_star2_O1/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 0x5071
leaq -0xa8(%rbp), %r15
movl $0x5, %edx
movq 0x4395(%rip), %r14      # 0x8fd0
movq %r14, %rdi
leaq 0x1821(%rip), %rsi      # 0x6466
callq 0x21c0
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x37f8
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x21c0
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1815(%rip), %rsi      # 0x648a
callq 0x21c0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4c93
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x38d8
movq %r14, %rdi
leaq 0x17c0(%rip), %rsi      # 0x646c
callq 0x2060
movl %eax, %r14d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4ccd
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
testl %r14d, %r14d
je 0x4ce7
movl $0x5, %edx
movq 0x42f2(%rip), %rdi      # 0x8fd0
leaq 0x1791(%rip), %rsi      # 0x6476
jmp 0x4cfa
movl $0x6, %edx
movq 0x42dd(%rip), %rdi      # 0x8fd0
leaq 0x1775(%rip), %rsi      # 0x646f
callq 0x21c0
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3832
movq %r14, %rdi
leaq 0x139d(%rip), %rsi      # 0x60b5
callq 0x2060
movl %eax, %r14d
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4d39
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
testl %r14d, %r14d
leaq 0x1751(%rip), %rsi      # 0x6494
leaq 0x1732(%rip), %rax      # 0x647c
cmoveq %rax, %rsi
movl $0x10, %edx
movq 0x4276(%rip), %r14      # 0x8fd0
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x395a
movq %r14, %rdi
movl %eax, %esi
callq 0x2290
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1707(%rip), %rsi      # 0x648d
callq 0x21c0
movl $0x1, %edx
movq %r14, %rdi
leaq 0x16ca(%rip), %rsi      # 0x6464
callq 0x21c0
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3872
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movaps -0x70(%rbp), %xmm0
movq -0x60(%rbp), %rax
movups -0xa8(%rbp), %xmm1
movaps %xmm1, -0x70(%rbp)
movq -0x98(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movaps -0x50(%rbp), %xmm1
movaps %xmm0, -0x50(%rbp)
movq %rax, -0x40(%rbp)
movups %xmm1, -0xa8(%rbp)
movq $0x0, -0x98(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x3374
movq %r15, %rdi
callq 0x3374
xorl %r14d, %r14d
movl $0x8, %r12d
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq %rbx, %rdi
callq 0x395a
cltq
cmpq %rax, %r14
jge 0x5039
cmpl $0x15, %r14d
jg 0x4e62
cmpl $0xa, %r14d
ja 0x4e84
movl %r14d, %eax
leaq 0x15c3(%rip), %rcx      # 0x6410
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xe, -0x2c(%rbp)
jmp 0x4f02
leal -0x20(%r14), %eax
cmpl $0x9, %eax
ja 0x4ea1
leaq 0x15ca(%rip), %rcx      # 0x643c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0xe, -0x2c(%rbp)
jmp 0x4ee2
cmpl $0xf, %r14d
jne 0x4f39
movl $0x2, -0x30(%rbp)
movl $0x2, -0x2c(%rbp)
jmp 0x4f39
cmpl $0x16, %r14d
jne 0x4f39
movl $0x3, -0x30(%rbp)
movl $0x3, -0x2c(%rbp)
jmp 0x4f39
movl $0xf, -0x2c(%rbp)
movl $0xb, -0x30(%rbp)
jmp 0x4f39
movl $0xe, -0x2c(%rbp)
movl $0x8, -0x30(%rbp)
jmp 0x4f39
movl $0x6, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x4f39
movl $0x7, -0x30(%rbp)
movl $0x7, -0x2c(%rbp)
jmp 0x4f39
movl $0xf, -0x2c(%rbp)
movl $0xd, -0x30(%rbp)
jmp 0x4f39
movl $0xf, -0x30(%rbp)
movl $0xf, -0x2c(%rbp)
jmp 0x4f39
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x4f39
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 0x34ce
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3966
movq %rbx, %rdi
movq %r13, %rsi
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x42f8
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl %eax, %ecx
callq 0x3a22
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x4fbc
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2170
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x4fd8
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x50(%rbp), %rdi
leaq 0x1482(%rip), %rsi      # 0x6465
callq 0x2060
testl %eax, %eax
je 0x5014
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x3fd5(%rip), %rdi      # 0x8fd0
callq 0x21c0
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1455(%rip), %rsi      # 0x6464
callq 0x21c0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x502d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
incq %r14
addq $0x20, %r12
jmp 0x4e24
movq 0xc0(%rbx), %rbx
movl $0x1, %edx
movq 0x3f84(%rip), %rdi      # 0x8fd0
leaq 0x1411(%rip), %rsi      # 0x6464
callq 0x21c0
leaq -0x70(%rbp), %rdi
callq 0x3374
testq %rbx, %rbx
leaq -0xa8(%rbp), %r15
jne 0x4c2f
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x50ac
jmp 0x50ac
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5111
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2170
jmp 0x5111
jmp 0x50ac
movq %rax, %rbx
jmp 0x50ec
movq %rax, %rbx
jmp 0x5108
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5108
movq -0x40(%rbp), %rsi
jmp 0x5100
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x50ec
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2170
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x5108
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2170
leaq -0x70(%rbp), %rdi
callq 0x3374
movq %rbx, %rdi
callq 0x22b0