	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cbs_av1_write_leb128
_cbs_av1_write_leb128:                  ## @cbs_av1_write_leb128
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	%ecx, -60(%rbp)                 ## 4-byte Spill
	movl	%ecx, %edi
	callq	_av_log2
	movl	%eax, %r14d
	cmpq	$0, (%rbx)
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	je	LBB0_1
## %bb.2:
	movq	%r15, %rdi
	callq	_put_bits_count
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	testl	%r14d, %r14d
	jns	LBB0_4
	jmp	LBB0_8
LBB0_1:
                                        ## implicit-def: $eax
                                        ## kill: killed $eax
	testl	%r14d, %r14d
	js	LBB0_8
LBB0_4:
	leal	7(%r14), %eax
	cltq
	imulq	$-1840700269, %rax, %rax        ## imm = 0x92492493
	shrq	$32, %rax
	addl	%r14d, %eax
	addl	$7, %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	sarl	$2, %eax
	addl	%ecx, %eax
	leal	-1(%rax), %r15d
	cmpl	$2, %eax
	movl	$1, %r12d
	cmovgel	%eax, %r12d
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1, -56(%rbp)
	movl	%ebx, -52(%rbp)
	movl	-60(%rbp), %eax                 ## 4-byte Reload
                                        ## kill: def $eax killed $eax def $rax
	movl	%r13d, %ecx
	sarl	%cl, %eax
	andl	$127, %eax
	leal	128(%rax), %r9d
	cmpl	%r15d, %ebx
	cmovgel	%eax, %r9d
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	movl	$8, %edx
	leaq	L_.str(%rip), %rcx
	leaq	-56(%rbp), %r8
	pushq	$255
	pushq	$0
	callq	_ff_cbs_write_unsigned
	addq	$16, %rsp
	testl	%eax, %eax
	js	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_6 Depth=1
	incl	%ebx
	addl	$7, %r13d
	cmpl	%ebx, %r12d
	jne	LBB0_6
LBB0_8:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	cmpq	$0, (%rdi)
	je	LBB0_9
## %bb.10:
	leaq	L_.str.1(%rip), %r8
	xorl	%r14d, %r14d
	movl	-64(%rbp), %esi                 ## 4-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	xorl	%ecx, %ecx
	movl	-60(%rbp), %r9d                 ## 4-byte Reload
	callq	_ff_cbs_trace_syntax_element
	jmp	LBB0_11
LBB0_7:
	movl	%eax, %r14d
	jmp	LBB0_11
LBB0_9:
	xorl	%r14d, %r14d
LBB0_11:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_13
## %bb.12:
	movl	%r14d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"leb128_byte[i]"

L_.str.1:                               ## @.str.1
	.space	1

	.no_dead_strip	_cbs_av1_write_leb128
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cbs_av1_write_leb128
_cbs_av1_write_leb128:                  ; @cbs_av1_write_leb128
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x19, x3
	mov	x20, x2
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	mov	x0, x3
	bl	_av_log2
	mov	x24, x0
	ldr	x8, [x21]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_put_bits_count
	str	w0, [sp, #12]                   ; 4-byte Folded Spill
	tbz	w24, #31, LBB0_3
	b	LBB0_6
LBB0_2:
                                        ; implicit-def: $w0
                                        ; kill: killed $w0
	tbnz	w24, #31, LBB0_6
LBB0_3:
	mov	w25, #0
	mov	w26, #0
	add	w8, w24, #7
	mov	w9, #9363
	movk	w9, #37449, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #2
	add	w8, w9, w8, lsr #31
	subs	w27, w8, #1
	csinc	w28, w8, wzr, gt
	mov	w23, #1
Lloh3:
	adrp	x24, l_.str@PAGE
Lloh4:
	add	x24, x24, l_.str@PAGEOFF
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	stp	w23, w26, [sp, #16]
	asr	w8, w19, w25
	and	w9, w8, #0x7f
	mov	w10, #128
	bfxil	w10, w8, #0, #7
	cmp	w26, w27
	csel	w5, w10, w9, lt
	add	x4, sp, #16
	mov	x0, x21
	mov	x1, x22
	mov	w2, #8
	mov	x3, x24
	mov	w6, #0
	mov	w7, #255
	bl	_ff_cbs_write_unsigned
	tbnz	w0, #31, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	w26, w26, #1
	add	w25, w25, #7
	cmp	w28, w26
	b.ne	LBB0_4
LBB0_6:
	ldr	x8, [x21]
	cbz	x8, LBB0_8
; %bb.7:
Lloh5:
	adrp	x4, l_.str.1@PAGE
Lloh6:
	add	x4, x4, l_.str.1@PAGEOFF
	mov	x0, x21
	ldr	w1, [sp, #12]                   ; 4-byte Folded Reload
	mov	x2, x20
	mov	x3, #0
	mov	x5, x19
	bl	_ff_cbs_trace_syntax_element
LBB0_8:
	mov	w0, #0
LBB0_9:
	ldr	x8, [sp, #24]
Lloh7:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh8:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_11:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"leb128_byte[i]"

l_.str.1:                               ; @.str.1
	.space	1

	.no_dead_strip	_cbs_av1_write_leb128
.subsections_via_symbols
