// File: /workspace/github_cpp_makefile_star2_O2/estwings57[P]CasHMC/sources/RunSim.cpp
// Function: ParseTraceFileLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned long&, unsigned long&, CasHMC::TransactionType&, unsigned int&)
void ParseTraceFileLine(string &line, uint64_t &clockCycle, uint64_t &addr, TransactionType &tranType, unsigned &dataSize)
{
	int previousIndex=0;
	int spaceIndex=0;
	string  tempStr="";

	spaceIndex = line.find_first_of(" ", 0);
	if(spaceIndex==-1)	ERROR("  == Error - tracefile format is wrong : "<<line);
	tempStr = line.substr(0, spaceIndex);
	istringstream clock(tempStr);
	clock>>clockCycle;
	previousIndex = spaceIndex;

	spaceIndex = line.find_first_not_of(" ", previousIndex);
	if(spaceIndex==-1)	ERROR("  == Error - tracefile format is wrong : "<<line);
	tempStr = line.substr(spaceIndex, line.find_first_of(" ", spaceIndex) - spaceIndex);
	istringstream add(tempStr.substr(2));
	add>>hex>>addr;
	previousIndex = line.find_first_of(" ", spaceIndex);

	spaceIndex = line.find_first_not_of(" ", previousIndex);
	if(spaceIndex==-1)	ERROR("  == Error - tracefile format is wrong : "<<line);
	
	tempStr = line.substr(spaceIndex, line.find_first_of(" ", spaceIndex) - spaceIndex);
	if(tempStr.compare("READ")==0)			tranType = DATA_READ;
	else if(tempStr.compare("WRITE")==0)	tranType = DATA_WRITE;
	//Arithmetic atomic
	else if(tempStr.compare("2ADD8")==0)	tranType = ATM_2ADD8;
	else if(tempStr.compare("ADD16")==0)	tranType = ATM_ADD16;
	else if(tempStr.compare("P_2ADD8")==0)	tranType = ATM_P_2ADD8;
	else if(tempStr.compare("P_ADD16")==0)	tranType = ATM_P_ADD16;
	else if(tempStr.compare("2ADDS8R")==0)	tranType = ATM_2ADDS8R;
	else if(tempStr.compare("ADDS16R")==0)	tranType = ATM_ADDS16R;
	else if(tempStr.compare("INC8")==0)		tranType = ATM_INC8;
	else if(tempStr.compare("P_INC8")==0)	tranType = ATM_P_INC8;
	//Boolean atomic
	else if(tempStr.compare("XOR16")==0)	tranType = ATM_XOR16;
	else if(tempStr.compare("OR16")==0)		tranType = ATM_OR16;
	else if(tempStr.compare("NOR16")==0)	tranType = ATM_NOR16;
	else if(tempStr.compare("AND16")==0)	tranType = ATM_AND16;
	else if(tempStr.compare("NAND16")==0)	tranType = ATM_NAND16;
	//Comparison atomic
	else if(tempStr.compare("CASGT8")==0)	tranType = ATM_CASGT8;
	else if(tempStr.compare("CASLT8")==0)	tranType = ATM_CASLT8;
	else if(tempStr.compare("CASGT16")==0)	tranType = ATM_CASGT16;
	else if(tempStr.compare("CASLT16")==0)	tranType = ATM_CASLT16;
	else if(tempStr.compare("CASEQ8")==0)	tranType = ATM_CASEQ8;
	else if(tempStr.compare("CASZERO16")==0)tranType = ATM_CASZERO16;
	else if(tempStr.compare("EQ16")==0)		tranType = ATM_EQ16;
	else if(tempStr.compare("EQ8")==0)		tranType = ATM_EQ8;
	//Bitwise atomic
	else if(tempStr.compare("BWR")==0)		tranType = ATM_BWR;
	else if(tempStr.compare("P_BWR")==0)	tranType = ATM_P_BWR;
	else if(tempStr.compare("BWR8R")==0)	tranType = ATM_BWR8R;
	else if(tempStr.compare("SWAP16")==0)	tranType = ATM_SWAP16;
	else {
		ERROR("  == Error - Unknown command in tracefile : "<<tempStr);
	}
	previousIndex = line.find_first_of(" ", spaceIndex);

	spaceIndex = line.find_first_not_of(" ", previousIndex);
	if(spaceIndex==-1) {
		dataSize = TRANSACTION_SIZE;
		return;
	}
	tempStr = line.substr(spaceIndex, line.find_first_of(" ", spaceIndex) - spaceIndex);
	istringstream size(tempStr);
	size>>dataSize;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %r8, %rbx
movq %rcx, 0x30(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
leaq 0x60ec(%rip), %rsi      # 0x25a55
leaq 0x8(%rsp), %rdi
leaq 0x338(%rsp), %rdx
callq 0xcfd4
leaq 0x60d2(%rip), %rsi      # 0x25a54
movq %r14, %rdi
xorl %edx, %edx
callq 0x4190
movq %rax, %rbp
cmpl $-0x1, %ebp
jne 0x1fa01
movq 0x11655(%rip), %rdi     # 0x30ff0
leaq 0x4680(%rip), %rsi      # 0x24022
callq 0x4300
leaq 0x7c17(%rip), %rsi      # 0x275c5
movq %rax, %rdi
callq 0x4300
leaq 0x4eba(%rip), %rsi      # 0x24877
movq %rax, %rdi
callq 0x4300
pushq $0x52
popq %rsi
movq %rax, %rdi
callq 0x44f0
leaq 0x466a(%rip), %rsi      # 0x24041
movq %rax, %rdi
callq 0x4300
leaq 0x7bf2(%rip), %rsi      # 0x275d8
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movq %r14, %rsi
callq 0x42b0
movq %rax, %rdi
callq 0x4180
movq %rbx, 0x28(%rsp)
movslq %ebp, %rbp
leaq 0x338(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbp, %rcx
callq 0x4330
leaq 0x8(%rsp), %rbx
leaq 0x338(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4380
movq %r15, %rdi
callq 0x4598
leaq 0x338(%rsp), %rdi
pushq $0x8
popq %rdx
movq %rbx, %rsi
callq 0x44c0
leaq 0x338(%rsp), %rdi
movq %r13, %rsi
callq 0x41b0
leaq 0x5fec(%rip), %rsi      # 0x25a54
movq %r14, %rdi
movq %rbp, %rdx
callq 0x41d0
movq %rax, %r13
cmpl $-0x1, %r13d
jne 0x1fae9
movq 0x1156d(%rip), %rdi     # 0x30ff0
leaq 0x4598(%rip), %rsi      # 0x24022
callq 0x4300
leaq 0x7b2f(%rip), %rsi      # 0x275c5
movq %rax, %rdi
callq 0x4300
leaq 0x4dd2(%rip), %rsi      # 0x24877
movq %rax, %rdi
callq 0x4300
pushq $0x59
popq %rsi
movq %rax, %rdi
callq 0x44f0
leaq 0x4582(%rip), %rsi      # 0x24041
movq %rax, %rdi
callq 0x4300
leaq 0x7b0a(%rip), %rsi      # 0x275d8
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movq %r14, %rsi
callq 0x42b0
movq %rax, %rdi
callq 0x4180
movslq %r13d, %r13
leaq 0x5f61(%rip), %rsi      # 0x25a54
movq %r14, %rdi
movq %r13, %rdx
callq 0x4190
subq %r13, %rax
leaq 0x1b8(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x4330
leaq 0x8(%rsp), %rbx
leaq 0x1b8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4380
movq %r15, %rdi
callq 0x4598
leaq 0x38(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $-0x1
popq %rcx
movq %rbx, %rsi
callq 0x4330
leaq 0x1b8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
pushq $0x8
popq %rbp
movl %ebp, %edx
callq 0x44c0
leaq 0x38(%rsp), %rdi
callq 0x4598
leaq 0x1b8(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x1d0(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x1d0(%rsp,%rax)
movq %r12, %rsi
callq 0x41b0
leaq 0x5eb7(%rip), %rbx      # 0x25a54
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4190
movslq %eax, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x41d0
movq %rax, %r12
cmpl $-0x1, %r12d
jne 0x1fc2f
movq 0x11427(%rip), %rdi     # 0x30ff0
leaq 0x4452(%rip), %rsi      # 0x24022
callq 0x4300
leaq 0x79e9(%rip), %rsi      # 0x275c5
movq %rax, %rdi
callq 0x4300
leaq 0x4c8c(%rip), %rsi      # 0x24877
movq %rax, %rdi
callq 0x4300
pushq $0x60
popq %rsi
movq %rax, %rdi
callq 0x44f0
leaq 0x443c(%rip), %rsi      # 0x24041
movq %rax, %rdi
callq 0x4300
leaq 0x79c4(%rip), %rsi      # 0x275d8
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movq %r14, %rsi
callq 0x42b0
movq %rax, %rdi
callq 0x4180
movslq %r12d, %r12
leaq 0x5e1b(%rip), %rsi      # 0x25a54
movq %r14, %rdi
movq %r12, %rdx
callq 0x4190
subq %r12, %rax
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x4330
leaq 0x8(%rsp), %rbx
leaq 0x38(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4380
movq %r15, %rdi
callq 0x4598
leaq 0x7984(%rip), %rsi      # 0x27602
movq %rbx, %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff8b
leaq 0x7972(%rip), %rsi      # 0x27607
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff8f
leaq 0x7961(%rip), %rsi      # 0x2760f
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff93
leaq 0x7950(%rip), %rsi      # 0x27617
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff97
leaq 0x792d(%rip), %rsi      # 0x2760d
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff9b
leaq 0x791c(%rip), %rsi      # 0x27615
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ff9f
leaq 0x790b(%rip), %rsi      # 0x2761d
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffa3
leaq 0x78fa(%rip), %rsi      # 0x27625
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1fff2
leaq 0x78eb(%rip), %rsi      # 0x2762f
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffa7
leaq 0x78d0(%rip), %rsi      # 0x2762d
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffab
leaq 0x78be(%rip), %rsi      # 0x27634
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffaf
leaq 0x78ac(%rip), %rsi      # 0x2763b
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffb3
leaq 0x7892(%rip), %rsi      # 0x2763a
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffb7
leaq 0x7880(%rip), %rsi      # 0x27641
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffbb
leaq 0x7866(%rip), %rsi      # 0x27640
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffbf
leaq 0x7854(%rip), %rsi      # 0x27647
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffc3
leaq 0x7842(%rip), %rsi      # 0x2764e
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffc7
leaq 0x7830(%rip), %rsi      # 0x27655
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffcb
leaq 0x781f(%rip), %rsi      # 0x2765d
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffcf
leaq 0x780e(%rip), %rsi      # 0x27665
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffd3
leaq 0x77fc(%rip), %rsi      # 0x2766c
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffd7
leaq 0x77ed(%rip), %rsi      # 0x27676
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffdb
leaq 0x77c6(%rip), %rsi      # 0x27668
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffdf
leaq 0x77c2(%rip), %rsi      # 0x2767d
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffe3
leaq 0x77a7(%rip), %rsi      # 0x2767b
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffe7
leaq 0x7794(%rip), %rsi      # 0x27681
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffeb
leaq 0x7781(%rip), %rsi      # 0x27687
leaq 0x8(%rsp), %rdi
callq 0x4120
testl %eax, %eax
je 0x1ffef
movq 0x110d1(%rip), %rdi     # 0x30ff0
leaq 0x40fc(%rip), %rsi      # 0x24022
callq 0x4300
leaq 0x7693(%rip), %rsi      # 0x275c5
movq %rax, %rdi
callq 0x4300
leaq 0x4936(%rip), %rsi      # 0x24877
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movl $0x83, %esi
callq 0x44f0
leaq 0x40e4(%rip), %rsi      # 0x24041
movq %rax, %rdi
callq 0x4300
leaq 0x7722(%rip), %rsi      # 0x2768e
movq %rax, %rdi
callq 0x4300
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x42b0
movq %rax, %rdi
callq 0x4180
jmp 0x1fff9
xorl %ebp, %ebp
jmp 0x1fff2
pushq $0x1
jmp 0x1fff1
pushq $0x3
jmp 0x1fff1
pushq $0x4
jmp 0x1fff1
pushq $0x5
jmp 0x1fff1
pushq $0x6
jmp 0x1fff1
pushq $0x7
jmp 0x1fff1
pushq $0x9
jmp 0x1fff1
pushq $0xa
jmp 0x1fff1
pushq $0xb
jmp 0x1fff1
pushq $0xc
jmp 0x1fff1
pushq $0xd
jmp 0x1fff1
pushq $0xe
jmp 0x1fff1
pushq $0xf
jmp 0x1fff1
pushq $0x10
jmp 0x1fff1
pushq $0x11
jmp 0x1fff1
pushq $0x12
jmp 0x1fff1
pushq $0x13
jmp 0x1fff1
pushq $0x14
jmp 0x1fff1
pushq $0x15
jmp 0x1fff1
pushq $0x16
jmp 0x1fff1
pushq $0x17
jmp 0x1fff1
pushq $0x18
jmp 0x1fff1
pushq $0x19
jmp 0x1fff1
pushq $0x1a
jmp 0x1fff1
pushq $0x1b
popq %rbp
movq 0x30(%rsp), %rax
movl %ebp, (%rax)
leaq 0x5a54(%rip), %rbx      # 0x25a54
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4190
movslq %eax, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x41d0
cmpl $-0x1, %eax
jne 0x20033
leaq 0x11478(%rip), %rax     # 0x314a0
movl (%rax), %eax
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
jmp 0x200a4
movslq %eax, %rbx
leaq 0x5a17(%rip), %rsi      # 0x25a54
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4190
subq %rbx, %rax
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x4330
leaq 0x8(%rsp), %rbx
leaq 0x38(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4380
movq %r14, %rdi
callq 0x4598
leaq 0x38(%rsp), %rdi
pushq $0x8
popq %rdx
movq %rbx, %rsi
callq 0x44c0
leaq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x4510
leaq 0x38(%rsp), %rdi
callq 0x4170
leaq 0x1b8(%rsp), %rdi
callq 0x4170
leaq 0x338(%rsp), %rdi
callq 0x4170
leaq 0x8(%rsp), %rdi
callq 0x4598
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4170
jmp 0x2010e
jmp 0x2010b
jmp 0x2010b
jmp 0x2010b
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4598
jmp 0x20120
jmp 0x2011d
jmp 0x2011d
jmp 0x20106
jmp 0x20106
movq %rax, %rbx
jmp 0x2012d
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x4170
jmp 0x20120
movq %rax, %rbx
leaq 0x338(%rsp), %rdi
callq 0x4170
leaq 0x8(%rsp), %rdi
callq 0x4598
movq %rbx, %rdi
callq 0x4520