	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_device
_init_device:                           ## @init_device
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_adv7180_set_power_pin
	movq	_ADV7180_REG_PWR_MAN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ADV7180_PWR_MAN_RES@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_adv7180_write
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	movq	16(%r15), %rax
	movq	%r15, %rdi
	callq	*(%rax)
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.1:
	movq	%r15, %rdi
	callq	_adv7180_program_std
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.2:
	movq	%r15, %rdi
	callq	_adv7180_set_field_mode
	cmpq	$0, (%r15)
	jle	LBB0_3
## %bb.4:
	movq	_ADV7180_REG_ICONF1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ADV7180_ICONF1_ACTIVE_LOW@GOTPCREL(%rip), %rax
	movq	_ADV7180_ICONF1_PSYNC_ONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_adv7180_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.5:
	movq	_ADV7180_REG_IMR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_adv7180_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.6:
	movq	_ADV7180_REG_IMR2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_adv7180_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.7:
	movq	_ADV7180_REG_IMR3@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ADV7180_IRQ3_AD_CHANGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_adv7180_write
	testl	%eax, %eax
	js	LBB0_9
## %bb.8:
	movq	_ADV7180_REG_IMR4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_adv7180_write
LBB0_9:
	movl	%eax, %ebx
	jmp	LBB0_10
LBB0_3:
	xorl	%ebx, %ebx
LBB0_10:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ADV7180_REG_PWR_MAN,4,2        ## @ADV7180_REG_PWR_MAN
	.comm	_ADV7180_PWR_MAN_RES,4,2        ## @ADV7180_PWR_MAN_RES
	.comm	_ADV7180_REG_ICONF1,4,2         ## @ADV7180_REG_ICONF1
	.comm	_ADV7180_ICONF1_ACTIVE_LOW,4,2  ## @ADV7180_ICONF1_ACTIVE_LOW
	.comm	_ADV7180_ICONF1_PSYNC_ONLY,4,2  ## @ADV7180_ICONF1_PSYNC_ONLY
	.comm	_ADV7180_REG_IMR1,4,2           ## @ADV7180_REG_IMR1
	.comm	_ADV7180_REG_IMR2,4,2           ## @ADV7180_REG_IMR2
	.comm	_ADV7180_REG_IMR3,4,2           ## @ADV7180_REG_IMR3
	.comm	_ADV7180_IRQ3_AD_CHANGE,4,2     ## @ADV7180_IRQ3_AD_CHANGE
	.comm	_ADV7180_REG_IMR4,4,2           ## @ADV7180_REG_IMR4
	.no_dead_strip	_init_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_device
_init_device:                           ; @init_device
	.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	x20, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x20
	mov	w1, #1
	bl	_adv7180_set_power_pin
Lloh0:
	adrp	x8, _ADV7180_REG_PWR_MAN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ADV7180_REG_PWR_MAN@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _ADV7180_PWR_MAN_RES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ADV7180_PWR_MAN_RES@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_adv7180_write
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	ldr	x8, [x20, #16]
	ldr	x8, [x8]
	mov	x0, x20
	blr	x8
	mov	x21, x0
	cbnz	w0, LBB0_10
; %bb.1:
	mov	x0, x20
	bl	_adv7180_program_std
	mov	x21, x0
	cbnz	w0, LBB0_10
; %bb.2:
	mov	x0, x20
	bl	_adv7180_set_field_mode
	ldr	x8, [x20]
	cmp	x8, #1
	b.lt	LBB0_9
; %bb.3:
Lloh6:
	adrp	x8, _ADV7180_REG_ICONF1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ADV7180_REG_ICONF1@GOTPAGEOFF]
Lloh8:
	adrp	x9, _ADV7180_ICONF1_ACTIVE_LOW@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ADV7180_ICONF1_ACTIVE_LOW@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	ldr	w8, [x9]
Lloh12:
	adrp	x9, _ADV7180_ICONF1_PSYNC_ONLY@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ADV7180_ICONF1_PSYNC_ONLY@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x20
	bl	_adv7180_write
	tbnz	w0, #31, LBB0_8
; %bb.4:
Lloh15:
	adrp	x8, _ADV7180_REG_IMR1@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ADV7180_REG_IMR1@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_adv7180_write
	tbnz	w0, #31, LBB0_8
; %bb.5:
Lloh18:
	adrp	x8, _ADV7180_REG_IMR2@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ADV7180_REG_IMR2@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_adv7180_write
	tbnz	w0, #31, LBB0_8
; %bb.6:
Lloh21:
	adrp	x8, _ADV7180_REG_IMR3@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ADV7180_REG_IMR3@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _ADV7180_IRQ3_AD_CHANGE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ADV7180_IRQ3_AD_CHANGE@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_adv7180_write
	tbnz	w0, #31, LBB0_8
; %bb.7:
Lloh27:
	adrp	x8, _ADV7180_REG_IMR4@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ADV7180_REG_IMR4@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_adv7180_write
LBB0_8:
	mov	x21, x0
	b	LBB0_10
LBB0_9:
	mov	w21, #0
LBB0_10:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	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	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_ADV7180_REG_PWR_MAN,4,2        ; @ADV7180_REG_PWR_MAN
	.comm	_ADV7180_PWR_MAN_RES,4,2        ; @ADV7180_PWR_MAN_RES
	.comm	_ADV7180_REG_ICONF1,4,2         ; @ADV7180_REG_ICONF1
	.comm	_ADV7180_ICONF1_ACTIVE_LOW,4,2  ; @ADV7180_ICONF1_ACTIVE_LOW
	.comm	_ADV7180_ICONF1_PSYNC_ONLY,4,2  ; @ADV7180_ICONF1_PSYNC_ONLY
	.comm	_ADV7180_REG_IMR1,4,2           ; @ADV7180_REG_IMR1
	.comm	_ADV7180_REG_IMR2,4,2           ; @ADV7180_REG_IMR2
	.comm	_ADV7180_REG_IMR3,4,2           ; @ADV7180_REG_IMR3
	.comm	_ADV7180_IRQ3_AD_CHANGE,4,2     ; @ADV7180_IRQ3_AD_CHANGE
	.comm	_ADV7180_REG_IMR4,4,2           ; @ADV7180_REG_IMR4
	.no_dead_strip	_init_device
.subsections_via_symbols
