	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function opt3001_write_event_config
_opt3001_write_event_config:            ## @opt3001_write_event_config
	.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	%r8d, %r12d
	callq	_iio_priv
	movq	%rax, %r15
	movq	(%rax), %rax
	testl	%r12d, %r12d
	je	LBB0_2
## %bb.1:
	movq	_OPT3001_CONFIGURATION_M_CONTINUOUS@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_2:
	movq	_OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPCREL(%rip), %rcx
LBB0_3:
	xorl	%ebx, %ebx
	cmpq	(%rcx), %rax
	je	LBB0_10
## %bb.4:
	movq	%r15, %r14
	addq	$8, %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_OPT3001_CONFIGURATION_M_CONTINUOUS@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	_OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	16(%r15), %edi
	movq	_OPT3001_CONFIGURATION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_i2c_smbus_read_word_swapped
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	testl	%r12d, %r12d
	cmovel	-56(%rbp), %r13d                ## 4-byte Folded Reload
	movl	%ebx, -44(%rbp)
	leaq	-44(%rbp), %rsi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_opt3001_set_mode
	movl	16(%r15), %edi
	movq	_OPT3001_CONFIGURATION@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movl	-44(%rbp), %edx
	callq	_i2c_smbus_write_word_swapped
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_9
## %bb.7:
	movl	12(%r15), %edi
	movl	(%r12), %edx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_8
LBB0_5:
	movl	12(%r15), %edi
	movq	_OPT3001_CONFIGURATION@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str(%rip), %rsi
LBB0_8:
	callq	_dev_err
LBB0_9:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_10:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_OPT3001_CONFIGURATION_M_CONTINUOUS,8,3 ## @OPT3001_CONFIGURATION_M_CONTINUOUS
	.comm	_OPT3001_CONFIGURATION_M_SHUTDOWN,8,3 ## @OPT3001_CONFIGURATION_M_SHUTDOWN
	.comm	_OPT3001_CONFIGURATION,4,2      ## @OPT3001_CONFIGURATION
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to read register %02x\n"

L_.str.1:                               ## @.str.1
	.asciz	"failed to write register %02x\n"

	.no_dead_strip	_opt3001_write_event_config
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function opt3001_write_event_config
_opt3001_write_event_config:            ; @opt3001_write_event_config
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x22, x4
	bl	_iio_priv
	mov	x20, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x21, _OPT3001_CONFIGURATION_M_CONTINUOUS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _OPT3001_CONFIGURATION_M_CONTINUOUS@GOTPAGEOFF]
	cbz	w22, LBB0_3
; %bb.1:
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_4
LBB0_2:
	mov	w21, #0
	b	LBB0_10
LBB0_3:
Lloh2:
	adrp	x9, _OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPAGE
Lloh3:
	ldr	x9, [x9, _OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_2
LBB0_4:
	add	x19, x20, #8
	mov	x0, x19
	bl	_mutex_lock
Lloh5:
	adrp	x8, _OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPAGE
Lloh6:
	ldr	x8, [x8, _OPT3001_CONFIGURATION_M_SHUTDOWN@GOTPAGEOFF]
	ldr	x24, [x21]
Lloh7:
	ldr	x25, [x8]
	ldr	w0, [x20, #16]
Lloh8:
	adrp	x23, _OPT3001_CONFIGURATION@GOTPAGE
Lloh9:
	ldr	x23, [x23, _OPT3001_CONFIGURATION@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_i2c_smbus_read_word_swapped
	mov	x21, x0
	tbnz	w0, #31, LBB0_7
; %bb.5:
	cmp	w22, #0
	csel	w2, w25, w24, eq
	str	w21, [sp, #12]
	add	x1, sp, #12
	mov	x0, x20
	bl	_opt3001_set_mode
	ldr	w0, [x20, #16]
	ldr	w1, [x23]
	ldr	w2, [sp, #12]
	bl	_i2c_smbus_write_word_swapped
	mov	x21, x0
	tbz	w0, #31, LBB0_9
; %bb.6:
	ldr	w0, [x20, #12]
	ldr	w2, [x23]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_7:
	ldr	w0, [x20, #12]
	ldr	w2, [x23]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
LBB0_8:
	bl	_dev_err
LBB0_9:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_10:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_OPT3001_CONFIGURATION_M_CONTINUOUS,8,3 ; @OPT3001_CONFIGURATION_M_CONTINUOUS
	.comm	_OPT3001_CONFIGURATION_M_SHUTDOWN,8,3 ; @OPT3001_CONFIGURATION_M_SHUTDOWN
	.comm	_OPT3001_CONFIGURATION,4,2      ; @OPT3001_CONFIGURATION
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to read register %02x\n"

l_.str.1:                               ; @.str.1
	.asciz	"failed to write register %02x\n"

	.no_dead_strip	_opt3001_write_event_config
.subsections_via_symbols
