	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function Rescale
_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	8(%rdi), %rdi
	callq	_STATS
	movq	%rax, %rbx
	movq	16(%r14), %rdx
	movl	(%rdx), %ecx
	cmpq	%rax, %rdx
	je	LBB0_2
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	-4(%rdx), %esi
	movl	%esi, (%rdx)
	leaq	-4(%rdx), %rsi
	movq	%rsi, %rdx
	cmpq	%rax, %rsi
	jne	LBB0_1
LBB0_2:
	movl	%ecx, (%rbx)
	movq	8(%r14), %rsi
	movl	(%rsi), %edx
	subl	%ecx, %edx
	xorl	%r8d, %r8d
	cmpq	$0, (%r14)
	setne	%r8b
	addl	%r8d, %ecx
	addl	$4, %ecx
	shrl	%ecx
	movl	%ecx, (%rbx)
	movl	4(%rsi), %r11d
	decl	%r11d
	addq	$4, %rax
	xorl	%edi, %edi
	movq	%rbx, %r10
	movl	%ecx, %r12d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rcx
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	%esi, (%rcx)
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	%r15d, %edx
	subl	%r9d, %edx
	addl	%esi, %r12d
	addq	$4, %rdi
	movl	(%r10), %ecx
	decl	%r11d
	je	LBB0_11
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	movl	%edx, %r15d
	movl	4(%r10), %r9d
	leal	(%r9,%r8), %esi
	shrl	%esi
	movl	%esi, 4(%r10)
	addq	$4, %r10
	cmpl	%ecx, %esi
	jle	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rdi, %rdx
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rbx,%rdx), %ecx
	movl	%ecx, 4(%rbx,%rdx)
	testq	%rdx, %rdx
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=2
	leaq	-4(%rdx), %rcx
	cmpl	-8(%rax,%rdx), %esi
	movq	%rcx, %rdx
	jg	LBB0_5
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	addq	%rax, %rcx
	jmp	LBB0_9
LBB0_11:
	testl	%ecx, %ecx
	jne	LBB0_21
## %bb.12:
	movq	8(%r14), %rcx
	movl	4(%rcx), %edi
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$0, -4(%r10,%rax,4)
	leaq	-1(%rax), %rax
	je	LBB0_13
## %bb.14:
	subl	%r9d, %r15d
	subq	%rax, %r15
	movl	$1, %edx
	subl	%edi, %edx
	leal	(%rdi,%rax), %esi
	movl	%esi, 4(%rcx)
	cmpl	%eax, %edx
	jne	LBB0_18
## %bb.15:
	movl	(%rbx), %r12d
	movl	%r15d, %eax
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movl	%r12d, %ecx
	sarl	%ecx
	subl	%ecx, %r12d
	shrl	%eax
	cmpl	$3, %r15d
	movl	%eax, %r15d
	ja	LBB0_16
## %bb.17:
	incl	%edi
	shrl	%edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_U2I
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_InsertNode
	movq	8(%r14), %rdi
	callq	_ONE_STATE
	movq	%rax, 16(%r14)
	movl	%r12d, (%rax)
	jmp	LBB0_22
LBB0_18:
	leal	1(%rdi), %edx
	shrl	%edx
	leal	(%rdi,%rax), %ecx
	incl	%ecx
	sarl	%ecx
	cmpl	%ecx, %edx
	je	LBB0_20
## %bb.19:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_ShrinkUnits
	movl	%eax, %edi
	callq	_STATS_REF
	movq	8(%r14), %rcx
	movl	%eax, 8(%rcx)
LBB0_20:
	movl	%r15d, %edx
LBB0_21:
	addl	%edx, %r12d
	shrl	%edx
	subl	%edx, %r12d
	movq	8(%r14), %rdi
	movl	%r12d, (%rdi)
	callq	_STATS
	movq	%rax, 16(%r14)
LBB0_22:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.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	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
	ldr	x0, [x0, #8]
	bl	_STATS
	mov	x20, x0
	ldr	x8, [x19, #16]
	ldr	w10, [x8]
	cmp	x8, x0
	b.eq	LBB0_3
; %bb.1:
	mov	x9, x8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x9, #-4]!
	str	w11, [x8]
	mov	x8, x9
	cmp	x9, x20
	b.ne	LBB0_2
LBB0_3:
	mov	x9, #0
	str	w10, [x20]
	ldp	x11, x8, [x19]
	ldp	w12, w13, [x8]
	sub	w8, w12, w10
	cmp	x11, #0
	cinc	w10, w10, ne
	cset	w11, ne
	add	w10, w10, #4
	lsr	w15, w10, #1
	mov	x12, x20
	str	w15, [x12], #4
	sub	w13, w13, #1
	mov	x10, x20
	mov	x21, x15
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x15, x20
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	str	w14, [x15]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w21, w14, w21
	ldr	w15, [x10]
	add	x9, x9, #4
	subs	w13, w13, #1
	b.eq	LBB0_12
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	ldr	w14, [x10, #4]!
	sub	w8, w8, w14
	add	w14, w14, w11
	lsr	w14, w14, #1
	str	w14, [x10]
	cmp	w14, w15
	b.le	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x15, x9
LBB0_9:                                 ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w16, [x20, x15]
	str	w16, [x12, x15]
	cbz	x15, LBB0_4
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x16, x12, x15
	ldur	w16, [x16, #-8]
	sub	x15, x15, #4
	cmp	w14, w16
	b.gt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x15, x12, x15
	b	LBB0_5
LBB0_12:
	cbnz	w15, LBB0_19
; %bb.13:
	mov	x11, #0
	ldr	x12, [x19, #8]
	ldr	w9, [x12, #4]
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	add	x13, x10, x11, lsl #2
	ldur	w13, [x13, #-4]
	sub	x11, x11, #1
	cbz	w13, LBB0_14
; %bb.15:
	sub	x22, x8, x11
	add	w8, w9, w11
	add	w10, w9, w11
	str	w8, [x12, #4]
	cmp	w10, #1
	b.eq	LBB0_21
; %bb.16:
	add	w8, w9, #1
	lsr	w2, w8, #1
	add	w8, w9, w11
	add	w8, w8, #1
	asr	w3, w8, #1
	cmp	w2, w3
	b.eq	LBB0_18
; %bb.17:
	mov	x0, x19
	mov	x1, x20
	bl	_ShrinkUnits
	bl	_STATS_REF
	ldr	x8, [x19, #8]
	str	w0, [x8, #8]
LBB0_18:
	mov	x8, x22
LBB0_19:
	add	w9, w8, w21
	sub	w8, w9, w8, lsr #1
	ldr	x0, [x19, #8]
	str	w8, [x0]
	bl	_STATS
	str	x0, [x19, #16]
LBB0_20:
	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
LBB0_21:
	ldr	w21, [x20]
LBB0_22:                                ; =>This Inner Loop Header: Depth=1
	sub	w21, w21, w21, asr #1
	lsr	w8, w22, #1
	cmp	w22, #3
	mov	x22, x8
	b.hi	LBB0_22
; %bb.23:
	add	w8, w9, #1
	lsr	w0, w8, #1
	bl	_U2I
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_InsertNode
	ldr	x0, [x19, #8]
	bl	_ONE_STATE
	str	x0, [x19, #16]
	str	w21, [x0]
	b	LBB0_20
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_Rescale
.subsections_via_symbols
