	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function loco_get_rice
_loco_get_rice:                         ## @loco_get_rice
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	(%rdi), %eax
	testl	%eax, %eax
	jle	LBB0_2
## %bb.1:
	decl	%eax
	movl	%eax, (%rbx)
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_loco_update_rice_param
LBB0_12:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	leaq	24(%rbx), %r15
	movq	%r15, %rdi
	callq	_get_bits_left
	testl	%eax, %eax
	jle	LBB0_3
## %bb.4:
	movq	%rbx, %rdi
	callq	_loco_get_rice_param
	movq	_INT_MAX@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%ecx, %ecx
	callq	_get_ur_golomb_jpegls
	movq	%rax, %r14
	leal	1(%rax), %esi
	sarl	%esi
	movq	%rbx, %rdi
	callq	_loco_update_rice_param
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.10:
	movl	%r14d, %eax
	sarl	%eax
	addl	20(%rbx), %eax
	andl	$1, %r14d
	negl	%r14d
	xorl	%eax, %r14d
	movl	16(%rbx), %eax
	testl	%eax, %eax
	jle	LBB0_12
## %bb.11:
	cmpl	$3, %eax
	movq	$-3, %rcx
	cmovaeq	%rax, %rcx
	addq	%rcx, 8(%rbx)
	movl	$0, 16(%rbx)
	jmp	LBB0_12
LBB0_3:
	movq	_INT_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	jmp	LBB0_12
LBB0_5:
	cmpq	$0, 8(%rbx)
	js	LBB0_9
## %bb.6:
	movl	(%r12), %edx
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	movl	$2, %esi
	xorl	%ecx, %ecx
	callq	_get_ur_golomb_jpegls
	movl	%eax, (%rbx)
	cmpl	$2, %eax
	jl	LBB0_8
## %bb.7:
	incl	%eax
	cltq
	addq	%rax, 8(%rbx)
	jmp	LBB0_12
LBB0_9:
	incl	16(%rbx)
	xorl	%r14d, %r14d
	jmp	LBB0_12
LBB0_8:
	addq	$-3, 8(%rbx)
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_MIN,4,2                    ## @INT_MIN
	.comm	_INT_MAX,4,2                    ## @INT_MAX
	.no_dead_strip	_loco_get_rice
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function loco_get_rice
_loco_get_rice:                         ; @loco_get_rice
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	w8, [x0]
	subs	w8, w8, #1
	b.lt	LBB0_3
; %bb.1:
	str	w8, [x19]
	mov	x0, x19
	mov	w1, #0
	bl	_loco_update_rice_param
	mov	w0, #0
LBB0_2:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_3:
	add	x20, x19, #24
	mov	x0, x20
	bl	_get_bits_left
	cmp	w0, #0
	b.le	LBB0_7
; %bb.4:
	mov	x0, x19
	bl	_loco_get_rice_param
	mov	x1, x0
Lloh0:
	adrp	x22, _INT_MAX@GOTPAGE
Lloh1:
	ldr	x22, [x22, _INT_MAX@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x20
	mov	w3, #0
	bl	_get_ur_golomb_jpegls
	mov	x21, x0
	add	w8, w21, #1
	asr	w1, w8, #1
	mov	x0, x19
	bl	_loco_update_rice_param
	cbz	w21, LBB0_8
; %bb.5:
	ldp	w8, w9, [x19, #16]
	add	w9, w9, w21, asr #1
	and	w10, w21, #0x1
	neg	w10, w10
	eor	w0, w9, w10
	cmp	w8, #1
	b.lt	LBB0_2
; %bb.6:
	cmp	w8, #2
	mov	x9, #-3
	csel	x8, x8, x9, hi
	ldr	x9, [x19, #8]
	add	x8, x9, x8
	str	x8, [x19, #8]
	str	wzr, [x19, #16]
	b	LBB0_2
LBB0_7:
Lloh2:
	adrp	x8, _INT_MIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _INT_MIN@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	b	LBB0_2
LBB0_8:
	ldr	x8, [x19, #8]
	tbnz	x8, #63, LBB0_11
; %bb.9:
	ldr	w2, [x22]
	mov	x0, x20
	mov	w1, #2
	mov	w3, #0
	bl	_get_ur_golomb_jpegls
	mov	x8, x0
	str	w8, [x19]
	cmp	w8, #2
	b.lt	LBB0_12
; %bb.10:
	mov	w0, #0
	add	w8, w8, #1
	ldr	x9, [x19, #8]
	add	x8, x9, w8, sxtw
	str	x8, [x19, #8]
	b	LBB0_2
LBB0_11:
	mov	w0, #0
	ldr	w8, [x19, #16]
	add	w8, w8, #1
	str	w8, [x19, #16]
	b	LBB0_2
LBB0_12:
	mov	w0, #0
	ldr	x8, [x19, #8]
	sub	x8, x8, #3
	str	x8, [x19, #8]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_MIN,4,2                    ; @INT_MIN
	.comm	_INT_MAX,4,2                    ; @INT_MAX
	.no_dead_strip	_loco_get_rice
.subsections_via_symbols
