	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wavpack_encode_sample
_wavpack_encode_sample:                 ## @wavpack_encode_sample
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rdi, %r15
	movq	24(%rdi), %rax
	movq	(%rax), %rdi
	cmpl	$1, (%rdi)
	jg	LBB0_8
## %bb.1:
	cmpl	$0, (%r15)
	jne	LBB0_8
## %bb.2:
	movq	8(%rax), %rax
	cmpl	$1, (%rax)
	jg	LBB0_8
## %bb.3:
	movl	4(%r15), %eax
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	testl	%r14d, %r14d
	je	LBB0_27
## %bb.5:
	movq	%r15, %rdi
	callq	_encode_flush
	jmp	LBB0_8
LBB0_6:
	testl	%r14d, %r14d
	je	LBB0_29
## %bb.7:
	leaq	32(%r15), %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_put_bits
LBB0_8:
	movl	%r14d, %r13d
	sarl	$31, %r13d
	xorl	%r14d, %r13d
	xorl	%edi, %edi
	callq	_GET_MED
	movl	%eax, %ebx
	xorl	%edi, %edi
	callq	_GET_MED
	movl	%eax, %r12d
	cmpl	%ebx, %r13d
	jge	LBB0_9
## %bb.18:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	xorl	%edi, %edi
	callq	_DEC_MED
	decl	%r12d
	cmpl	$0, (%r15)
	movl	$0, %ebx
	jne	LBB0_17
	jmp	LBB0_19
LBB0_9:
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	xorl	%edi, %edi
	callq	_INC_MED
	movl	%r13d, %r14d
	subl	%r12d, %r14d
	movl	$1, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$1, %edi
	callq	_GET_MED
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	$1, %edi
	callq	_GET_MED
	movl	%eax, %ebx
	addl	%r12d, %ebx
	cmpl	-48(%rbp), %r14d                ## 4-byte Folded Reload
	jge	LBB0_11
## %bb.10:
	movl	%r12d, %r14d
	movl	$1, %edi
	callq	_DEC_MED
	movl	%ebx, %r12d
	movl	%r14d, %ebx
	jmp	LBB0_14
LBB0_11:
	movl	$1, %edi
	callq	_INC_MED
	movl	%r13d, %r14d
	subl	%ebx, %r14d
	movl	$2, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$2, %edi
	callq	_GET_MED
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	$2, %edi
	callq	_GET_MED
	movl	%eax, %r12d
	cmpl	-48(%rbp), %r14d                ## 4-byte Folded Reload
	jge	LBB0_13
## %bb.12:
	addl	%ebx, %r12d
	movl	$2, %edi
	callq	_DEC_MED
	jmp	LBB0_14
LBB0_13:
	movl	%r14d, %eax
	cltd
	idivl	%r12d
	movl	%eax, %r12d
	leal	2(%r12), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$2, %edi
	callq	_GET_MED
	imull	%r12d, %eax
	addl	%eax, %ebx
	movl	$2, %edi
	callq	_GET_MED
	movl	%eax, %r12d
	addl	%ebx, %r12d
	movl	$2, %edi
	callq	_INC_MED
LBB0_14:
	decl	%r12d
	cmpl	$0, (%r15)
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	je	LBB0_19
## %bb.15:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	je	LBB0_16
## %bb.30:
	incl	8(%r15)
	movq	%r15, %rdi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	callq	_encode_flush
	movl	$1, (%r15)
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	decl	%eax
	jmp	LBB0_20
LBB0_19:
	movl	$1, (%r15)
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	jmp	LBB0_20
LBB0_16:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
LBB0_17:
	movq	%r15, %rdi
	callq	_encode_flush
	movl	$0, (%r15)
	xorl	%eax, %eax
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_20:
	shrl	$31, %r14d
	addl	%eax, %eax
	movl	%eax, 8(%r15)
	subl	%ebx, %r12d
	jne	LBB0_22
## %bb.21:
	movl	12(%r15), %r13d
	movl	16(%r15), %eax
	jmp	LBB0_25
LBB0_22:
	subl	%ebx, %r13d
	movl	%r12d, %edi
	callq	_count_bits
                                        ## kill: def $eax killed $eax def $rax
	movl	$1, %edx
	movl	%eax, %ecx
	shll	%cl, %edx
	notl	%r12d
	addl	%edx, %r12d
	cmpl	%r12d, %r13d
	jge	LBB0_24
## %bb.23:
	movl	16(%r15), %ecx
	shll	%cl, %r13d
	orl	12(%r15), %r13d
	addl	%ecx, %eax
	decl	%eax
	jmp	LBB0_25
LBB0_24:
	addl	%r13d, %r12d
	movl	%r12d, %edx
	sarl	%edx
	movl	16(%r15), %ecx
	shll	%cl, %edx
	orl	12(%r15), %edx
	andl	$1, %r12d
	addl	%ecx, %eax
	leal	-1(%rax), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %r12d
	orl	%edx, %r12d
	movl	%r12d, %r13d
LBB0_25:
	leal	1(%rax), %ecx
	movl	%ecx, 16(%r15)
	movl	%eax, %ecx
	shll	%cl, %r14d
	orl	%r13d, %r14d
	movl	%r14d, 12(%r15)
	cmpl	$0, (%r15)
	je	LBB0_26
LBB0_28:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_26:
	movq	%r15, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_encode_flush                   ## TAILCALL
LBB0_27:
	incl	%eax
	movl	%eax, 4(%r15)
	jmp	LBB0_28
LBB0_29:
	callq	_CLEAR
	movq	24(%r15), %rax
	movq	8(%rax), %rdi
	callq	_CLEAR
	movl	$1, 4(%r15)
	jmp	LBB0_28
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_wavpack_encode_sample
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wavpack_encode_sample
_wavpack_encode_sample:                 ; @wavpack_encode_sample
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x2
	mov	x19, x0
	ldr	x8, [x0, #24]
	ldr	x0, [x8]
	ldr	w9, [x0]
	cmp	w9, #1
	b.gt	LBB0_8
; %bb.1:
	ldr	w9, [x19]
	cbnz	w9, LBB0_8
; %bb.2:
	ldr	x8, [x8, #8]
	ldr	w8, [x8]
	cmp	w8, #1
	b.gt	LBB0_8
; %bb.3:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_6
; %bb.4:
	cbz	w20, LBB0_28
; %bb.5:
	mov	x0, x19
	bl	_encode_flush
	b	LBB0_8
LBB0_6:
	cbz	w20, LBB0_29
; %bb.7:
	add	x0, x19, #32
	mov	w1, #1
	mov	w2, #0
	bl	_put_bits
LBB0_8:
	eor	w23, w20, w20, asr #31
	mov	w0, #0
	bl	_GET_MED
	mov	x22, x0
	mov	w0, #0
	bl	_GET_MED
	mov	x21, x0
	cmp	w23, w22
	b.ge	LBB0_10
; %bb.9:
	mov	w0, #0
	bl	_DEC_MED
	mov	w24, #0
	mov	w22, #0
	sub	w21, w21, #1
	ldr	w8, [x19]
	cbnz	w8, LBB0_18
	b	LBB0_19
LBB0_10:
	mov	w0, #0
	bl	_INC_MED
	sub	w25, w23, w21
	mov	w0, #1
	bl	_GET_MED
	mov	x22, x0
	mov	w0, #1
	bl	_GET_MED
	add	w24, w0, w21
	cmp	w25, w22
	b.ge	LBB0_12
; %bb.11:
	mov	w22, #1
	mov	w0, #1
	bl	_DEC_MED
	mov	x25, x24
	mov	x24, x21
	b	LBB0_15
LBB0_12:
	mov	w0, #1
	bl	_INC_MED
	sub	w22, w23, w24
	mov	w0, #2
	bl	_GET_MED
	mov	x21, x0
	mov	w0, #2
	bl	_GET_MED
	cmp	w22, w21
	b.ge	LBB0_14
; %bb.13:
	add	w25, w0, w24
	mov	w22, #2
	mov	w0, #2
	bl	_DEC_MED
	b	LBB0_15
LBB0_14:
	sdiv	w21, w22, w0
	add	w22, w21, #2
	mov	w0, #2
	bl	_GET_MED
	madd	w24, w0, w21, w24
	mov	w0, #2
	bl	_GET_MED
	add	w25, w24, w0
	mov	w0, #2
	bl	_INC_MED
LBB0_15:
	sub	w21, w25, #1
	ldr	w8, [x19]
	cbz	w8, LBB0_19
; %bb.16:
	cbz	w22, LBB0_18
; %bb.17:
	ldr	w8, [x19, #8]
	add	w8, w8, #1
	str	w8, [x19, #8]
	mov	x0, x19
	bl	_encode_flush
	mov	w8, #1
	str	w8, [x19]
	sub	w22, w22, #1
	b	LBB0_20
LBB0_18:
	mov	x0, x19
	bl	_encode_flush
	mov	w22, #0
	str	wzr, [x19]
	b	LBB0_20
LBB0_19:
	mov	w8, #1
	str	w8, [x19]
LBB0_20:
	lsr	w25, w20, #31
	lsl	w8, w22, #1
	str	w8, [x19, #8]
	subs	w20, w21, w24
	b.ne	LBB0_22
; %bb.21:
	ldp	w9, w8, [x19, #12]
	b	LBB0_25
LBB0_22:
	sub	w21, w23, w24
	mov	x0, x20
	bl	_count_bits
	mov	w8, #1
	lsl	w8, w8, w0
	mvn	w9, w20
	add	w8, w8, w9
	cmp	w21, w8
	b.ge	LBB0_24
; %bb.23:
	ldp	w9, w8, [x19, #12]
	lsl	w10, w21, w8
	orr	w9, w9, w10
	add	w8, w0, w8
	sub	w8, w8, #1
	b	LBB0_25
LBB0_24:
	add	w9, w8, w21
	asr	w8, w9, #1
	ldp	w11, w10, [x19, #12]
	lsl	w8, w8, w10
	orr	w11, w11, w8
	add	w8, w10, w0
	sub	w10, w8, #1
	and	w9, w9, #0x1
	lsl	w9, w9, w10
	orr	w9, w11, w9
LBB0_25:
	add	w10, w8, #1
	lsl	w8, w25, w8
	orr	w8, w9, w8
	stp	w8, w10, [x19, #12]
	ldr	w8, [x19]
	cbz	w8, LBB0_27
LBB0_26:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_27:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_encode_flush
LBB0_28:
	add	w8, w8, #1
	b	LBB0_30
LBB0_29:
	bl	_CLEAR
	ldr	x8, [x19, #24]
	ldr	x0, [x8, #8]
	bl	_CLEAR
	mov	w8, #1
LBB0_30:
	str	w8, [x19, #4]
	b	LBB0_26
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_wavpack_encode_sample
.subsections_via_symbols
