	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tw2804_s_video_routing
_tw2804_s_video_routing:                ## @tw2804_s_video_routing
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_to_state
	movq	%rax, %r12
	movq	%rbx, %rdi
	callq	_v4l2_get_subdevdata
	movq	%rax, %rbx
	testl	%r15d, %r15d
	je	LBB0_8
## %bb.1:
	leal	-1(%r15), %edx
	cmpl	(%r12), %edx
	je	LBB0_8
## %bb.2:
	cmpl	$5, %r15d
	jl	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_4:
	movl	%edx, (%r12)
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	callq	_dev_dbg
	movl	(%r12), %edx
	testl	%edx, %edx
	jne	LBB0_7
## %bb.5:
	movq	_global_registers@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_write_regs
	testq	%rax, %rax
	js	LBB0_17
## %bb.6:
	movl	(%r12), %edx
LBB0_7:
	movq	_channel_registers@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_write_regs
	testq	%rax, %rax
	js	LBB0_15
LBB0_8:
	cmpl	$2, %r14d
	jl	LBB0_10
## %bb.9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
LBB0_19:
	subl	(%rax), %r13d
	jmp	LBB0_20
LBB0_10:
	xorl	%r13d, %r13d
	cmpl	%r14d, 4(%r12)
	je	LBB0_20
## %bb.11:
	movl	(%r12), %edx
	movq	%rbx, %rdi
	movl	$34, %esi
	callq	_read_reg
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	js	LBB0_14
## %bb.12:
	xorl	%ecx, %ecx
	testl	%r14d, %r14d
	setne	%cl
	andl	$-5, %eax
	leal	(%rax,%rcx,4), %edx
	movl	(%r12), %ecx
	movq	%rbx, %rdi
	movl	$34, %esi
	callq	_write_reg
	testl	%eax, %eax
	js	LBB0_16
## %bb.13:
	movl	%r14d, 4(%r12)
	jmp	LBB0_20
LBB0_14:
	movl	%eax, %r13d
	jmp	LBB0_20
LBB0_15:
	movl	(%r12), %edx
	leaq	L_.str.3(%rip), %rsi
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_18
LBB0_16:
	movl	%eax, %r13d
LBB0_20:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_18:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"channel %d is not between 1 and 4!\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"initializing TW2804 channel %d\n"

	.comm	_global_registers,4,2           ## @global_registers
L_.str.2:                               ## @.str.2
	.asciz	"error initializing TW2804 global registers\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_channel_registers,4,2          ## @channel_registers
L_.str.3:                               ## @.str.3
	.asciz	"error initializing TW2804 channel %d\n"

	.no_dead_strip	_tw2804_s_video_routing
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tw2804_s_video_routing
_tw2804_s_video_routing:                ; @tw2804_s_video_routing
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x22, x3
	mov	x19, x1
	mov	x20, x0
	bl	_to_state
	mov	x21, x0
	mov	x0, x20
	bl	_v4l2_get_subdevdata
	mov	x20, x0
	cbz	w22, LBB0_8
; %bb.1:
	sub	w2, w22, #1
	ldr	w8, [x21]
	cmp	w2, w8
	b.eq	LBB0_8
; %bb.2:
	cmp	w22, #5
	b.lt	LBB0_4
; %bb.3:
	str	x22, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
	b	LBB0_9
LBB0_4:
	str	w2, [x21]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	ldr	w2, [x21]
	cbnz	w2, LBB0_7
; %bb.5:
Lloh4:
	adrp	x8, _global_registers@GOTPAGE
Lloh5:
	ldr	x8, [x8, _global_registers@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_write_regs
	tbnz	x0, #63, LBB0_19
; %bb.6:
	ldr	w2, [x21]
LBB0_7:
Lloh7:
	adrp	x8, _channel_registers@GOTPAGE
Lloh8:
	ldr	x8, [x8, _channel_registers@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_write_regs
	tbnz	x0, #63, LBB0_16
LBB0_8:
	cmp	w19, #2
	b.lt	LBB0_11
LBB0_9:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w2, w8
	b	LBB0_18
LBB0_11:
	ldr	w8, [x21, #4]
	cmp	w8, w19
	b.ne	LBB0_13
; %bb.12:
	mov	w2, #0
	b	LBB0_18
LBB0_13:
	ldr	w2, [x21]
	mov	x0, x20
	mov	w1, #34
	bl	_read_reg
	mov	x2, x0
	tbnz	w0, #31, LBB0_18
; %bb.14:
	cmp	w19, #0
	cset	w8, ne
	bfi	w2, w8, #2, #1
	ldr	w3, [x21]
	mov	x0, x20
	mov	w1, #34
	bl	_write_reg
	tbnz	w0, #31, LBB0_17
; %bb.15:
	mov	w2, #0
	str	w19, [x21, #4]
	b	LBB0_18
LBB0_16:
	ldr	w8, [x21]
	str	x8, [sp]
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_20
LBB0_17:
	mov	x2, x0
LBB0_18:
	mov	x0, x2
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_19:
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_20:
	mov	x0, x20
	bl	_dev_err
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_10
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"channel %d is not between 1 and 4!\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"initializing TW2804 channel %d\n"

	.comm	_global_registers,4,2           ; @global_registers
l_.str.2:                               ; @.str.2
	.asciz	"error initializing TW2804 global registers\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_channel_registers,4,2          ; @channel_registers
l_.str.3:                               ; @.str.3
	.asciz	"error initializing TW2804 channel %d\n"

	.no_dead_strip	_tw2804_s_video_routing
.subsections_via_symbols
