	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_device_state
_set_device_state:                      ## @set_device_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	leaq	L_.str(%rip), %rsi
	leaq	-28(%rbp), %rdx
	callq	_sscanf
	cmpl	$1, %eax
	jne	LBB0_3
## %bb.1:
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	js	LBB0_3
## %bb.2:
	cmpl	$2, %eax
	jge	LBB0_3
## %bb.5:
	movq	_quirks@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.6:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_MSI_STANDARD_EC_COMMAND_ADDRESS@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	-32(%rbp), %rsi
	callq	_ec_read
	testl	%eax, %eax
	js	LBB0_10
## %bb.8:
	movl	-32(%rbp), %eax
	xorl	%ecx, %ecx
	testl	%r14d, %eax
	setne	%cl
	cmpl	%ecx, -28(%rbp)
	je	LBB0_11
## %bb.9:
	movl	%r14d, %ecx
	notl	%ecx
	andl	%eax, %ecx
	movl	%eax, %esi
	orl	%r14d, %esi
	testl	%r14d, %eax
	cmovnel	%ecx, %esi
	movl	(%r15), %edi
	callq	_ec_write
	testl	%eax, %eax
	jns	LBB0_11
LBB0_10:
	movl	%eax, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%i"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_quirks,8,3                     ## @quirks
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_MSI_STANDARD_EC_COMMAND_ADDRESS,4,2 ## @MSI_STANDARD_EC_COMMAND_ADDRESS
	.no_dead_strip	_set_device_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_device_state
_set_device_state:                      ; @set_device_state
	.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	x20, x2
	mov	x19, x1
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #12
	bl	_sscanf
	cmp	w0, #1
	b.ne	LBB0_5
; %bb.1:
	ldr	w8, [sp, #12]
	tbnz	w8, #31, LBB0_5
; %bb.2:
	cmp	w8, #2
	b.ge	LBB0_5
; %bb.3:
Lloh2:
	adrp	x8, _quirks@GOTPAGE
Lloh3:
	ldr	x8, [x8, _quirks@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	ldr	x8, [x8]
	cbz	x8, LBB0_8
; %bb.4:
Lloh5:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_7:
	mov	x0, x19
	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_8:
Lloh9:
	adrp	x21, _MSI_STANDARD_EC_COMMAND_ADDRESS@GOTPAGE
Lloh10:
	ldr	x21, [x21, _MSI_STANDARD_EC_COMMAND_ADDRESS@GOTPAGEOFF]
	ldr	w0, [x21]
	add	x1, sp, #8
	bl	_ec_read
	tbnz	w0, #31, LBB0_11
; %bb.9:
	ldp	w8, w11, [sp, #8]
	ands	w9, w8, w20
	cset	w10, ne
	cmp	w11, w10
	b.eq	LBB0_7
; %bb.10:
	bic	w10, w8, w20
	orr	w8, w8, w20
	cmp	w9, #0
	csel	w1, w10, w8, ne
	ldr	w0, [x21]
	bl	_ec_write
	tbz	w0, #31, LBB0_7
LBB0_11:
	mov	x19, x0
	b	LBB0_7
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%i"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_quirks,8,3                     ; @quirks
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_MSI_STANDARD_EC_COMMAND_ADDRESS,4,2 ; @MSI_STANDARD_EC_COMMAND_ADDRESS
	.no_dead_strip	_set_device_state
.subsections_via_symbols
