	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function abituguru_write
_abituguru_write:                       ## @abituguru_write
	.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, -64(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r13
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	movq	_ABIT_UGURU_READY_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	_ABIT_UGURU_MAX_RETRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_abituguru_send_address
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_17
## %bb.1:
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	testl	%ecx, %ecx
	jle	LBB0_2
## %bb.3:
	movl	%ecx, %r14d
	xorl	%ebx, %ebx
	movl	%eax, %r15d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	_ABIT_UGURU_STATUS_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_abituguru_wait
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	(%r13,%rbx,8), %rdi
	movq	_ABIT_UGURU_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r12), %rsi
	callq	_outb
	incq	%rbx
	cmpq	%rbx, %r14
	jne	LBB0_4
## %bb.7:
	movl	%r14d, %ebx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_8
LBB0_2:
	xorl	%ebx, %ebx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	%eax, %r15d
	jmp	LBB0_8
LBB0_5:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movl	%r14d, %edx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movl	%r13d, %ecx
	callq	_ABIT_UGURU_DEBUG
LBB0_8:
	movq	_ABIT_UGURU_STATUS_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_abituguru_wait
	testq	%rax, %rax
	je	LBB0_9
## %bb.13:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	movl	%r14d, %edx
LBB0_14:
	movl	%r13d, %ecx
	callq	_ABIT_UGURU_DEBUG
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_9:
	movq	_ABIT_UGURU_CMD@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rdi
	addq	(%r12), %rdi
	callq	_inb_p
	cmpl	$172, %eax
	je	LBB0_16
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	decl	%r15d
	je	LBB0_12
## %bb.15:                              ##   in Loop: Header=BB0_10 Depth=1
	xorl	%edi, %edi
	callq	_msleep
	jmp	LBB0_10
LBB0_16:
	movq	%r12, %rdi
	callq	_abituguru_ready
LBB0_17:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_ABIT_UGURU_READY_TIMEOUT,4,2   ## @ABIT_UGURU_READY_TIMEOUT
	.comm	_ABIT_UGURU_MAX_RETRIES,4,2     ## @ABIT_UGURU_MAX_RETRIES
	.comm	_ABIT_UGURU_STATUS_WRITE,4,2    ## @ABIT_UGURU_STATUS_WRITE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"timeout exceeded waiting for write state (bank: %d, sensor: %d)\n"

	.comm	_ABIT_UGURU_CMD,8,3             ## @ABIT_UGURU_CMD
	.comm	_ABIT_UGURU_STATUS_READ,4,2     ## @ABIT_UGURU_STATUS_READ
L_.str.1:                               ## @.str.1
	.asciz	"timeout exceeded waiting for read state after write (bank: %d, sensor: %d)\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"CMD reg does not hold 0xAC after write (bank: %d, sensor: %d)\n"

	.no_dead_strip	_abituguru_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function abituguru_write
_abituguru_write:                       ; @abituguru_write
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x24, x4
	mov	x23, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _ABIT_UGURU_READY_TIMEOUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ABIT_UGURU_READY_TIMEOUT@GOTPAGEOFF]
Lloh2:
	ldr	w25, [x8]
Lloh3:
	adrp	x8, _ABIT_UGURU_MAX_RETRIES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ABIT_UGURU_MAX_RETRIES@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	bl	_abituguru_send_address
	mov	x22, x0
	cbnz	w0, LBB0_16
; %bb.1:
	cmp	w24, #1
	b.lt	LBB0_6
; %bb.2:
	mov	x22, #0
Lloh6:
	adrp	x26, _ABIT_UGURU_STATUS_WRITE@GOTPAGE
Lloh7:
	ldr	x26, [x26, _ABIT_UGURU_STATUS_WRITE@GOTPAGEOFF]
Lloh8:
	adrp	x27, _ABIT_UGURU_CMD@GOTPAGE
Lloh9:
	ldr	x27, [x27, _ABIT_UGURU_CMD@GOTPAGEOFF]
	mov	w24, w24
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x21
	bl	_abituguru_wait
	cbnz	x0, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x0, [x23, x22, lsl #3]
	ldr	x8, [x21]
	ldr	x9, [x27]
	add	x1, x9, x8
	bl	_outb
	add	x22, x22, #1
	cmp	x24, x22
	b.ne	LBB0_3
; %bb.5:
	mov	x22, x24
	b	LBB0_8
LBB0_6:
	mov	w22, #0
	b	LBB0_8
LBB0_7:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	mov	x2, x20
	mov	x3, x19
	bl	_ABIT_UGURU_DEBUG
LBB0_8:
Lloh12:
	adrp	x8, _ABIT_UGURU_STATUS_READ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ABIT_UGURU_STATUS_READ@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_abituguru_wait
	cbz	x0, LBB0_11
; %bb.9:
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_10:
	mov	w0, #1
	mov	x2, x20
	mov	x3, x19
	bl	_ABIT_UGURU_DEBUG
Lloh17:
	adrp	x8, _EIO@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_16
LBB0_11:
	ldr	x8, [x21]
Lloh20:
	adrp	x23, _ABIT_UGURU_CMD@GOTPAGE
Lloh21:
	ldr	x23, [x23, _ABIT_UGURU_CMD@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x23]
	add	x0, x9, x8
	bl	_inb_p
	cmp	w0, #172
	b.eq	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	subs	w25, w25, #1
	b.eq	LBB0_17
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	w0, #0
	bl	_msleep
	ldr	x8, [x21]
	b	LBB0_12
LBB0_15:
	mov	x0, x21
	bl	_abituguru_ready
LBB0_16:
	mov	x0, x22
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_17:
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_ABIT_UGURU_READY_TIMEOUT,4,2   ; @ABIT_UGURU_READY_TIMEOUT
	.comm	_ABIT_UGURU_MAX_RETRIES,4,2     ; @ABIT_UGURU_MAX_RETRIES
	.comm	_ABIT_UGURU_STATUS_WRITE,4,2    ; @ABIT_UGURU_STATUS_WRITE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"timeout exceeded waiting for write state (bank: %d, sensor: %d)\n"

	.comm	_ABIT_UGURU_CMD,8,3             ; @ABIT_UGURU_CMD
	.comm	_ABIT_UGURU_STATUS_READ,4,2     ; @ABIT_UGURU_STATUS_READ
l_.str.1:                               ; @.str.1
	.asciz	"timeout exceeded waiting for read state after write (bank: %d, sensor: %d)\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"CMD reg does not hold 0xAC after write (bank: %d, sensor: %d)\n"

	.no_dead_strip	_abituguru_write
.subsections_via_symbols
