	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r14d
	movl	%edx, %r15d
	movl	(%rdi), %eax
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	cmpl	%r8d, %eax
	jne	LBB0_2
## %bb.1:
	cmpl	%r9d, 4(%rdi)
	je	LBB0_24
LBB0_2:
	movl	%r9d, -52(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_6
## %bb.3:
	testl	%r14d, %r14d
	jle	LBB0_10
## %bb.4:
	movl	%r15d, %ebx
	sarl	%ebx
	movl	%r14d, %r12d
	leal	-1(%r14), %r13d
	imull	%r15d, %r13d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	decq	%r12
	movq	_PREAMBLE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	leaq	(%rsi,%rax,4), %rax
	movslq	%r13d, %r13
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	cmpl	$0, 4(%rcx)
	setne	%cl
	movl	%r12d, %edx
	sarl	%cl, %edx
	leaq	(%rax,%r13,4), %rdi
	imull	%ebx, %edx
	movslq	%edx, %rcx
	leaq	(%rax,%rcx,4), %rsi
	movl	%r15d, %edx
	callq	_scaleup_rev
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	subl	%r15d, %r13d
	testq	%r12, %r12
	jne	LBB0_5
	jmp	LBB0_10
LBB0_6:
	cmpl	$0, 4(%rdi)
	je	LBB0_10
## %bb.7:
	testl	%r14d, %r14d
	jle	LBB0_10
## %bb.8:
	movl	%r14d, %r12d
	leal	-1(%r14), %ebx
	imull	%r15d, %ebx
	movq	_PREAMBLE_SIZE@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	decq	%r12
	movslq	(%r13), %rax
	leaq	(%rsi,%rax,4), %rax
	movslq	%ebx, %rbx
	leaq	(%rax,%rbx,4), %rdi
	movl	%r12d, %ecx
	sarl	%ecx
	imull	%r15d, %ecx
	movslq	%ecx, %rcx
	leaq	(%rax,%rcx,4), %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	subl	%r15d, %ebx
	testq	%r12, %r12
	jne	LBB0_9
LBB0_10:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	je	LBB0_15
## %bb.11:
	testl	%eax, %eax
	je	LBB0_15
## %bb.12:
	cmpl	$2, %r14d
	jl	LBB0_23
## %bb.13:
	shrl	%r14d
	movl	%r15d, %eax
	sarl	%eax
	addl	%r15d, %r15d
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movslq	%eax, %r13
	shlq	$2, %r13
	xorl	%ebx, %ebx
	movq	%rsi, %r12
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	_PREAMBLE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	leaq	(%rsi,%rax,4), %rcx
	leaq	(%r12,%rax,4), %rdi
	movslq	%ebx, %rbx
	leaq	(%rcx,%rbx,4), %rsi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_scaledown
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	addq	%r13, %r12
	addl	%r15d, %ebx
	decq	%r14
	jne	LBB0_14
	jmp	LBB0_23
LBB0_15:
	testl	%eax, %eax
	je	LBB0_19
## %bb.16:
	cmpl	$2, %r14d
	jl	LBB0_23
## %bb.17:
	shrl	%r14d
	leal	(%r15,%r15), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movslq	%r15d, %r13
	shlq	$2, %r13
	xorl	%ebx, %ebx
	movq	%rsi, %r12
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	_PREAMBLE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	leaq	(%rsi,%rax,4), %rcx
	leaq	(%r12,%rax,4), %rdi
	movslq	%ebx, %rbx
	leaq	(%rcx,%rbx,4), %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	addq	%r13, %r12
	addl	-48(%rbp), %ebx                 ## 4-byte Folded Reload
	decq	%r14
	jne	LBB0_18
	jmp	LBB0_23
LBB0_19:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_23
## %bb.20:
	testl	%r14d, %r14d
	jle	LBB0_23
## %bb.21:
	movslq	%r15d, %r12
	sarl	%r15d
	movl	%r14d, %ebx
	shlq	$2, %r12
	movq	_PREAMBLE_SIZE@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movslq	(%r14), %rax
	leaq	(%rsi,%rax,4), %rdi
	movq	%rsi, %r13
	movq	%rdi, %rsi
	movl	%r15d, %edx
	callq	_scaledown
	movq	%r13, %rsi
	addq	%r12, %rsi
	decq	%rbx
	jne	LBB0_22
LBB0_23:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 4(%rcx)
LBB0_24:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PREAMBLE_SIZE,4,2              ## @PREAMBLE_SIZE
	.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:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x22, x5
	mov	x20, x4
	mov	x24, x3
	mov	x23, x2
	mov	x19, x1
	mov	x21, x0
	ldr	w8, [x0]
	cmp	w8, w4
	b.ne	LBB0_2
; %bb.1:
	ldr	w9, [x21, #4]
	cmp	w9, w22
	b.eq	LBB0_23
LBB0_2:
	cbz	w8, LBB0_6
; %bb.3:
	subs	w8, w24, #1
	b.lt	LBB0_9
; %bb.4:
	asr	w25, w23, #1
	mul	w26, w23, w8
Lloh0:
	adrp	x27, _PREAMBLE_SIZE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _PREAMBLE_SIZE@GOTPAGEOFF]
	mov	w28, w24
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	sub	x28, x28, #1
	ldrsw	x8, [x27]
	add	x8, x19, x8, lsl #2
	add	x0, x8, w26, sxtw #2
	ldr	w9, [x21, #4]
	cmp	w9, #0
	cset	w9, ne
	asr	w9, w28, w9
	mul	w9, w9, w25
	add	x1, x8, w9, sxtw #2
	mov	x2, x23
	bl	_scaleup_rev
	sub	w26, w26, w23
	cbnz	x28, LBB0_5
	b	LBB0_9
LBB0_6:
	ldr	w8, [x21, #4]
	cmp	w8, #0
	ccmp	w24, #1, #8, ne
	b.lt	LBB0_9
; %bb.7:
	mov	w25, w24
	sub	w8, w24, #1
	mul	w26, w23, w8
Lloh2:
	adrp	x27, _PREAMBLE_SIZE@GOTPAGE
Lloh3:
	ldr	x27, [x27, _PREAMBLE_SIZE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	sub	x25, x25, #1
	ldrsw	x8, [x27]
	add	x8, x19, x8, lsl #2
	add	x0, x8, w26, sxtw #2
	asr	w9, w25, #1
	mul	w9, w9, w23
	add	x1, x8, w9, sxtw #2
	mov	x2, x23
	bl	_memcpy
	sub	w26, w26, w23
	cbnz	x25, LBB0_8
LBB0_9:
	str	w22, [sp, #12]                  ; 4-byte Folded Spill
	cbz	w20, LBB0_14
; %bb.10:
	cbz	w22, LBB0_14
; %bb.11:
	cmp	w24, #2
	b.lt	LBB0_22
; %bb.12:
	mov	w25, #0
	lsr	w26, w24, #1
	asr	w24, w23, #1
	lsl	w23, w23, #1
	sbfiz	x27, x24, #2, #32
Lloh4:
	adrp	x28, _PREAMBLE_SIZE@GOTPAGE
Lloh5:
	ldr	x28, [x28, _PREAMBLE_SIZE@GOTPAGEOFF]
	mov	x22, x19
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldrsw	x8, [x28]
	lsl	x8, x8, #2
	add	x9, x19, x8
	add	x0, x22, x8
	add	x1, x9, w25, sxtw #2
	mov	x2, x24
	bl	_scaledown
	add	x22, x22, x27
	add	w25, w25, w23
	subs	x26, x26, #1
	b.ne	LBB0_13
	b	LBB0_22
LBB0_14:
	cbz	w22, LBB0_18
; %bb.15:
	cmp	w24, #2
	b.lt	LBB0_22
; %bb.16:
	mov	w25, #0
	lsr	w24, w24, #1
	lsl	w26, w23, #1
Lloh6:
	adrp	x27, _PREAMBLE_SIZE@GOTPAGE
Lloh7:
	ldr	x27, [x27, _PREAMBLE_SIZE@GOTPAGEOFF]
	sbfiz	x28, x23, #2, #32
	mov	x22, x19
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldrsw	x8, [x27]
	lsl	x8, x8, #2
	add	x9, x19, x8
	add	x0, x22, x8
	add	x1, x9, w25, sxtw #2
	mov	x2, x23
	bl	_memcpy
	add	x22, x22, x28
	add	w25, w25, w26
	subs	x24, x24, #1
	b.ne	LBB0_17
	b	LBB0_22
LBB0_18:
	cbz	w20, LBB0_22
; %bb.19:
	cmp	w24, #1
	b.lt	LBB0_22
; %bb.20:
	asr	w25, w23, #1
	mov	w22, w24
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	sbfiz	x23, x23, #2, #32
Lloh8:
	adrp	x24, _PREAMBLE_SIZE@GOTPAGE
Lloh9:
	ldr	x24, [x24, _PREAMBLE_SIZE@GOTPAGEOFF]
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldrsw	x8, [x24]
	add	x0, x19, x8, lsl #2
	mov	x1, x0
	mov	x2, x25
	bl	_scaledown
	add	x19, x19, x23
	subs	x22, x22, #1
	b.ne	LBB0_21
LBB0_22:
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	stp	w20, w8, [x21]
LBB0_23:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PREAMBLE_SIZE,4,2              ; @PREAMBLE_SIZE
	.no_dead_strip	_rescale
.subsections_via_symbols
