// File: /workspace/github_cpp_makefile_star2_O3/tonymuu[P]distributed-kv-store/Message.cpp
// Function: Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Message::Message(string message){
	this->delimiter = "::";
	vector<string> tuple;
	size_t pos = message.find(delimiter);
	size_t start = 0;
	while (pos != string::npos) {
		string field = message.substr(start, pos-start);
		tuple.push_back(field);
		start = pos + 2;
		pos = message.find(delimiter, start);
	}
	tuple.push_back(message.substr(start));

	transID = stoi(tuple.at(0));
	Address addr(tuple.at(1));
	fromAddr = addr;
	type = static_cast<MessageType>(stoi(tuple.at(2)));
	switch(type){
		case CREATE:
		case UPDATE:
			key = tuple.at(3);
			value = tuple.at(4);
			if (tuple.size() > 5)
				replica = static_cast<ReplicaType>(stoi(tuple.at(5)));
			break;
		case READ:
		case DELETE:
			key = tuple.at(3);
			break;
		case REPLY:
			if (tuple.at(3) == "1")
				success = true;
			else
				success = false;
			break;
		case READREPLY:
			value = tuple.at(3);
			break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r13
movq %rdi, %r12
leaq 0x8(%rdi), %rax
movq %rax, 0x28(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x8(%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movb %al, 0x18(%rdi)
leaq 0x28(%rdi), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x38(%rdi), %rcx
movq %rcx, 0x58(%rsp)
movq %rcx, 0x28(%rdi)
movq %rax, 0x30(%rdi)
movb %al, 0x38(%rdi)
movl $0x0, 0x48(%rdi)
movw $0x0, 0x4c(%rdi)
leaq 0x58(%rdi), %rdi
leaq 0x68(%r12), %rcx
movq %rcx, 0x50(%rsp)
movq %rcx, 0x58(%r12)
movq %rax, 0x60(%r12)
movb %al, 0x68(%r12)
leaq 0x2530(%rip), %rcx      # 0x17c5c
movl $0x2, %r8d
movq %rdi, 0x70(%rsp)
xorl %esi, %esi
xorl %edx, %edx
callq 0x3440
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rcx
xorl %ebp, %ebp
movq %r13, %rdi
xorl %edx, %edx
callq 0x34a0
cmpq $-0x1, %rax
je 0x157d9
movq %rax, %r15
xorl %ebp, %ebp
leaq 0x30(%rsp), %r14
movq %rsp, %rbx
movq %r15, %rcx
subq %rbp, %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x32e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15194
movq %r15, %rbp
addq $0x2, %rbp
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rcx
movq %r13, %rdi
movq %rbp, %rdx
callq 0x34a0
movq %rax, %r15
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x157d3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
cmpq $-0x1, %r15
jne 0x15779
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq $-0x1, %rcx
callq 0x32e0
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x15496
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15818
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x15ae3
movq (%rax), %rbx
callq 0x3050
movq %rax, %r13
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x33c0
cmpq %rbx, (%r14)
je 0x15af5
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x15b01
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15b01
testl %ecx, %ecx
jne 0x15879
movl %ebp, (%r13)
movl %eax, 0x50(%r12)
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jb 0x15b0d
leaq 0x88(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x5a4e
leaq 0x6a(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x16c6e
leaq 0x48(%r12), %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x158e7
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x6a(%rsp), %rsi
movq %rbx, %rdi
callq 0xc8d2
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x3, %rdx
jb 0x15b14
movq 0x40(%rax), %rbx
movl (%r13), %ebp
movl $0x0, (%r13)
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x33c0
cmpq %rbx, (%r14)
je 0x15b1b
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rcx
cmpq %r15, %rcx
jb 0x15b27
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15b27
testl %ecx, %ecx
jne 0x1596b
movl %ebp, (%r13)
movl %eax, (%r12)
cmpl $0x5, %eax
ja 0x15a8f
movl %eax, %eax
leaq 0x22ff(%rip), %rcx      # 0x17c80
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x4, %rdx
jb 0x15b33
addq $0x60, %rsi
movq 0x28(%rsp), %rdi
callq 0x3160
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x5, %rdx
jb 0x15b3a
subq $-0x80, %rsi
movq 0x20(%rsp), %rdi
callq 0x3160
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0xa1, %rcx
jb 0x15a8f
movq 0xa0(%rax), %rbx
movl (%r13), %ebp
movl $0x0, (%r13)
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x33c0
cmpq %rbx, (%r14)
je 0x15b4d
leaq -0x80000000(%rax), %rcx
cmpq %r15, %rcx
jb 0x15b59
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15b59
testl %ecx, %ecx
jne 0x15a49
movl %ebp, (%r13)
movl %eax, 0x4(%r12)
jmp 0x15a8f
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
movq 0x28(%rsp), %rdi
jmp 0x15a7c
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
movq 0x20(%rsp), %rdi
cmpq $0x3, %rdx
jbe 0x15b33
addq $0x60, %rsi
callq 0x3160
movq %rsp, %rdi
callq 0x151d2
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
cmpq $0x4, %rdx
jb 0x15b33
addq $0x60, %rdi
leaq 0x21e6(%rip), %rsi      # 0x17cb0
callq 0x30c0
testl %eax, %eax
je 0x15adb
movb $0x0, 0x54(%r12)
jmp 0x15a8f
movb $0x1, 0x54(%r12)
jmp 0x15a8f
leaq 0x1c84(%rip), %rdi      # 0x1776e
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3410
leaq 0x217c(%rip), %rdi      # 0x17c78
callq 0x3190
leaq 0x2170(%rip), %rdi      # 0x17c78
callq 0x33e0
movl $0x1, %esi
jmp 0x15b3f
movl $0x2, %esi
jmp 0x15b3f
leaq 0x2156(%rip), %rdi      # 0x17c78
callq 0x3190
leaq 0x214a(%rip), %rdi      # 0x17c78
callq 0x33e0
movl $0x3, %esi
jmp 0x15b3f
movl $0x4, %esi
leaq 0x1c28(%rip), %rdi      # 0x1776e
xorl %eax, %eax
callq 0x3410
leaq 0x2124(%rip), %rdi      # 0x17c78
callq 0x3190
leaq 0x2118(%rip), %rdi      # 0x17c78
callq 0x33e0
jmp 0x15b97
movq %rax, %r12
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x15bcd
movq 0x88(%rsp), %rsi
jmp 0x15bc5
jmp 0x15ba9
movq %rax, %r12
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x15bbb
jmp 0x15ba9
movq %rax, %r12
jmp 0x15bd5
jmp 0x15b97
movq %rax, %r12
cmpl $0x0, (%r13)
jne 0x15bcd
movl %ebp, (%r13)
jmp 0x15bcd
jmp 0x15ba9
movq %rax, %r12
jmp 0x15bcd
movq %rax, %r12
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x15bcd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rsp, %rdi
callq 0x151d2
movq 0x70(%rsp), %rax
movq (%rax), %rdi
cmpq 0x50(%rsp), %rdi
je 0x15bf4
movq 0x50(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq 0x20(%rsp), %rax
movq (%rax), %rdi
cmpq 0x58(%rsp), %rdi
je 0x15c13
movq 0x58(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq 0x28(%rsp), %rax
movq (%rax), %rdi
cmpq 0x60(%rsp), %rdi
je 0x15c32
movq 0x60(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq %r12, %rdi
callq 0x34b0