	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ffat_update_ctx
_ffat_update_ctx:                       ## @ffat_update_ctx
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	24(%rdi), %r13
	movl	$32, -44(%rbp)
	movl	8(%r13), %edi
	movq	_kAudioConverterCurrentInputStreamDescription@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	leaq	-80(%rbp), %rcx
	callq	_AudioConverterGetProperty
	testl	%eax, %eax
	jne	LBB0_4
## %bb.1:
	movq	-56(%rbp), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	%rax, 16(%r15)
LBB0_3:
	movl	-64(%rbp), %edi
	movl	%edi, 8(%r15)
	callq	_av_get_default_channel_layout
	movl	%eax, (%r15)
	movl	-80(%rbp), %eax
	movl	%eax, 4(%r15)
LBB0_4:
	movl	8(%r13), %edi
	movq	_kAudioConverterCurrentOutputStreamDescription@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-44(%rbp), %rdx
	leaq	-80(%rbp), %rcx
	callq	_AudioConverterGetProperty
	testl	%eax, %eax
	jne	LBB0_6
## %bb.5:
	movq	16(%r15), %rax
	movq	%rax, -56(%rbp)
	movl	8(%r15), %eax
	movl	%eax, -64(%rbp)
	movl	8(%r13), %edi
	movl	(%rbx), %esi
	movl	-44(%rbp), %edx
	leaq	-80(%rbp), %rcx
	callq	_AudioConverterSetProperty
LBB0_6:
	movl	8(%r13), %edi
	movq	_kAudioConverterOutputChannelLayout@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	xorl	%ebx, %ebx
	leaq	-44(%rbp), %rdx
	xorl	%ecx, %ecx
	callq	_AudioConverterGetPropertyInfo
	testl	%eax, %eax
	jne	LBB0_21
## %bb.7:
	movl	-44(%rbp), %edi
	testl	%edi, %edi
	je	LBB0_21
## %bb.8:
	callq	_av_malloc
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %rbx
	movl	8(%r13), %edi
	movl	(%r14), %esi
	leaq	-44(%rbp), %r12
	movq	%r12, %rdx
	movq	%rax, %rcx
	callq	_AudioConverterGetProperty
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ffat_convert_layout
	testq	%rax, %rax
	je	LBB0_9
## %bb.11:
	movq	%rax, %r12
	movl	4(%rax), %esi
	movq	8(%rax), %rdi
	testl	%esi, %esi
	jle	LBB0_12
## %bb.13:
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	4(%rdi,%r14,8), %edi
	callq	_ffat_get_channel_id
	testl	%eax, %eax
	js	LBB0_20
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	$1, %edx
	movl	%eax, %ecx
	shll	%cl, %edx
	btl	%eax, %ebx
	jb	LBB0_20
## %bb.16:                              ##   in Loop: Header=BB0_14 Depth=1
	orl	%edx, %ebx
	movq	8(%r12), %rdi
	movl	%r14d, (%rdi,%r14,8)
	incq	%r14
	movslq	4(%r12), %rsi
	cmpq	%rsi, %r14
	jl	LBB0_14
	jmp	LBB0_17
LBB0_9:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_AVERROR
	movl	%eax, %ebx
	jmp	LBB0_23
LBB0_12:
	xorl	%ebx, %ebx
LBB0_17:
	movl	%ebx, (%r15)
	movq	_ffat_compare_channel_descriptions@GOTPCREL(%rip), %rcx
                                        ## kill: def $esi killed $esi killed $rsi
	movl	$4, %edx
	callq	_qsort
	cmpl	$0, 4(%r12)
	jle	LBB0_20
## %bb.18:
	movq	8(%r12), %rax
	movq	(%r13), %rcx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdx,8), %esi
	movl	%esi, (%rcx,%rdx,4)
	incq	%rdx
	movslq	4(%r12), %rsi
	cmpq	%rsi, %rdx
	jl	LBB0_19
LBB0_20:
	movq	%r12, %rdi
	callq	_av_free
	xorl	%ebx, %ebx
LBB0_21:
	cmpl	$0, 4(%r15)
	jne	LBB0_23
## %bb.22:
	movl	$2048, 4(%r15)                  ## imm = 0x800
LBB0_23:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_kAudioConverterCurrentInputStreamDescription,4,2 ## @kAudioConverterCurrentInputStreamDescription
	.comm	_kAudioConverterCurrentOutputStreamDescription,4,2 ## @kAudioConverterCurrentOutputStreamDescription
	.comm	_kAudioConverterOutputChannelLayout,4,2 ## @kAudioConverterOutputChannelLayout
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ffat_compare_channel_descriptions,4,2 ## @ffat_compare_channel_descriptions
	.no_dead_strip	_ffat_update_ctx
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ffat_update_ctx
_ffat_update_ctx:                       ; @ffat_update_ctx
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	mov	x19, x0
	ldr	x21, [x0, #24]
	mov	w8, #32
	str	w8, [sp, #12]
	ldr	w0, [x21, #8]
Lloh0:
	adrp	x8, _kAudioConverterCurrentInputStreamDescription@GOTPAGE
Lloh1:
	ldr	x8, [x8, _kAudioConverterCurrentInputStreamDescription@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	add	x3, sp, #16
	bl	_AudioConverterGetProperty
	cbnz	w0, LBB0_4
; %bb.1:
	ldr	x8, [sp, #40]
	cbz	x8, LBB0_3
; %bb.2:
	str	x8, [x19, #16]
LBB0_3:
	ldr	w0, [sp, #32]
	str	w0, [x19, #8]
	bl	_av_get_default_channel_layout
	ldr	w8, [sp, #16]
	stp	w0, w8, [x19]
LBB0_4:
	ldr	w0, [x21, #8]
Lloh3:
	adrp	x20, _kAudioConverterCurrentOutputStreamDescription@GOTPAGE
Lloh4:
	ldr	x20, [x20, _kAudioConverterCurrentOutputStreamDescription@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	add	x3, sp, #16
	bl	_AudioConverterGetProperty
	cbnz	w0, LBB0_6
; %bb.5:
	ldr	x8, [x19, #16]
	str	x8, [sp, #40]
	ldr	w8, [x19, #8]
	str	w8, [sp, #32]
	ldr	w0, [x21, #8]
	ldr	w1, [x20]
	ldr	w2, [sp, #12]
	add	x3, sp, #16
	bl	_AudioConverterSetProperty
LBB0_6:
	ldr	w0, [x21, #8]
Lloh5:
	adrp	x22, _kAudioConverterOutputChannelLayout@GOTPAGE
Lloh6:
	ldr	x22, [x22, _kAudioConverterOutputChannelLayout@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, sp, #12
	mov	x3, #0
	bl	_AudioConverterGetPropertyInfo
	mov	x8, x0
	ldr	w0, [sp, #12]
	cmp	w8, #0
	ccmp	w0, #0, #4, eq
	b.eq	LBB0_20
; %bb.7:
	bl	_av_malloc
	cbz	x0, LBB0_14
; %bb.8:
	mov	x20, x0
	ldr	w0, [x21, #8]
	ldr	w1, [x22]
	add	x2, sp, #12
	mov	x3, x20
	bl	_AudioConverterGetProperty
	add	x1, sp, #12
	mov	x0, x20
	bl	_ffat_convert_layout
	cbz	x0, LBB0_14
; %bb.9:
	mov	x20, x0
	ldr	w1, [x0, #4]
	ldr	x0, [x0, #8]
	cmp	w1, #1
	b.lt	LBB0_15
; %bb.10:
	mov	x23, #0
	mov	x24, #0
	mov	w22, #0
	mov	w25, #1
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	x8, x0, x23
	ldr	w0, [x8, #4]
	bl	_ffat_get_channel_id
	tbnz	w0, #31, LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	lsl	w8, w25, w0
	tst	w8, w22
	b.ne	LBB0_19
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	orr	w22, w8, w22
	ldr	x0, [x20, #8]
	str	w24, [x0, x23]
	add	x24, x24, #1
	ldrsw	x1, [x20, #4]
	add	x23, x23, #8
	cmp	x24, x1
	b.lt	LBB0_11
	b	LBB0_16
LBB0_14:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	bl	_AVERROR
	b	LBB0_23
LBB0_15:
	mov	w22, #0
LBB0_16:
	str	w22, [x19]
Lloh10:
	adrp	x3, _ffat_compare_channel_descriptions@GOTPAGE
Lloh11:
	ldr	x3, [x3, _ffat_compare_channel_descriptions@GOTPAGEOFF]
                                        ; kill: def $w1 killed $w1 killed $x1
	mov	w2, #4
	bl	_qsort
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.17:
	mov	x8, #0
	ldr	x9, [x20, #8]
	ldr	x10, [x21]
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x9], #8
	str	w11, [x10, x8, lsl #2]
	add	x8, x8, #1
	ldrsw	x11, [x20, #4]
	cmp	x8, x11
	b.lt	LBB0_18
LBB0_19:
	mov	x0, x20
	bl	_av_free
LBB0_20:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_22
; %bb.21:
	mov	w0, #0
	b	LBB0_23
LBB0_22:
	mov	w0, #0
	mov	w8, #2048
	str	w8, [x19, #4]
LBB0_23:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_kAudioConverterCurrentInputStreamDescription,4,2 ; @kAudioConverterCurrentInputStreamDescription
	.comm	_kAudioConverterCurrentOutputStreamDescription,4,2 ; @kAudioConverterCurrentOutputStreamDescription
	.comm	_kAudioConverterOutputChannelLayout,4,2 ; @kAudioConverterOutputChannelLayout
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ffat_compare_channel_descriptions,4,2 ; @ffat_compare_channel_descriptions
	.no_dead_strip	_ffat_update_ctx
.subsections_via_symbols
