	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function update_model4_to_5
_update_model4_to_5:                    ## @update_model4_to_5
	.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	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	pxor	%xmm0, %xmm0
	movdqu	%xmm0, -56(%rbp)
	movq	$0, -40(%rbp)
	movl	$5, -64(%rbp)
	movslq	4(%rdi), %rax
	testq	%rax, %rax
	jle	LBB0_1
## %bb.2:
	movq	8(%r15), %rdx
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rsi, (%rdx,%rcx,8)
	jge	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	16(%r15), %rbx
	addl	(%rbx,%rcx,4), %edi
	incq	%rcx
	cmpq	%rax, %rcx
	jl	LBB0_3
	jmp	LBB0_5
LBB0_1:
	xorl	%ecx, %ecx
	xorl	%edi, %edi
LBB0_5:
	addl	$50, %edi
	cmpl	%eax, %ecx
	jge	LBB0_17
## %bb.6:
	movl	%ecx, %ecx
	movq	16(%r15), %rdx
	movl	%ecx, %r9d
	notl	%r9d
	addl	%eax, %r9d
	cmpl	$3, %r9d
	jb	LBB0_16
## %bb.7:
	incq	%r9
	movq	%r9, %r8
	andq	$-4, %r8
	movd	%edi, %xmm0
	leaq	-4(%r8), %rsi
	movq	%rsi, %rdi
	shrq	$2, %rdi
	incq	%rdi
	movl	%edi, %r10d
	andl	$3, %r10d
	cmpq	$12, %rsi
	jae	LBB0_9
## %bb.8:
	pxor	%xmm1, %xmm1
	xorl	%esi, %esi
	jmp	LBB0_11
LBB0_9:
	andq	$-4, %rdi
	leaq	(%rdx,%rcx,4), %rbx
	addq	$56, %rbx
	pxor	%xmm1, %xmm1
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbx,%rsi,4), %xmm2         ## xmm2 = mem[0],zero
	paddd	%xmm0, %xmm2
	movq	-48(%rbx,%rsi,4), %xmm0         ## xmm0 = mem[0],zero
	paddd	%xmm1, %xmm0
	movq	-40(%rbx,%rsi,4), %xmm1         ## xmm1 = mem[0],zero
	movq	-32(%rbx,%rsi,4), %xmm3         ## xmm3 = mem[0],zero
	movq	-24(%rbx,%rsi,4), %xmm4         ## xmm4 = mem[0],zero
	paddd	%xmm1, %xmm4
	paddd	%xmm2, %xmm4
	movq	-16(%rbx,%rsi,4), %xmm2         ## xmm2 = mem[0],zero
	paddd	%xmm3, %xmm2
	paddd	%xmm0, %xmm2
	movq	-8(%rbx,%rsi,4), %xmm0          ## xmm0 = mem[0],zero
	paddd	%xmm4, %xmm0
	movq	(%rbx,%rsi,4), %xmm1            ## xmm1 = mem[0],zero
	paddd	%xmm2, %xmm1
	addq	$16, %rsi
	addq	$-4, %rdi
	jne	LBB0_10
LBB0_11:
	testq	%r10, %r10
	je	LBB0_14
## %bb.12:
	addq	%rcx, %rsi
	leaq	(%rdx,%rsi,4), %rsi
	addq	$8, %rsi
	shlq	$4, %r10
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	-8(%rsi,%rdi), %xmm2            ## xmm2 = mem[0],zero
	paddd	%xmm2, %xmm0
	movq	(%rsi,%rdi), %xmm2              ## xmm2 = mem[0],zero
	paddd	%xmm2, %xmm1
	addq	$16, %rdi
	cmpq	%rdi, %r10
	jne	LBB0_13
LBB0_14:
	paddd	%xmm1, %xmm0
	pshufd	$85, %xmm0, %xmm1               ## xmm1 = xmm0[1,1,1,1]
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edi
	cmpq	%r8, %r9
	je	LBB0_17
## %bb.15:
	addq	%r8, %rcx
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	addl	(%rdx,%rcx,4), %edi
	incq	%rcx
	cmpl	%ecx, %eax
	jg	LBB0_16
LBB0_17:
	incl	%eax
	movl	%eax, -60(%rbp)
	cmpl	$4097, %edi                     ## imm = 0x1001
	jl	LBB0_19
## %bb.18:
	leaq	-64(%rbp), %rdi
	leaq	-28(%rbp), %rsi
	callq	_rescale
LBB0_19:
	leaq	-64(%rbp), %r14
	movq	%r14, %rdi
	callq	_calc_sum5
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$32, %edx
	callq	_memcpy
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_update_model4_to_5
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function update_model4_to_5
_update_model4_to_5:                    ; @update_model4_to_5
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	stp	xzr, xzr, [sp, #24]
	str	xzr, [sp, #40]
	mov	w8, #5
	str	w8, [sp, #16]
	ldrsw	x8, [x0, #4]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x9, #0
	mov	w10, #0
	ldr	x11, [x19, #8]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x11, x9, lsl #3]
	cmp	x12, x1
	b.ge	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x12, [x19, #16]
	ldr	w12, [x12, x9, lsl #2]
	add	w10, w12, w10
	add	x9, x9, #1
	cmp	x9, x8
	b.lt	LBB0_2
	b	LBB0_5
LBB0_4:
	mov	w9, #0
	mov	w10, #0
LBB0_5:
	add	w11, w10, #50
	cmp	w9, w8
	b.ge	LBB0_12
; %bb.6:
	mov	w14, w9
	ldr	x9, [x19, #16]
	mvn	w10, w14
	add	w10, w8, w10
	cmp	w10, #7
	b.hs	LBB0_8
; %bb.7:
	mov	x10, x14
	b	LBB0_11
LBB0_8:
	add	x12, x10, #1
	and	x13, x12, #0x1fffffff8
	add	x10, x13, x14
	movi	d0, #0000000000000000
	mov.s	v0[0], w11
	add	x11, x9, x14, lsl #2
	add	x11, x11, #16
	movi.2d	v1, #0000000000000000
	mov	x14, x13
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldp	d4, d5, [x11, #-16]
	ldp	d6, d7, [x11], #32
	add.2s	v0, v4, v0
	add.2s	v1, v5, v1
	add.2s	v2, v6, v2
	add.2s	v3, v7, v3
	subs	x14, x14, #8
	b.ne	LBB0_9
; %bb.10:
	add.2s	v0, v1, v0
	add.2s	v0, v2, v0
	add.2s	v0, v3, v0
	addp.2s	v0, v0, v0
	fmov	w11, s0
	cmp	x12, x13
	b.eq	LBB0_12
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x9, x10, lsl #2]
	add	x13, x10, #1
	add	w11, w12, w11
	mov	x10, x13
	cmp	w8, w13
	b.gt	LBB0_11
LBB0_12:
	add	w8, w8, #1
	str	w8, [sp, #20]
	cmp	w11, #1, lsl #12                ; =4096
	b.le	LBB0_14
; %bb.13:
	add	x0, sp, #16
	add	x1, sp, #12
	bl	_rescale
LBB0_14:
	add	x0, sp, #16
	bl	_calc_sum5
	add	x1, sp, #16
	mov	x0, x19
	mov	w2, #32
	bl	_memcpy
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_update_model4_to_5
.subsections_via_symbols
