// File: /workspace/github_c_makefile_star2_O0/ngkaho1234[P]ext4-extents-tree/extents.c
// Function: ext4_ext_shrinkable
static int
ext4_ext_shrinkable(struct ext4_ext_cursor *cur, bool *shrinkablep)
{
	int ret = 0;
	int i = 0;
	int maxnritems;
	int nritems;
	int nnritems = 0;
	int rootdepth;
	struct ext4_extent_header *hdr;
	struct ext4_ext_cursor *ncur = NULL;
	bool shrinkable = false;

	rootdepth = ext4_ext_cursor_depth(cur);
	hdr = cur->c_root;

	if (!rootdepth)
		goto out;

	ncur = ext4_ext_cursor_alloc(cur->c_superblock, cur->c_root,
				     cur->c_fsinfo, cur->c_blocksz);
	if (!ncur)
		return ENOMEM;

	ret = ext4_ext_lookup_extent(ncur, 0, NULL);
	if (ret)
		goto out;

	maxnritems = ext4_ext_header_max_entries(hdr);
	nritems = ext4_ext_header_entries(hdr);

	for (i = 0; i < nritems; i++) {
		bool nosib;
		struct ext4_ext_cursor *tcur;
		struct ext4_extent_header *nhdr =
		
		nhdr = cur->c_paths[rootdepth - 1].p_hdr;

		nnritems += ext4_ext_header_entries(nhdr);
		ret =
		    ext4_ext_right_sibling(ncur, rootdepth - 1, &tcur, &nosib);
		if (ret)
			goto out;
		if (nosib) {
			if (tcur)
				ext4_ext_cursor_free(tcur);
			break;
		}
		ext4_ext_cursor_free(ncur);
		ncur = tcur;
	}
	if (nnritems <= maxnritems)
		shrinkable = true;

out:
	if (ncur)
		ext4_ext_cursor_free(ncur);
	*shrinkablep = shrinkable;
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x41(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6720
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x9673
jmp 0x9799
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
callq 0x6120
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x96ae
movl $0xc, -0x4(%rbp)
jmp 0x97bb
movq -0x40(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x64b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x96cb
jmp 0x9799
movq -0x38(%rbp), %rdi
callq 0x9430
movzwl %ax, %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rdi
callq 0x69a0
movzwl %ax, %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x978b
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x69a0
movzwl %ax, %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %rdi
movl -0x30(%rbp), %esi
subl $0x1, %esi
leaq -0x50(%rbp), %rdx
leaq -0x42(%rbp), %rcx
callq 0x9450
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x9754
jmp 0x9799
testb $0x1, -0x42(%rbp)
je 0x976c
cmpq $0x0, -0x50(%rbp)
je 0x976a
movq -0x50(%rbp), %rdi
callq 0x6470
jmp 0x978b
movq -0x40(%rbp), %rdi
callq 0x6470
movq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x96f0
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x9797
movb $0x1, -0x41(%rbp)
jmp 0x9799
cmpq $0x0, -0x40(%rbp)
je 0x97a9
movq -0x40(%rbp), %rdi
callq 0x6470
movb -0x41(%rbp), %cl
movq -0x18(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)