// File: /workspace/github_cpp_makefile_star2_O1/nmmmnu[P]HM3/hm3/linklist.cc
// Function: bool hm3::LinkList::putT_<hm3::Pair>(hm3::Pair&&)
bool LinkList::putT_(UPAIR&& newdata){
	const StringRef &key = newdata.getKey();

	Node *prev = nullptr;
	for(Node *node = head_; node; node = node->next){
		Pair & olddata = node->data;

		int const cmp = olddata.cmp(key);

		if (cmp == 0){
			// handle overwrite,
			// keep the node, overwrite the data

			// check if the data in database is valid
			if (! newdata.valid(olddata)){
				// newdata will be magically destroyed.
				return false;
			}

			dataSize_ = dataSize_
					- olddata.getBytes()
					+ newdata.getBytes();

			// copy assignment
			olddata = std::forward<UPAIR>(newdata);

			return true;
		}

		if (cmp > 0)
			break;

		prev = node;
	}

	size_t const size = newdata.getBytes();

	Node *newnode = new(std::nothrow) Node(std::forward<UPAIR>(newdata));
	if (newnode == nullptr){
		// newdata will be magically destroyed.
		return false;
	}

	// put new pair here...
	if (prev){
		// we are at the middle
		newnode->next = prev->next;
		prev->next = newnode;
	}else{
		newnode->next = head_;
		head_ = newnode;
	}

	dataSize_ += size;
	dataCount_++;

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xacd4
movq %rdx, 0x20(%rsp)
movq %rbx, 0x10(%rsp)
movq (%rbx), %r13
testq %r13, %r13
je 0xa05c
movq %rax, %r12
xorl %ebx, %ebx
movl %eax, 0xc(%rsp)
movq %r12, 0x18(%rsp)
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0xad48
testl %eax, %eax
je 0x9fd6
setle %bpl
setg %al
cmovleq %r13, %rbx
movzbl %al, %r14d
addl %r14d, %r14d
jmp 0xa037
xorl %ebp, %ebp
movq %r15, %rdi
xorl %esi, %esi
callq 0xadd8
movl $0x1, %r14d
testb %al, %al
je 0xa02f
movq %rbx, %r12
movq 0x10(%rsp), %rbx
movq 0x10(%rbx), %rbp
movq %r13, %rdi
callq 0xadec
subq %rax, %rbp
movq %r15, %rdi
callq 0xadec
addq %rbp, %rax
movq %rax, 0x10(%rbx)
movq %r12, %rbx
movq 0x18(%rsp), %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0xac48
movb $0x1, %al
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
jmp 0xa037
movl $0x0, 0xc(%rsp)
testb %bpl, %bpl
je 0xa04f
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0x9fae
movl $0x2, %r14d
cmpl $0x2, %r14d
sete %cl
movl 0xc(%rsp), %eax
jmp 0xa060
movb $0x1, %cl
xorl %ebx, %ebx
testb %cl, %cl
je 0xa0ec
movq %r15, %rdi
callq 0xadec
movq %r15, %r14
movq %rax, %r15
movq 0x5f43(%rip), %rsi      # 0xffc0
movl $0x10, %edi
callq 0x2250
testq %rax, %rax
je 0xa0a5
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0xac3a
movq $0x0, 0x8(%r12)
jmp 0xa0a8
xorl %r12d, %r12d
testq %r12, %r12
setne %al
je 0xa0ec
leaq 0x8(%rbx), %rax
testq %rbx, %rbx
movq 0x10(%rsp), %rdx
cmoveq %rdx, %rax
movq (%rax), %rcx
movq %rcx, 0x8(%r12)
movq %r12, (%rax)
movdqu 0x8(%rdx), %xmm0
movq %r15, %xmm1
movdqa 0x2153(%rip), %xmm2     # 0xc230
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
paddq %xmm0, %xmm2
movdqu %xmm2, 0x8(%rdx)
movb $0x1, %al
andb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x5eb9(%rip), %rsi      # 0xffc0
movq %r12, %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2240
nop