	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ahci_write_fis
_ahci_write_fis:                        ## @ahci_write_fis
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
                                        ## kill: def $esi killed $esi def $rsi
	movq	16(%rdi), %rcx
	testq	%rcx, %rcx
	je	LBB0_7
## %bb.1:
	movq	%rdi, %rbx
	movq	_AHCI_P_CMD_FRE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rdi)
	je	LBB0_7
## %bb.2:
	leal	-128(%rsi), %eax
	cmpl	$3, %eax
	jae	LBB0_8
## %bb.3:
	cltq
	leaq	l_switch.table.ahci_write_fis(%rip), %rsi
	movq	(%rsi,%rax,8), %rdi
	leaq	l_switch.table.ahci_write_fis.1(%rip), %rsi
	movq	(%rsi,%rax,8), %r8
	leaq	l_switch.table.ahci_write_fis.2(%rip), %rsi
	movl	(%rsi,%rax,4), %eax
	movl	4(%rdx), %r14d
	shll	$25, %r14d
	sarl	$31, %r14d
	andl	(%rdi), %r14d
	movq	_ATA_S_ERROR@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%esi, 8(%rdx)
	je	LBB0_5
## %bb.4:
	movl	$1, 4(%rbx)
	movq	_AHCI_P_IX_TFE@GOTPCREL(%rip), %rsi
	orl	(%rsi), %r14d
LBB0_5:
	leaq	(%rcx,%r8,4), %rdi
	movq	%rdx, %rsi
	movl	%eax, %edx
	callq	_memcpy
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.6:
	movl	8(%rbx), %eax
	movl	%eax, %ecx
	notl	%ecx
	testl	%ecx, %r14d
	je	LBB0_7
## %bb.9:
	orl	%r14d, %eax
	movl	%eax, 8(%rbx)
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_ahci_port_intr                 ## TAILCALL
LBB0_7:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_8:
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_WPRINTF                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AHCI_P_CMD_FRE,4,2             ## @AHCI_P_CMD_FRE
	.comm	_AHCI_P_IX_DHR,4,2              ## @AHCI_P_IX_DHR
	.comm	_AHCI_P_IX_SDB,4,2              ## @AHCI_P_IX_SDB
	.comm	_AHCI_P_IX_PS,4,2               ## @AHCI_P_IX_PS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unsupported fis type %d\n"

	.comm	_ATA_S_ERROR,4,2                ## @ATA_S_ERROR
	.comm	_AHCI_P_IX_TFE,4,2              ## @AHCI_P_IX_TFE
	.no_dead_strip	_ahci_write_fis
	.section	__DATA,__const
	.p2align	3                               ## @switch.table.ahci_write_fis
l_switch.table.ahci_write_fis:
	.quad	_AHCI_P_IX_SDB
	.quad	_AHCI_P_IX_DHR
	.quad	_AHCI_P_IX_PS

	.section	__TEXT,__const
	.p2align	3                               ## @switch.table.ahci_write_fis.1
l_switch.table.ahci_write_fis.1:
	.quad	88                              ## 0x58
	.quad	64                              ## 0x40
	.quad	32                              ## 0x20

	.p2align	2                               ## @switch.table.ahci_write_fis.2
l_switch.table.ahci_write_fis.2:
	.long	8                               ## 0x8
	.long	20                              ## 0x14
	.long	20                              ## 0x14

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ahci_write_fis
_ahci_write_fis:                        ; @ahci_write_fis
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x9, [x0, #16]
	cbz	x9, LBB0_8
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0]
Lloh0:
	adrp	x10, _AHCI_P_CMD_FRE@GOTPAGE
Lloh1:
	ldr	x10, [x10, _AHCI_P_CMD_FRE@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	tst	w10, w8
	b.eq	LBB0_8
; %bb.2:
	sub	w8, w1, #128
	cmp	w8, #3
	b.hs	LBB0_9
; %bb.3:
	sbfiz	x10, x8, #3, #32
Lloh3:
	adrp	x11, l_switch.table.ahci_write_fis@PAGE
Lloh4:
	add	x11, x11, l_switch.table.ahci_write_fis@PAGEOFF
	ldr	x11, [x11, x10]
Lloh5:
	adrp	x12, l_switch.table.ahci_write_fis.1@PAGE
Lloh6:
	add	x12, x12, l_switch.table.ahci_write_fis.1@PAGEOFF
	ldr	x10, [x12, x10]
Lloh7:
	adrp	x12, l_switch.table.ahci_write_fis.2@PAGE
Lloh8:
	add	x12, x12, l_switch.table.ahci_write_fis.2@PAGEOFF
	ldr	w8, [x12, w8, sxtw #2]
	ldr	w11, [x11]
	ldrb	w12, [x2, #4]
	lsl	w12, w12, #25
	and	w20, w11, w12, asr #31
	ldr	w11, [x2, #8]
Lloh9:
	adrp	x12, _ATA_S_ERROR@GOTPAGE
Lloh10:
	ldr	x12, [x12, _ATA_S_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x12]
	tst	w12, w11
	b.eq	LBB0_5
; %bb.4:
	mov	w11, #1
	str	w11, [x19, #4]
Lloh12:
	adrp	x11, _AHCI_P_IX_TFE@GOTPAGE
Lloh13:
	ldr	x11, [x11, _AHCI_P_IX_TFE@GOTPAGEOFF]
Lloh14:
	ldr	w11, [x11]
	orr	w20, w11, w20
LBB0_5:
	add	x0, x9, x10, lsl #2
	mov	x1, x2
	mov	x2, x8
	bl	_memcpy
	cbz	w20, LBB0_8
; %bb.6:
	ldr	w8, [x19, #8]
	bics	wzr, w20, w8
	b.eq	LBB0_8
; %bb.7:
	orr	w8, w8, w20
	str	w8, [x19, #8]
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ahci_port_intr
LBB0_8:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_9:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_WPRINTF
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_AHCI_P_CMD_FRE,4,2             ; @AHCI_P_CMD_FRE
	.comm	_AHCI_P_IX_DHR,4,2              ; @AHCI_P_IX_DHR
	.comm	_AHCI_P_IX_SDB,4,2              ; @AHCI_P_IX_SDB
	.comm	_AHCI_P_IX_PS,4,2               ; @AHCI_P_IX_PS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unsupported fis type %d\n"

	.comm	_ATA_S_ERROR,4,2                ; @ATA_S_ERROR
	.comm	_AHCI_P_IX_TFE,4,2              ; @AHCI_P_IX_TFE
	.no_dead_strip	_ahci_write_fis
	.section	__DATA,__const
	.p2align	3                               ; @switch.table.ahci_write_fis
l_switch.table.ahci_write_fis:
	.quad	_AHCI_P_IX_SDB
	.quad	_AHCI_P_IX_DHR
	.quad	_AHCI_P_IX_PS

	.section	__TEXT,__const
	.p2align	3                               ; @switch.table.ahci_write_fis.1
l_switch.table.ahci_write_fis.1:
	.quad	88                              ; 0x58
	.quad	64                              ; 0x40
	.quad	32                              ; 0x20

	.p2align	2                               ; @switch.table.ahci_write_fis.2
l_switch.table.ahci_write_fis.2:
	.long	8                               ; 0x8
	.long	20                              ; 0x14
	.long	20                              ; 0x14

.subsections_via_symbols
