	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function redspark_read_header
_redspark_read_header:                  ## @redspark_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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	%rsp, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	(%rdi), %r13
	movq	8(%rdi), %rbx
	movq	_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_avformat_new_stream
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%r13, -88(%rbp)                 ## 8-byte Spill
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_avio_rb32
	movl	%eax, %r14d
	xorl	$1382376531, %r14d              ## imm = 0x52656453
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	$1382376531, %esi               ## imm = 0x52656453
	callq	_AV_WB32
	movl	%r14d, %edi
	movl	$11, %esi
	callq	_rol
	movq	_HEADER_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	cmpl	$5, %edx
	jl	LBB0_5
## %bb.3:
	movl	%eax, %r14d
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	addq	$16, %r12
	movl	$4, %r13d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r14d, %edi
	movl	$3, %esi
	callq	_rol
	addl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_avio_rb32
	xorl	%r14d, %eax
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	_AV_WB32
	movl	(%r15), %edx
	addq	$16, %r12
	addl	$4, %r13d
	cmpl	%r13d, %edx
	jg	LBB0_4
LBB0_5:
	movq	_AV_CODEC_ID_ADPCM_THP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-104(%rbp), %r13                ## 8-byte Reload
	movl	%eax, 20(%r13)
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r13)
	leaq	-52(%rbp), %rbx
	movq	%rbx, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	callq	_bytestream2_init
	movq	_SEEK_SET@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	movq	%rbx, %rdi
	movl	$60, %esi
	callq	_bytestream2_seek
	movq	%rbx, %rdi
	callq	_bytestream2_get_be32u
                                        ## kill: def $eax killed $eax def $rax
	movl	%eax, (%r13)
	leal	-96001(%rax), %ecx
	cmpl	$-96001, %ecx                   ## imm = 0xFFFE88FF
	ja	LBB0_7
## %bb.6:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	L_.str(%rip), %rdx
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %ecx
	callq	_av_log
	jmp	LBB0_8
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_AVERROR
	jmp	LBB0_17
LBB0_7:
	leaq	-52(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_bytestream2_get_be32u
	movl	%eax, %ecx
	shll	$4, %ecx
	subl	%eax, %ecx
	subl	%eax, %ecx
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	%ecx, (%rax)
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	movq	%rbx, %rdi
	movl	$10, %esi
	callq	_bytestream2_skipu
	movq	%rbx, %rdi
	callq	_bytestream2_get_byteu
	movl	%eax, 4(%r13)
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%eax, %r12d
	leaq	-52(%rbp), %rdi
	callq	_bytestream2_get_byteu
	xorl	%ebx, %ebx
	testl	%eax, %eax
	setne	%bl
	shll	$4, %ebx
	leal	(%rbx,%r12,8), %eax
	movl	4(%r13), %esi
	imull	$46, %esi, %ecx
	addl	%ecx, %eax
	addl	$84, %eax
	cmpl	(%r15), %eax
	jg	LBB0_8
## %bb.10:
	shll	$5, %esi
	movq	%r13, %rdi
	callq	_ff_alloc_extradata
	testq	%rax, %rax
	je	LBB0_11
LBB0_8:
	movq	_AVERROR_INVALIDDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_16:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
LBB0_17:
	movq	%r14, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_19
## %bb.18:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	leal	(%rbx,%r12,8), %esi
	addl	$84, %esi
	movl	(%r14), %edx
	leaq	-52(%rbp), %rdi
	callq	_bytestream2_seek
	cmpl	$0, 4(%r13)
	jle	LBB0_15
## %bb.12:
	xorl	%r15d, %r15d
	leaq	-52(%rbp), %r14
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r13), %rsi
	addq	%r15, %rsi
	movq	%r14, %rdi
	movl	$32, %edx
	callq	_bytestream2_get_bufferu
	cmpl	$32, %eax
	jne	LBB0_8
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	movl	$14, %esi
	callq	_bytestream2_skipu
	incq	%rbx
	movslq	4(%r13), %rax
	addq	$32, %r15
	cmpq	%rax, %rbx
	jl	LBB0_13
LBB0_15:
	movl	(%r13), %ecx
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	$64, %esi
	movl	$1, %edx
	callq	_avpriv_set_pts_info
	xorl	%eax, %eax
	jmp	LBB0_16
LBB0_19:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HEADER_SIZE,4,2                ## @HEADER_SIZE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_AV_CODEC_ID_ADPCM_THP,4,2      ## @AV_CODEC_ID_ADPCM_THP
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ## @AVMEDIA_TYPE_AUDIO
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid sample rate: %d\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ## @AVERROR_INVALIDDATA
	.no_dead_strip	_redspark_read_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function redspark_read_header
_redspark_read_header:                  ; @redspark_read_header
	.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, #32
	mov	x21, x0
	mov	x28, sp
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldp	x26, x23, [x0]
Lloh3:
	adrp	x27, _HEADER_SIZE@GOTPAGE
Lloh4:
	ldr	x27, [x27, _HEADER_SIZE@GOTPAGEOFF]
	ldr	w8, [x27]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x22, x9, x8
	mov	sp, x22
	mov	x1, #0
	bl	_avformat_new_stream
	cbz	x0, LBB0_7
; %bb.1:
	mov	x19, x0
	ldr	x20, [x0, #8]
	mov	x0, x23
	bl	_avio_rb32
	mov	w8, #25683
	movk	w8, #21093, lsl #16
	eor	w24, w0, w8
	mov	x0, x22
	mov	w1, #25683
	movk	w1, #21093, lsl #16
	bl	_AV_WB32
	mov	x0, x24
	mov	w1, #11
	bl	_rol
	ldr	w2, [x27]
	cmp	w2, #5
	b.lt	LBB0_5
; %bb.2:
	mov	x24, x0
	stur	x26, [x29, #-104]               ; 8-byte Folded Spill
	add	x25, x22, #16
	mov	w26, #4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x24
	mov	w1, #3
	bl	_rol
	add	w24, w0, w24
	mov	x0, x23
	bl	_avio_rb32
	eor	w1, w0, w24
	mov	x0, x25
	bl	_AV_WB32
	ldr	w2, [x27]
	add	x25, x25, #16
	add	w26, w26, #4
	cmp	w2, w26
	b.gt	LBB0_3
; %bb.4:
	ldur	x26, [x29, #-104]               ; 8-byte Folded Reload
LBB0_5:
Lloh7:
	adrp	x8, _AV_CODEC_ID_ADPCM_THP@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AV_CODEC_ID_ADPCM_THP@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh11:
	ldr	x9, [x9, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #16]
	sub	x0, x29, #92
	mov	x1, x22
	bl	_bytestream2_init
Lloh13:
	adrp	x22, _SEEK_SET@GOTPAGE
Lloh14:
	ldr	x22, [x22, _SEEK_SET@GOTPAGEOFF]
	ldr	w2, [x22]
	sub	x0, x29, #92
	mov	w1, #60
	bl	_bytestream2_seek
	sub	x0, x29, #92
	bl	_bytestream2_get_be32u
	str	w0, [x20]
	mov	w8, #35071
	movk	w8, #65534, lsl #16
	add	w9, w8, #1
	add	w8, w0, w8
	cmp	w8, w9
	b.hs	LBB0_8
; %bb.6:
	mov	x3, x0
Lloh15:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x2, l_.str@PAGE
Lloh19:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x21
	bl	_av_log
	b	LBB0_11
LBB0_7:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	bl	_AVERROR
	b	LBB0_12
LBB0_8:
	sub	x0, x29, #92
	bl	_bytestream2_get_be32u
	mov	w8, #14
	mul	w8, w0, w8
	str	w8, [x19]
	str	xzr, [x26]
	sub	x0, x29, #92
	mov	w1, #10
	bl	_bytestream2_skipu
	sub	x0, x29, #92
	bl	_bytestream2_get_byteu
	str	w0, [x20, #4]
	cbz	w0, LBB0_11
; %bb.9:
	mov	x21, x0
	sub	x0, x29, #92
	bl	_bytestream2_get_byteu
	mov	w8, #100
	mov	w9, #84
	cmp	w0, #0
	csel	w8, w9, w8, eq
	add	w21, w8, w21, lsl #3
	ldr	w8, [x20, #4]
	mov	w9, #46
	madd	w9, w8, w9, w21
	ldr	w10, [x27]
	cmp	w9, w10
	b.gt	LBB0_11
; %bb.10:
	lsl	w1, w8, #5
	mov	x0, x20
	bl	_ff_alloc_extradata
	cbz	x0, LBB0_14
LBB0_11:
Lloh23:
	adrp	x8, _AVERROR_INVALIDDATA@GOTPAGE
Lloh24:
	ldr	x8, [x8, _AVERROR_INVALIDDATA@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
LBB0_12:
	mov	sp, x28
	ldur	x8, [x29, #-88]
Lloh26:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh27:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.13:
	sub	sp, x29, #80
	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_14:
	ldr	w2, [x22]
	sub	x0, x29, #92
	mov	x1, x21
	bl	_bytestream2_seek
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.15:
	mov	x21, #0
	mov	x22, #0
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	add	x1, x21, x8
	sub	x0, x29, #92
	mov	w2, #32
	bl	_bytestream2_get_bufferu
	cmp	w0, #32
	b.ne	LBB0_11
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	sub	x0, x29, #92
	mov	w1, #14
	bl	_bytestream2_skipu
	add	x22, x22, #1
	ldrsw	x8, [x20, #4]
	add	x21, x21, #32
	cmp	x22, x8
	b.lt	LBB0_16
LBB0_18:
	ldr	w3, [x20]
	mov	x0, x19
	mov	w1, #64
	mov	w2, #1
	bl	_avpriv_set_pts_info
	mov	w0, #0
	b	LBB0_12
LBB0_19:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_HEADER_SIZE,4,2                ; @HEADER_SIZE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_AV_CODEC_ID_ADPCM_THP,4,2      ; @AV_CODEC_ID_ADPCM_THP
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ; @AVMEDIA_TYPE_AUDIO
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid sample rate: %d\n"

	.comm	_AVERROR_INVALIDDATA,4,2        ; @AVERROR_INVALIDDATA
	.no_dead_strip	_redspark_read_header
.subsections_via_symbols
