	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_oggpack_write                  ## -- Begin function oggpack_write
	.p2align	4, 0x90
_oggpack_write:                         ## @oggpack_write
	.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, %r14
	cmpl	$32, %edx
	jbe	LBB0_1
LBB0_13:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_oggpack_writeclear             ## TAILCALL
LBB0_1:
	movl	%edx, %ebx
	movq	%rsi, %r15
	movl	(%r14), %edx
	movl	4(%r14), %eax
	leal	-4(%rax), %ecx
	movq	8(%r14), %rsi
	cmpl	%ecx, %edx
	jge	LBB0_2
LBB0_6:
	movq	_mask@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, %ecx
	andq	(%rax,%rcx,8), %r15
	movl	24(%r14), %eax
	addl	%eax, %ebx
	movq	%r15, %rdi
	movl	%eax, %ecx
	shlq	%cl, %rdi
	orq	%rdi, (%rsi)
	cmpl	$8, %ebx
	jl	LBB0_11
## %bb.7:
	movb	$8, %cl
	subb	%al, %cl
	movq	%r15, %rdi
	shrq	%cl, %rdi
	movzbl	%dil, %ecx
	movq	%rcx, 8(%rsi)
	cmpl	$16, %ebx
	jb	LBB0_11
## %bb.8:
	movb	$16, %cl
	subb	%al, %cl
	movq	%r15, %rdi
	shrq	%cl, %rdi
	movzbl	%dil, %ecx
	movq	%rcx, 16(%rsi)
	cmpl	$24, %ebx
	jb	LBB0_11
## %bb.9:
	movb	$24, %cl
	subb	%al, %cl
	movq	%r15, %rdi
	shrq	%cl, %rdi
	movzbl	%dil, %ecx
	movq	%rcx, 24(%rsi)
	cmpl	$32, %ebx
	jb	LBB0_11
## %bb.10:
	leal	32(%rax), %ecx
	negl	%ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shrq	%cl, %r15
	xorl	%ecx, %ecx
	testl	%eax, %eax
	movzbl	%r15b, %eax
	cmovneq	%rax, %rcx
	movq	%rcx, 32(%rsi)
LBB0_11:
	leal	7(%rbx), %eax
	testl	%ebx, %ebx
	cmovnsl	%ebx, %eax
	sarl	$3, %eax
	addl	%eax, %edx
	movl	%edx, (%r14)
	cltq
	leaq	(%rsi,%rax,8), %rax
	movq	%rax, 8(%r14)
	andl	$7, %ebx
	movl	%ebx, 24(%r14)
	jmp	LBB0_12
LBB0_2:
	testq	%rsi, %rsi
	je	LBB0_12
## %bb.3:
	movq	_LONG_MAX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_BUFFER_INCREMENT@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	subl	%esi, %ecx
	cmpl	%ecx, %eax
	jg	LBB0_13
## %bb.4:
	movq	16(%r14), %rdi
	addl	%eax, %esi
	callq	__ogg_realloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.5:
	movq	%rax, 16(%r14)
	movl	(%r12), %ecx
	addl	%ecx, 4(%r14)
	movslq	(%r14), %rdx
	leaq	(%rax,%rdx,8), %rsi
	movq	%rsi, 8(%r14)
	jmp	LBB0_6
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LONG_MAX,4,2                   ## @LONG_MAX
	.comm	_BUFFER_INCREMENT,4,2           ## @BUFFER_INCREMENT
	.comm	_mask,8,3                       ## @mask
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_oggpack_write                  ; -- Begin function oggpack_write
	.p2align	2
_oggpack_write:                         ; @oggpack_write
	.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
	cmp	w2, #32
	b.ls	LBB0_2
LBB0_1:
	mov	x0, x19
	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
	b	_oggpack_writeclear
LBB0_2:
	mov	x20, x2
	mov	x21, x1
	ldp	w8, w10, [x19]
	sub	w11, w10, #4
	ldr	x9, [x19, #8]
	cmp	w8, w11
	b.ge	LBB0_9
LBB0_3:
Lloh0:
	adrp	x10, _mask@GOTPAGE
Lloh1:
	ldr	x10, [x10, _mask@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
	ldr	x10, [x10, w20, uxtw #3]
	and	x12, x10, x21
	ldr	w11, [x19, #24]
	add	w10, w11, w20
	lsl	x13, x12, x11
	ldr	x14, [x9]
	orr	x13, x14, x13
	str	x13, [x9]
	cmp	w10, #8
	b.lt	LBB0_8
; %bb.4:
	mov	w13, #8
	sub	w13, w13, w11
	lsr	x13, x12, x13
	and	x13, x13, #0xff
	str	x13, [x9, #8]
	cmp	w10, #16
	b.lo	LBB0_8
; %bb.5:
	mov	w13, #16
	sub	w13, w13, w11
	lsr	x13, x12, x13
	and	x13, x13, #0xff
	str	x13, [x9, #16]
	cmp	w10, #24
	b.lo	LBB0_8
; %bb.6:
	mov	w13, #24
	sub	w13, w13, w11
	lsr	x13, x12, x13
	and	x13, x13, #0xff
	str	x13, [x9, #24]
	cmp	w10, #32
	b.lo	LBB0_8
; %bb.7:
	mov	w13, #32
	sub	w13, w13, w11
	lsr	x12, x12, x13
	and	x12, x12, #0xff
	cmp	w11, #0
	csel	x11, xzr, x12, eq
	str	x11, [x9, #32]
LBB0_8:
	add	w11, w10, #7
	cmp	w10, #0
	csel	w11, w11, w10, lt
	asr	w11, w11, #3
	add	w8, w8, w11
	str	w8, [x19]
	add	x8, x9, w11, sxtw #3
	str	x8, [x19, #8]
	and	w8, w10, #0x7
	str	w8, [x19, #24]
	b	LBB0_13
LBB0_9:
	cbz	x9, LBB0_13
; %bb.10:
Lloh3:
	adrp	x8, _LONG_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _LONG_MAX@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x8]
Lloh6:
	adrp	x22, _BUFFER_INCREMENT@GOTPAGE
Lloh7:
	ldr	x22, [x22, _BUFFER_INCREMENT@GOTPAGEOFF]
	ldr	w8, [x22]
	sub	w9, w9, w8
	cmp	w10, w9
	b.gt	LBB0_1
; %bb.11:
	ldr	x0, [x19, #16]
	add	w1, w8, w10
	bl	__ogg_realloc
	cbz	x0, LBB0_1
; %bb.12:
	ldr	w9, [x22]
	ldp	w8, w10, [x19]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	w9, w10, w9
	str	w9, [x19, #4]
	add	x9, x0, x8, lsl #3
	stp	x9, x0, [x19, #8]
	b	LBB0_3
LBB0_13:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_LONG_MAX,4,2                   ; @LONG_MAX
	.comm	_BUFFER_INCREMENT,4,2           ; @BUFFER_INCREMENT
	.comm	_mask,8,3                       ; @mask
.subsections_via_symbols
