	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function adv7393_setstd
_adv7393_setstd:                        ## @adv7393_setstd
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r15
	callq	_to_state
	movq	%rax, %r14
	movq	_stdinfo@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_1
## %bb.6:
	movq	(%rbx), %rdx
	movl	%eax, %esi
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	testl	%r12d, (%rdx)
	jne	LBB0_2
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	incq	%rcx
	addq	$12, %rdx
	cmpq	%rcx, %rsi
	jne	LBB0_7
	jmp	LBB0_9
LBB0_1:
	xorl	%ecx, %ecx
LBB0_2:
	cmpl	%eax, %ecx
	jne	LBB0_3
LBB0_9:
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movslq	%r12d, %r8
	leaq	L_.str(%rip), %rcx
	movl	$1, %edi
	movq	%r15, %rdx
	callq	_v4l2_dbg
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_18
LBB0_3:
	movq	(%rbx), %rdx
	movl	%ecx, %eax
	movq	_SD_STD_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	notl	%ebx
	andl	(%r14), %ebx
	leaq	(%rax,%rax,2), %rax
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	orl	4(%rdx,%rax,4), %ebx
	movq	_ADV7393_SD_MODE_REG1@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_adv7393_write
	testl	%eax, %eax
	js	LBB0_4
## %bb.10:
	movl	%ebx, (%r14)
	movq	_INPUT_MODE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	notl	%ebx
	andl	4(%r14), %ebx
	movq	_SD_INPUT_MODE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_ADV7393_MODE_SELECT_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_adv7393_write
	testl	%eax, %eax
	js	LBB0_4
## %bb.11:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, 4(%r14)
	movq	_ADV7393_FSC_REG0@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_ADV7393_FSC_REG3@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jg	LBB0_15
## %bb.12:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	8(%rax,%rcx,4), %r14d
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%r14d, %edx
	callq	_adv7393_write
	testl	%eax, %eax
	js	LBB0_4
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	sarl	$8, %r14d
	leaq	1(%rbx), %rax
	movq	_ADV7393_FSC_REG3@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	movq	%rax, %rbx
	jl	LBB0_13
LBB0_15:
	movq	_V4L2_STD_NTSC@GOTPCREL(%rip), %rax
	movq	_V4L2_STD_NTSC_443@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	8(%r14), %ebx
	movq	_SD_PEDESTAL_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%ebx, %eax
	movq	_SD_PEDESTAL_DI@GOTPCREL(%rip), %rdx
	andl	(%rdx), %ebx
	testl	%r12d, %ecx
	cmovnel	%eax, %ebx
	movq	_ADV7393_SD_MODE_REG2@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_adv7393_write
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_5
## %bb.16:
	movl	%ebx, 8(%r14)
	jne	LBB0_5
## %bb.17:
	xorl	%r13d, %r13d
	jmp	LBB0_18
LBB0_4:
	movl	%eax, %r13d
LBB0_5:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	callq	_v4l2_err
LBB0_18:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_stdinfo,8,3                    ## @stdinfo
	.comm	_debug,4,2                      ## @debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid std or std is not supported: %llx\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SD_STD_MASK,4,2                ## @SD_STD_MASK
	.comm	_ADV7393_SD_MODE_REG1,8,3       ## @ADV7393_SD_MODE_REG1
	.comm	_INPUT_MODE_MASK,4,2            ## @INPUT_MODE_MASK
	.comm	_SD_INPUT_MODE,4,2              ## @SD_INPUT_MODE
	.comm	_ADV7393_MODE_SELECT_REG,8,3    ## @ADV7393_MODE_SELECT_REG
	.comm	_ADV7393_FSC_REG0,8,3           ## @ADV7393_FSC_REG0
	.comm	_ADV7393_FSC_REG3,8,3           ## @ADV7393_FSC_REG3
	.comm	_V4L2_STD_NTSC,4,2              ## @V4L2_STD_NTSC
	.comm	_V4L2_STD_NTSC_443,4,2          ## @V4L2_STD_NTSC_443
	.comm	_SD_PEDESTAL_EN,4,2             ## @SD_PEDESTAL_EN
	.comm	_SD_PEDESTAL_DI,4,2             ## @SD_PEDESTAL_DI
	.comm	_ADV7393_SD_MODE_REG2,8,3       ## @ADV7393_SD_MODE_REG2
L_.str.1:                               ## @.str.1
	.asciz	"Error setting std, write failed\n"

	.no_dead_strip	_adv7393_setstd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function adv7393_setstd
_adv7393_setstd:                        ; @adv7393_setstd
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x1
	mov	x19, x0
	bl	_to_state
	mov	x20, x0
Lloh0:
	adrp	x22, _stdinfo@GOTPAGE
Lloh1:
	ldr	x22, [x22, _stdinfo@GOTPAGEOFF]
	ldr	x0, [x22]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x24, #0
	ldr	x8, [x22]
	mov	w9, w0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8]
	tst	w10, w21
	b.ne	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x24, x24, #1
	add	x8, x8, #12
	cmp	x9, x24
	b.ne	LBB0_2
	b	LBB0_6
LBB0_4:
	mov	w24, #0
LBB0_5:
	cmp	w24, w0
	b.ne	LBB0_7
LBB0_6:
Lloh2:
	adrp	x8, _debug@GOTPAGE
Lloh3:
	ldr	x8, [x8, _debug@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	sxtw	x4, w21
Lloh5:
	adrp	x3, l_.str@PAGE
Lloh6:
	add	x3, x3, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x19
	bl	_v4l2_dbg
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_17
LBB0_7:
	ldr	x25, [x22]
	ldr	w8, [x20]
Lloh10:
	adrp	x9, _SD_STD_MASK@GOTPAGE
Lloh11:
	ldr	x9, [x9, _SD_STD_MASK@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	bic	w8, w8, w9
	mov	w9, #12
	umaddl	x9, w24, w9, x25
	ldr	w9, [x9, #4]
	orr	w23, w8, w9
Lloh13:
	adrp	x8, _ADV7393_SD_MODE_REG1@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ADV7393_SD_MODE_REG1@GOTPAGEOFF]
Lloh15:
	ldr	x1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_adv7393_write
	tbnz	w0, #31, LBB0_15
; %bb.8:
	str	w23, [x20]
	ldr	w8, [x20, #4]
Lloh16:
	adrp	x9, _INPUT_MODE_MASK@GOTPAGE
Lloh17:
	ldr	x9, [x9, _INPUT_MODE_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
Lloh19:
	adrp	x10, _SD_INPUT_MODE@GOTPAGE
Lloh20:
	ldr	x10, [x10, _SD_INPUT_MODE@GOTPAGEOFF]
	bic	w8, w8, w9
Lloh21:
	ldr	w9, [x10]
	orr	w23, w8, w9
Lloh22:
	adrp	x8, _ADV7393_MODE_SELECT_REG@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ADV7393_MODE_SELECT_REG@GOTPAGEOFF]
Lloh24:
	ldr	x1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_adv7393_write
	tbnz	w0, #31, LBB0_15
; %bb.9:
Lloh25:
	adrp	x8, _ADV7393_FSC_REG0@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ADV7393_FSC_REG0@GOTPAGEOFF]
	str	w23, [x20, #4]
Lloh27:
	ldr	x23, [x8]
Lloh28:
	adrp	x26, _ADV7393_FSC_REG3@GOTPAGE
Lloh29:
	ldr	x26, [x26, _ADV7393_FSC_REG3@GOTPAGEOFF]
	ldr	x8, [x26]
	cmp	x23, x8
	b.gt	LBB0_13
; %bb.10:
	mov	w8, w24
	mov	w9, #12
	madd	x8, x8, x9, x25
	ldr	w24, [x8, #8]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x23
	mov	x2, x24
	bl	_adv7393_write
	tbnz	w0, #31, LBB0_15
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	asr	w24, w24, #8
	add	x8, x23, #1
	ldr	x9, [x26]
	cmp	x23, x9
	mov	x23, x8
	b.lt	LBB0_11
LBB0_13:
	ldr	w8, [x20, #8]
Lloh30:
	adrp	x9, _V4L2_STD_NTSC@GOTPAGE
Lloh31:
	ldr	x9, [x9, _V4L2_STD_NTSC@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
Lloh33:
	adrp	x10, _V4L2_STD_NTSC_443@GOTPAGE
Lloh34:
	ldr	x10, [x10, _V4L2_STD_NTSC_443@GOTPAGEOFF]
Lloh35:
	ldr	w10, [x10]
Lloh36:
	adrp	x11, _SD_PEDESTAL_EN@GOTPAGE
Lloh37:
	ldr	x11, [x11, _SD_PEDESTAL_EN@GOTPAGEOFF]
	orr	w9, w10, w9
Lloh38:
	ldr	w10, [x11]
	orr	w10, w10, w8
Lloh39:
	adrp	x11, _SD_PEDESTAL_DI@GOTPAGE
Lloh40:
	ldr	x11, [x11, _SD_PEDESTAL_DI@GOTPAGEOFF]
Lloh41:
	ldr	w11, [x11]
	and	w8, w11, w8
	tst	w9, w21
	csel	w21, w8, w10, eq
Lloh42:
	adrp	x8, _ADV7393_SD_MODE_REG2@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ADV7393_SD_MODE_REG2@GOTPAGEOFF]
Lloh44:
	ldr	x1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_adv7393_write
	mov	x22, x0
	tbnz	w0, #31, LBB0_16
; %bb.14:
	str	w21, [x20, #8]
	cbnz	w22, LBB0_16
	b	LBB0_17
LBB0_15:
	mov	x22, x0
LBB0_16:
Lloh45:
	adrp	x1, l_.str.1@PAGE
Lloh46:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_v4l2_err
LBB0_17:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_stdinfo,8,3                    ; @stdinfo
	.comm	_debug,4,2                      ; @debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid std or std is not supported: %llx\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SD_STD_MASK,4,2                ; @SD_STD_MASK
	.comm	_ADV7393_SD_MODE_REG1,8,3       ; @ADV7393_SD_MODE_REG1
	.comm	_INPUT_MODE_MASK,4,2            ; @INPUT_MODE_MASK
	.comm	_SD_INPUT_MODE,4,2              ; @SD_INPUT_MODE
	.comm	_ADV7393_MODE_SELECT_REG,8,3    ; @ADV7393_MODE_SELECT_REG
	.comm	_ADV7393_FSC_REG0,8,3           ; @ADV7393_FSC_REG0
	.comm	_ADV7393_FSC_REG3,8,3           ; @ADV7393_FSC_REG3
	.comm	_V4L2_STD_NTSC,4,2              ; @V4L2_STD_NTSC
	.comm	_V4L2_STD_NTSC_443,4,2          ; @V4L2_STD_NTSC_443
	.comm	_SD_PEDESTAL_EN,4,2             ; @SD_PEDESTAL_EN
	.comm	_SD_PEDESTAL_DI,4,2             ; @SD_PEDESTAL_DI
	.comm	_ADV7393_SD_MODE_REG2,8,3       ; @ADV7393_SD_MODE_REG2
l_.str.1:                               ; @.str.1
	.asciz	"Error setting std, write failed\n"

	.no_dead_strip	_adv7393_setstd
.subsections_via_symbols
