// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/kvlds/btree_node.c
// Function: btree_node_mknode
struct node *
btree_node_mknode(struct btree * T, unsigned int type, int height, size_t nkeys,
    const struct kvldskey ** keys, struct node ** children,
    struct kvpair_const * pairs)
{
	struct node * N;

	/* Sanity check. */
	assert((height <= INT8_MAX) && (height >= -1));

	/* Allocate node. */
	if ((N = node_alloc((uint64_t)(-1), (uint64_t)(-1), (uint32_t)(-1)))
	    == NULL)
		goto err0;

	/* Make the node present. */
	if (makepresent(T, N))
		goto err1;

	/* This is a DIRTY node of the indicated type and height. */
	N->state = NODE_STATE_DIRTY;
	N->type = type;
	N->height = (int8_t)height;

	/* Store node data. */
	N->nkeys = nkeys;
	if (type == NODE_TYPE_LEAF) {
		N->u.pairs = pairs;
		if ((N->nkeys > 0) && (pairs != NULL)) {
			N->mlen_n = (uint8_t)kvldskey_mlen(N->u.pairs[0].k,
			    N->u.pairs[N->nkeys - 1].k);
		} else {
			N->mlen_n = 255;
		}
	} else {
		N->u.keys = keys;
		N->v.children = children;
	}

	/* We don't know how far keys in this subtree match. */
	N->mlen_t = 0;

	/* Success! */
	return (N);

err1:
	node_free(N);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x7f, -0x18(%rbp)
jg 0xbe70
cmpl $-0x1, -0x18(%rbp)
jl 0xbe70
jmp 0xbe8f
leaq 0x13598(%rip), %rdi     # 0x1f40f
leaq 0x135b8(%rip), %rsi     # 0x1f436
movl $0x8e, %edx
leaq 0x135b9(%rip), %rcx     # 0x1f443
callq 0x21d0
movq $-0x1, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rdi
callq 0xfa70
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xbeb2
jmp 0xbfa2
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xbfc0
cmpl $0x0, %eax
je 0xbec9
jmp 0xbf99
movq -0x38(%rbp), %rax
movb 0x1c(%rax), %cl
andb $-0xd, %cl
orb $0x8, %cl
movb %cl, 0x1c(%rax)
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movb %cl, %dl
movb 0x1c(%rax), %cl
andb $0x3, %dl
andb $-0x4, %cl
orb %dl, %cl
movb %cl, 0x1c(%rax)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x1d(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x38(%rax)
cmpl $0x1, -0x14(%rbp)
jne 0xbf6f
movq 0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jbe 0xbf65
cmpq $0x0, 0x10(%rbp)
je 0xbf65
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x38(%rcx), %rcx
subq $0x1, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x18730
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x1f(%rax)
jmp 0xbf6d
movq -0x38(%rbp), %rax
movb $-0x1, 0x1f(%rax)
jmp 0xbf87
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movb $0x0, 0x1e(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbfaa
movq -0x38(%rbp), %rdi
callq 0xfb50
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)