	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fraps2_decode_plane
_fraps2_decode_plane:                   ## @fraps2_decode_plane
	.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	$2120, %rsp                     ## imm = 0x848
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, -2112(%rbp)               ## 4-byte Spill
	movl	%ecx, -2108(%rbp)               ## 4-byte Spill
	movl	%edx, -2120(%rbp)               ## 4-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %r14
	movl	16(%rbp), %r13d
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	%r9, -2136(%rbp)
	xorl	%ebx, %ebx
	leaq	-2136(%rbp), %r12
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_bytestream_get_le32
	movl	%eax, -2096(%rbp,%rbx,4)
	incq	%rbx
	cmpq	$256, %rbx                      ## imm = 0x100
	jne	LBB0_1
## %bb.2:
	movl	16(%r14), %edi
	movq	_VLC_BITS@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_huff_cmp@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	_FF_HUFFMAN_FLAG_ZERO_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	leaq	-2104(%rbp), %rsi
	leaq	-2096(%rbp), %r8
	movl	$256, %edx                      ## imm = 0x100
	callq	_ff_huff_build_tree
	testl	%eax, %eax
	js	LBB0_18
## %bb.3:
	addl	$-1024, %r13d                   ## imm = 0xFC00
	movq	(%r14), %rdi
	movq	-2136(%rbp), %rsi
	movl	%r13d, %edx
	sarl	$2, %edx
	callq	*8(%r14)
	movq	(%r14), %rsi
	leaq	-2124(%rbp), %rdi
	movl	%r13d, %edx
	callq	_init_get_bits8
	testl	%eax, %eax
	js	LBB0_18
## %bb.4:
	cmpl	$0, -2112(%rbp)                 ## 4-byte Folded Reload
	jle	LBB0_17
## %bb.5:
	movl	-2108(%rbp), %eax               ## 4-byte Reload
	movl	32(%rbp), %edx
	imull	%edx, %eax
	movslq	-2120(%rbp), %rcx               ## 4-byte Folded Reload
	movslq	%edx, %rdx
	movq	%rdx, -2120(%rbp)               ## 8-byte Spill
	movl	%eax, -2108(%rbp)               ## 4-byte Spill
	cltq
	movq	%rax, -2152(%rbp)               ## 8-byte Spill
	shlq	$3, %rcx
	movq	%r15, %rbx
	movq	%rcx, -2144(%rbp)               ## 8-byte Spill
	subq	%rcx, %rbx
	xorl	%r13d, %r13d
	leaq	-2124(%rbp), %r12
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_6 Depth=1
	incl	%r13d
	movq	-2144(%rbp), %rax               ## 8-byte Reload
	addq	%rax, %rbx
	addq	%rax, %r15
	cmpl	-2112(%rbp), %r13d              ## 4-byte Folded Reload
	je	LBB0_17
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	cmpl	$0, -2108(%rbp)                 ## 4-byte Folded Reload
	jle	LBB0_16
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	-2104(%rbp), %esi
	movq	_VLC_BITS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movl	$3, %ecx
	callq	_get_vlc2
	movq	%rax, (%r15,%r14,8)
	testl	%r13d, %r13d
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	addq	(%rbx,%r14,8), %rax
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=2
	cmpl	$0, 24(%rbp)
	je	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=2
	subq	$-128, %rax
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	%rax, (%r15,%r14,8)
LBB0_14:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	%r12, %rdi
	callq	_get_bits_left
	testq	%rax, %rax
	js	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=2
	addq	-2120(%rbp), %r14               ## 8-byte Folded Reload
	cmpq	-2152(%rbp), %r14               ## 8-byte Folded Reload
	jl	LBB0_9
	jmp	LBB0_16
LBB0_15:
	leaq	-2104(%rbp), %rdi
	callq	_ff_free_vlc
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_18
LBB0_17:
	leaq	-2104(%rbp), %rdi
	callq	_ff_free_vlc
	xorl	%eax, %eax
LBB0_18:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_20
## %bb.19:
	addq	$2120, %rsp                     ## imm = 0x848
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_VLC_BITS,4,2                   ## @VLC_BITS
	.comm	_huff_cmp,4,2                   ## @huff_cmp
	.comm	_FF_HUFFMAN_FLAG_ZERO_COUNT,4,2 ## @FF_HUFFMAN_FLAG_ZERO_COUNT
	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
	.no_dead_strip	_fraps2_decode_plane
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fraps2_decode_plane
_fraps2_decode_plane:                   ; @fraps2_decode_plane
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #2080
	mov	x19, x7
	mov	x25, x6
	mov	x20, x4
	mov	x23, x3
	mov	x22, x2
	mov	x21, x1
	mov	x24, x0
	mov	x26, #0
	ldr	w27, [x29, #16]
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
	str	x5, [sp, #8]
	add	x28, sp, #16
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #8
	bl	_bytestream_get_le32
	str	w0, [x28, x26]
	add	x26, x26, #4
	cmp	x26, #1024
	b.ne	LBB0_1
; %bb.2:
	ldr	w0, [x24, #16]
Lloh3:
	adrp	x26, _VLC_BITS@GOTPAGE
Lloh4:
	ldr	x26, [x26, _VLC_BITS@GOTPAGEOFF]
	ldr	w3, [x26]
Lloh5:
	adrp	x8, _huff_cmp@GOTPAGE
Lloh6:
	ldr	x8, [x8, _huff_cmp@GOTPAGEOFF]
Lloh7:
	ldr	w5, [x8]
Lloh8:
	adrp	x8, _FF_HUFFMAN_FLAG_ZERO_COUNT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _FF_HUFFMAN_FLAG_ZERO_COUNT@GOTPAGEOFF]
Lloh10:
	ldr	w6, [x8]
	mov	x1, sp
	add	x4, sp, #16
	mov	w2, #256
	bl	_ff_huff_build_tree
	tbnz	w0, #31, LBB0_18
; %bb.3:
	sub	w25, w25, #1024
	ldp	x0, x8, [x24]
	ldr	x1, [sp, #8]
	asr	w2, w25, #2
	blr	x8
	ldr	x1, [x24]
	add	x0, sp, #4
	mov	x2, x25
	bl	_init_get_bits8
	tbnz	w0, #31, LBB0_18
; %bb.4:
	cmp	w20, #1
	b.lt	LBB0_17
; %bb.5:
	mov	w24, #0
	mul	w8, w27, w23
	sxtw	x23, w27
	sxtw	x25, w8
	sbfiz	x22, x22, #3, #32
	sub	x27, x21, x22
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w24, w24, #1
	add	x27, x27, x22
	add	x21, x21, x22
	cmp	w24, w20
	b.eq	LBB0_17
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	cmp	w25, #1
	b.lt	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x28, #0
LBB0_9:                                 ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [sp]
	ldr	w2, [x26]
	add	x0, sp, #4
	mov	w3, #3
	bl	_get_vlc2
	str	x0, [x21, x28, lsl #3]
	cbz	w24, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	ldr	x8, [x27, x28, lsl #3]
	add	x8, x8, x0
	b	LBB0_13
LBB0_11:                                ;   in Loop: Header=BB0_9 Depth=2
	cbz	w19, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x8, x0, #128
LBB0_13:                                ;   in Loop: Header=BB0_9 Depth=2
	str	x8, [x21, x28, lsl #3]
LBB0_14:                                ;   in Loop: Header=BB0_9 Depth=2
	add	x0, sp, #4
	bl	_get_bits_left
	tbnz	x0, #63, LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x28, x28, x23
	cmp	x28, x25
	b.lt	LBB0_9
	b	LBB0_6
LBB0_16:
	mov	x0, sp
	bl	_ff_free_vlc
Lloh11:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	b	LBB0_18
LBB0_17:
	mov	x0, sp
	bl	_ff_free_vlc
	mov	w0, #0
LBB0_18:
	ldur	x8, [x29, #-96]
Lloh14:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh15:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.19:
	add	sp, sp, #2080
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_20:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_VLC_BITS,4,2                   ; @VLC_BITS
	.comm	_huff_cmp,4,2                   ; @huff_cmp
	.comm	_FF_HUFFMAN_FLAG_ZERO_COUNT,4,2 ; @FF_HUFFMAN_FLAG_ZERO_COUNT
	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
	.no_dead_strip	_fraps2_decode_plane
.subsections_via_symbols
