	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function AVIFILE_AddRecord
_AVIFILE_AddRecord:                     ## @AVIFILE_AddRecord
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	32(%rbx), %rax
	xorl	%edi, %edi
	cmpq	$0, (%rax)
	setne	%dil
	jmp	LBB0_3
LBB0_1:
	xorl	%edi, %edi
LBB0_3:
	callq	_assert
	cmpq	$0, 24(%rbx)
	movslq	(%rbx), %r14
	je	LBB0_10
## %bb.4:
	movq	%r14, %rax
	shrq	$2, %rax
	movslq	4(%rbx), %rcx
	cmpq	%rcx, %rax
	ja	LBB0_8
## %bb.5:
	addl	$4096, %r14d                    ## imm = 0x1000
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	_HEAP_ZERO_MEMORY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	24(%rbx), %rdx
	movl	%eax, %edi
	movl	%r14d, %ecx
	callq	_HeapReAlloc
	testq	%rax, %rax
	je	LBB0_11
LBB0_7:
	movl	%r14d, (%rbx)
	movq	%rax, 24(%rbx)
	movslq	4(%rbx), %rcx
	movslq	%r14d, %rax
	shrq	$2, %rax
LBB0_8:
	xorl	%edi, %edi
	cmpq	%rcx, %rax
	seta	%dil
	callq	_assert
	movq	_listtypeAVIRECORD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	24(%rbx), %rcx
	movslq	4(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rsi
	movl	%eax, 20(%rcx,%rsi,8)
	movq	_AVIIF_LIST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rcx,%rsi,8)
	movq	16(%rbx), %rax
	addq	$-8, %rax
	movq	%rax, 8(%rcx,%rsi,8)
	movl	8(%rbx), %eax
	movl	%eax, (%rcx,%rsi,8)
	leal	1(%rdx), %eax
	movl	%eax, 4(%rbx)
	movq	_AVIERR_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_10:
	addl	$4096, %r14d                    ## imm = 0x1000
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	_HEAP_ZERO_MEMORY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	movl	%r14d, %edx
	callq	_HeapAlloc
	testq	%rax, %rax
	jne	LBB0_7
LBB0_11:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	$0, 24(%rbx)
	movq	_AVIERR_MEMORY@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HEAP_ZERO_MEMORY,4,2           ## @HEAP_ZERO_MEMORY
	.comm	_AVIERR_MEMORY,4,2              ## @AVIERR_MEMORY
	.comm	_listtypeAVIRECORD,4,2          ## @listtypeAVIRECORD
	.comm	_AVIIF_LIST,4,2                 ## @AVIIF_LIST
	.comm	_AVIERR_OK,4,2                  ## @AVIERR_OK
	.no_dead_strip	_AVIFILE_AddRecord
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function AVIFILE_AddRecord
_AVIFILE_AddRecord:                     ; @AVIFILE_AddRecord
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	cbz	x0, LBB0_2
; %bb.1:
	ldr	x8, [x19, #32]
	ldr	x8, [x8]
	cmp	x8, #0
	cset	w0, ne
LBB0_2:
	bl	_assert
	ldr	x8, [x19, #24]
	ldrsw	x10, [x19]
	cbz	x8, LBB0_7
; %bb.3:
	lsr	x9, x10, #2
	ldrsw	x8, [x19, #4]
	cmp	x9, x8
	b.hi	LBB0_6
; %bb.4:
	add	w20, w10, #1, lsl #12           ; =4096
	bl	_GetProcessHeap
Lloh0:
	adrp	x8, _HEAP_ZERO_MEMORY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HEAP_ZERO_MEMORY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	ldr	x2, [x19, #24]
	mov	x3, x20
	bl	_HeapReAlloc
	cbz	x0, LBB0_8
LBB0_5:
	str	w20, [x19]
	str	x0, [x19, #24]
	ldrsw	x8, [x19, #4]
	sxtw	x9, w20
	lsr	x9, x9, #2
LBB0_6:
	cmp	x9, x8
	cset	w0, hi
	bl	_assert
	mov	w8, #24
	ldp	x10, x9, [x19, #16]
	ldp	w11, w12, [x19, #4]
                                        ; kill: def $w11 killed $w11 def $x11
	sxtw	x11, w11
	madd	x8, x11, x8, x9
Lloh3:
	adrp	x9, _listtypeAVIRECORD@GOTPAGE
Lloh4:
	ldr	x9, [x9, _listtypeAVIRECORD@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	str	w9, [x8, #20]
Lloh6:
	adrp	x9, _AVIIF_LIST@GOTPAGE
Lloh7:
	ldr	x9, [x9, _AVIIF_LIST@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	str	w9, [x8, #16]
	sub	x9, x10, #8
	str	x9, [x8, #8]
	str	w12, [x8]
	add	w8, w11, #1
	str	w8, [x19, #4]
Lloh9:
	adrp	x8, _AVIERR_OK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AVIERR_OK@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:
	add	w20, w10, #1, lsl #12           ; =4096
	bl	_GetProcessHeap
Lloh11:
	adrp	x8, _HEAP_ZERO_MEMORY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _HEAP_ZERO_MEMORY@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_HeapAlloc
	cbnz	x0, LBB0_5
LBB0_8:
	bl	_GetProcessHeap
	ldr	x2, [x19, #24]
	mov	w1, #0
	bl	_HeapFree
	str	xzr, [x19, #24]
Lloh14:
	adrp	x8, _AVIERR_MEMORY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _AVIERR_MEMORY@GOTPAGEOFF]
LBB0_9:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_HEAP_ZERO_MEMORY,4,2           ; @HEAP_ZERO_MEMORY
	.comm	_AVIERR_MEMORY,4,2              ; @AVIERR_MEMORY
	.comm	_listtypeAVIRECORD,4,2          ; @listtypeAVIRECORD
	.comm	_AVIIF_LIST,4,2                 ; @AVIIF_LIST
	.comm	_AVIERR_OK,4,2                  ; @AVIERR_OK
	.no_dead_strip	_AVIFILE_AddRecord
.subsections_via_symbols
