// File: /workspace/github_c_makefile_star2_O2/ngkaho1234[P]ext4-extents-tree/extents.c
// Function: ext4_ext_lookup_extent
int
ext4_ext_lookup_extent(struct ext4_ext_cursor *cur, ext4_lblk_t lblock,
		       bool *notfound)
{
	int ret = 0;
	int depth;
	int rootdepth;
	struct super_block *sb;

	sb = cur->c_superblock;
	rootdepth = ext4_ext_cursor_depth(cur);

	if (notfound)
		*notfound = true;

	ext4_assert(cur->c_paths[rootdepth].p_hdr);

	for (depth = rootdepth; depth >= 0; depth--) {
		struct ext4_ext_path npath;
		struct ext4_extent_header *hdr;

		hdr = cur->c_paths[depth].p_hdr;
		if (depth)
			ext4_ext_binsearch_node(hdr, lblock,
						&cur->c_paths[depth].p_ptr);
		else
			ext4_ext_binsearch_leaf(hdr, lblock,
						&cur->c_paths[depth].p_ptr);
		if (depth) {
			struct ext4_extent_idx *idx;
			void *data;

			idx = EXT_FIRST_INDEX(hdr) + cur->c_paths[depth].p_ptr;
			npath.p_bcb = fs_bread(sb, ext4_idx_block(idx), &ret);
			if (ret)
				break;
			data = npath.p_bcb->b_data;
			npath.p_hdr = (struct ext4_extent_header *)data;
			ext4_ext_cursor_set_buf(cur, depth - 1, &npath);

			hdr = npath.p_hdr;
			if (hdr->eh_magic != EXT4_EXT_MAGIC) {
				ret = EIO;
				break;
			}
		} else {
			struct ext4_extent *ext =
			    EXT_FIRST_EXTENT(hdr) + cur->c_paths[0].p_ptr;
			uint16_t nritems = ext4_ext_header_entries(hdr);

			if (nritems && ext4_ext_in_range(lblock, ext)) {
				if (notfound)
					*notfound = false;
			}
		}
	}
	if (ret)
		ext4_ext_cursor_unpin(cur, -1, -1);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %r15d
andl $0x0, -0x2c(%rbp)
movq (%rdi), %rax
movq %rdi, -0x38(%rbp)
movq 0x10(%rdi), %rcx
movq %rcx, -0x48(%rbp)
movzwl 0x6(%rax), %r14d
testq %rdx, %rdx
je 0x42cd
movb $0x1, (%rdx)
movq %rdx, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movl %r14d, %ecx
imulq $0x18, %rcx, %rcx
cmpq $0x0, 0x8(%rax,%rcx)
je 0x44b6
pushq $0x2
popq %r13
pushq $-0x1
popq %r12
testl %r14d, %r14d
js 0x4485
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
movl %r14d, %eax
imulq $0x18, %rax, %r8
movq 0x8(%rsi,%r8), %rcx
movzwl 0x2(%rcx), %eax
movq %rax, -0x50(%rbp)
leaq -0x1(%rax), %r9
addq $0xc, %rcx
xorl %edi, %edi
xorl %r10d, %r10d
xorl %edx, %edx
testl %r14d, %r14d
je 0x4386
cmpq %r9, %r10
jg 0x43d0
leaq (%r10,%r9), %rax
cqto
idivq %r13
movq %rax, %rdi
imulq $0xc, %rax, %rdx
movl (%rcx,%rdx), %r11d
xorl %edx, %edx
cmpl %r15d, %r11d
setb %dl
cmoval %r12d, %edx
testl %edx, %edx
je 0x43ce
leaq -0x1(%rdi), %rbx
movq %rdi, %rax
incq %rax
cmpl %r15d, %r11d
cmovaq %rbx, %r9
cmovbeq %rax, %r10
jmp 0x432d
leaq -0x1(%rdi), %rax
movq %rdi, %rbx
incq %rbx
cmpl %r15d, %r11d
cmovaq %rax, %r9
cmovbeq %rbx, %r10
cmpq %r9, %r10
jg 0x43d0
leaq (%r10,%r9), %rax
cqto
idivq %r13
movq %rax, %rdi
imulq $0xc, %rax, %rbx
movl (%rcx,%rbx), %r11d
xorl %edx, %edx
cmpl %r15d, %r11d
setb %dl
cmoval %r12d, %edx
ja 0x4371
addq %rcx, %rbx
movzwl 0x4(%rbx), %eax
movl %eax, %ebx
andl $0x7fff, %ebx           # imm = 0x7FFF
cmpw $0x8001, %ax            # imm = 0x8001
cmovbl %eax, %ebx
leal (%r11,%rbx), %eax
decl %eax
cmpl %r15d, %eax
jb 0x4371
xorl %edx, %edx
addq %rsi, %r8
testl %edx, %edx
sets %al
testq %rdi, %rdi
setne %dl
andb %al, %dl
movzbl %dl, %eax
subq %rax, %rdi
movq %rdi, 0x10(%r8)
testl %r14d, %r14d
je 0x4442
imulq $0xc, %rdi, %rax
movl 0x4(%rcx,%rax), %edx
movzwl 0x8(%rcx,%rax), %esi
shlq $0x20, %rsi
orq %rdx, %rsi
movq -0x48(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x267c
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x4496
movq 0x18(%rax), %rbx
movq %rbx, -0x60(%rbp)
leal -0x1(%r14), %esi
movq -0x38(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x4227
cmpw $0xf30a, (%rbx)         # imm = 0xF30A
jne 0x448f
decl %r14d
jmp 0x42f4
cmpw $0x0, -0x50(%rbp)
je 0x443a
imulq $0xc, 0x10(%rsi), %rax
addq %rax, %rcx
movl (%rcx), %eax
cmpl %r15d, %eax
ja 0x443a
movzwl 0x4(%rcx), %edx
movl %edx, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpw $0x8001, %dx            # imm = 0x8001
cmovbl %edx, %ecx
cmpq $0x0, -0x40(%rbp)
je 0x443a
addl %ecx, %eax
decl %eax
cmpl %r15d, %eax
jb 0x443a
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
jmp 0x443a
cmpl $0x0, -0x2c(%rbp)
jne 0x4496
xorl %eax, %eax
jmp 0x44a7
movl $0x5, -0x2c(%rbp)
pushq $-0x1
popq %rdx
movq -0x38(%rbp), %rdi
movl %edx, %esi
callq 0x417f
movl -0x2c(%rbp), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x257c(%rip), %rdi      # 0x6a39
leaq 0x2517(%rip), %rsi      # 0x69db
leaq 0x258c(%rip), %rcx      # 0x6a57
movl $0x2dc, %edx            # imm = 0x2DC
callq 0x20c0