	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_eba_read_leb_sg            ## -- Begin function ubi_eba_read_leb_sg
	.p2align	4, 0x90
_ubi_eba_read_leb_sg:                   ## @ubi_eba_read_leb_sg
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, %ebx
	movl	%r8d, %r15d
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdx, %r14
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	(%rdx), %rax
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	movq	_UBI_MAX_SG_COUNT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	setb	%dil
	callq	_ubi_assert
	movq	(%r14), %rax
	movq	16(%r14), %rcx
	movl	(%rcx,%rax,4), %r13d
	subl	8(%r14), %r13d
	leaq	(%rcx,%rax,4), %r12
	cmpl	%r13d, %ebx
	cmovll	%ebx, %r13d
	movq	%r12, %rdi
	callq	_sg_virt
	addl	8(%r14), %eax
	movl	16(%rbp), %ecx
	movl	%ecx, (%rsp)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	%eax, %ecx
	movl	%r15d, %r8d
	movl	%r13d, %r9d
	callq	_ubi_eba_read_leb
	testl	%eax, %eax
	js	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	subl	%r13d, %ebx
	je	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	addl	%r13d, %r15d
	movq	(%r14), %rax
	incq	%rax
	movq	%rax, (%r14)
	movl	$0, 8(%r14)
	jmp	LBB0_1
LBB0_3:
	addl	8(%r14), %r13d
	movl	%r13d, 8(%r14)
	cmpl	(%r12), %r13d
	jne	LBB0_5
## %bb.4:
	incq	(%r14)
	movl	$0, 8(%r14)
LBB0_5:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_UBI_MAX_SG_COUNT,8,3           ## @UBI_MAX_SG_COUNT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_eba_read_leb_sg            ; -- Begin function ubi_eba_read_leb_sg
	.p2align	2
_ubi_eba_read_leb_sg:                   ; @ubi_eba_read_leb_sg
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x6
	mov	x21, x5
	mov	x22, x4
	mov	x23, x3
	mov	x19, x2
	mov	x24, x1
	mov	x25, x0
	ldr	x8, [x2]
Lloh0:
	adrp	x28, _UBI_MAX_SG_COUNT@GOTPAGE
Lloh1:
	ldr	x28, [x28, _UBI_MAX_SG_COUNT@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x28]
	cmp	x8, x9
	cset	w0, lo
	bl	_ubi_assert
	ldr	x8, [x19, #16]
	ldr	x9, [x19]
	add	x26, x8, x9, lsl #2
	ldr	w8, [x26]
	ldr	w9, [x19, #8]
	sub	w8, w8, w9
	cmp	w21, w8
	csel	w27, w21, w8, lt
	mov	x0, x26
	bl	_sg_virt
	ldr	w8, [x19, #8]
	add	w3, w8, w0
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	mov	x4, x22
	mov	x5, x27
	mov	x6, x20
	bl	_ubi_eba_read_leb
	tbnz	w0, #31, LBB0_6
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	subs	w21, w21, w27
	b.eq	LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	add	w22, w27, w22
	ldr	x8, [x19]
	add	x8, x8, #1
	str	x8, [x19]
	str	wzr, [x19, #8]
	b	LBB0_1
LBB0_4:
	ldr	w8, [x19, #8]
	ldr	w9, [x26]
	add	w8, w8, w27
	cmp	w8, w9
	str	w8, [x19, #8]
	b.ne	LBB0_6
; %bb.5:
	ldr	x8, [x19]
	add	x8, x8, #1
	str	x8, [x19]
	str	wzr, [x19, #8]
LBB0_6:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_UBI_MAX_SG_COUNT,8,3           ; @UBI_MAX_SG_COUNT
.subsections_via_symbols
