	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function AVIFILE_ReadBlock
_AVIFILE_ReadBlock:                     ## @AVIFILE_ReadBlock
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r14
	movq	%rdi, %r15
	xorl	%edi, %edi
	testq	%r15, %r15
	setne	%dil
	callq	_assert
	xorl	%edi, %edi
	cmpq	$0, 24(%r15)
	setne	%dil
	callq	_assert
	movq	24(%r15), %rax
	xorl	%edi, %edi
	cmpq	$0, (%rax)
	setne	%dil
	callq	_assert
	xorl	%edi, %edi
	cmpq	%r14, 40(%r15)
	jg	LBB0_2
## %bb.1:
	xorl	%edi, %edi
	cmpq	%r14, 48(%r15)
	setg	%dil
LBB0_2:
	callq	_assert
	xorl	%edi, %edi
	cmpq	%r14, (%r15)
	setge	%dil
	callq	_assert
	movq	32(%r15), %rax
	leaq	(%r14,%r14,2), %r12
	movq	(%rax,%r12,8), %rcx
	cmpq	%r13, %rcx
	movq	%r13, %rbx
	cmovlq	%rcx, %rbx
	testq	%r13, %r13
	cmoveq	%rcx, %rbx
	cmpq	$0, -48(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_6
## %bb.3:
	movq	24(%r15), %rcx
	movq	(%rcx), %rdi
	movq	16(%rax,%r12,8), %rsi
	addq	$16, %rsi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_mmioSeek
	movq	_AVIERR_FILEREAD@GOTPCREL(%rip), %r13
	cmpl	$-1, %eax
	je	LBB0_20
## %bb.4:
	movq	24(%r15), %rax
	movq	(%rax), %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_mmioRead
	cmpq	%rbx, %rax
	jne	LBB0_20
LBB0_5:
	movq	_AVIERR_OK@GOTPCREL(%rip), %r13
	jmp	LBB0_20
LBB0_6:
	addq	$16, %rbx
	cmpq	$0, 8(%r15)
	je	LBB0_8
## %bb.7:
	cmpq	%rbx, 16(%r15)
	jge	LBB0_13
LBB0_8:
	movl	56(%r15), %esi
	movq	%rbx, %rdi
	callq	_max
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	8(%r15), %r13
	xorl	%eax, %eax
	callq	_GetProcessHeap
	testq	%r13, %r13
	je	LBB0_11
## %bb.9:
	movq	8(%r15), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rcx
	callq	_HeapReAlloc
	testq	%rax, %rax
	je	LBB0_19
## %bb.10:
	movq	%rax, 8(%r15)
	jmp	LBB0_12
LBB0_11:
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdx
	callq	_HeapAlloc
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	je	LBB0_19
LBB0_12:
	movq	%r13, 16(%r15)
	movq	32(%r15), %rax
LBB0_13:
	movq	24(%r15), %rcx
	movq	(%rcx), %rdi
	movq	16(%rax,%r12,8), %rsi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_mmioSeek
	movq	_AVIERR_FILEREAD@GOTPCREL(%rip), %r13
	cmpl	$-1, %eax
	je	LBB0_20
## %bb.14:
	movq	8(%r15), %rsi
	movq	24(%r15), %rax
	movq	(%rax), %rdi
	movq	%rbx, %rdx
	callq	_mmioRead
	cmpq	%rbx, %rax
	jne	LBB0_20
## %bb.15:
	movq	8(%r15), %rcx
	movq	32(%r15), %rax
	movq	(%rcx), %rdx
	cmpq	8(%rax,%r12,8), %rdx
	jne	LBB0_17
## %bb.16:
	movq	8(%rcx), %rcx
	cmpq	(%rax,%r12,8), %rcx
	je	LBB0_5
LBB0_17:
	leaq	(,%r14,8), %rcx
	leaq	(%rcx,%rcx,2), %rbx
	movq	16(%rax,%rbx), %rdx
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_ERR
	movq	32(%r15), %rax
	leaq	(%rax,%rbx), %rsi
	addq	$8, %rsi
	movq	(%rax,%rbx), %rcx
	movq	8(%rax,%rbx), %rdx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	movq	8(%r15), %rsi
	movq	(%rsi), %rdx
	movq	8(%rsi), %rcx
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	jmp	LBB0_20
LBB0_19:
	movq	_AVIERR_MEMORY@GOTPCREL(%rip), %r13
LBB0_20:
	movl	(%r13), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AVIERR_MEMORY,4,2              ## @AVIERR_MEMORY
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_AVIERR_FILEREAD,4,2            ## @AVIERR_FILEREAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	": block %d not found at 0x%08X\n"

L_.str.1:                               ## @.str.1
	.asciz	": Index says: '%4.4s'(0x%08X) size 0x%08X\n"

L_.str.2:                               ## @.str.2
	.asciz	": Data  says: '%4.4s'(0x%08X) size 0x%08X\n"

	.comm	_AVIERR_OK,4,2                  ## @AVIERR_OK
	.no_dead_strip	_AVIFILE_ReadBlock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function AVIFILE_ReadBlock
_AVIFILE_ReadBlock:                     ; @AVIFILE_ReadBlock
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
	ldr	x8, [x19, #24]
	cmp	x8, #0
	cset	w0, ne
	bl	_assert
	ldr	x8, [x19, #24]
	ldr	x8, [x8]
	cmp	x8, #0
	cset	w0, ne
	bl	_assert
	ldr	x8, [x19, #40]
	cmp	x8, x20
	b.le	LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_3
LBB0_2:
	ldr	x8, [x19, #48]
	cmp	x8, x20
	cset	w0, gt
LBB0_3:
	bl	_assert
	ldr	x8, [x19]
	cmp	x8, x20
	cset	w0, ge
	bl	_assert
	ldr	x8, [x19, #32]
	mov	w9, #24
	mul	x9, x20, x9
	ldr	x9, [x8, x9]
	cmp	x9, x22
	ccmp	x22, #0, #4, ge
	csel	x22, x9, x22, eq
	cbz	x21, LBB0_7
; %bb.4:
	ldr	x9, [x19, #24]
	ldr	x0, [x9]
	mov	w9, #24
	madd	x8, x20, x9, x8
	ldr	x8, [x8, #16]
	add	x1, x8, #16
Lloh0:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	bl	_mmioSeek
	cmn	w0, #1
	b.eq	LBB0_19
; %bb.5:
	ldr	x8, [x19, #24]
	ldr	x0, [x8]
	mov	x1, x21
	mov	x2, x22
	bl	_mmioRead
	cmp	x0, x22
	b.ne	LBB0_19
LBB0_6:
Lloh3:
	adrp	x8, _AVIERR_OK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AVIERR_OK@GOTPAGEOFF]
	b	LBB0_20
LBB0_7:
	add	x21, x22, #16
	ldr	x9, [x19, #8]
	cbz	x9, LBB0_9
; %bb.8:
	ldr	x9, [x19, #16]
	cmp	x9, x21
	b.ge	LBB0_14
LBB0_9:
	ldr	w1, [x19, #56]
	mov	x0, x21
	bl	_max
	mov	x22, x0
	ldr	x23, [x19, #8]
	bl	_GetProcessHeap
	cbz	x23, LBB0_12
; %bb.10:
	ldr	x2, [x19, #8]
	mov	w1, #0
	mov	x3, x22
	bl	_HeapReAlloc
	cbz	x0, LBB0_21
; %bb.11:
	str	x0, [x19, #8]
	b	LBB0_13
LBB0_12:
	mov	w1, #0
	mov	x2, x22
	bl	_HeapAlloc
	str	x0, [x19, #8]
	cbz	x0, LBB0_21
LBB0_13:
	str	x22, [x19, #16]
	ldr	x8, [x19, #32]
LBB0_14:
	ldr	x9, [x19, #24]
	ldr	x0, [x9]
	mov	w9, #24
	madd	x8, x20, x9, x8
	ldr	x1, [x8, #16]
Lloh5:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	bl	_mmioSeek
	cmn	w0, #1
	b.eq	LBB0_19
; %bb.15:
	ldr	x8, [x19, #24]
	ldr	x0, [x8]
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_mmioRead
	cmp	x0, x21
	b.ne	LBB0_19
; %bb.16:
	ldr	x9, [x19, #8]
	ldr	x10, [x9]
	ldr	x8, [x19, #32]
	mov	w11, #24
	madd	x11, x20, x11, x8
	ldr	x11, [x11, #8]
	cmp	x10, x11
	b.ne	LBB0_18
; %bb.17:
	ldr	x9, [x9, #8]
	mov	w10, #24
	mul	x10, x20, x10
	ldr	x10, [x8, x10]
	cmp	x9, x10
	b.eq	LBB0_6
LBB0_18:
	add	x9, x20, x20, lsl #1
	lsl	x21, x9, #3
	add	x8, x8, x21
	ldr	x2, [x8, #16]
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_ERR
	ldr	x8, [x19, #32]
	add	x1, x8, x21
	ldr	x2, [x1, #8]!
	ldr	x8, [x8, x21]
	str	x8, [sp]
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERR
	ldr	x1, [x19, #8]
	ldp	x2, x8, [x1]
	str	x8, [sp]
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_ERR
LBB0_19:
Lloh14:
	adrp	x8, _AVIERR_FILEREAD@GOTPAGE
Lloh15:
	ldr	x8, [x8, _AVIERR_FILEREAD@GOTPAGEOFF]
LBB0_20:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_21:
Lloh16:
	adrp	x8, _AVIERR_MEMORY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AVIERR_MEMORY@GOTPAGEOFF]
	b	LBB0_20
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_AVIERR_MEMORY,4,2              ; @AVIERR_MEMORY
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_AVIERR_FILEREAD,4,2            ; @AVIERR_FILEREAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	": block %d not found at 0x%08X\n"

l_.str.1:                               ; @.str.1
	.asciz	": Index says: '%4.4s'(0x%08X) size 0x%08X\n"

l_.str.2:                               ; @.str.2
	.asciz	": Data  says: '%4.4s'(0x%08X) size 0x%08X\n"

	.comm	_AVIERR_OK,4,2                  ; @AVIERR_OK
	.no_dead_strip	_AVIFILE_ReadBlock
.subsections_via_symbols
