	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_msp_set_scart                  ## -- Begin function msp_set_scart
	.p2align	4, 0x90
_msp_set_scart:                         ## @msp_set_scart
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movl	%esi, %r12d
	movq	%rdi, %r14
	callq	_i2c_get_clientdata
	movl	%eax, %edi
	callq	_to_state
	movq	%rax, %rbx
	movl	%r12d, (%rax)
	cmpl	$7, %r12d
	ja	LBB0_4
## %bb.1:
	cmpl	$2, %r15d
	ja	LBB0_4
## %bb.2:
	movq	_scarts@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r15d, %ecx
	movq	(%rax,%rcx,8), %rcx
	movl	%r12d, %edx
	cmpl	$-1, 4(%rcx,%rdx,4)
	je	LBB0_6
## %bb.3:
	incq	%rdx
	movl	(%rcx), %eax
	notl	%eax
	andl	4(%rbx), %eax
	movl	%eax, 4(%rbx)
	orl	(%rcx,%rdx,4), %eax
	movl	%eax, 4(%rbx)
	jmp	LBB0_5
LBB0_4:
	movl	$3936, 4(%rbx)                  ## imm = 0xF60
	movl	$3936, %eax                     ## imm = 0xF60
LBB0_5:
	movq	_msp_debug@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_scart_names@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	%r12d, %rsi
	movl	(%rcx,%rsi,4), %r8d
	movl	%eax, (%rsp)
	leaq	L_.str(%rip), %rcx
	movq	%r14, %rdi
	movl	$1, %esi
	movl	%r15d, %r9d
	callq	_dev_dbg_lvl
	movl	4(%rbx), %edx
	movq	%r14, %rdi
	movl	$19, %esi
	callq	_msp_write_dsp
	cmpq	$0, 16(%rbx)
	je	LBB0_6
## %bb.7:
	movl	8(%rbx), %edx
	movq	%r14, %rdi
	movl	$64, %esi
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_msp_write_dem                  ## TAILCALL
LBB0_6:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_scarts,8,3                     ## @scarts
	.comm	_msp_debug,4,2                  ## @msp_debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"scart switch: %s => %d (ACB=0x%04x)\n"

	.comm	_scart_names,8,3                ## @scart_names
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_msp_set_scart                  ; -- Begin function msp_set_scart
	.p2align	2
_msp_set_scart:                         ; @msp_set_scart
	.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	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	_i2c_get_clientdata
	bl	_to_state
	mov	x20, x0
	str	w22, [x0]
	cmp	w22, #7
	b.hi	LBB0_4
; %bb.1:
	cmp	w21, #2
	b.hi	LBB0_4
; %bb.2:
Lloh0:
	adrp	x8, _scarts@GOTPAGE
Lloh1:
	ldr	x8, [x8, _scarts@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x8, [x8, w21, uxtw #3]
	add	w9, w22, #1
	ldr	w10, [x8, w9, uxtw #2]
	cmn	w10, #1
	b.eq	LBB0_7
; %bb.3:
	ldr	w10, [x8]
	ldr	w11, [x20, #4]
	bic	w10, w11, w10
	str	w10, [x20, #4]
	ldr	w8, [x8, x9, lsl #2]
	orr	w6, w8, w10
	b	LBB0_5
LBB0_4:
	mov	w6, #3936
LBB0_5:
	str	w6, [x20, #4]
Lloh3:
	adrp	x8, _msp_debug@GOTPAGE
Lloh4:
	ldr	x8, [x8, _msp_debug@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
Lloh6:
	adrp	x8, _scart_names@GOTPAGE
Lloh7:
	ldr	x8, [x8, _scart_names@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	ldr	w4, [x8, w22, sxtw #2]
Lloh9:
	adrp	x3, l_.str@PAGE
Lloh10:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x19
	mov	w1, #1
	mov	x5, x21
	bl	_dev_dbg_lvl
	ldr	w2, [x20, #4]
	mov	x0, x19
	mov	w1, #19
	bl	_msp_write_dsp
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w2, [x20, #8]
	mov	x0, x19
	mov	w1, #64
	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	_msp_write_dem
LBB0_7:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_scarts,8,3                     ; @scarts
	.comm	_msp_debug,4,2                  ; @msp_debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"scart switch: %s => %d (ACB=0x%04x)\n"

	.comm	_scart_names,8,3                ; @scart_names
.subsections_via_symbols
