	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apbps2_write
_apbps2_write:                          ## @apbps2_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	(%rdi), %r12
	movq	(%r12), %rdi
	addq	$8, %rdi
	callq	_ioread32be
	movq	_APBPS2_STATUS_TF@GOTPCREL(%rip), %r15
	testl	%eax, (%r15)
	je	LBB0_4
## %bb.1:
	movl	$-9999, %ebx                    ## imm = 0xD8F1
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	$10, %edi
	callq	_udelay
	movq	(%r12), %rdi
	addq	$8, %rdi
	callq	_ioread32be
	testl	%eax, (%r15)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	1(%rbx), %eax
	testl	%ebx, %ebx
	movl	%eax, %ebx
	jne	LBB0_2
LBB0_4:
	movq	(%r12), %rdi
	addq	$8, %rdi
	callq	_ioread32be
	testl	%eax, (%r15)
	je	LBB0_5
## %bb.6:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_7
LBB0_5:
	movq	(%r12), %rsi
	addq	$4, %rsi
	movzbl	%r14b, %edi
	callq	_iowrite32be
	movq	_APBPS2_CTRL_RE@GOTPCREL(%rip), %rax
	movq	_APBPS2_CTRL_RI@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	orb	(%rax), %cl
	movq	_APBPS2_CTRL_TE@GOTPCREL(%rip), %rax
	orb	(%rax), %cl
	movq	(%r12), %rsi
	movzbl	%cl, %edi
	callq	_iowrite32be
	xorl	%eax, %eax
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_APBPS2_STATUS_TF,4,2           ## @APBPS2_STATUS_TF
	.comm	_APBPS2_CTRL_RE,1,0             ## @APBPS2_CTRL_RE
	.comm	_APBPS2_CTRL_RI,1,0             ## @APBPS2_CTRL_RI
	.comm	_APBPS2_CTRL_TE,1,0             ## @APBPS2_CTRL_TE
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_apbps2_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apbps2_write
_apbps2_write:                          ; @apbps2_write
	.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
	mov	x19, x1
	ldr	x20, [x0]
	ldr	x8, [x20]
	add	x0, x8, #8
	bl	_ioread32be
Lloh0:
	adrp	x21, _APBPS2_STATUS_TF@GOTPAGE
Lloh1:
	ldr	x21, [x21, _APBPS2_STATUS_TF@GOTPAGEOFF]
	ldr	w8, [x21]
	tst	w8, w0
	b.eq	LBB0_3
; %bb.1:
	mov	w22, #-9999
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #10
	bl	_udelay
	ldr	x8, [x20]
	add	x0, x8, #8
	bl	_ioread32be
	ldr	w8, [x21]
	and	w8, w8, w0
	cmp	w8, #0
	ccmp	w22, #0, #4, ne
	add	w22, w22, #1
	b.ne	LBB0_2
LBB0_3:
	ldr	x8, [x20]
	add	x0, x8, #8
	bl	_ioread32be
	ldr	w8, [x21]
	tst	w8, w0
	b.eq	LBB0_5
; %bb.4:
Lloh2:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_5:
	ldr	x8, [x20]
	add	x1, x8, #4
	mov	x0, x19
	bl	_iowrite32be
Lloh5:
	adrp	x8, _APBPS2_CTRL_RE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _APBPS2_CTRL_RE@GOTPAGEOFF]
	ldrb	w8, [x8]
Lloh7:
	adrp	x9, _APBPS2_CTRL_RI@GOTPAGE
Lloh8:
	ldr	x9, [x9, _APBPS2_CTRL_RI@GOTPAGEOFF]
	ldrb	w9, [x9]
	orr	w8, w9, w8
Lloh9:
	adrp	x9, _APBPS2_CTRL_TE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _APBPS2_CTRL_TE@GOTPAGEOFF]
	ldrb	w9, [x9]
	orr	w0, w8, w9
	ldr	x1, [x20]
	bl	_iowrite32be
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_APBPS2_STATUS_TF,4,2           ; @APBPS2_STATUS_TF
	.comm	_APBPS2_CTRL_RE,1,0             ; @APBPS2_CTRL_RE
	.comm	_APBPS2_CTRL_RI,1,0             ; @APBPS2_CTRL_RI
	.comm	_APBPS2_CTRL_TE,1,0             ; @APBPS2_CTRL_TE
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_apbps2_write
.subsections_via_symbols
