	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cbs_av1_write_obu
_cbs_av1_write_obu:                     ## @cbs_av1_write_obu
	.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, %r13
	movq	%rsi, %r15
	movq	(%rdi), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	8(%rsi), %rax
	leaq	72(%rax), %rbx
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$1, 72(%rax)
	movq	%rdi, %r14
	movq	%rdx, %rsi
	movq	%rbx, %rdx
	callq	_cbs_av1_write_obu_header
	testl	%eax, %eax
	js	LBB0_39
## %bb.1:
	cmpl	$0, (%rbx)
	je	LBB0_4
## %bb.2:
	movl	(%r13), %eax
	movl	%eax, -92(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_put_bits32
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_put_bits32
	jmp	LBB0_5
LBB0_4:
                                        ## implicit-def: $eax
                                        ## kill: killed $eax
LBB0_5:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%r13, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	movl	76(%rbx), %esi
	leal	-128(%rsi), %ecx
	cmpl	$8, %ecx
	ja	LBB0_9
## %bb.6:
	leaq	LJTI0_0(%rip), %rdx
	movslq	(%rdx,%rcx,4), %rcx
	addq	%rdx, %rcx
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	jmpq	*%rcx
LBB0_7:
	leaq	64(%rbx), %rdx
	xorl	%ecx, %ecx
	cmpl	$132, %esi
	sete	%cl
	movq	%r14, %rdi
	movq	%r13, %rsi
	xorl	%r8d, %r8d
	callq	_cbs_av1_write_frame_header_obu
	testl	%eax, %eax
	jns	LBB0_22
	jmp	LBB0_39
LBB0_9:
	movq	_ENOSYS@GOTPCREL(%rip), %rax
	jmp	LBB0_31
LBB0_10:
	leaq	16(%rbx), %r15
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	_cbs_av1_write_tile_list_obu
	testl	%eax, %eax
	jns	LBB0_27
	jmp	LBB0_39
LBB0_12:
	leaq	48(%rbx), %r15
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	_cbs_av1_write_tile_group_obu
	testl	%eax, %eax
	jns	LBB0_27
	jmp	LBB0_39
LBB0_14:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_cbs_av1_write_temporal_delimiter_obu
	testl	%eax, %eax
	jns	LBB0_22
	jmp	LBB0_39
LBB0_16:
	addq	$68, %rbx
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_cbs_av1_write_sequence_header_obu
	testl	%eax, %eax
	js	LBB0_39
## %bb.17:
	movq	%rbx, %r12
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	leaq	16(%rbx), %rdi
	callq	_av_buffer_unref
	movq	$0, 8(%rbx)
	movl	(%r15), %edi
	callq	_av_buffer_ref
	movl	%eax, 16(%rbx)
	testl	%eax, %eax
	je	LBB0_41
## %bb.18:
	movq	%r12, 8(%rbx)
	jmp	LBB0_22
LBB0_19:
	leaq	8(%rbx), %rdx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_cbs_av1_write_padding_obu
	testl	%eax, %eax
	jns	LBB0_22
	jmp	LBB0_39
LBB0_21:
	leaq	12(%rbx), %rdx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_cbs_av1_write_metadata_obu
	testl	%eax, %eax
	js	LBB0_39
LBB0_22:
	movq	%r13, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, %edx
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	subl	%ebx, %edx
	addl	$14, %edx
	xorl	%ecx, %ecx
	cmpl	$15, %edx
	jae	LBB0_24
## %bb.23:
	movb	$1, %al
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r14, %r12
	xorl	%eax, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_28
LBB0_24:
	leal	7(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	andl	$-8, %edx
	subl	%eax, %edx
	addl	$8, %edx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_cbs_av1_write_trailing_bits
	testl	%eax, %eax
	js	LBB0_39
## %bb.25:
	movb	$1, %al
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r14, %r12
	movq	%r13, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	subl	%ebx, %eax
	leal	7(%rax), %ecx
	addl	$14, %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	movslq	%eax, %rcx
	xorl	%eax, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_28
LBB0_26:
	leaq	32(%rbx), %r15
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	xorl	%ecx, %ecx
	callq	_cbs_av1_write_frame_obu
	testl	%eax, %eax
	js	LBB0_39
LBB0_27:
	movq	%r14, %r12
	movq	%r13, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	subl	%ebx, %eax
	leal	7(%rax), %ecx
	addl	$14, %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	movslq	%eax, %rdx
	movq	%r15, %rax
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	(%r15), %rcx
	movq	%rdx, %rax
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	addq	%rdx, %rcx
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_28:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%rcx, (%r14)
	movq	%r13, %rdi
	callq	_put_bits_count
	xorl	%edi, %edi
	testb	$7, %al
	sete	%dil
	callq	_av_assert0
	movq	%r13, %rdi
	callq	_flush_put_bits
	leal	7(%rbx), %r15d
	testl	%ebx, %ebx
	cmovnsl	%ebx, %r15d
	movl	-92(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%r13)
	movq	(%r14), %rcx
	leaq	L_.str(%rip), %rdx
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_cbs_av1_write_leb128
	testl	%eax, %eax
	js	LBB0_39
## %bb.29:
	movq	%r14, %rbx
	sarl	$3, %r15d
	movq	%r13, %rdi
	callq	_put_bits_count
                                        ## kill: def $eax killed $eax def $rax
	leal	7(%rax), %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	sarl	$3, %r14d
	movq	%r13, %rdi
	callq	_flush_put_bits
	xorl	%edi, %edi
	cmpl	%r15d, %r14d
	setle	%dil
	callq	_av_assert0
	movq	%rbx, %r12
	movq	(%rbx), %rbx
	shlq	$3, %rbx
	movq	%r13, %rdi
	callq	_put_bits_left
	cltq
	cmpq	%rax, %rbx
	jbe	LBB0_33
## %bb.30:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
LBB0_31:
	movl	(%rax), %edi
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_39:
	movl	%eax, %r12d
LBB0_40:
	movl	%r12d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_33:
	movq	%r12, %rax
	xorl	%r12d, %r12d
	cmpq	$0, (%rax)
	je	LBB0_40
## %bb.34:
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movslq	%r14d, %r14
	leaq	(%rax,%r14), %rdi
	movslq	%r15d, %rsi
	addq	%rax, %rsi
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_memmove
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_skip_put_bytes
	cmpb	$0, -44(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_40
## %bb.35:
	addq	%r14, %rbx
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	addq	(%rax), %rbx
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movl	8(%r14), %esi
	movq	(%r14), %rdx
	movq	%rbx, %rdi
	callq	_memcpy
	movq	(%r14), %rsi
	movq	%r13, %rdi
	callq	_skip_put_bytes
	jmp	LBB0_40
LBB0_41:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_31
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_14, LBB0_14-LJTI0_0
.set L0_0_set_16, LBB0_16-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_19, LBB0_19-LJTI0_0
.set L0_0_set_21, LBB0_21-LJTI0_0
.set L0_0_set_26, LBB0_26-LJTI0_0
LJTI0_0:
	.long	L0_0_set_10
	.long	L0_0_set_12
	.long	L0_0_set_14
	.long	L0_0_set_16
	.long	L0_0_set_7
	.long	L0_0_set_19
	.long	L0_0_set_21
	.long	L0_0_set_7
	.long	L0_0_set_26
	.end_data_region
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ENOSYS,4,2                     ## @ENOSYS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"obu_size"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.no_dead_strip	_cbs_av1_write_obu
.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_obu
_cbs_av1_write_obu:                     ; @cbs_av1_write_obu
	.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	x19, x2
	mov	x22, x1
	mov	x20, x0
	ldr	x24, [x0]
	ldr	x25, [x1, #8]
	mov	w8, #1
	mov	x21, x25
	str	w8, [x21, #72]!
	mov	x1, x2
	mov	x2, x21
	bl	_cbs_av1_write_obu_header
	tbnz	w0, #31, LBB0_30
; %bb.1:
	ldr	w8, [x21]
	cbz	w8, LBB0_3
; %bb.2:
	ldr	w26, [x19]
	mov	x0, x19
	mov	w1, #0
	bl	_put_bits32
	mov	x0, x19
	mov	w1, #0
	bl	_put_bits32
	b	LBB0_4
LBB0_3:
                                        ; implicit-def: $w26
LBB0_4:
	mov	x0, x19
	bl	_put_bits_count
	ldr	w8, [x25, #76]
	sub	w9, w8, #128
	cmp	w9, #8
	b.hi	LBB0_7
; %bb.5:
	mov	x21, x0
Lloh0:
	adrp	x10, lJTI0_0@PAGE
Lloh1:
	add	x10, x10, lJTI0_0@PAGEOFF
	adr	x11, LBB0_6
	ldrb	w12, [x10, x9]
	add	x11, x11, x12, lsl #2
	br	x11
LBB0_6:
	add	x2, x25, #64
	cmp	w8, #132
	cset	w3, eq
	mov	x0, x20
	mov	x1, x19
	mov	x4, #0
	bl	_cbs_av1_write_frame_header_obu
	tbz	w0, #31, LBB0_16
	b	LBB0_30
LBB0_7:
Lloh2:
	adrp	x8, _ENOSYS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOSYS@GOTPAGEOFF]
	b	LBB0_25
LBB0_8:
	add	x22, x25, #16
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	bl	_cbs_av1_write_tile_list_obu
	tbz	w0, #31, LBB0_21
	b	LBB0_30
LBB0_9:
	add	x22, x25, #48
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	bl	_cbs_av1_write_tile_group_obu
	tbz	w0, #31, LBB0_21
	b	LBB0_30
LBB0_10:
	mov	x0, x20
	mov	x1, x19
	bl	_cbs_av1_write_temporal_delimiter_obu
	tbz	w0, #31, LBB0_16
	b	LBB0_30
LBB0_11:
	add	x23, x25, #68
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_cbs_av1_write_sequence_header_obu
	tbnz	w0, #31, LBB0_30
; %bb.12:
	add	x0, x24, #16
	bl	_av_buffer_unref
	str	xzr, [x24, #8]
	ldr	w0, [x22]
	bl	_av_buffer_ref
	str	w0, [x24, #16]
	cbz	w0, LBB0_31
; %bb.13:
	str	x23, [x24, #8]
	b	LBB0_16
LBB0_14:
	add	x2, x25, #8
	mov	x0, x20
	mov	x1, x19
	bl	_cbs_av1_write_padding_obu
	tbz	w0, #31, LBB0_16
	b	LBB0_30
LBB0_15:
	add	x2, x25, #12
	mov	x0, x20
	mov	x1, x19
	bl	_cbs_av1_write_metadata_obu
	tbnz	w0, #31, LBB0_30
LBB0_16:
	mov	x0, x19
	bl	_put_bits_count
	sub	w8, w0, w21
	add	w8, w8, #14
	cmp	w8, #15
	b.hs	LBB0_18
; %bb.17:
	mov	x8, #0
	mov	x22, #0
	mov	x23, #0
	mov	w27, #1
	b	LBB0_22
LBB0_18:
	negs	w8, w0
	and	w8, w8, #0x7
	and	w9, w0, #0x7
	csneg	w8, w9, w8, mi
	mov	w9, #8
	sub	w2, w9, w8
	mov	x0, x20
	mov	x1, x19
	bl	_cbs_av1_write_trailing_bits
	tbnz	w0, #31, LBB0_30
; %bb.19:
	mov	x0, x19
	bl	_put_bits_count
	mov	x22, #0
	sub	w8, w0, w21
	add	w9, w8, #7
	add	w8, w8, #14
	cmp	w9, #0
	csel	w8, w8, w9, lt
	sbfx	x8, x8, #3, #29
	mov	w27, #1
	mov	x23, x8
	b	LBB0_22
LBB0_20:
	add	x22, x25, #32
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	mov	x3, #0
	bl	_cbs_av1_write_frame_obu
	tbnz	w0, #31, LBB0_30
LBB0_21:
	mov	x0, x19
	bl	_put_bits_count
	mov	w27, #0
	sub	w8, w0, w21
	add	w9, w8, #7
	add	w8, w8, #14
	cmp	w9, #0
	csel	w8, w8, w9, lt
	sbfx	x23, x8, #3, #29
	ldr	x8, [x22]
	add	x8, x8, x23
LBB0_22:
	str	x8, [x25]
	mov	x0, x19
	bl	_put_bits_count
	tst	w0, #0x7
	cset	w0, eq
	bl	_av_assert0
	mov	x0, x19
	bl	_flush_put_bits
	add	w8, w21, #7
	cmp	w21, #0
	csel	w21, w8, w21, lt
	str	w26, [x19]
	ldr	x3, [x25]
Lloh4:
	adrp	x2, l_.str@PAGE
Lloh5:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	x1, x19
	bl	_cbs_av1_write_leb128
	tbnz	w0, #31, LBB0_30
; %bb.23:
	asr	w20, w21, #3
	mov	x0, x19
	bl	_put_bits_count
	add	w8, w0, #7
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w21, w8, #3
	mov	x0, x19
	bl	_flush_put_bits
	cmp	w21, w20
	cset	w0, le
	bl	_av_assert0
	ldr	x26, [x25]
	mov	x0, x19
	bl	_put_bits_left
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	cmp	x8, x26, lsl #3
	b.hs	LBB0_26
; %bb.24:
Lloh6:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
LBB0_25:
	ldr	w0, [x8]
	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
	b	_AVERROR
LBB0_26:
	ldr	x8, [x25]
	cbz	x8, LBB0_29
; %bb.27:
	ldr	x8, [x24]
	sxtw	x21, w21
	add	x0, x8, x21
	add	x1, x8, w20, sxtw
	mov	x2, x23
	bl	_memmove
	mov	x0, x19
	mov	x1, x23
	bl	_skip_put_bytes
	tbnz	w27, #0, LBB0_29
; %bb.28:
	ldr	x8, [x24]
	add	x9, x23, x21
	add	x0, x9, x8
	ldr	w1, [x22, #8]
	ldr	x2, [x22]
	bl	_memcpy
	ldr	x1, [x22]
	mov	x0, x19
	bl	_skip_put_bytes
LBB0_29:
	mov	w0, #0
LBB0_30:
	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
LBB0_31:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_25
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_8-LBB0_6)>>2
	.byte	(LBB0_9-LBB0_6)>>2
	.byte	(LBB0_10-LBB0_6)>>2
	.byte	(LBB0_11-LBB0_6)>>2
	.byte	(LBB0_6-LBB0_6)>>2
	.byte	(LBB0_14-LBB0_6)>>2
	.byte	(LBB0_15-LBB0_6)>>2
	.byte	(LBB0_6-LBB0_6)>>2
	.byte	(LBB0_20-LBB0_6)>>2
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ENOSYS,4,2                     ; @ENOSYS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"obu_size"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.no_dead_strip	_cbs_av1_write_obu
.subsections_via_symbols
