	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function msrle_decode_pal4
_msrle_decode_pal4:                     ## @msrle_decode_pal4
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movl	(%rdi), %ebx
	testl	%ebx, %ebx
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_31
## %bb.1:
	movq	%rsi, %r12
	decl	%ebx
	xorl	%r13d, %r13d
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_29:                                ##   in Loop: Header=BB0_2 Depth=1
	addl	%edx, %r13d
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_30:                                ##   in Loop: Header=BB0_2 Depth=1
	testl	%ebx, %ebx
	js	LBB0_31
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_27 Depth 2
                                        ##     Child Loop BB0_12 Depth 2
	cmpl	4(%rdi), %r13d
	jg	LBB0_31
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	callq	_bytestream2_get_bytes_left
	testb	%al, %al
	jle	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	callq	_bytestream2_get_byteu
	movslq	%ebx, %r14
	testb	%al, %al
	je	LBB0_6
## %bb.24:                              ##   in Loop: Header=BB0_2 Depth=1
	movzbl	%al, %r15d
	leal	(%r15,%r13), %eax
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	4(%rdi), %r9d
	leal	1(%r9), %ecx
	cmpl	%ecx, %eax
	jg	LBB0_25
## %bb.26:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_bytestream2_get_byte
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %r11d
	andb	$15, %r11b
	shrb	$4, %al
	movl	%r15d, %r8d
	movl	%r13d, %r9d
	movslq	%r13d, %r10
	xorl	%edx, %edx
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_27:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leal	(%r9,%rdx), %esi
	cmpl	4(%rdi), %esi
	jge	LBB0_29
## %bb.28:                              ##   in Loop: Header=BB0_27 Depth=2
	movq	(%r12), %rsi
	movq	8(%r12), %rbx
	movslq	(%rbx), %rcx
	imulq	%r14, %rcx
	addq	(%rsi), %rcx
	addq	%r10, %rcx
	testb	$1, %dl
	movzbl	%al, %esi
	movzbl	%r11b, %ebx
	cmovel	%esi, %ebx
	movb	%bl, (%rdx,%rcx)
	incq	%rdx
	cmpl	%edx, %r8d
	jne	LBB0_27
	jmp	LBB0_29
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	callq	_bytestream2_get_byte
	testb	%al, %al
	je	LBB0_17
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpb	$2, %al
	je	LBB0_18
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpb	$1, %al
	je	LBB0_33
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movzbl	%al, %ebx
	andb	$1, %al
	incl	%ebx
	movl	%ebx, %esi
	andl	$-2, %esi
	movb	%al, -45(%rbp)                  ## 1-byte Spill
	movzbl	%al, %ecx
	movl	%r13d, %edx
	subl	%ecx, %edx
	addl	%esi, %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	cmpl	4(%rdi), %edx
	jg	LBB0_19
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, %r15d
	shrl	%r15d
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_bytestream2_get_bytes_left
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movsbl	%al, %eax
	cmpl	%eax, %r15d
	jg	LBB0_19
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, -68(%rbp)                 ## 4-byte Spill
	movslq	%r13d, %r13
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	4(%rdi), %r13d
	jge	LBB0_22
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=2
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_bytestream2_get_byteu
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %ecx
	shrb	$4, %cl
	movq	(%r12), %rdx
	movq	8(%r12), %rsi
	movslq	(%rsi), %rsi
	imulq	%r14, %rsi
	addq	(%rdx), %rsi
	movb	%cl, (%r13,%rsi)
	cmpl	$1, %r15d
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=2
	cmpb	$0, -45(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_21
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=2
	leaq	1(%r13), %rcx
	cmpl	4(%rdi), %ecx
	jge	LBB0_21
## %bb.16:                              ##   in Loop: Header=BB0_12 Depth=2
	andb	$15, %al
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	movq	(%rcx), %rcx
	movl	(%rdx), %edx
	imull	-44(%rbp), %edx                 ## 4-byte Folded Reload
	addl	%r13d, %edx
	incl	%edx
	movslq	%edx, %rdx
	movb	%al, (%rcx,%rdx)
	addq	$2, %r13
	decl	%r15d
	jne	LBB0_12
	jmp	LBB0_22
LBB0_17:                                ##   in Loop: Header=BB0_2 Depth=1
	decl	%ebx
	xorl	%r13d, %r13d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_30
LBB0_18:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	callq	_bytestream2_get_byte
	movzbl	%al, %eax
	addl	%eax, %r13d
	movq	%r15, %rdi
	callq	_bytestream2_get_byte
	movzbl	%al, %eax
	subl	%eax, %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_30
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=1
	incl	%r13d
LBB0_22:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	testb	$2, %al
	je	LBB0_30
## %bb.23:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_bytestream2_skip
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_30
LBB0_31:
	movq	%r15, %rdi
	callq	_bytestream2_get_bytes_left
	testb	%al, %al
	je	LBB0_33
## %bb.32:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%r15, %rdi
	callq	_bytestream2_get_bytes_left
	movsbl	%al, %ecx
	leaq	L_.str.3(%rip), %rdx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_20
LBB0_33:
	xorl	%eax, %eax
	jmp	LBB0_34
LBB0_4:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	4(%rdi), %ecx
	subl	%r13d, %ecx
	leaq	L_.str(%rip), %rdx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_20
LBB0_25:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	movl	%r13d, %ecx
	movl	%r15d, %r8d
                                        ## kill: def $r9d killed $r9d killed $r9
	xorl	%eax, %eax
	callq	_av_log
	jmp	LBB0_20
LBB0_19:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	xorl	%eax, %eax
	callq	_av_log
LBB0_20:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_34:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MS RLE: bytestream overrun, %dx%d left\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
L_.str.1:                               ## @.str.1
	.asciz	"MS RLE: frame/stream ptr just went out of bounds (copy)\n"

L_.str.2:                               ## @.str.2
	.asciz	"MS RLE: frame ptr just went out of bounds (run) %d %d %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"MS RLE: ended frame decode with %d bytes left over\n"

	.no_dead_strip	_msrle_decode_pal4
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function msrle_decode_pal4
_msrle_decode_pal4:                     ; @msrle_decode_pal4
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x19, x0
	ldr	w8, [x0]
	subs	w23, w8, #1
	b.lt	LBB0_27
; %bb.1:
	mov	x21, x1
	mov	w24, #0
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w24, w24, w8
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	tbnz	w23, #31, LBB0_27
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
                                        ;     Child Loop BB0_17 Depth 2
	ldr	w8, [x19, #4]
	cmp	w24, w8
	b.gt	LBB0_27
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_bytestream2_get_bytes_left
	cmp	w0, #0
	b.le	LBB0_29
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_bytestream2_get_byteu
	cbz	w0, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x22, x0
	ldr	w8, [x19, #4]
	add	w9, w8, #1
	add	w10, w24, w0
	cmp	w10, w9
	b.gt	LBB0_30
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_bytestream2_get_byte
	mov	x8, #0
	lsr	w9, w0, #4
	and	w10, w0, #0xf
	mov	w11, w22
	mov	x12, x24
	sxtw	x12, w12
	mov	w13, w24
LBB0_9:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w14, [x19, #4]
	add	w15, w13, w8
	cmp	w15, w14
	b.ge	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	ldp	x14, x15, [x21]
	ldr	x14, [x14]
	ldrsw	x15, [x15]
	mov	x16, x23
	sxtw	x16, w16
	madd	x14, x15, x16, x14
	add	x14, x14, x12
	tst	w8, #0x1
	csel	w15, w9, w10, eq
	strb	w15, [x14, x8]
	add	x8, x8, #1
	cmp	w11, w8
	b.ne	LBB0_9
	b	LBB0_2
LBB0_11:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_bytestream2_get_byte
	cbz	w0, LBB0_23
; %bb.12:                               ;   in Loop: Header=BB0_4 Depth=1
	cmp	w0, #2
	b.eq	LBB0_24
; %bb.13:                               ;   in Loop: Header=BB0_4 Depth=1
	cmp	w0, #1
	b.eq	LBB0_35
; %bb.14:                               ;   in Loop: Header=BB0_4 Depth=1
	and	w25, w0, #0x1
	add	w22, w0, #1
	and	w8, w22, #0x1fe
	sub	w9, w24, w25
	add	w8, w9, w8
	ldr	w9, [x19, #4]
	cmp	w8, w9
	b.gt	LBB0_31
; %bb.15:                               ;   in Loop: Header=BB0_4 Depth=1
	lsr	w26, w22, #1
	mov	x0, x20
	bl	_bytestream2_get_bytes_left
	cmp	w26, w0
	b.gt	LBB0_31
; %bb.16:                               ;   in Loop: Header=BB0_4 Depth=1
	sxtw	x24, w24
LBB0_17:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x19, #4]
	cmp	w24, w8
	b.ge	LBB0_22
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=2
	mov	x0, x20
	bl	_bytestream2_get_byteu
	lsr	w8, w0, #4
	ldp	x9, x10, [x21]
	ldr	x9, [x9]
	ldrsw	x10, [x10]
	sxtw	x11, w23
	madd	x9, x10, x11, x9
	strb	w8, [x9, x24]
	cmp	w26, #1
	b.ne	LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_17 Depth=2
	cbnz	w25, LBB0_25
LBB0_20:                                ;   in Loop: Header=BB0_17 Depth=2
	add	x8, x24, #1
	ldr	w9, [x19, #4]
	cmp	w8, w9
	b.ge	LBB0_25
; %bb.21:                               ;   in Loop: Header=BB0_17 Depth=2
	and	w8, w0, #0xf
	ldp	x9, x10, [x21]
	ldr	x9, [x9]
	ldr	w10, [x10]
	madd	w10, w10, w23, w24
	add	w10, w10, #1
	strb	w8, [x9, w10, sxtw]
	add	x24, x24, #2
	subs	w26, w26, #1
	b.ne	LBB0_17
LBB0_22:                                ;   in Loop: Header=BB0_4 Depth=1
                                        ; kill: def $w24 killed $w24 killed $x24 def $x24
	tbz	w22, #1, LBB0_3
	b	LBB0_26
LBB0_23:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w24, #0
	sub	w23, w23, #1
	b	LBB0_3
LBB0_24:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_bytestream2_get_byte
	add	w24, w24, w0
	mov	x0, x20
	bl	_bytestream2_get_byte
	sub	w23, w23, w0
	b	LBB0_3
LBB0_25:                                ;   in Loop: Header=BB0_4 Depth=1
	add	w24, w24, #1
	tbz	w22, #1, LBB0_3
LBB0_26:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	mov	w1, #1
	bl	_bytestream2_skip
	b	LBB0_3
LBB0_27:
	mov	x0, x20
	bl	_bytestream2_get_bytes_left
	cbz	w0, LBB0_34
; %bb.28:
Lloh0:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
	mov	x0, x20
	bl	_bytestream2_get_bytes_left
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	str	x8, [sp]
Lloh3:
	adrp	x2, l_.str.3@PAGE
Lloh4:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	x0, x19
	mov	x1, x21
	b	LBB0_33
LBB0_29:
Lloh5:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	ldr	w8, [x19, #4]
	sub	w8, w8, w24
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	stp	x8, x23, [sp]
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
	b	LBB0_32
LBB0_30:
Lloh10:
	adrp	x9, _AV_LOG_ERROR@GOTPAGE
Lloh11:
	ldr	x9, [x9, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x9]
	stp	x22, x8, [sp, #8]
                                        ; kill: def $w24 killed $w24 killed $x24 def $x24
	str	x24, [sp]
Lloh13:
	adrp	x2, l_.str.2@PAGE
Lloh14:
	add	x2, x2, l_.str.2@PAGEOFF
	b	LBB0_32
LBB0_31:
Lloh15:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x2, l_.str.1@PAGE
Lloh19:
	add	x2, x2, l_.str.1@PAGEOFF
LBB0_32:
	mov	x0, x19
LBB0_33:
	bl	_av_log
Lloh20:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh21:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
LBB0_34:
	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
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_35:
	mov	w0, #0
	b	LBB0_34
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MS RLE: bytestream overrun, %dx%d left\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
l_.str.1:                               ; @.str.1
	.asciz	"MS RLE: frame/stream ptr just went out of bounds (copy)\n"

l_.str.2:                               ; @.str.2
	.asciz	"MS RLE: frame ptr just went out of bounds (run) %d %d %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"MS RLE: ended frame decode with %d bytes left over\n"

	.no_dead_strip	_msrle_decode_pal4
.subsections_via_symbols
