	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apply_palette
_apply_palette:                         ## @apply_palette
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rsi, -72(%rbp)
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	movq	16(%rdi), %r14
	movq	(%r14), %rax
	movq	8(%r14), %r12
	movq	(%rax), %rdi
	movl	4(%rdi), %edx
	movl	8(%rdi), %esi
	callq	_ff_get_video_buffer
	movq	%rax, -80(%rbp)
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r13
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	movq	%r15, %rsi
	callq	_av_frame_copy_props
	movl	28(%r12), %edi
	movl	20(%r12), %esi
	movl	24(%r12), %ecx
	subq	$8, %rsp
	leaq	-44(%rbp), %rax
	leaq	-48(%rbp), %rbx
	leaq	-52(%rbp), %r10
	leaq	-56(%rbp), %r9
	movq	%r15, %rdx
	movq	%r13, %r8
	pushq	%rax
	pushq	%rbx
	pushq	%r10
	callq	_set_processing_window
	addq	$32, %rsp
	movl	20(%r12), %edi
	callq	_av_frame_unref
	movl	24(%r12), %edi
	callq	_av_frame_unref
	movl	20(%r12), %edi
	movq	%r15, %rsi
	callq	_av_frame_ref
	testq	%rax, %rax
	js	LBB0_6
## %bb.4:
	movl	24(%r12), %edi
	movq	%r13, %rsi
	callq	_av_frame_ref
	testq	%rax, %rax
	js	LBB0_6
## %bb.5:
	movl	20(%r12), %edi
	callq	_av_frame_make_writable
	testq	%rax, %rax
	js	LBB0_6
## %bb.7:
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %ecx
	movl	-56(%rbp), %r8d
	movl	-52(%rbp), %r9d
	leal	(%r8,%rdx), %r10d
	leal	(%r9,%rcx), %r11d
	movl	8(%r15), %eax
	movl	12(%r15), %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
                                        ## kill: def $ecx killed $ecx killed $rcx
                                        ## kill: def $r8d killed $r8d killed $r8
                                        ## kill: def $r9d killed $r9d killed $r9
	pushq	%rax
	pushq	%rbx
	pushq	%r11
	pushq	%r10
	callq	_ff_dlog
	addq	$32, %rsp
	movl	-56(%rbp), %ecx
	movl	-52(%rbp), %r8d
	movl	-48(%rbp), %r9d
	movl	-44(%rbp), %eax
	subq	$8, %rsp
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	pushq	%rax
	callq	*(%r12)
	addq	$16, %rsp
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:
	movq	(%r13), %rax
	movl	4(%rax), %edi
	movl	16(%r12), %esi
	movq	_AVPALETTE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_memcpy
	cmpq	$0, 8(%r12)
	je	LBB0_11
## %bb.10:
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %ecx
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	callq	_debug_mean_error
LBB0_11:
	leaq	-72(%rbp), %rdi
	callq	_av_frame_free
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	%r13, (%rax)
	xorl	%ebx, %ebx
	jmp	LBB0_12
LBB0_6:
	leaq	-72(%rbp), %rdi
	callq	_av_frame_free
	leaq	-80(%rbp), %rdi
	callq	_av_frame_free
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	jmp	LBB0_2
LBB0_1:
	leaq	-72(%rbp), %rdi
	callq	_av_frame_free
	movq	$0, (%rbx)
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_AVERROR
	movl	%eax, %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%eax, %ebx
	leaq	-80(%rbp), %rdi
	callq	_av_frame_free
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n"

	.comm	_AVPALETTE_SIZE,4,2             ## @AVPALETTE_SIZE
	.no_dead_strip	_apply_palette
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apply_palette
_apply_palette:                         ; @apply_palette
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x2
	mov	x20, x1
	mov	x22, x0
	str	x1, [sp, #40]
	ldr	x24, [x0, #16]
	ldp	x8, x23, [x24]
	ldr	x0, [x8]
	ldp	w2, w1, [x0, #4]
	bl	_ff_get_video_buffer
	str	x0, [sp, #16]
	cbz	x0, LBB0_9
; %bb.1:
	mov	x21, x0
	mov	x1, x20
	bl	_av_frame_copy_props
	ldp	w3, w0, [x23, #24]
	ldr	w1, [x23, #20]
	add	x8, sp, #24
	str	x8, [sp]
	add	x5, sp, #36
	add	x6, sp, #32
	add	x7, sp, #28
	mov	x2, x20
	mov	x4, x21
	bl	_set_processing_window
	ldr	w0, [x23, #20]
	bl	_av_frame_unref
	ldr	w0, [x23, #24]
	bl	_av_frame_unref
	ldr	w0, [x23, #20]
	mov	x1, x20
	bl	_av_frame_ref
	tbnz	x0, #63, LBB0_8
; %bb.2:
	ldr	w0, [x23, #24]
	mov	x1, x21
	bl	_av_frame_ref
	tbnz	x0, #63, LBB0_8
; %bb.3:
	ldr	w0, [x23, #20]
	bl	_av_frame_make_writable
	tbnz	x0, #63, LBB0_8
; %bb.4:
	ldp	w3, w2, [sp, #24]
	ldp	w5, w4, [sp, #32]
	add	w6, w4, w2
	add	w7, w5, w3
	ldp	w9, w8, [x20, #8]
	stp	w8, w9, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x24
	bl	_ff_dlog
	ldr	x8, [x23]
	ldp	w4, w3, [sp, #32]
	ldp	w6, w5, [sp, #24]
	mov	x0, x23
	mov	x1, x21
	mov	x2, x20
	blr	x8
	tbnz	w0, #31, LBB0_12
; %bb.5:
	ldr	x8, [x21]
	ldr	w0, [x8, #4]
	ldr	w1, [x23, #16]
Lloh2:
	adrp	x8, _AVPALETTE_SIZE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AVPALETTE_SIZE@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	bl	_memcpy
	ldr	x8, [x23, #8]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w3, [x22]
	mov	x0, x23
	mov	x1, x20
	mov	x2, x21
	bl	_debug_mean_error
LBB0_7:
	add	x0, sp, #40
	bl	_av_frame_free
	mov	w24, #0
	str	x21, [x19]
	b	LBB0_11
LBB0_8:
	add	x0, sp, #40
	bl	_av_frame_free
	add	x0, sp, #16
	b	LBB0_10
LBB0_9:
	add	x0, sp, #40
LBB0_10:
	bl	_av_frame_free
	str	xzr, [x19]
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	bl	_AVERROR
	mov	x24, x0
LBB0_11:
	mov	x0, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_12:
	mov	x24, x0
	add	x0, sp, #16
	bl	_av_frame_free
	str	xzr, [x19]
	b	LBB0_11
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n"

	.comm	_AVPALETTE_SIZE,4,2             ; @AVPALETTE_SIZE
	.no_dead_strip	_apply_palette
.subsections_via_symbols
