	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kmx61_chip_init
_kmx61_chip_init:                       ## @kmx61_chip_init
	.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, %r14
	movq	16(%rdi), %rdi
	movq	_KMX61_REG_WHO_AM_I@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_8
## %bb.1:
	movq	_KMX61_CHIP_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	%ecx, %ebx
	jne	LBB0_10
## %bb.2:
	movq	_KMX61_RANGE_4G@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_kmx61_set_range
	testl	%eax, %eax
	js	LBB0_15
## %bb.3:
	movq	16(%r14), %rdi
	movq	_KMX61_REG_ODCNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_12
## %bb.4:
	movl	%ebx, (%r14)
	movq	_KMX61_ACC@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	leaq	-32(%rbp), %rsi
	leaq	-28(%rbp), %rdx
	movq	%r14, %rdi
	callq	_kmx61_get_odr
	testl	%eax, %eax
	js	LBB0_15
## %bb.5:
	movl	-32(%rbp), %esi
	movl	-28(%rbp), %edx
	movq	%r14, %rdi
	callq	_kmx61_set_wake_up_odr
	testl	%eax, %eax
	js	LBB0_15
## %bb.6:
	movq	_KMX61_MAG@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	(%r15), %edx
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$1, %ecx
	callq	_kmx61_set_mode
	testl	%eax, %eax
	js	LBB0_15
## %bb.7:
	movq	_KMX61_DEFAULT_WAKE_THRESH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movq	_KMX61_DEFAULT_WAKE_DURATION@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%r14)
	jmp	LBB0_16
LBB0_8:
	movq	16(%r14), %rdi
	leaq	L_.str(%rip), %rsi
LBB0_9:
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_16
LBB0_10:
	movq	16(%r14), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	movl	%r14d, %ebx
	jmp	LBB0_16
LBB0_15:
	movl	%eax, %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	16(%r14), %rdi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_KMX61_REG_WHO_AM_I,4,2         ## @KMX61_REG_WHO_AM_I
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error reading who_am_i\n"

	.comm	_KMX61_CHIP_ID,4,2              ## @KMX61_CHIP_ID
L_.str.1:                               ## @.str.1
	.asciz	"Wrong chip id, got %x expected %x\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_KMX61_RANGE_4G,4,2             ## @KMX61_RANGE_4G
	.comm	_KMX61_REG_ODCNTL,4,2           ## @KMX61_REG_ODCNTL
L_.str.2:                               ## @.str.2
	.asciz	"Error reading reg_odcntl\n"

	.comm	_KMX61_ACC,4,2                  ## @KMX61_ACC
	.comm	_KMX61_MAG,4,2                  ## @KMX61_MAG
	.comm	_KMX61_DEFAULT_WAKE_THRESH,4,2  ## @KMX61_DEFAULT_WAKE_THRESH
	.comm	_KMX61_DEFAULT_WAKE_DURATION,4,2 ## @KMX61_DEFAULT_WAKE_DURATION
	.no_dead_strip	_kmx61_chip_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kmx61_chip_init
_kmx61_chip_init:                       ; @kmx61_chip_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
	ldr	x0, [x0, #16]
Lloh0:
	adrp	x8, _KMX61_REG_WHO_AM_I@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KMX61_REG_WHO_AM_I@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_i2c_smbus_read_byte_data
	mov	x20, x0
	tbnz	w0, #31, LBB0_8
; %bb.1:
Lloh3:
	adrp	x8, _KMX61_CHIP_ID@GOTPAGE
Lloh4:
	ldr	x8, [x8, _KMX61_CHIP_ID@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_9
; %bb.2:
Lloh6:
	adrp	x8, _KMX61_RANGE_4G@GOTPAGE
Lloh7:
	ldr	x8, [x8, _KMX61_RANGE_4G@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_kmx61_set_range
	tbnz	w0, #31, LBB0_10
; %bb.3:
	ldr	x0, [x19, #16]
Lloh9:
	adrp	x8, _KMX61_REG_ODCNTL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KMX61_REG_ODCNTL@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_i2c_smbus_read_byte_data
	mov	x20, x0
	tbnz	w0, #31, LBB0_11
; %bb.4:
	str	w20, [x19]
Lloh12:
	adrp	x21, _KMX61_ACC@GOTPAGE
Lloh13:
	ldr	x21, [x21, _KMX61_ACC@GOTPAGEOFF]
	ldr	w3, [x21]
	add	x1, sp, #28
	add	x2, sp, #24
	mov	x0, x19
	bl	_kmx61_get_odr
	tbnz	w0, #31, LBB0_10
; %bb.5:
	ldp	w2, w1, [sp, #24]
	mov	x0, x19
	bl	_kmx61_set_wake_up_odr
	tbnz	w0, #31, LBB0_10
; %bb.6:
	ldr	w8, [x21]
Lloh14:
	adrp	x9, _KMX61_MAG@GOTPAGE
Lloh15:
	ldr	x9, [x9, _KMX61_MAG@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	mov	w1, #0
	mov	w3, #1
	bl	_kmx61_set_mode
	tbnz	w0, #31, LBB0_10
; %bb.7:
	mov	w20, #0
Lloh17:
	adrp	x8, _KMX61_DEFAULT_WAKE_THRESH@GOTPAGE
Lloh18:
	ldr	x8, [x8, _KMX61_DEFAULT_WAKE_THRESH@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
Lloh20:
	adrp	x9, _KMX61_DEFAULT_WAKE_DURATION@GOTPAGE
Lloh21:
	ldr	x9, [x9, _KMX61_DEFAULT_WAKE_DURATION@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #4]
	b	LBB0_12
LBB0_8:
	ldr	x0, [x19, #16]
Lloh23:
	adrp	x1, l_.str@PAGE
Lloh24:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_12
LBB0_9:
	ldr	x0, [x19, #16]
	stp	x20, x8, [sp]
Lloh25:
	adrp	x1, l_.str.1@PAGE
Lloh26:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh27:
	adrp	x8, _EINVAL@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_12
LBB0_10:
	mov	x20, x0
	b	LBB0_12
LBB0_11:
	ldr	x0, [x19, #16]
Lloh30:
	adrp	x1, l_.str.2@PAGE
Lloh31:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
LBB0_12:
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_KMX61_REG_WHO_AM_I,4,2         ; @KMX61_REG_WHO_AM_I
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error reading who_am_i\n"

	.comm	_KMX61_CHIP_ID,4,2              ; @KMX61_CHIP_ID
l_.str.1:                               ; @.str.1
	.asciz	"Wrong chip id, got %x expected %x\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_KMX61_RANGE_4G,4,2             ; @KMX61_RANGE_4G
	.comm	_KMX61_REG_ODCNTL,4,2           ; @KMX61_REG_ODCNTL
l_.str.2:                               ; @.str.2
	.asciz	"Error reading reg_odcntl\n"

	.comm	_KMX61_ACC,4,2                  ; @KMX61_ACC
	.comm	_KMX61_MAG,4,2                  ; @KMX61_MAG
	.comm	_KMX61_DEFAULT_WAKE_THRESH,4,2  ; @KMX61_DEFAULT_WAKE_THRESH
	.comm	_KMX61_DEFAULT_WAKE_DURATION,4,2 ; @KMX61_DEFAULT_WAKE_DURATION
	.no_dead_strip	_kmx61_chip_init
.subsections_via_symbols
