// File: /workspace/github_c_makefile_star2_O0/ngkaho1234[P]ext4-extents-tree/extents.c
// Function: ext4_ext_tree_grow
static int
ext4_ext_tree_grow(struct ext4_ext_cursor *cur, int depth, ext4_fsblk_t nblocknr,
		   struct ext4_ext_path *pathp)
{
	int ret;
	struct buffer_head *nbcb;
	uint16_t nritems;
	uint16_t nnritems;
	struct super_block *sb;
	struct ext4_extent_header *hdr;
	struct ext4_extent_header *nhdr;
	union ext4_extent_item *items;
	union ext4_extent_item *nitems;
	ssize_t nptr;

	sb = cur->c_superblock;

	nbcb = fs_bwrite(sb, nblocknr, &ret);
	if (ret)
		return ret;

	hdr = cur->c_root;
	nhdr = (struct ext4_extent_header *)nbcb->b_data;

	items = EXT_FIRST_ITEM(hdr);
	nitems = EXT_FIRST_ITEM(nhdr);

	nnritems = nritems = ext4_ext_header_entries(hdr);

	ext4_ext_header_set_magic(nhdr);
	ext4_ext_header_set_depth(nhdr, depth);
	ext4_ext_header_set_max_entries(nhdr,
					ext4_ext_node_maxitems(cur->c_blocksz));
	ext4_ext_header_set_generation(nhdr, 0);
	ext4_ext_header_set_entries(nhdr, nnritems);

	memcpy(nitems, items, nnritems * EXT4_EXT_ITEM_SIZE);

	ext4_ext_header_set_depth(hdr, depth + 1);
	ext4_ext_header_set_entries(hdr, 0);
	memset(items, 0, nritems * EXT4_EXT_ITEM_SIZE);

	cur->c_cursor_op.c_root_dirty_func(cur);
	fs_mark_buffer_dirty(nbcb);

	nptr = cur->c_paths[depth].p_ptr;

	pathp->p_bcb = nbcb;
	pathp->p_hdr = nhdr;
	pathp->p_ptr = nptr;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2920
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x8cac
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x8dd8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
callq 0x69a0
movw %ax, -0x3a(%rbp)
movw %ax, -0x3c(%rbp)
movq -0x58(%rbp), %rdi
callq 0x87a0
movq -0x58(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x80a0
movq -0x58(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x6100
movq -0x78(%rbp), %rdi
movzwl %ax, %esi
callq 0x87c0
movq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x8800
movq -0x58(%rbp), %rdi
movzwl -0x3c(%rbp), %esi
callq 0x87e0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movzwl -0x3c(%rbp), %eax
imulq $0xc, %rax, %rdx
callq 0x2180
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
addl $0x1, %esi
callq 0x80a0
movq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x87e0
movq -0x60(%rbp), %rdi
movzwl -0x3a(%rbp), %eax
imulq $0xc, %rax, %rdx
xorl %esi, %esi
callq 0x20d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x38(%rbp), %rdi
callq 0x29b0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)