// File: /workspace/github_cpp_makefile_star2_O1/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 0x3290(%rip), %rcx      # 0x18cb8
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 0x15ad5
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 0x15464
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 0x15acf
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
cmpq $-0x1, %r15
jne 0x15a75
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq $-0x1, %rcx
callq 0x32e0
movq %rsp, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1579c
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15b14
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x15ddf
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 0x15df1
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x15dfd
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15dfd
testl %ecx, %ecx
jne 0x15b75
movl %ebp, (%r13)
movl %eax, 0x50(%r12)
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jb 0x15e09
leaq 0x88(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x5a48
leaq 0x6a(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x16f72
leaq 0x48(%r12), %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x15be3
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32c0
leaq 0x6a(%rsp), %rsi
movq %rbx, %rdi
callq 0xc9b6
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x3, %rdx
jb 0x15e10
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 0x15e17
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rcx
cmpq %r15, %rcx
jb 0x15e23
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15e23
testl %ecx, %ecx
jne 0x15c67
movl %ebp, (%r13)
movl %eax, (%r12)
cmpl $0x5, %eax
ja 0x15d8b
movl %eax, %eax
leaq 0x305f(%rip), %rcx      # 0x18cdc
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 0x15e2f
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 0x15e36
subq $-0x80, %rsi
movq 0x20(%rsp), %rdi
callq 0x3160
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0xa1, %rcx
jb 0x15d8b
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 0x15e49
leaq -0x80000000(%rax), %rcx
cmpq %r15, %rcx
jb 0x15e55
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x15e55
testl %ecx, %ecx
jne 0x15d45
movl %ebp, (%r13)
movl %eax, 0x4(%r12)
jmp 0x15d8b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
movq 0x28(%rsp), %rdi
jmp 0x15d78
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
movq 0x20(%rsp), %rdi
cmpq $0x3, %rdx
jbe 0x15e2f
addq $0x60, %rsi
callq 0x3160
movq %rsp, %rdi
callq 0x154a2
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 0x15e2f
addq $0x60, %rdi
leaq 0x2f46(%rip), %rsi      # 0x18d0c
callq 0x30c0
testl %eax, %eax
je 0x15dd7
movb $0x0, 0x54(%r12)
jmp 0x15d8b
movb $0x1, 0x54(%r12)
jmp 0x15d8b
leaq 0x2988(%rip), %rdi      # 0x1876e
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3410
leaq 0x2edc(%rip), %rdi      # 0x18cd4
callq 0x3190
leaq 0x2ed0(%rip), %rdi      # 0x18cd4
callq 0x33e0
movl $0x1, %esi
jmp 0x15e3b
movl $0x2, %esi
jmp 0x15e3b
leaq 0x2eb6(%rip), %rdi      # 0x18cd4
callq 0x3190
leaq 0x2eaa(%rip), %rdi      # 0x18cd4
callq 0x33e0
movl $0x3, %esi
jmp 0x15e3b
movl $0x4, %esi
leaq 0x292c(%rip), %rdi      # 0x1876e
xorl %eax, %eax
callq 0x3410
leaq 0x2e84(%rip), %rdi      # 0x18cd4
callq 0x3190
leaq 0x2e78(%rip), %rdi      # 0x18cd4
callq 0x33e0
jmp 0x15e93
movq %rax, %r12
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0x15ec9
movq 0x88(%rsp), %rsi
jmp 0x15ec1
jmp 0x15ea5
movq %rax, %r12
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x15eb7
jmp 0x15ea5
movq %rax, %r12
jmp 0x15ed1
jmp 0x15e93
movq %rax, %r12
cmpl $0x0, (%r13)
jne 0x15ec9
movl %ebp, (%r13)
jmp 0x15ec9
jmp 0x15ea5
movq %rax, %r12
jmp 0x15ec9
movq %rax, %r12
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x15ec9
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32c0
movq %rsp, %rdi
callq 0x154a2
movq 0x70(%rsp), %rax
movq (%rax), %rdi
cmpq 0x50(%rsp), %rdi
je 0x15ef0
movq 0x50(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq 0x20(%rsp), %rax
movq (%rax), %rdi
cmpq 0x58(%rsp), %rdi
je 0x15f0f
movq 0x58(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq 0x28(%rsp), %rax
movq (%rax), %rdi
cmpq 0x60(%rsp), %rdi
je 0x15f2e
movq 0x60(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x32c0
movq %r12, %rdi
callq 0x34b0