	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2                               ## -- Begin function calculate_scales
LCPI0_0:
	.long	0x3f800000                      ## float 1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_calculate_scales:                      ## @calculate_scales
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	(%rdi), %eax
	testl	%eax, %eax
	jle	LBB0_17
## %bb.1:
	movl	%esi, %r14d
	movq	%rdi, %r12
	xorps	%xmm0, %xmm0
	movss	%xmm0, -36(%rbp)                ## 4-byte Spill
	xorl	%ebx, %ebx
	movq	_INPUT_ON@GOTPCREL(%rip), %r15
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rcx
	movl	(%r15), %edx
	testl	%edx, (%rcx,%rbx,4)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	48(%r12), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_FFABS
	movss	-36(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	movss	%xmm1, -36(%rbp)                ## 4-byte Spill
	movl	(%r12), %eax
	jmp	LBB0_4
LBB0_5:
	testl	%eax, %eax
	jle	LBB0_17
## %bb.6:
	xorps	%xmm0, %xmm0
	cvtsi2ss	%r14d, %xmm0
	movss	%xmm0, -44(%rbp)                ## 4-byte Spill
	xorl	%ebx, %ebx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	incq	%rbx
	movslq	(%r12), %rax
	cmpq	%rax, %rbx
	jge	LBB0_11
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rax
	movl	(%r15), %ecx
	testl	%ecx, (%rax,%rbx,4)
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	16(%r12), %rax
	movq	48(%r12), %rcx
	movss	(%rax,%rbx,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, -40(%rbp)                ## 4-byte Spill
	movl	(%rcx,%rbx,4), %edi
	callq	_FFABS
	movss	-36(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	movss	-40(%rbp), %xmm0                ## 4-byte Reload
                                        ## xmm0 = mem[0],zero,zero,zero
	ucomiss	%xmm1, %xmm0
	jbe	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ssl	24(%r12), %xmm0
	movss	%xmm0, -40(%rbp)                ## 4-byte Spill
	movq	48(%r12), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_FFABS
	movss	-40(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	cvtsi2ssl	(%r12), %xmm0
	divss	%xmm0, %xmm1
	mulss	-44(%rbp), %xmm1                ## 4-byte Folded Reload
	movl	32(%r12), %eax
	imull	28(%r12), %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	divss	%xmm0, %xmm1
	movq	16(%r12), %rax
	movss	(%rax,%rbx,4), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	subss	%xmm1, %xmm0
	movss	%xmm0, (%rax,%rbx,4)
	cvttss2si	%xmm0, %r14d
	movq	48(%r12), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_FFABS
	movss	-36(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	divss	%xmm0, %xmm1
	movl	%r14d, %edi
	movaps	%xmm1, %xmm0
	callq	_FFMAX
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movq	16(%r12), %rax
	movss	%xmm0, (%rax,%rbx,4)
	jmp	LBB0_10
LBB0_11:
	testl	%eax, %eax
	jle	LBB0_17
## %bb.12:
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	40(%r12), %rcx
	movl	$0, (%rcx,%rbx,4)
LBB0_16:                                ##   in Loop: Header=BB0_13 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_17
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rcx
	movl	(%r15), %edx
	testl	%edx, (%rcx,%rbx,4)
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	16(%r12), %rax
	movq	48(%r12), %rcx
	movss	LCPI0_0(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	divss	(%rax,%rbx,4), %xmm0
	movss	%xmm0, -36(%rbp)                ## 4-byte Spill
	movl	(%rcx,%rbx,4), %edi
	callq	_FFSIGN
	mulss	-36(%rbp), %xmm0                ## 4-byte Folded Reload
	movq	40(%r12), %rax
	movss	%xmm0, (%rax,%rbx,4)
	movl	(%r12), %eax
	jmp	LBB0_16
LBB0_17:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INPUT_ON,4,2                   ## @INPUT_ON
	.no_dead_strip	_calculate_scales
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_scales
_calculate_scales:                      ; @calculate_scales
	.cfi_startproc
; %bb.0:
	stp	d11, d10, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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 b8, -72
	.cfi_offset b9, -80
	.cfi_offset b10, -88
	.cfi_offset b11, -96
	ldr	w8, [x0]
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	mov	x22, #0
	movi	d8, #0000000000000000
Lloh0:
	adrp	x21, _INPUT_ON@GOTPAGE
Lloh1:
	ldr	x21, [x21, _INPUT_ON@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	cmp	x22, w8, sxtw
	b.ge	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #8]
	ldr	w9, [x9, x22, lsl #2]
	ldr	w10, [x21]
	tst	w10, w9
	b.eq	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x19, #48]
	ldr	w0, [x8, x22, lsl #2]
	bl	_FFABS
	fadd	s8, s8, s0
	ldr	w8, [x19]
	b	LBB0_2
LBB0_5:
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.6:
	mov	x22, #0
	scvtf	s9, w20
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x22, x22, #1
	ldrsw	x8, [x19]
	cmp	x22, x8
	b.ge	LBB0_11
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	ldr	w8, [x8, x22, lsl #2]
	ldr	w9, [x21]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x19, #16]
	lsl	x23, x22, #2
	ldr	s10, [x8, x23]
	ldr	x8, [x19, #48]
	ldr	w0, [x8, x23]
	bl	_FFABS
	fdiv	s0, s8, s0
	fcmp	s10, s0
	b.le	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	s0, [x19, #24]
	scvtf	s10, s0
	ldr	x8, [x19, #48]
	ldr	w0, [x8, x23]
	bl	_FFABS
	fdiv	s0, s10, s0
	ldr	s1, [x19]
	scvtf	s1, s1
	fdiv	s0, s0, s1
	fmul	s0, s0, s9
	ldp	w8, w9, [x19, #28]
	mul	w8, w9, w8
	scvtf	s1, w8
	fdiv	s0, s0, s1
	ldr	x8, [x19, #16]
	ldr	s1, [x8, x23]
	fsub	s0, s1, s0
	str	s0, [x8, x23]
	fcvtzs	w20, s0
	ldr	x8, [x19, #48]
	ldr	w0, [x8, x23]
	bl	_FFABS
	fdiv	s0, s8, s0
	mov	x0, x20
	bl	_FFMAX
	scvtf	s0, w0
	ldr	x8, [x19, #16]
	str	s0, [x8, x23]
	b	LBB0_7
LBB0_11:
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.12:
	mov	x20, #0
	fmov	s8, #1.00000000
	b	LBB0_15
LBB0_13:                                ;   in Loop: Header=BB0_15 Depth=1
	ldr	x9, [x19, #40]
	str	wzr, [x9, x20, lsl #2]
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	add	x20, x20, #1
	cmp	x20, w8, sxtw
	b.ge	LBB0_17
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #8]
	ldr	w9, [x9, x20, lsl #2]
	ldr	w10, [x21]
	tst	w10, w9
	b.eq	LBB0_13
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x8, [x19, #16]
	lsl	x22, x20, #2
	ldr	s0, [x8, x22]
	fdiv	s9, s8, s0
	ldr	x8, [x19, #48]
	ldr	w0, [x8, x22]
	bl	_FFSIGN
	fmul	s0, s9, s0
	ldr	x8, [x19, #40]
	str	s0, [x8, x22]
	ldr	w8, [x19]
	b	LBB0_14
LBB0_17:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	ldp	d11, d10, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_INPUT_ON,4,2                   ; @INPUT_ON
	.no_dead_strip	_calculate_scales
.subsections_via_symbols
