// File: /workspace/github_c_makefile_star2_O0/ngkaho1234[P]ext4-extents-tree/extents.c
// Function: ext4_ext_try_merge_right
static int
ext4_ext_try_merge_right(struct ext4_ext_cursor *cur, int depth,
			 struct ext4_ext_cursor **ncurp, int *mergedp)
{
	int ret;
	bool nosib;
	int merged = 0;
	uint16_t nritems;
	uint16_t snritems;
	struct ext4_ext_cursor *ncur = NULL;
	struct ext4_extent_header *hdr;
	struct ext4_extent_header *shdr;

	*ncurp = NULL;
	*mergedp = 0;

	ret = ext4_ext_right_sibling(cur, depth, &ncur, &nosib);
	if (ret || nosib)
		goto out;

	hdr = cur->c_paths[depth].p_hdr;
	shdr = ncur->c_paths[depth].p_hdr;
	nritems = ext4_ext_header_entries(hdr);
	snritems = ext4_ext_header_entries(shdr);
	if (ext4_ext_may_merge(cur, depth) &&
	    nritems + snritems <= ext4_ext_header_max_entries(shdr)) {
		union ext4_extent_item *itemp = EXT_FIRST_ITEM(shdr);

		memmove(itemp + nritems, itemp, snritems * EXT4_EXT_ITEM_SIZE);
		memcpy(itemp, EXT_FIRST_ITEM(hdr),
		       nritems * EXT4_EXT_ITEM_SIZE);
		ext4_ext_header_set_entries(shdr, snritems + nritems);
		fs_mark_buffer_dirty(ncur->c_paths[depth].p_bcb);
		merged = 2;
	}
out:
	if (!merged && ncur) {
		ext4_ext_cursor_free(ncur);
		ncur = NULL;
	}
	*mergedp = merged;
	*ncurp = ncur;
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x38(%rbp), %rdx
leaq -0x25(%rbp), %rcx
callq 0x9450
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x910e
testb $0x1, -0x25(%rbp)
je 0x9113
jmp 0x921c
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x69a0
movw %ax, -0x2e(%rbp)
movq -0x48(%rbp), %rdi
callq 0x69a0
movw %ax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x93c0
testb $0x1, %al
jne 0x9178
jmp 0x921a
movzwl -0x2e(%rbp), %eax
movzwl -0x30(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x54(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9430
movw %ax, %cx
movl -0x54(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
jg 0x921a
movq -0x48(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movzwl -0x2e(%rbp), %eax
cltq
imulq $0xc, %rax, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rsi
movzwl -0x30(%rbp), %eax
imulq $0xc, %rax, %rdx
callq 0x2210
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0xc, %rsi
movzwl -0x2e(%rbp), %eax
imulq $0xc, %rax, %rdx
callq 0x2180
movq -0x48(%rbp), %rdi
movzwl -0x30(%rbp), %eax
movzwl -0x2e(%rbp), %ecx
addl %ecx, %eax
movzwl %ax, %esi
callq 0x87e0
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x29b0
movl $0x2, -0x2c(%rbp)
jmp 0x921c
cmpl $0x0, -0x2c(%rbp)
jne 0x923a
cmpq $0x0, -0x38(%rbp)
je 0x923a
movq -0x38(%rbp), %rdi
callq 0x6470
movq $0x0, -0x38(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0x24(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)