	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hdcs_set_state
_hdcs_set_state:                        ## @hdcs_set_state
	.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
	movq	(%rdi), %r12
	movl	(%r12), %eax
	cmpl	%esi, %eax
	je	LBB0_11
## %bb.1:
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_HDCS_STATE_IDLE@GOTPCREL(%rip), %r15
	cmpl	(%r15), %eax
	je	LBB0_4
## %bb.2:
	movq	%rbx, %rdi
	callq	_HDCS_REG_CONTROL
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_stv06xx_write_sensor
	testl	%eax, %eax
	jne	LBB0_12
## %bb.3:
	movl	(%r15), %eax
LBB0_4:
	movl	%eax, (%r12)
	cmpl	%r14d, (%r15)
	je	LBB0_11
## %bb.5:
	cmpl	$128, %r14d
	je	LBB0_6
## %bb.7:
	cmpl	$129, %r14d
	jne	LBB0_13
## %bb.8:
	movq	_HDCS_RUN_ENABLE@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_6:
	movq	_HDCS_SLEEP_MODE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %r15d
	movq	%rbx, %rdi
	callq	_HDCS_REG_CONTROL
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	%r15d, %edx
	callq	_stv06xx_write_sensor
	testl	%eax, %eax
	jne	LBB0_12
## %bb.10:
	movl	%r14d, (%r12)
LBB0_11:
	xorl	%eax, %eax
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_HDCS_STATE_IDLE,4,2            ## @HDCS_STATE_IDLE
	.comm	_HDCS_SLEEP_MODE,4,2            ## @HDCS_SLEEP_MODE
	.comm	_HDCS_RUN_ENABLE,4,2            ## @HDCS_RUN_ENABLE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_hdcs_set_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hdcs_set_state
_hdcs_set_state:                        ; @hdcs_set_state
	.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	x22, [x0]
	ldr	w8, [x22]
	cmp	w8, w1
	b.eq	LBB0_5
; %bb.1:
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, _HDCS_STATE_IDLE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _HDCS_STATE_IDLE@GOTPAGEOFF]
	ldr	w9, [x21]
	cmp	w8, w9
	b.eq	LBB0_4
; %bb.2:
	mov	x0, x20
	bl	_HDCS_REG_CONTROL
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	bl	_stv06xx_write_sensor
	cbnz	w0, LBB0_6
; %bb.3:
	ldr	w8, [x21]
LBB0_4:
	str	w8, [x22]
	ldr	w8, [x21]
	cmp	w8, w19
	b.ne	LBB0_7
LBB0_5:
	mov	w0, #0
LBB0_6:
	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_7:
	cmp	w19, #128
	b.eq	LBB0_10
; %bb.8:
	cmp	w19, #129
	b.ne	LBB0_13
; %bb.9:
Lloh2:
	adrp	x8, _HDCS_RUN_ENABLE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _HDCS_RUN_ENABLE@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:
Lloh4:
	adrp	x8, _HDCS_SLEEP_MODE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _HDCS_SLEEP_MODE@GOTPAGEOFF]
LBB0_11:
	ldr	w21, [x8]
	mov	x0, x20
	bl	_HDCS_REG_CONTROL
	mov	x1, x0
	mov	x0, x20
	mov	x2, x21
	bl	_stv06xx_write_sensor
	cbnz	w0, LBB0_6
; %bb.12:
	str	w19, [x22]
	b	LBB0_6
LBB0_13:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_HDCS_STATE_IDLE,4,2            ; @HDCS_STATE_IDLE
	.comm	_HDCS_SLEEP_MODE,4,2            ; @HDCS_SLEEP_MODE
	.comm	_HDCS_RUN_ENABLE,4,2            ; @HDCS_RUN_ENABLE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_hdcs_set_state
.subsections_via_symbols
