	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pg_completion
_pg_completion:                         ## @pg_completion
	.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
	movq	%rdx, %rcx
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	_STAT_BUSY@GOTPCREL(%rip), %rax
	movq	_STAT_DRQ@GOTPCREL(%rip), %r15
	movq	_STAT_READY@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%r15), %edx
	movl	(%rax), %esi
	movq	_STAT_ERR@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	leaq	L_.str(%rip), %r8
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	callq	_pg_wait
	movl	%eax, %r14d
	movq	$0, 8(%rbx)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movl	$7, %esi
	callq	_read_reg
	testl	%eax, (%r15)
	je	LBB0_9
## %bb.1:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	$1, %eax
	subl	%r15d, %eax
	imull	%r12d, %eax
	cltq
	addq	%rax, 8(%rbx)
	movslq	%r12d, %rax
	addq	%rax, -48(%rbp)                 ## 8-byte Folded Spill
	movq	_STAT_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_STAT_READY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_STAT_DRQ@GOTPCREL(%rip), %r15
	orl	(%r15), %edx
	movq	_STAT_ERR@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%rbx, %rdi
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	L_.str(%rip), %r8
	callq	_pg_wait
	movl	%eax, %r14d
	movq	%rbx, %rdi
	movl	$7, %esi
	callq	_read_reg
	testl	%eax, (%r15)
	je	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_read_reg
	movl	%eax, %r14d
	movq	%rbx, %rdi
	movl	$5, %esi
	callq	_read_reg
	movl	%eax, %r12d
	shll	$8, %r12d
	leal	(%r12,%r14), %r13d
	addl	$3, %r13d
	andl	$65532, %r13d                   ## imm = 0xFFFC
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_read_reg
	movl	%eax, %r15d
	andl	$3, %r15d
	cmpl	$2, %r15d
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	testl	%r15d, %r15d
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	_pi_write_block
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	_pi_read_block
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	addl	%r14d, %r12d
	movq	_verbose@GOTPCREL(%rip), %rax
	cmpl	$2, (%rax)
	jl	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	16(%rbx), %esi
	testl	%r15d, %r15d
	leaq	L_.str.2(%rip), %rdx
	leaq	L_.str.3(%rip), %rax
	cmoveq	%rax, %rdx
	leaq	L_.str.1(%rip), %rdi
	movl	%r13d, %ecx
	callq	_printk
	jmp	LBB0_8
LBB0_9:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_pi_disconnect
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STAT_BUSY,4,2                  ## @STAT_BUSY
	.comm	_STAT_DRQ,4,2                   ## @STAT_DRQ
	.comm	_STAT_READY,4,2                 ## @STAT_READY
	.comm	_STAT_ERR,4,2                   ## @STAT_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"completion"

	.comm	_verbose,4,2                    ## @verbose
L_.str.1:                               ## @.str.1
	.asciz	"%s: %s %d bytes\n"

L_.str.2:                               ## @.str.2
	.asciz	"Read"

L_.str.3:                               ## @.str.3
	.asciz	"Write"

	.no_dead_strip	_pg_completion
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pg_completion
_pg_completion:                         ; @pg_completion
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _STAT_BUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STAT_BUSY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x26, _STAT_DRQ@GOTPAGE
Lloh4:
	ldr	x26, [x26, _STAT_DRQ@GOTPAGEOFF]
	ldr	w8, [x26]
Lloh5:
	adrp	x9, _STAT_READY@GOTPAGE
Lloh6:
	ldr	x9, [x9, _STAT_READY@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x28, _STAT_ERR@GOTPAGE
Lloh9:
	ldr	x28, [x28, _STAT_ERR@GOTPAGEOFF]
	ldr	w9, [x28]
	orr	w2, w8, w9
Lloh10:
	adrp	x4, l_.str@PAGE
Lloh11:
	add	x4, x4, l_.str@PAGEOFF
	mov	x3, x20
	bl	_pg_wait
	mov	x24, x0
	str	xzr, [x19, #8]
	mov	x0, x19
	mov	w1, #7
	bl	_read_reg
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_9
; %bb.1:
Lloh12:
	adrp	x22, _verbose@GOTPAGE
Lloh13:
	ldr	x22, [x22, _verbose@GOTPAGEOFF]
Lloh14:
	adrp	x23, l_.str@PAGE
Lloh15:
	add	x23, x23, l_.str@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	msub	w8, w25, w27, w25
	ldr	x9, [x19, #8]
	add	x8, x9, w8, sxtw
	str	x8, [x19, #8]
	add	x21, x21, w25, sxtw
Lloh16:
	adrp	x8, _STAT_BUSY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _STAT_BUSY@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	ldr	w8, [x26]
Lloh19:
	adrp	x9, _STAT_READY@GOTPAGE
Lloh20:
	ldr	x9, [x9, _STAT_READY@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [x28]
	orr	w2, w8, w9
	mov	x0, x19
	mov	x3, x20
	mov	x4, x23
	bl	_pg_wait
	mov	x24, x0
	mov	x0, x19
	mov	w1, #7
	bl	_read_reg
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_9
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	w1, #4
	bl	_read_reg
	mov	x24, x0
	mov	x0, x19
	mov	w1, #5
	bl	_read_reg
	add	w25, w24, w0, lsl #8
	add	w8, w25, #3
	and	w24, w8, #0xfffc
	mov	x0, x19
	mov	w1, #2
	bl	_read_reg
	and	w27, w0, #0x3
	cmp	w27, #2
	b.eq	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cbnz	w27, LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19]
	mov	x1, x21
	mov	x2, x24
	bl	_pi_write_block
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19]
	mov	x1, x21
	mov	x2, x24
	bl	_pi_read_block
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x22]
	cmp	w8, #2
	b.lt	LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x19, #16]
	cmp	w27, #0
Lloh22:
	adrp	x8, l_.str.2@PAGE
Lloh23:
	add	x8, x8, l_.str.2@PAGEOFF
Lloh24:
	adrp	x9, l_.str.3@PAGE
Lloh25:
	add	x9, x9, l_.str.3@PAGEOFF
	csel	x2, x9, x8, eq
Lloh26:
	adrp	x0, l_.str.1@PAGE
Lloh27:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x3, x24
	bl	_printk
	b	LBB0_2
LBB0_9:
	ldr	w0, [x19]
	bl	_pi_disconnect
	mov	x0, x24
	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
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_STAT_BUSY,4,2                  ; @STAT_BUSY
	.comm	_STAT_DRQ,4,2                   ; @STAT_DRQ
	.comm	_STAT_READY,4,2                 ; @STAT_READY
	.comm	_STAT_ERR,4,2                   ; @STAT_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"completion"

	.comm	_verbose,4,2                    ; @verbose
l_.str.1:                               ; @.str.1
	.asciz	"%s: %s %d bytes\n"

l_.str.2:                               ; @.str.2
	.asciz	"Read"

l_.str.3:                               ; @.str.3
	.asciz	"Write"

	.no_dead_strip	_pg_completion
.subsections_via_symbols
