	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function model_rescale_weights
_model_rescale_weights:                 ## @model_rescale_weights
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	_THRESH_ADAPTIVE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.2:
	movq	%r14, %rdi
	callq	_model_calc_threshold
	movl	%eax, 8(%r14)
	jmp	LBB0_3
LBB0_1:
	movl	8(%r14), %eax
LBB0_3:
	movq	16(%r14), %rcx
	movl	(%rcx), %esi
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	(%rcx), %esi
	movl	8(%r14), %eax
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
	cmpl	%eax, %esi
	jle	LBB0_5
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	24(%r14), %edx
	testl	%edx, %edx
	js	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	movq	32(%r14), %rax
	leaq	1(%rdx), %r8
	testq	%rdx, %rdx
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_4 Depth=1
	movq	%r8, %rsi
	andq	$-2, %rsi
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_13:                                ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%edi, (%rcx,%rdx,4)
	movl	(%rax,%rdx,4), %ebx
	incl	%ebx
	sarl	%ebx
	movl	%ebx, (%rax,%rdx,4)
	addl	%edi, %ebx
	movl	%ebx, -4(%rcx,%rdx,4)
	movl	-4(%rax,%rdx,4), %edi
	incl	%edi
	sarl	%edi
	movl	%edi, -4(%rax,%rdx,4)
	addl	%ebx, %edi
	addq	$-2, %rdx
	addq	$-2, %rsi
	jne	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	testb	$1, %r8b
	je	LBB0_8
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=1
	xorl	%edi, %edi
	testb	$1, %r8b
	je	LBB0_8
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	%edi, (%rcx,%rdx,4)
	movl	(%rax,%rdx,4), %esi
	incl	%esi
	sarl	%esi
	movl	%esi, (%rax,%rdx,4)
	jmp	LBB0_8
LBB0_5:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_THRESH_ADAPTIVE,8,3            ## @THRESH_ADAPTIVE
	.no_dead_strip	_model_rescale_weights
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function model_rescale_weights
_model_rescale_weights:                 ; @model_rescale_weights
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _THRESH_ADAPTIVE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _THRESH_ADAPTIVE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_model_calc_threshold
	str	w0, [x19, #8]
	b	LBB0_3
LBB0_2:
	ldr	w0, [x19, #8]
LBB0_3:
	ldr	x8, [x19, #16]
	ldr	w9, [x8]
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	cmp	w9, w0
	b.le	LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w11, [x19, #24]
	tbnz	w11, #31, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w9, #0
	ldr	x10, [x19, #32]
	lsl	x11, x11, #2
LBB0_7:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	str	w9, [x8, x11]
	ldr	w12, [x10, x11]
	add	w12, w12, #1
	asr	w12, w12, #1
	str	w12, [x10, x11]
	add	w9, w12, w9
	sub	x11, x11, #4
	cmn	x11, #4
	b.ne	LBB0_7
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w9, [x8]
	ldr	w0, [x19, #8]
	b	LBB0_4
LBB0_9:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_THRESH_ADAPTIVE,8,3            ; @THRESH_ADAPTIVE
	.no_dead_strip	_model_rescale_weights
.subsections_via_symbols
