	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function calculate_visual_weight
LCPI0_0:
	.quad	0x4115800000000000              ## double 352256
LCPI0_1:
	.quad	0x3fe0000000000000              ## double 0.5
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_calculate_visual_weight:               ## @calculate_visual_weight
	.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	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	cmpl	$0, (%rdi)
	jle	LBB0_20
## %bb.1:
	movq	%rdi, %r15
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movslq	(%rax), %r12
	movl	%r12d, %ebx
	movl	4(%rax), %r13d
	movl	%ebx, %eax
	imull	%r13d, %eax
	shll	$2, %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %eax
	andl	$-8, %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	addq	$-8, %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%rax, %rcx
	shrq	$3, %rcx
	incq	%rcx
	movq	%rcx, %rax
	movq	%rcx, -144(%rbp)                ## 8-byte Spill
	andq	$-2, %rcx
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	xorl	%ecx, %ecx
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%rcx
	movslq	(%r15), %rax
	cmpq	%rax, %rcx
	jge	LBB0_20
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
                                        ##       Child Loop BB0_5 Depth 3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	xorl	%edx, %edx
	testq	%rcx, %rcx
	setne	%dl
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_3 Depth=2
	movq	_QROOT@GOTPCREL(%rip), %rax
	movsd	(%rax), %xmm0                   ## xmm0 = mem[0],zero
	movsd	%xmm0, -48(%rbp)                ## 8-byte Spill
	movl	%r14d, %edi
	callq	_sqrt
	movsd	LCPI0_0(%rip), %xmm1            ## xmm1 = mem[0],zero
	divsd	%xmm0, %xmm1
	movapd	%xmm1, %xmm0
	callq	_log2
	mulsd	-48(%rbp), %xmm0                ## 8-byte Folded Reload
	addsd	LCPI0_1(%rip), %xmm0
	cvttsd2si	%xmm0, %eax
	movq	-120(%rbp), %rcx                ## 8-byte Reload
	movq	-112(%rbp), %rdx                ## 8-byte Reload
	movl	%eax, 20(%rcx,%rdx,8)
	movq	-128(%rbp), %rdx                ## 8-byte Reload
	incq	%rdx
	cmpq	$4, %rdx
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	je	LBB0_19
LBB0_3:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_5 Depth 3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rax
	movq	(%rax,%rcx,8), %r15
	movq	%rdx, -128(%rbp)                ## 8-byte Spill
	leaq	(%rdx,%rdx,2), %r13
	movq	(%r15,%r13,8), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	callq	_memset
	movl	8(%r15,%r13,8), %eax
	movl	12(%r15,%r13,8), %ecx
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%eax, %edx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movq	%r15, -120(%rbp)                ## 8-byte Spill
	movq	%r13, -112(%rbp)                ## 8-byte Spill
	imull	16(%r15,%r13,8), %eax
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	sarl	%edx
	addl	%edx, %eax
	cltq
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	$4096, (%rcx,%rax,4)            ## imm = 0x1000
	movq	8(%r15), %rdi
	movl	20(%r15), %esi
	movl	16(%r15), %r9d
	movl	(%r15), %eax
	movl	%eax, (%rsp)
	movl	%r12d, %edx
	movl	%r13d, %ecx
	movl	%ebx, %r8d
	callq	_ff_spatial_idwt
	testl	%r13d, %r13d
	movq	-96(%rbp), %r10                 ## 8-byte Reload
	movq	-88(%rbp), %r11                 ## 8-byte Reload
	jle	LBB0_18
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	xorl	%eax, %eax
	movl	$12, %r9d
	xorl	%edx, %edx
	xorl	%r14d, %r14d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=3
	incq	%rdx
	addq	%r12, %r9
	addq	%r12, %rax
	cmpq	%r13, %rdx
	je	LBB0_18
LBB0_5:                                 ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_3 Depth=2
                                        ## =>    This Loop Header: Depth=3
                                        ##         Child Loop BB0_11 Depth 4
                                        ##         Child Loop BB0_16 Depth 4
	testl	%r12d, %r12d
	jle	LBB0_17
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=3
	movq	8(%r15), %r8
	cmpl	$8, %ebx
	jae	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=3
	xorl	%ecx, %ecx
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=3
	movd	%r14d, %xmm0
	testq	%r11, %r11
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=3
	leaq	(%r8,%r9,4), %rsi
	pxor	%xmm2, %xmm2
	movq	-136(%rbp), %rcx                ## 8-byte Reload
	xorl	%edi, %edi
	movdqa	%xmm0, %xmm3
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_3 Depth=2
                                        ##       Parent Loop BB0_5 Depth=3
                                        ## =>      This Inner Loop Header: Depth=4
	movdqu	-48(%rsi,%rdi,4), %xmm4
	movdqu	-32(%rsi,%rdi,4), %xmm5
	movdqu	-16(%rsi,%rdi,4), %xmm0
	movdqu	(%rsi,%rdi,4), %xmm1
	pslld	$4, %xmm4
	pslld	$4, %xmm5
	pmulld	%xmm4, %xmm4
	paddd	%xmm3, %xmm4
	pmulld	%xmm5, %xmm5
	paddd	%xmm2, %xmm5
	pslld	$4, %xmm0
	pslld	$4, %xmm1
	pmulld	%xmm0, %xmm0
	paddd	%xmm4, %xmm0
	pmulld	%xmm1, %xmm1
	paddd	%xmm5, %xmm1
	addq	$16, %rdi
	movdqa	%xmm0, %xmm3
	movdqa	%xmm1, %xmm2
	addq	$-2, %rcx
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=3
	testb	$1, -144(%rbp)                  ## 1-byte Folded Reload
	je	LBB0_14
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=3
	movq	%rdx, %rcx
	imulq	%r12, %rcx
	addq	%rcx, %rdi
	movdqu	(%r8,%rdi,4), %xmm2
	movdqu	16(%r8,%rdi,4), %xmm3
	pslld	$4, %xmm2
	pslld	$4, %xmm3
	pmulld	%xmm2, %xmm2
	paddd	%xmm2, %xmm0
	pmulld	%xmm3, %xmm3
	paddd	%xmm3, %xmm1
LBB0_14:                                ##   in Loop: Header=BB0_5 Depth=3
	paddd	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddd	%xmm0, %xmm1
	pshufd	$85, %xmm1, %xmm0               ## xmm0 = xmm1[1,1,1,1]
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	movq	%r10, %rcx
	cmpq	%rbx, %r10
	je	LBB0_17
LBB0_15:                                ##   in Loop: Header=BB0_5 Depth=3
	leaq	(%r8,%rax,4), %rsi
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_2 Depth=1
                                        ##     Parent Loop BB0_3 Depth=2
                                        ##       Parent Loop BB0_5 Depth=3
                                        ## =>      This Inner Loop Header: Depth=4
	movl	(%rsi,%rcx,4), %edi
	shll	$4, %edi
	imull	%edi, %edi
	addl	%edi, %r14d
	incq	%rcx
	cmpq	%rcx, %rbx
	jne	LBB0_16
	jmp	LBB0_17
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=3
	pxor	%xmm1, %xmm1
	xorl	%edi, %edi
	testb	$1, -144(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_13
	jmp	LBB0_14
LBB0_20:
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_QROOT,8,3                      ## @QROOT
	.no_dead_strip	_calculate_visual_weight
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_visual_weight
_calculate_visual_weight:               ; @calculate_visual_weight
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset b8, -104
	.cfi_offset b9, -112
	str	x1, [sp, #8]                    ; 8-byte Folded Spill
	ldr	w8, [x0]
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.1:
	mov	x20, x0
	mov	x25, #0
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldp	w21, w22, [x8]
                                        ; kill: def $w21 killed $w21 def $x21
	sxtw	x21, w21
	and	x23, x21, #0xffffffff
	mul	w8, w23, w22
	lsl	w8, w8, #2
	str	w8, [sp, #4]                    ; 4-byte Folded Spill
	and	x26, x23, #0xfffffff0
	fmov	d8, #0.50000000
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x25, x25, #1
	ldrsw	x8, [x20]
	cmp	x25, x8
	b.ge	LBB0_17
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
                                        ;       Child Loop BB0_9 Depth 3
                                        ;         Child Loop BB0_13 Depth 4
                                        ;         Child Loop BB0_16 Depth 4
	cmp	x25, #0
	cset	w28, ne
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=2
	mov	w0, #0
	mov	w24, #24
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=2
Lloh0:
	adrp	x8, _QROOT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _QROOT@GOTPAGEOFF]
Lloh2:
	ldr	d9, [x8]
	bl	_sqrt
	mov	x8, #140737488355328
	movk	x8, #16661, lsl #48
	fmov	d1, x8
	fdiv	d0, d1, d0
	bl	_log2
	fmadd	d0, d9, d0, d8
	fcvtzs	w8, d0
	madd	x9, x28, x24, x19
	str	w8, [x9, #20]
	add	x28, x28, #1
	cmp	x28, #4
	b.eq	LBB0_2
LBB0_6:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_9 Depth 3
                                        ;         Child Loop BB0_13 Depth 4
                                        ;         Child Loop BB0_16 Depth 4
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x8, [x8, #8]
	ldr	x19, [x8, x25, lsl #3]
	mov	w8, #24
	madd	x24, x28, x8, x19
	ldr	x27, [x24]
	ldr	x0, [x20, #8]
	mov	w1, #0
	ldr	w2, [sp, #4]                    ; 4-byte Folded Reload
	bl	_memset
	ldp	w8, w9, [x24, #8]
	cmp	w8, #0
	cinc	w8, w8, lt
	cmp	w9, #0
	cinc	w9, w9, lt
	asr	w9, w9, #1
	ldr	w10, [x24, #16]
	mul	w9, w9, w10
	add	w8, w9, w8, asr #1
	mov	w9, #4096
	str	w9, [x27, w8, sxtw #2]
	ldr	x0, [x20, #8]
	ldp	w5, w1, [x20, #16]
	ldr	w6, [x20]
	mov	x2, x21
	mov	x3, x22
	mov	x4, x23
	bl	_ff_spatial_idwt
	cmp	w22, #1
	b.lt	LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	mov	x8, #0
	mov	x9, #0
	mov	w0, #0
	mov	w10, #8
	mov	w24, #24
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=3
	add	x9, x9, #1
	add	x10, x10, x21
	add	x8, x8, x21
	cmp	x9, x22
	b.eq	LBB0_5
LBB0_9:                                 ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_6 Depth=2
                                        ; =>    This Loop Header: Depth=3
                                        ;         Child Loop BB0_13 Depth 4
                                        ;         Child Loop BB0_16 Depth 4
	cmp	w21, #1
	b.lt	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=3
	ldr	x11, [x20, #8]
	cmp	w23, #16
	b.hs	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=3
	mov	x12, #0
	b	LBB0_15
LBB0_12:                                ;   in Loop: Header=BB0_9 Depth=3
	movi.2d	v0, #0000000000000000
	mov.s	v0[0], w0
	add	x12, x11, x10, lsl #2
	movi.2d	v1, #0000000000000000
	mov	x13, x26
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_13:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_6 Depth=2
                                        ;       Parent Loop BB0_9 Depth=3
                                        ; =>      This Inner Loop Header: Depth=4
	ldp	q4, q5, [x12, #-32]
	ldp	q6, q7, [x12], #64
	shl.4s	v4, v4, #4
	shl.4s	v5, v5, #4
	shl.4s	v6, v6, #4
	shl.4s	v7, v7, #4
	mla.4s	v0, v4, v4
	mla.4s	v1, v5, v5
	mla.4s	v2, v6, v6
	mla.4s	v3, v7, v7
	subs	x13, x13, #16
	b.ne	LBB0_13
; %bb.14:                               ;   in Loop: Header=BB0_9 Depth=3
	add.4s	v0, v1, v0
	add.4s	v0, v2, v0
	add.4s	v0, v3, v0
	addv.4s	s0, v0
	fmov	w0, s0
	mov	x12, x26
	cmp	x26, x23
	b.eq	LBB0_8
LBB0_15:                                ;   in Loop: Header=BB0_9 Depth=3
	add	x13, x12, x8
	add	x11, x11, x13, lsl #2
	sub	x12, x23, x12
LBB0_16:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_6 Depth=2
                                        ;       Parent Loop BB0_9 Depth=3
                                        ; =>      This Inner Loop Header: Depth=4
	ldr	w13, [x11], #4
	lsl	w13, w13, #4
	madd	w0, w13, w13, w0
	subs	x12, x12, #1
	b.ne	LBB0_16
	b	LBB0_8
LBB0_17:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_QROOT,8,3                      ; @QROOT
	.no_dead_strip	_calculate_visual_weight
.subsections_via_symbols
