// File: /workspace/github_cpp_makefile_star2_O2/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 $0x88, %rsp
movq (%rdi), %rbx
leaq -0x90(%rbp), %r12
leaq -0x50(%rbp), %r13
testq %rbx, %rbx
je 0x4352
movq 0x3f62(%rip), %rdi      # 0x7fd0
leaq 0x13f1(%rip), %rsi      # 0x5466
callq 0x2180
movq %rax, %r14
movq %r12, %rdi
movq %rbx, %rsi
callq 0x31ee
movq %r14, %rdi
movq %r12, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x13ed(%rip), %rsi      # 0x548a
callq 0x2180
movq %r12, %rdi
callq 0x20e0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3296
movq %r12, %rdi
leaq 0x13ad(%rip), %rsi      # 0x546c
callq 0x2c77
movl %eax, %r14d
movq %r12, %rdi
callq 0x20e0
testb %r14b, %r14b
leaq 0x139d(%rip), %rsi      # 0x5476
leaq 0x138f(%rip), %rax      # 0x546f
cmovneq %rax, %rsi
movq 0x3ee5(%rip), %r15      # 0x7fd0
movq %r15, %rdi
callq 0x2180
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3214
movq %r12, %rdi
leaq 0xfad(%rip), %rsi       # 0x50b5
callq 0x2c77
movl %eax, %r14d
movq %r12, %rdi
callq 0x20e0
testb %r14b, %r14b
leaq 0x1372(%rip), %rsi      # 0x5494
leaq 0x1353(%rip), %rax      # 0x547c
cmovneq %rax, %rsi
movq %r15, %rdi
callq 0x2180
movq %rax, %r14
movq %rbx, %rdi
callq 0x32f0
movq %r14, %rdi
movl %eax, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x1339(%rip), %rsi      # 0x548d
callq 0x2180
movq %rax, %rdi
leaq 0x1301(%rip), %rsi      # 0x5464
callq 0x2180
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3242
movq %r13, %rdi
movq %r12, %rsi
callq 0x3cfe
movq %r12, %rdi
callq 0x2e6e
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq %rbx, %rdi
callq 0x32f0
cltq
cmpq %rax, %r14
jge 0x4320
cmpl $0xa, %r14d
jbe 0x41e5
leal -0x20(%r14), %eax
cmpl $0x9, %eax
ja 0x4200
leaq 0x126d(%rip), %rcx      # 0x543c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq -0x70(%rbp), %rdi
jmpq *%rax
movl $0x0, -0x30(%rbp)
jmp 0x425d
movl %r14d, %eax
leaq 0x1221(%rip), %rcx      # 0x5410
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq -0x70(%rbp), %rdi
jmpq *%rax
pushq $0xd
jmp 0x4259
cmpl $0xf, %r14d
je 0x430b
cmpl $0x16, %r14d
leaq -0x70(%rbp), %rdi
jne 0x4265
pushq $0x3
jmp 0x424f
movl $0x0, -0x30(%rbp)
pushq $0x6
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x4265
pushq $0xd
jmp 0x423d
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x4265
pushq $0xb
popq %rax
movl %eax, -0x30(%rbp)
pushq $0xf
jmp 0x425f
pushq $0x7
jmp 0x424f
pushq $0xf
jmp 0x424f
pushq $0xe
popq %r13
movl %r13d, -0x30(%rbp)
jmp 0x4261
pushq $0x8
popq %rax
movl %eax, -0x30(%rbp)
pushq $0xe
popq %r13
movl %r13d, -0x2c(%rbp)
movq -0x50(%rbp), %rsi
addq %r12, %rsi
movq %rdi, %r15
callq 0x2230
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x32fc
movq %rbx, %rdi
movq %r13, %rsi
movl -0x30(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x3886
leaq -0x90(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl %eax, %ecx
callq 0x339a
leaq -0xb0(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x20e0
movq %r15, %rdi
leaq 0x1195(%rip), %rsi      # 0x5465
callq 0x43e6
testb %al, %al
je 0x42f7
movq 0x3cf0(%rip), %rdi      # 0x7fd0
movq %r15, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x1172(%rip), %rsi      # 0x5464
callq 0x2180
movq %r15, %rdi
callq 0x20e0
incq %r14
addq $0x20, %r12
jmp 0x41a6
pushq $0x2
popq %r13
movl %r13d, -0x30(%rbp)
movl %r13d, -0x2c(%rbp)
leaq -0x70(%rbp), %rdi
jmp 0x4265
movq 0xc0(%rbx), %rbx
movq 0x3ca2(%rip), %rdi      # 0x7fd0
leaq 0x112f(%rip), %rsi      # 0x5464
callq 0x2180
leaq -0x50(%rbp), %r13
movq %r13, %rdi
callq 0x2e6e
leaq -0x90(%rbp), %r12
jmp 0x405e
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x438c
jmp 0x438c
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x20e0
jmp 0x43b2
movq %rax, %rbx
jmp 0x43a0
jmp 0x438c
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
jmp 0x43a4
movq %rax, %rbx
jmp 0x43a9
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x20e0
leaq -0x50(%rbp), %rdi
callq 0x2e6e
movq %rbx, %rdi
callq 0x22c0