// File: 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
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7ea0
movq 0x56e4(%rip), %rdi      # 0xcfd0
leaq 0x1bab(%rip), %rsi      # 0x949e
callq 0x3210
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x5370
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x31e0
movq %rax, -0x128(%rbp)
jmp 0x792f
movq -0x128(%rbp), %rdi
leaq 0x1b85(%rip), %rsi      # 0x94c2
callq 0x3210
jmp 0x7944
leaq -0x30(%rbp), %rdi
callq 0x3150
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x54f0
movq -0x148(%rbp), %rdi
leaq 0x1b35(%rip), %rsi      # 0x94a4
callq 0x4380
movb %al, -0x139(%rbp)
jmp 0x797c
leaq -0x60(%rbp), %rdi
callq 0x3150
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x7991
jmp 0x79da
movq 0x5638(%rip), %rdi      # 0xcfd0
leaq 0x1b08(%rip), %rsi      # 0x94a7
callq 0x3210
jmp 0x79ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3150
jmp 0x7ea9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3150
jmp 0x7ea9
movq 0x55ef(%rip), %rdi      # 0xcfd0
leaq 0x1ac6(%rip), %rsi      # 0x94ae
callq 0x3210
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x53d0
movq -0x158(%rbp), %rdi
leaq 0x1662(%rip), %rsi      # 0x9071
callq 0x4380
movb %al, -0x149(%rbp)
jmp 0x7a1c
leaq -0x80(%rbp), %rdi
callq 0x3150
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0x7a31
jmp 0x7a9c
movq 0x5598(%rip), %rdi      # 0xcfd0
leaq 0x1a75(%rip), %rsi      # 0x94b4
callq 0x3210
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rdi
callq 0x55b0
movq -0x160(%rbp), %rdi
movl %eax, %esi
callq 0x33c0
movq %rax, %rdi
leaq 0x1a59(%rip), %rsi      # 0x94c5
callq 0x3210
movq %rax, %rdi
leaq 0x1a21(%rip), %rsi      # 0x949c
callq 0x3210
jmp 0x7aeb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3150
jmp 0x7ea9
movq 0x552d(%rip), %rdi      # 0xcfd0
leaq 0x1a22(%rip), %rsi      # 0x94cc
callq 0x3210
movq %rax, -0x168(%rbp)
movq -0x10(%rbp), %rdi
callq 0x55b0
movq -0x168(%rbp), %rdi
movl %eax, %esi
callq 0x33c0
movq %rax, %rdi
leaq 0x19ee(%rip), %rsi      # 0x94c5
callq 0x3210
movq %rax, %rdi
leaq 0x19b6(%rip), %rsi      # 0x949c
callq 0x3210
movl $0x0, -0x84(%rbp)
movl $0x0, -0x88(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x6670
movq -0x10(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x5430
jmp 0x7b1d
leaq -0xa0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x6830
leaq -0xb8(%rbp), %rdi
callq 0x4740
movl $0x0, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x170(%rbp)
movq -0x10(%rbp), %rdi
callq 0x55b0
movl %eax, -0x16c(%rbp)
jmp 0x7b63
movl -0x170(%rbp), %eax
movl -0x16c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7e5d
movl -0xbc(%rbp), %eax
movq %rax, -0x178(%rbp)
subq $0x29, %rax
ja 0x7cce
movq -0x178(%rbp), %rax
leaq 0x1858(%rip), %rcx      # 0x93f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x7e92
movl $0xd, -0x84(%rbp)
movl $0xe, -0x88(%rbp)
jmp 0x7cce
movl $0xd, -0x84(%rbp)
movl $0xf, -0x88(%rbp)
jmp 0x7cce
movl $0x0, -0x84(%rbp)
movl $0x0, -0x88(%rbp)
jmp 0x7cce
movl $0x0, -0x84(%rbp)
movl $0x6, -0x88(%rbp)
jmp 0x7cce
movl $0xb, -0x84(%rbp)
movl $0xf, -0x88(%rbp)
jmp 0x7cce
movl $0x2, -0x84(%rbp)
movl $0x2, -0x88(%rbp)
jmp 0x7cce
movl $0x3, -0x84(%rbp)
movl $0x3, -0x88(%rbp)
jmp 0x7cce
movl $0x0, -0x84(%rbp)
movl $0xe, -0x88(%rbp)
jmp 0x7cce
movl $0xf, -0x84(%rbp)
movl $0xf, -0x88(%rbp)
jmp 0x7cce
movl $0xe, -0x84(%rbp)
movl $0xe, -0x88(%rbp)
jmp 0x7cce
movl $0x7, -0x84(%rbp)
movl $0x7, -0x88(%rbp)
jmp 0x7cce
movl $0x8, -0x84(%rbp)
movl $0xe, -0x88(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x198(%rbp)
movq %rcx, %rax
movq %rax, -0x190(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x184(%rbp)
movq %rcx, -0x180(%rbp)
movslq %eax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x7f90
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x30f0
jmp 0x7d16
movq -0x198(%rbp), %rsi
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0x55d0
jmp 0x7d32
movq -0x180(%rbp), %rdi
movl -0x84(%rbp), %edx
movl -0x88(%rbp), %ecx
leaq -0x100(%rbp), %rsi
callq 0x6420
movl %eax, -0x19c(%rbp)
jmp 0x7d59
movl -0x19c(%rbp), %ecx
movl -0x184(%rbp), %edx
movq -0x190(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x5890
jmp 0x7d7a
leaq -0x100(%rbp), %rdi
callq 0x3150
leaq -0x120(%rbp), %rdi
callq 0x3150
leaq 0x1704(%rip), %rsi      # 0x949d
leaq -0xe0(%rbp), %rdi
callq 0x7fb0
movb %al, -0x19d(%rbp)
jmp 0x7dad
movb -0x19d(%rbp), %al
testb $0x1, %al
jne 0x7dbc
jmp 0x7e3d
movq 0x520d(%rip), %rdi      # 0xcfd0
leaq -0xe0(%rbp), %rsi
callq 0x31e0
movq %rax, -0x1a8(%rbp)
jmp 0x7dd8
movq -0x1a8(%rbp), %rdi
leaq 0x16b6(%rip), %rsi      # 0x949c
callq 0x3210
jmp 0x7ded
jmp 0x7e3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x7e15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3150
leaq -0x120(%rbp), %rdi
callq 0x3150
jmp 0x7e92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x3150
jmp 0x7e92
leaq -0xe0(%rbp), %rdi
callq 0x3150
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x7b46
movq -0x10(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, -0x10(%rbp)
movq 0x515d(%rip), %rdi      # 0xcfd0
leaq 0x1622(%rip), %rsi      # 0x949c
callq 0x3210
jmp 0x7e81
leaq -0xa0(%rbp), %rdi
callq 0x4740
jmp 0x78da
leaq -0xa0(%rbp), %rdi
callq 0x4740
jmp 0x7ea9
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x33e0
nopw %cs:(%rax,%rax)
nopl (%rax)