	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vag_read_header
_vag_read_header:                       ## @vag_read_header
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	xorl	%esi, %esi
	callq	_avformat_new_stream
	testq	%rax, %rax
	je	LBB0_10
## %bb.1:
	movq	%rax, %r14
	movl	(%rbx), %edi
	movl	$4, %esi
	callq	_avio_skip
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	8(%r14), %rcx
	movl	%eax, 16(%rcx)
	movq	_AV_CODEC_ID_ADPCM_PSX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rcx)
	movl	(%rbx), %edi
	callq	_avio_rb32
	xorl	%ecx, %ecx
	cmpl	$4, %eax
	sete	%cl
	incl	%ecx
	movq	8(%r14), %rax
	movl	%ecx, (%rax)
	movl	(%rbx), %edi
	movl	$4, %esi
	callq	_avio_skip
	movq	8(%r14), %rax
	movl	(%rax), %r15d
	movl	(%rbx), %edi
	callq	_avio_rb32
                                        ## kill: def $eax killed $eax def $rax
	cmpl	$1, %r15d
	jg	LBB0_3
## %bb.2:
	leal	15(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$4, %ecx
	leal	(%rcx,%rcx,8), %eax
	leal	(%rax,%rax,2), %eax
	addl	%ecx, %eax
LBB0_3:
	movl	%eax, (%r14)
	movl	(%rbx), %edi
	callq	_avio_rb32
	movq	8(%r14), %rcx
	movl	%eax, 4(%rcx)
	testl	%eax, %eax
	jle	LBB0_4
## %bb.5:
	movl	(%rbx), %edi
	movq	_SEEK_SET@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_avio_seek
	movl	(%rbx), %edi
	callq	_avio_rl32
	movq	%rax, %r15
	movl	$86, %edi
	movl	$65, %esi
	movl	$71, %edx
	movl	$112, %ecx
	callq	_MKTAG
	movq	8(%r14), %rdx
	movl	(%rdx), %ecx
	cmpq	%rax, %r15
	jne	LBB0_7
## %bb.6:
	shll	$12, %ecx
	movl	%ecx, 8(%rdx)
	movl	(%rbx), %edi
	movl	(%r12), %edx
	xorl	%esi, %esi
	callq	_avio_seek
	movl	(%r14), %eax
	leal	15(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$4, %ecx
	leal	(%rcx,%rcx,8), %eax
	leal	(%rax,%rax,2), %eax
	addl	%ecx, %eax
	movl	%eax, (%r14)
	jmp	LBB0_8
LBB0_10:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_4:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_9
LBB0_7:
	movl	%ecx, %eax
	shll	$4, %eax
	movl	%eax, 8(%rdx)
	movl	(%rbx), %edi
	cmpl	$2, %ecx
	movl	$128, %eax
	movl	$48, %esi
	cmovgel	%eax, %esi
	movl	(%r12), %edx
	callq	_avio_seek
LBB0_8:
	movq	8(%r14), %rax
	movl	4(%rax), %ecx
	movq	%r14, %rdi
	movl	$64, %esi
	movl	$1, %edx
	callq	_avpriv_set_pts_info
	xorl	%eax, %eax
LBB0_9:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ## @AVMEDIA_TYPE_AUDIO
	.comm	_AV_CODEC_ID_ADPCM_PSX,4,2      ## @AV_CODEC_ID_ADPCM_PSX
	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.no_dead_strip	_vag_read_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vag_read_header
_vag_read_header:                       ; @vag_read_header
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x0
	mov	x1, #0
	bl	_avformat_new_stream
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	ldr	w0, [x20]
	mov	w1, #4
	bl	_avio_skip
Lloh0:
	adrp	x8, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	x9, [x19, #8]
Lloh3:
	adrp	x10, _AV_CODEC_ID_ADPCM_PSX@GOTPAGE
Lloh4:
	ldr	x10, [x10, _AV_CODEC_ID_ADPCM_PSX@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	stp	w10, w8, [x9, #12]
	ldr	w0, [x20]
	bl	_avio_rb32
	cmp	w0, #4
	mov	w8, #1
	cinc	w8, w8, eq
	ldr	x9, [x19, #8]
	str	w8, [x9]
	ldr	w0, [x20]
	mov	w1, #4
	bl	_avio_skip
	ldr	x8, [x19, #8]
	ldr	w21, [x8]
	ldr	w0, [x20]
	bl	_avio_rb32
	add	w8, w0, #15
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w8, w8, #4
	mov	w9, #28
	mul	w8, w8, w9
	cmp	w21, #1
	csel	w8, w0, w8, gt
	str	w8, [x19]
	ldr	w0, [x20]
	bl	_avio_rb32
	ldr	x8, [x19, #8]
	str	w0, [x8, #4]
	cmp	w0, #1
	b.lt	LBB0_5
; %bb.2:
	ldr	w0, [x20]
Lloh6:
	adrp	x22, _SEEK_SET@GOTPAGE
Lloh7:
	ldr	x22, [x22, _SEEK_SET@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	w1, #4096
	bl	_avio_seek
	ldr	w0, [x20]
	bl	_avio_rl32
	mov	x21, x0
	mov	w0, #86
	mov	w1, #65
	mov	w2, #71
	mov	w3, #112
	bl	_MKTAG
	ldr	x9, [x19, #8]
	ldr	w8, [x9]
	cmp	x21, x0
	b.ne	LBB0_6
; %bb.3:
	lsl	w8, w8, #12
	str	w8, [x9, #8]
	ldr	w0, [x20]
	ldr	w2, [x22]
	mov	w1, #0
	bl	_avio_seek
	ldr	w8, [x19]
	add	w9, w8, #15
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #4
	mov	w9, #28
	mul	w8, w8, w9
	str	w8, [x19]
	b	LBB0_7
LBB0_4:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_5:
Lloh11:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	b	LBB0_8
LBB0_6:
	lsl	w10, w8, #4
	str	w10, [x9, #8]
	ldr	w0, [x20]
	mov	w9, #48
	mov	w10, #128
	cmp	w8, #1
	csel	w1, w10, w9, gt
	ldr	w2, [x22]
	bl	_avio_seek
LBB0_7:
	ldr	x8, [x19, #8]
	ldr	w3, [x8, #4]
	mov	x0, x19
	mov	w1, #64
	mov	w2, #1
	bl	_avpriv_set_pts_info
	mov	w0, #0
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ; @AVMEDIA_TYPE_AUDIO
	.comm	_AV_CODEC_ID_ADPCM_PSX,4,2      ; @AV_CODEC_ID_ADPCM_PSX
	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.no_dead_strip	_vag_read_header
.subsections_via_symbols
