	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx231xx_set_mode               ## -- Begin function cx231xx_set_mode
	.p2align	4, 0x90
_cx231xx_set_mode:                      ## @cx231xx_set_mode
	.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
	movl	(%rdi), %eax
	xorl	%r14d, %r14d
	cmpl	%esi, %eax
	je	LBB0_18
## %bb.1:
	movq	%rdi, %rbx
	movq	_CX231XX_SUSPEND@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ecx
	cmpl	%esi, %ecx
	jne	LBB0_3
## %bb.2:
	movl	%esi, (%rbx)
	movl	(%rdx), %ecx
	movl	%esi, %eax
LBB0_3:
	cmpl	%ecx, %eax
	jne	LBB0_4
## %bb.5:
	movl	%esi, (%rbx)
	movslq	%esi, %rcx
	movq	_CX231XX_DIGITAL_MODE@GOTPCREL(%rip), %r12
	movl	4(%rbx), %eax
	cmpq	%rcx, (%r12)
	jne	LBB0_11
## %bb.6:
	addl	$-128, %eax
	cmpl	$10, %eax
	ja	LBB0_18
## %bb.7:
	movl	$1696, %ecx                     ## imm = 0x6A0
	btl	%eax, %ecx
	jb	LBB0_14
## %bb.8:
	movl	$321, %ecx                      ## imm = 0x141
	btl	%eax, %ecx
	jb	LBB0_13
## %bb.9:
	movl	$24, %ecx
	btl	%eax, %ecx
	jae	LBB0_18
## %bb.10:
	movq	_POLARIS_AVMODE_DIGITAL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_cx231xx_set_power_mode
	jmp	LBB0_16
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_18
LBB0_11:
	addl	$-128, %eax
	cmpl	$10, %eax
	ja	LBB0_18
## %bb.12:
	movl	$351, %ecx                      ## imm = 0x15F
	btl	%eax, %ecx
	jae	LBB0_13
LBB0_14:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	jmp	LBB0_15
LBB0_13:
	movq	%rbx, %rdi
	movl	$1, %esi
LBB0_15:
	callq	_cx231xx_set_agc_analog_digital_mux_select
LBB0_16:
	movl	%eax, %r15d
	testl	%eax, %eax
	jns	LBB0_18
## %bb.17:
	movl	8(%rbx), %edi
	movslq	(%rbx), %rax
	cmpq	%rax, (%r12)
	leaq	L_.str.1(%rip), %rax
	leaq	L_.str.2(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %ecx
	callq	_dev_err
	movl	%r15d, %r14d
LBB0_18:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CX231XX_SUSPEND,4,2            ## @CX231XX_SUSPEND
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CX231XX_DIGITAL_MODE,8,3       ## @CX231XX_DIGITAL_MODE
	.comm	_POLARIS_AVMODE_DIGITAL,4,2     ## @POLARIS_AVMODE_DIGITAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to set devmode to %s: error: %i"

L_.str.1:                               ## @.str.1
	.asciz	"digital"

L_.str.2:                               ## @.str.2
	.asciz	"analog"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx231xx_set_mode               ; -- Begin function cx231xx_set_mode
	.p2align	2
_cx231xx_set_mode:                      ; @cx231xx_set_mode
	.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
	ldr	w8, [x0]
	cmp	w8, w1
	b.eq	LBB0_17
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x10, _CX231XX_SUSPEND@GOTPAGE
Lloh1:
	ldr	x10, [x10, _CX231XX_SUSPEND@GOTPAGEOFF]
	ldr	w9, [x10]
	cmp	w9, w1
	b.ne	LBB0_3
; %bb.2:
	str	w1, [x19]
	ldr	w9, [x10]
	mov	x8, x1
LBB0_3:
	cmp	w8, w9
	b.ne	LBB0_10
; %bb.4:
	str	w1, [x19]
Lloh2:
	adrp	x21, _CX231XX_DIGITAL_MODE@GOTPAGE
Lloh3:
	ldr	x21, [x21, _CX231XX_DIGITAL_MODE@GOTPAGEOFF]
	ldr	x9, [x21]
	ldr	w8, [x19, #4]
	cmp	x9, w1, sxtw
	b.ne	LBB0_11
; %bb.5:
	mov	w20, #0
	sub	w8, w8, #128
	cmp	w8, #10
	b.hi	LBB0_18
; %bb.6:
	mov	w9, #1
	lsl	w9, w9, w8
	mov	w10, #1696
	tst	w9, w10
	b.ne	LBB0_13
; %bb.7:
	mov	w10, #321
	tst	w9, w10
	b.ne	LBB0_14
; %bb.8:
	mov	w9, #1
	lsl	w8, w9, w8
	tst	w8, #0x18
	b.eq	LBB0_18
; %bb.9:
Lloh4:
	adrp	x8, _POLARIS_AVMODE_DIGITAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _POLARIS_AVMODE_DIGITAL@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_cx231xx_set_power_mode
	b	LBB0_16
LBB0_10:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_18
LBB0_11:
	sub	w8, w8, #128
	cmp	w8, #10
	b.hi	LBB0_17
; %bb.12:
	mov	w9, #1
	lsl	w8, w9, w8
	mov	w9, #351
	tst	w8, w9
	b.eq	LBB0_14
LBB0_13:
	mov	x0, x19
	mov	w1, #0
	b	LBB0_15
LBB0_14:
	mov	x0, x19
	mov	w1, #1
LBB0_15:
	bl	_cx231xx_set_agc_analog_digital_mux_select
LBB0_16:
	mov	x20, x0
	tbnz	w0, #31, LBB0_19
LBB0_17:
	mov	w20, #0
LBB0_18:
	mov	x0, x20
	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
LBB0_19:
	ldr	w0, [x19, #8]
	ldrsw	x8, [x19]
	ldr	x9, [x21]
Lloh10:
	adrp	x10, l_.str.2@PAGE
Lloh11:
	add	x10, x10, l_.str.2@PAGEOFF
Lloh12:
	adrp	x11, l_.str.1@PAGE
Lloh13:
	add	x11, x11, l_.str.1@PAGEOFF
	cmp	x9, x8
	csel	x2, x11, x10, eq
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x20
	bl	_dev_err
	b	LBB0_18
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_CX231XX_SUSPEND,4,2            ; @CX231XX_SUSPEND
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CX231XX_DIGITAL_MODE,8,3       ; @CX231XX_DIGITAL_MODE
	.comm	_POLARIS_AVMODE_DIGITAL,4,2     ; @POLARIS_AVMODE_DIGITAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to set devmode to %s: error: %i"

l_.str.1:                               ; @.str.1
	.asciz	"digital"

l_.str.2:                               ; @.str.2
	.asciz	"analog"

.subsections_via_symbols
