	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function restore_median_planar
_restore_median_planar:                 ## @restore_median_planar
	.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
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	movq	%rsi, -112(%rbp)                ## 8-byte Spill
	testl	%r9d, %r9d
	jle	LBB0_13
## %bb.1:
	movl	%r9d, %r15d
	movl	%r8d, %r12d
	movl	%ecx, %r10d
	movq	%rdi, %r11
	movl	16(%rbp), %eax
	notl	%eax
	movl	%eax, -96(%rbp)                 ## 4-byte Spill
	movslq	-60(%rbp), %rcx                 ## 4-byte Folded Reload
	movl	%ecx, %eax
	negl	%eax
	cltq
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	movq	%rcx, %rax
	negq	%rax
	movq	%rax, -136(%rbp)                ## 8-byte Spill
	leal	-16(%r10), %eax
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	leaq	(,%rcx,4), %rdi
	movq	-112(%rbp), %rax                ## 8-byte Reload
	movq	%rcx, -152(%rbp)                ## 8-byte Spill
	leaq	(%rax,%rcx,8), %rax
	movq	%rax, -128(%rbp)                ## 8-byte Spill
	xorl	%ebx, %ebx
	movl	%r9d, -92(%rbp)                 ## 4-byte Spill
	movl	%r8d, -88(%rbp)                 ## 4-byte Spill
	movq	%r10, -56(%rbp)                 ## 8-byte Spill
	movq	%r11, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -120(%rbp)                ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-100(%rbp), %ebx                ## 4-byte Reload
	cmpl	%r15d, %ebx
	je	LBB0_13
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##     Child Loop BB0_11 Depth 2
	movl	%ebx, %eax
	imull	%r12d, %eax
	cltd
	idivl	%r15d
	movl	%eax, %ecx
	movl	-96(%rbp), %esi                 ## 4-byte Reload
	andl	%esi, %ecx
	incl	%ebx
	movl	%ebx, -100(%rbp)                ## 4-byte Spill
	movl	%ebx, %eax
	imull	%r12d, %eax
	cltd
	idivl	%r15d
	movl	%eax, %r13d
	andl	%esi, %r13d
	subl	%ecx, %r13d
	je	LBB0_12
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	imull	-60(%rbp), %ecx                 ## 4-byte Folded Reload
	movslq	%ecx, %rbx
	movq	-112(%rbp), %rax                ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rsi
	subl	$-128, (%rax,%rbx,4)
	movq	%rsi, %rdi
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movl	%r10d, %edx
	xorl	%ecx, %ecx
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	callq	*8(%rax)
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	cmpl	$2, %r13d
	jl	LBB0_12
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, -160(%rbp)                ## 8-byte Spill
	movq	-152(%rbp), %rax                ## 8-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %r14
	movq	-144(%rbp), %rax                ## 8-byte Reload
	movl	(%r14,%rax,4), %ebx
	movl	(%r14), %eax
	addl	%ebx, %eax
	movl	%eax, (%r14)
	movl	%eax, -44(%rbp)
	movl	%r10d, %edi
	movl	$16, %esi
	callq	_FFMIN
	cmpl	$2, %eax
	jl	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-120(%rbp), %rax                ## 8-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax), %r12
	movl	$1, %r15d
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax,%r15,4), %esi
	movl	%esi, -48(%rbp)
	movl	-44(%rbp), %edi
	movl	%esi, %edx
	subl	%ebx, %edx
	addl	%edi, %edx
	callq	_mid_pred
	addl	(%r12,%r15,4), %eax
	movl	%eax, (%r12,%r15,4)
	movl	-48(%rbp), %ebx
	movl	%eax, -44(%rbp)
	incq	%r15
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$16, %esi
	callq	_FFMIN
	cltq
	cmpq	%rax, %r15
	jl	LBB0_6
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	cmpl	$17, %r10d
	jl	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	64(%r14), %rdi
	movq	-136(%rbp), %rax                ## 8-byte Reload
	leaq	(%r14,%rax,4), %rsi
	addq	$64, %rsi
	movq	%rdi, %rdx
	movl	-84(%rbp), %ecx                 ## 4-byte Reload
	leaq	-44(%rbp), %r8
	leaq	-48(%rbp), %r9
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	callq	*(%rax)
	movq	-56(%rbp), %r10                 ## 8-byte Reload
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$3, %r13d
	movl	-92(%rbp), %r15d                ## 4-byte Reload
	movl	-88(%rbp), %r12d                ## 4-byte Reload
	leaq	-44(%rbp), %r8
	leaq	-48(%rbp), %r9
	movq	-160(%rbp), %rcx                ## 8-byte Reload
	jl	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	addl	$-2, %r13d
	movq	-128(%rbp), %rax                ## 8-byte Reload
	leaq	(%rax,%rcx,4), %rbx
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movl	%r10d, %ecx
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	callq	*(%rax)
	leaq	-48(%rbp), %r9
	leaq	-44(%rbp), %r8
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	addq	%rdi, %rbx
	addq	%rdi, %r14
	decl	%r13d
	jne	LBB0_11
	jmp	LBB0_12
LBB0_13:
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_restore_median_planar
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function restore_median_planar
_restore_median_planar:                 ; @restore_median_planar
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #192
	.cfi_def_cfa_offset 192
	stp	x28, x27, [sp, #96]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #112]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #128]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #144]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #160]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #176]            ; 16-byte Folded Spill
	add	x29, sp, #176
	.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
	str	x1, [sp, #64]                   ; 8-byte Folded Spill
	cmp	w5, #1
	b.lt	LBB0_12
; %bb.1:
	mov	x22, x5
	mov	x23, x4
	mov	x21, x3
	mov	x25, x2
	mov	x11, x0
	mov	w9, #0
	mvn	w8, w6
	str	w8, [sp, #72]                   ; 4-byte Folded Spill
	sxtw	x8, w25
	stp	x8, x25, [sp, #16]              ; 16-byte Folded Spill
	neg	x8, x8
	str	x8, [sp, #48]                   ; 8-byte Folded Spill
	sub	w8, w3, #16
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	ldr	x8, [sp, #64]                   ; 8-byte Folded Reload
	add	x8, x8, #4
	str	x8, [sp]                        ; 8-byte Folded Spill
	sbfiz	x27, x25, #2, #32
	sbfiz	x12, x25, #3, #32
	stp	w4, w5, [sp, #32]               ; 8-byte Folded Spill
	str	x0, [sp, #80]                   ; 8-byte Folded Spill
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [sp, #76]                   ; 4-byte Folded Reload
	cmp	w9, w22
	b.eq	LBB0_12
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;     Child Loop BB0_11 Depth 2
	mul	w8, w9, w23
	sdiv	w8, w8, w22
	ldr	w10, [sp, #72]                  ; 4-byte Folded Reload
	and	w8, w8, w10
	add	w9, w9, #1
	str	w9, [sp, #76]                   ; 4-byte Folded Spill
	mul	w9, w9, w23
	sdiv	w9, w9, w22
	and	w9, w9, w10
	subs	w24, w9, w8
	b.eq	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mul	w19, w8, w25
	ldr	x8, [sp, #64]                   ; 8-byte Folded Reload
	add	x26, x8, w19, sxtw #2
	ldr	w8, [x26]
	add	w8, w8, #128
	str	w8, [x26]
	ldr	x8, [x11, #8]
	mov	x0, x26
	mov	x1, x26
	mov	x2, x21
	mov	w3, #0
	mov	x28, x12
	blr	x8
	mov	x12, x28
	ldr	x11, [sp, #80]                  ; 8-byte Folded Reload
	subs	w20, w24, #2
	b.lt	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	str	w24, [sp, #60]                  ; 4-byte Folded Spill
	mov	x24, x27
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x9, x26, x8, lsl #2
	ldr	x8, [sp, #48]                   ; 8-byte Folded Reload
	ldr	w25, [x9, x8, lsl #2]
	ldr	w8, [x9]
	add	w8, w8, w25
	str	x9, [sp, #40]                   ; 8-byte Folded Spill
	str	w8, [x9]
	stur	w8, [x29, #-84]
	mov	x0, x21
	mov	w1, #16
	bl	_FFMIN
	cmp	w0, #2
	b.lt	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x27, #0
	sxtw	x8, w19
	ldr	x9, [sp]                        ; 8-byte Folded Reload
	add	x19, x9, x8, lsl #2
	add	x22, x19, x24
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	lsl	x23, x27, #2
	ldr	w1, [x19, x23]
	str	w1, [sp, #88]
	ldur	w0, [x29, #-84]
	sub	w8, w1, w25
	add	w2, w8, w0
	bl	_mid_pred
	ldr	w8, [x22, x23]
	add	w8, w8, w0
	str	w8, [x22, x23]
	ldr	w25, [sp, #88]
	stur	w8, [x29, #-84]
	mov	x0, x21
	mov	w1, #16
	bl	_FFMIN
	add	x8, x27, #2
	add	x27, x27, #1
	cmp	x8, w0, sxtw
	b.lt	LBB0_7
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w21, #17
	mov	x12, x28
	b.lt	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [sp, #80]                   ; 8-byte Folded Reload
	ldr	x8, [x8]
	ldp	x10, x9, [sp, #40]              ; 16-byte Folded Reload
	add	x0, x10, #64
	add	x9, x10, x9, lsl #2
	add	x1, x9, #64
	sub	x4, x29, #84
	add	x5, sp, #88
	mov	x2, x0
	ldr	w3, [sp, #12]                   ; 4-byte Folded Reload
	blr	x8
	mov	x12, x28
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [sp, #60]                   ; 4-byte Folded Reload
	cmp	w8, #3
	ldp	w23, w22, [sp, #32]             ; 8-byte Folded Reload
	ldr	x25, [sp, #24]                  ; 8-byte Folded Reload
	mov	x27, x24
	ldr	x11, [sp, #80]                  ; 8-byte Folded Reload
	b.lt	LBB0_2
LBB0_11:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x27, x26, x24
	add	x0, x26, x12
	ldr	x8, [x11]
	sub	x4, x29, #84
	add	x5, sp, #88
	mov	x1, x27
	mov	x2, x0
	mov	x3, x21
	blr	x8
	mov	x12, x28
	ldr	x11, [sp, #80]                  ; 8-byte Folded Reload
	mov	x26, x27
	mov	x27, x24
	subs	w20, w20, #1
	b.ne	LBB0_11
	b	LBB0_2
LBB0_12:
	ldp	x29, x30, [sp, #176]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #160]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #144]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #128]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #112]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #192
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_restore_median_planar
.subsections_via_symbols
