	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pg_command
_pg_command:                            ## @pg_command
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movl	%edx, %r15d
	movq	%rsi, %r14
	movq	%rdi, %r13
	movl	(%rdi), %edi
	callq	_pi_connect
	movq	%r13, %rdi
	callq	_DRIVE
	movq	%r13, %rdi
	movl	$6, %esi
	movl	%eax, %edx
	callq	_write_reg
	movq	_STAT_BUSY@GOTPCREL(%rip), %rcx
	movq	_STAT_DRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%rcx), %esi
	leaq	L_.str(%rip), %r8
	movq	%r13, %rdi
	xorl	%edx, %edx
	movq	%r12, %rcx
	callq	_pg_wait
	testq	%rax, %rax
	jne	LBB0_4
## %bb.1:
	leal	255(%r15), %ebx
	testl	%r15d, %r15d
	cmovnsl	%r15d, %ebx
	movl	%ebx, %eax
	andl	$-256, %eax
	movl	%r15d, %edx
	subl	%eax, %edx
	movq	%r13, %rdi
	movl	$4, %esi
	callq	_write_reg
	sarl	$8, %ebx
	movq	%r13, %rdi
	movl	$5, %esi
	movl	%ebx, %edx
	callq	_write_reg
	movq	%r13, %rdi
	movl	$7, %esi
	movl	$160, %edx
	callq	_write_reg
	movq	_STAT_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_STAT_DRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %r8
	movq	%r13, %rdi
	movq	%r12, %rcx
	callq	_pg_wait
	testq	%rax, %rax
	jne	LBB0_4
## %bb.2:
	movq	%r13, %rdi
	movl	$2, %esi
	callq	_read_reg
	cmpl	$1, %eax
	jne	LBB0_3
## %bb.5:
	movl	(%r13), %edi
	movq	%r14, %rsi
	movl	$12, %edx
	callq	_pi_write_block
	movq	_verbose@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	cmpl	$2, (%rax)
	jl	LBB0_7
## %bb.6:
	movl	4(%r13), %esi
	leaq	L_.str.3(%rip), %rdi
	xorl	%r12d, %r12d
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_printk
	movzbl	(%r14), %esi
	movq	%r14, %rbx
	leaq	L_.str.4(%rip), %r14
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	1(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	2(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	3(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	4(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	5(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	6(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	7(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	8(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	9(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	10(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	movzbl	11(%rbx), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_printk
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
	jmp	LBB0_7
LBB0_3:
	movl	4(%r13), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
LBB0_4:
	movl	(%r13), %edi
	callq	_pi_disconnect
	movl	$-1, %r12d
LBB0_7:
	movl	%r12d, %eax
	addq	$8, %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
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"before command"

L_.str.1:                               ## @.str.1
	.asciz	"command DRQ"

L_.str.2:                               ## @.str.2
	.asciz	"%s: command phase error\n"

	.comm	_verbose,4,2                    ## @verbose
L_.str.3:                               ## @.str.3
	.asciz	"%s: Command sent, dlen=%d packet= "

L_.str.4:                               ## @.str.4
	.asciz	"%02x "

L_.str.5:                               ## @.str.5
	.asciz	"\n"

	.no_dead_strip	_pg_command
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pg_command
_pg_command:                            ; @pg_command
	.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, x3
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	ldr	w0, [x0]
	bl	_pi_connect
	mov	x0, x20
	bl	_DRIVE
	mov	x2, x0
	mov	x0, x20
	mov	w1, #6
	bl	_write_reg
Lloh0:
	adrp	x24, _STAT_BUSY@GOTPAGE
Lloh1:
	ldr	x24, [x24, _STAT_BUSY@GOTPAGEOFF]
	ldr	w8, [x24]
Lloh2:
	adrp	x25, _STAT_DRQ@GOTPAGE
Lloh3:
	ldr	x25, [x25, _STAT_DRQ@GOTPAGEOFF]
	ldr	w9, [x25]
	orr	w1, w9, w8
Lloh4:
	adrp	x4, l_.str@PAGE
Lloh5:
	add	x4, x4, l_.str@PAGEOFF
	mov	x0, x20
	mov	w2, #0
	mov	x3, x22
	bl	_pg_wait
	cbnz	x0, LBB0_7
; %bb.1:
	add	w8, w21, #255
	cmp	w21, #0
	csel	w8, w8, w21, lt
	asr	w23, w8, #8
	and	w8, w8, #0xffffff00
	sub	w2, w21, w8
	mov	x0, x20
	mov	w1, #4
	bl	_write_reg
	mov	x0, x20
	mov	w1, #5
	mov	x2, x23
	bl	_write_reg
	mov	x0, x20
	mov	w1, #7
	mov	w2, #160
	bl	_write_reg
	ldr	w1, [x24]
	ldr	w2, [x25]
Lloh6:
	adrp	x4, l_.str.1@PAGE
Lloh7:
	add	x4, x4, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x3, x22
	bl	_pg_wait
	cbnz	x0, LBB0_7
; %bb.2:
	mov	x0, x20
	mov	w1, #2
	bl	_read_reg
	cmp	w0, #1
	b.ne	LBB0_6
; %bb.3:
	ldr	w0, [x20]
	mov	x1, x19
	mov	w2, #12
	bl	_pi_write_block
Lloh8:
	adrp	x8, _verbose@GOTPAGE
Lloh9:
	ldr	x8, [x8, _verbose@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w8, #2
	b.lt	LBB0_5
; %bb.4:
	ldr	w8, [x20, #4]
	stp	x8, x21, [sp]
Lloh11:
	adrp	x0, l_.str.3@PAGE
Lloh12:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_printk
	ldrb	w8, [x19]
	str	x8, [sp]
Lloh13:
	adrp	x20, l_.str.4@PAGE
Lloh14:
	add	x20, x20, l_.str.4@PAGEOFF
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #1]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #2]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #3]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #4]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #5]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #6]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #7]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #8]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #9]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #10]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
	ldrb	w8, [x19, #11]
	str	x8, [sp]
	mov	x0, x20
	bl	_printk
Lloh15:
	adrp	x0, l_.str.5@PAGE
Lloh16:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_printk
LBB0_5:
	mov	w0, #0
	b	LBB0_8
LBB0_6:
	ldr	w8, [x20, #4]
	str	x8, [sp]
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_printk
LBB0_7:
	ldr	w0, [x20]
	bl	_pi_disconnect
	mov	w0, #-1
LBB0_8:
	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 AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_STAT_BUSY,4,2                  ; @STAT_BUSY
	.comm	_STAT_DRQ,4,2                   ; @STAT_DRQ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"before command"

l_.str.1:                               ; @.str.1
	.asciz	"command DRQ"

l_.str.2:                               ; @.str.2
	.asciz	"%s: command phase error\n"

	.comm	_verbose,4,2                    ; @verbose
l_.str.3:                               ; @.str.3
	.asciz	"%s: Command sent, dlen=%d packet= "

l_.str.4:                               ; @.str.4
	.asciz	"%02x "

l_.str.5:                               ; @.str.5
	.asciz	"\n"

	.no_dead_strip	_pg_command
.subsections_via_symbols
