	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function Rescale
LCPI0_0:
	.long	63                              ## 0x3f
	.long	63                              ## 0x3f
	.long	63                              ## 0x3f
	.long	63                              ## 0x3f
LCPI0_1:
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.long	8                               ## 0x8
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_Rescale:                               ## @Rescale
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	16(%rdi), %rdi
	callq	_STATS
	movq	%rax, %r13
	movq	24(%rbx), %rdx
	movq	(%rdx), %rcx
	cmpq	%rax, %rdx
	je	LBB0_2
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	-8(%rdx), %rsi
	movq	%rsi, (%rdx)
	leaq	-8(%rdx), %rsi
	movq	%rsi, %rdx
	cmpq	%rax, %rsi
	jne	LBB0_1
LBB0_2:
	movq	%rcx, (%r13)
	movq	16(%rbx), %rdx
	movl	(%rdx), %r12d
	subl	%ecx, %r12d
	xorl	%r8d, %r8d
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	cmpq	$0, (%rbx)
	setne	%r8b
	leal	(%rcx,%r8), %esi
	addl	$4, %esi
	shrl	%esi
	movl	%esi, (%r13)
	movl	4(%rdx), %edi
	addq	$8, %rax
	xorl	%r14d, %r14d
	movq	%r13, %rbx
	movl	%esi, %r15d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, %rdx
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	%ecx, (%rdx)
	movl	%esi, -4(%rax,%rbx)
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	%r9d, %r12d
	subl	%r10d, %r12d
	addl	%ecx, %r15d
	addq	$8, %r14
	movl	(%r11), %esi
	movq	%r11, %rbx
	decl	%edi
	je	LBB0_11
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	movl	%r12d, %r9d
	leaq	8(%rbx), %r11
	movl	8(%rbx), %r10d
	leal	(%r10,%r8), %ecx
	shrl	%ecx
	movl	%ecx, 8(%rbx)
	cmpl	%esi, %ecx
	jle	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	12(%rbx), %esi
	movq	%r14, %rdx
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%rdx, %rbx
	movq	(%r13,%rdx), %rdx
	movq	%rdx, 8(%r13,%rbx)
	testq	%rbx, %rbx
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=2
	leaq	-8(%rbx), %rdx
	cmpl	-16(%rax,%rbx), %ecx
	jg	LBB0_5
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	addq	%rax, %rdx
	jmp	LBB0_9
LBB0_11:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	16(%r14), %rdi
	testl	%esi, %esi
	je	LBB0_13
## %bb.12:
	movl	8(%rdi), %ecx
	jmp	LBB0_27
LBB0_13:
	movl	4(%rdi), %r8d
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$0, -8(%r11,%rax,8)
	leaq	-1(%rax), %rax
	je	LBB0_14
## %bb.15:
	subl	%r10d, %r9d
	movq	%r9, %r12
	subq	%rax, %r12
	leal	(%r8,%rax), %ecx
	movl	%ecx, 4(%rdi)
	movl	%r8d, %ecx
	addl	%eax, %ecx
	je	LBB0_16
## %bb.17:
	movl	%r8d, %edx
	addl	$2, %edx
	shrl	%edx
	leal	(%r8,%rax), %ecx
	addl	$2, %ecx
	shrl	%ecx
	cmpl	%ecx, %edx
	je	LBB0_19
## %bb.18:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_ShrinkUnits
	movl	%eax, %edi
	callq	_STATS_REF
	movq	16(%r14), %rdi
	movl	%eax, 12(%rdi)
LBB0_19:
	andb	$-9, 8(%rdi)
	callq	_STATS
	xorl	%ecx, %ecx
	cmpl	$64, 4(%rax)
	setge	%cl
	shll	$3, %ecx
	movq	16(%r14), %rdi
	orl	8(%rdi), %ecx
	movl	%ecx, 8(%rdi)
	movl	4(%rdi), %r8d
	leal	-1(%r8), %edx
	cmpl	$8, %edx
	jae	LBB0_21
## %bb.20:
	movq	%rax, %rdx
	jmp	LBB0_24
LBB0_16:
	movl	(%r13), %ecx
	movl	4(%r13), %r15d
	leal	(%r9,%rcx,2), %ecx
	notl	%eax
	addl	%ecx, %eax
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r12d
	movq	_MAX_FREQ@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	imulq	$1431655766, %rcx, %r12         ## imm = 0x55555556
	movq	%r12, %rcx
	shrq	$63, %rcx
	shrq	$32, %r12
	addl	%ecx, %r12d
	cmpl	%r12d, %eax
	cmovll	%eax, %r12d
	addl	$2, %r8d
	shrl	%r8d
	movl	%r8d, %edi
	callq	_U2I
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_InsertNode
	movq	16(%r14), %rdi
	movl	8(%rdi), %eax
	andl	$16, %eax
	xorl	%ecx, %ecx
	cmpl	$64, %r15d
	setge	%cl
	leal	(%rax,%rcx,8), %eax
	movl	%eax, 8(%rdi)
	callq	_ONE_STATE
	movq	%rax, 24(%r14)
	movl	%r12d, (%rax)
	movl	%r15d, 4(%rax)
	jmp	LBB0_28
LBB0_21:
	movl	%edx, %ebx
	incq	%rbx
	movl	%ebx, %edx
	andl	$7, %edx
	testq	%rdx, %rdx
	movl	$8, %esi
	cmovneq	%rdx, %rsi
	subq	%rsi, %rbx
	leaq	(%rax,%rbx,8), %rdx
	subl	%ebx, %r8d
	movd	%ecx, %xmm1
	pxor	%xmm0, %xmm0
	xorl	%ecx, %ecx
	movdqa	LCPI0_0(%rip), %xmm2            ## xmm2 = [63,63,63,63]
	movdqa	LCPI0_1(%rip), %xmm3            ## xmm3 = [8,8,8,8]
	.p2align	4, 0x90
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movups	12(%rax,%rcx,8), %xmm4
	movups	28(%rax,%rcx,8), %xmm5
	shufps	$136, %xmm5, %xmm4              ## xmm4 = xmm4[0,2],xmm5[0,2]
	movups	44(%rax,%rcx,8), %xmm5
	movups	60(%rax,%rcx,8), %xmm6
	shufps	$136, %xmm6, %xmm5              ## xmm5 = xmm5[0,2],xmm6[0,2]
	pcmpgtd	%xmm2, %xmm4
	pand	%xmm3, %xmm4
	por	%xmm4, %xmm1
	pcmpgtd	%xmm2, %xmm5
	pand	%xmm3, %xmm5
	por	%xmm5, %xmm0
	addq	$8, %rcx
	cmpq	%rcx, %rbx
	jne	LBB0_22
## %bb.23:
	por	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	por	%xmm0, %xmm1
	pshufd	$85, %xmm1, %xmm0               ## xmm0 = xmm1[1,1,1,1]
	por	%xmm1, %xmm0
	movd	%xmm0, %ecx
LBB0_24:
	movl	%r8d, %eax
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_25:                                ## =>This Inner Loop Header: Depth=1
	xorl	%ebx, %ebx
	cmpl	$64, 12(%rdx,%rsi,8)
	setge	%bl
	shll	$3, %ebx
	orl	%ebx, %ecx
	incq	%rsi
	cmpl	%esi, %eax
	jne	LBB0_25
## %bb.26:
	movl	%ecx, 8(%rdi)
LBB0_27:
	addl	%r12d, %r15d
	shrl	%r12d
	subl	%r12d, %r15d
	movl	%r15d, (%rdi)
	orl	$4, %ecx
	movl	%ecx, 8(%rdi)
	callq	_STATS
	movq	%rax, 24(%r14)
LBB0_28:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_FREQ,4,2                   ## @MAX_FREQ
	.comm	_PPMD8_RESTORE_METHOD_FREEZE,8,3 ## @PPMD8_RESTORE_METHOD_FREEZE
	.no_dead_strip	_Rescale
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function Rescale
_Rescale:                               ; @Rescale
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	ldr	x0, [x0, #16]
	bl	_STATS
	mov	x20, x0
	ldr	x8, [x19, #24]
	ldr	x9, [x8]
	cmp	x8, x0
	b.eq	LBB0_3
; %bb.1:
	mov	x10, x8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x10, #-8]!
	str	x11, [x8]
	mov	x8, x10
	cmp	x10, x20
	b.ne	LBB0_2
LBB0_3:
	mov	x10, #0
	str	x9, [x20]
	ldr	x8, [x19, #16]
	ldp	w12, w11, [x8]
	sub	w8, w12, w9
	ldr	x12, [x19]
	cmp	x12, #0
	cinc	w9, w9, ne
	cset	w12, ne
	add	w9, w9, #4
	lsr	w15, w9, #1
	str	w15, [x20]
	mov	x13, x20
	mov	x21, x15
	mov	x9, x20
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x13, x20
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	str	w14, [x13]
	str	w15, [x16, #4]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w21, w14, w21
	ldr	w15, [x9]
	sub	x10, x10, #8
	mov	x13, x9
	sub	w11, w11, #1
	cbz	w11, LBB0_12
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	ldr	w14, [x9, #8]!
	sub	w8, w8, w14
	add	w14, w14, w12
	lsr	w14, w14, #1
	str	w14, [x9]
	cmp	w14, w15
	b.le	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x17, #0
	ldr	w15, [x13, #12]
LBB0_9:                                 ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x16, x13, x17
	ldr	x0, [x16]
	str	x0, [x16, #8]
	cmp	x10, x17
	b.eq	LBB0_4
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	ldur	w0, [x16, #-8]
	sub	x17, x17, #8
	cmp	w14, w0
	b.gt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x13, x13, x17
	add	x13, x13, #8
	b	LBB0_5
LBB0_12:
	ldr	x0, [x19, #16]
	cbz	w15, LBB0_14
; %bb.13:
	ldr	w11, [x0, #8]
	b	LBB0_28
LBB0_14:
	mov	w11, #0
	ldr	w10, [x0, #4]
	mov	x12, #-8
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	add	w11, w11, #1
	ldr	w13, [x9, x12]
	sub	x12, x12, #8
	cbz	w13, LBB0_15
; %bb.16:
	add	w22, w8, w11
	subs	w9, w10, w11
	str	w9, [x0, #4]
	b.ne	LBB0_18
; %bb.17:
	ldp	w9, w21, [x20]
	cmp	w21, #63
	cset	w23, gt
	add	w8, w8, w9, lsl #1
	add	w8, w8, w11
	sub	w8, w8, #1
	udiv	w8, w8, w22
Lloh0:
	adrp	x9, _MAX_FREQ@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MAX_FREQ@GOTPAGEOFF]
Lloh2:
	ldrsw	x9, [x9]
	mov	w11, #21846
	movk	w11, #21845, lsl #16
	mul	x9, x9, x11
	lsr	x11, x9, #63
	lsr	x9, x9, #32
	add	w9, w9, w11
	cmp	w8, w9
	csel	w22, w8, w9, lt
	add	w8, w10, #2
	lsr	w0, w8, #1
	bl	_U2I
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_InsertNode
	ldr	x0, [x19, #16]
	ldr	w8, [x0, #8]
	and	w8, w8, #0x10
	bfi	w8, w23, #3, #1
	str	w8, [x0, #8]
	bl	_ONE_STATE
	str	x0, [x19, #24]
	stp	w22, w21, [x0]
	b	LBB0_29
LBB0_18:
	add	w8, w10, #2
	lsr	w2, w8, #1
	add	w8, w9, #2
	lsr	w3, w8, #1
	cmp	w2, w3
	b.eq	LBB0_20
; %bb.19:
	mov	x0, x19
	mov	x1, x20
	bl	_ShrinkUnits
	bl	_STATS_REF
	mov	x8, x0
	ldr	x0, [x19, #16]
	str	w8, [x0, #12]
LBB0_20:
	ldr	w8, [x0, #8]
	and	w8, w8, #0xfffffff7
	str	w8, [x0, #8]
	bl	_STATS
	mov	x8, x0
	ldr	w9, [x0, #4]
	cmp	w9, #63
	cset	w10, gt
	ldr	x0, [x19, #16]
	ldp	w9, w11, [x0, #4]
	orr	w11, w11, w10, lsl #3
	str	w11, [x0, #8]
	sub	w10, w9, #1
	cmp	w10, #16
	b.hs	LBB0_22
; %bb.21:
	mov	x10, x8
	b	LBB0_25
LBB0_22:
	add	x10, x10, #1
	ands	x12, x10, #0xf
	mov	w13, #16
	csel	x12, x13, x12, eq
	sub	x12, x10, x12
	sub	w9, w9, w12
	add	x10, x8, x12, lsl #3
	movi.2d	v0, #0000000000000000
	mov.s	v0[0], w11
	movi.2d	v1, #0000000000000000
	add	x8, x8, #76
	movi.4s	v2, #63
	movi.4s	v3, #8
	movi.2d	v4, #0000000000000000
	movi.2d	v5, #0000000000000000
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	sub	x11, x8, #64
	ld2.4s	{ v6, v7 }, [x11]
	sub	x11, x8, #32
	ld2.4s	{ v16, v17 }, [x11]
	mov	x11, x8
	ld2.4s	{ v18, v19 }, [x11], #32
	ld2.4s	{ v20, v21 }, [x11]
	cmgt.4s	v6, v6, v2
	cmgt.4s	v7, v16, v2
	cmgt.4s	v16, v18, v2
	cmgt.4s	v17, v20, v2
	and.16b	v6, v6, v3
	and.16b	v7, v7, v3
	and.16b	v16, v16, v3
	and.16b	v17, v17, v3
	orr.16b	v0, v6, v0
	orr.16b	v1, v7, v1
	orr.16b	v4, v16, v4
	orr.16b	v5, v17, v5
	add	x8, x8, #128
	subs	x12, x12, #16
	b.ne	LBB0_23
; %bb.24:
	orr.16b	v0, v1, v0
	orr.16b	v0, v4, v0
	orr.16b	v0, v5, v0
	ext.16b	v1, v0, v0, #8
	orr.8b	v0, v0, v1
	fmov	w8, s0
	mov.s	w11, v0[1]
	orr	w11, w8, w11
LBB0_25:
	add	x8, x10, #12
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8], #8
	cmp	w10, #63
	cset	w10, gt
	orr	w11, w11, w10, lsl #3
	subs	w9, w9, #1
	b.ne	LBB0_26
; %bb.27:
	str	w11, [x0, #8]
	mov	x8, x22
LBB0_28:
	add	w9, w8, w21
	sub	w8, w9, w8, lsr #1
	str	w8, [x0]
	orr	w8, w11, #0x4
	str	w8, [x0, #8]
	bl	_STATS
	str	x0, [x19, #24]
LBB0_29:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_FREQ,4,2                   ; @MAX_FREQ
	.comm	_PPMD8_RESTORE_METHOD_FREEZE,8,3 ; @PPMD8_RESTORE_METHOD_FREEZE
	.no_dead_strip	_Rescale
.subsections_via_symbols
