	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fd_writetrack
_fd_writetrack:                         ## @fd_writetrack
	.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	_ReqSide@GOTPCREL(%rip), %r15
	movslq	(%r15), %rdi
	callq	_DPRINT
	movq	_PhysTrackBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_BUFFER_SIZE@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_dma_cache_maintenance
	movl	(%r15), %edi
	callq	_fd_select_side
	movq	_SUDT@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	cmpl	$0, (%rax)
	je	LBB0_2
## %bb.1:
	movq	_FDCREG_TRACK@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	callq	_FDC_READ
	movl	%eax, %r15d
	xorl	%eax, %eax
	callq	_MFPDELAY
	movl	(%r13), %edi
	movq	(%r12), %rax
	movb	(%rax), %cl
	shrl	%cl, %r15d
	movl	%r15d, %esi
	callq	_FDC_WRITE
LBB0_2:
	movl	$40, %edi
	callq	_udelay
	callq	_local_irq_save
	movq	_dma_wd@GOTPCREL(%rip), %r15
	movb	%bl, (%r15)
	xorl	%eax, %eax
	callq	_MFPDELAY
	movq	%r15, %rax
	movb	%bh, 1(%rax)
	xorl	%eax, %eax
	callq	_MFPDELAY
	shrq	$16, %rbx
	movq	_EXTD_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ATARIHW_PRESENT
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_st_dma_ext_dmahi@GOTPCREL(%rip), %rax
	movw	%bx, (%rax)
	jmp	LBB0_5
LBB0_4:
	movq	%r15, %rax
	movb	%bl, 2(%r15)
LBB0_5:
	xorl	%eax, %eax
	callq	_MFPDELAY
	callq	_local_irq_restore
	movl	$400, 4(%r15)                   ## imm = 0x190
	xorl	%eax, %eax
	callq	_MFPDELAY
	movl	$144, 4(%r15)
	xorl	%eax, %eax
	callq	_MFPDELAY
	movl	$400, 4(%r15)                   ## imm = 0x190
	xorl	%eax, %eax
	callq	_MFPDELAY
	movl	(%r14), %eax
	leal	511(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$9, %ecx
	movl	%ecx, 8(%r15)
	movl	$40, %edi
	callq	_udelay
	movq	_FDCSELREG_STP@GOTPCREL(%rip), %rax
	movl	$256, %ecx                      ## imm = 0x100
	orl	(%rax), %ecx
	movl	%ecx, 4(%r15)
	movl	$40, %edi
	callq	_udelay
	movq	_fd_writetrack_done@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_SET_IRQ_HANDLER
	movq	_FDCCMD_WRTRA@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	xorl	%eax, %eax
	callq	_get_head_settle_flag
	orl	%ebx, %eax
	movl	%eax, 8(%r15)
	movq	_MotorOn@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_start_timeout                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ReqTrack,4,2                   ## @ReqTrack
	.comm	_ReqSide,4,2                    ## @ReqSide
	.comm	_PhysTrackBuffer,8,3            ## @PhysTrackBuffer
	.comm	_BUFFER_SIZE,4,2                ## @BUFFER_SIZE
	.comm	_SUDT,8,3                       ## @SUDT
	.comm	_FDCREG_TRACK,4,2               ## @FDCREG_TRACK
	.comm	_dma_wd,12,2                    ## @dma_wd
	.comm	_EXTD_DMA,4,2                   ## @EXTD_DMA
	.comm	_st_dma_ext_dmahi,2,1           ## @st_dma_ext_dmahi
	.comm	_FDCSELREG_STP,4,2              ## @FDCSELREG_STP
	.comm	_fd_writetrack_done,4,2         ## @fd_writetrack_done
	.comm	_FDCCMD_WRTRA,4,2               ## @FDCCMD_WRTRA
	.comm	_MotorOn,4,2                    ## @MotorOn
	.no_dead_strip	_fd_writetrack
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fd_writetrack
_fd_writetrack:                         ; @fd_writetrack
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
Lloh0:
	adrp	x20, _ReqSide@GOTPAGE
Lloh1:
	ldr	x20, [x20, _ReqSide@GOTPAGEOFF]
	ldrsw	x0, [x20]
	bl	_DPRINT
Lloh2:
	adrp	x8, _PhysTrackBuffer@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PhysTrackBuffer@GOTPAGEOFF]
Lloh4:
	ldr	x19, [x8]
Lloh5:
	adrp	x21, _BUFFER_SIZE@GOTPAGE
Lloh6:
	ldr	x21, [x21, _BUFFER_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	mov	w2, #1
	bl	_dma_cache_maintenance
	ldr	w0, [x20]
	bl	_fd_select_side
Lloh7:
	adrp	x22, _SUDT@GOTPAGE
Lloh8:
	ldr	x22, [x22, _SUDT@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	w8, [x8]
	cbz	w8, LBB0_2
; %bb.1:
Lloh9:
	adrp	x23, _FDCREG_TRACK@GOTPAGE
Lloh10:
	ldr	x23, [x23, _FDCREG_TRACK@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_FDC_READ
	mov	x20, x0
	bl	_MFPDELAY
	ldr	w0, [x23]
	ldr	x8, [x22]
	ldr	w8, [x8]
	lsr	w1, w20, w8
	bl	_FDC_WRITE
LBB0_2:
	mov	w0, #40
	bl	_udelay
	bl	_local_irq_save
Lloh11:
	adrp	x20, _dma_wd@GOTPAGE
Lloh12:
	ldr	x20, [x20, _dma_wd@GOTPAGEOFF]
	strb	w19, [x20]
	bl	_MFPDELAY
	lsr	x8, x19, #8
	strb	w8, [x20, #1]
	bl	_MFPDELAY
Lloh13:
	adrp	x8, _EXTD_DMA@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EXTD_DMA@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	bl	_ATARIHW_PRESENT
	lsr	x8, x19, #16
	cbz	x0, LBB0_4
; %bb.3:
Lloh16:
	adrp	x9, _st_dma_ext_dmahi@GOTPAGE
Lloh17:
	ldr	x9, [x9, _st_dma_ext_dmahi@GOTPAGEOFF]
Lloh18:
	strh	w8, [x9]
	b	LBB0_5
LBB0_4:
	strb	w8, [x20, #2]
LBB0_5:
	bl	_MFPDELAY
	bl	_local_irq_restore
	mov	w19, #400
	str	w19, [x20, #4]
	bl	_MFPDELAY
	mov	w8, #144
	str	w8, [x20, #4]
	bl	_MFPDELAY
	str	w19, [x20, #4]
	bl	_MFPDELAY
	ldr	w8, [x21]
	add	w9, w8, #511
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #9
	str	w8, [x20, #8]
	mov	w0, #40
	bl	_udelay
Lloh19:
	adrp	x8, _FDCSELREG_STP@GOTPAGE
Lloh20:
	ldr	x8, [x8, _FDCSELREG_STP@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	orr	w8, w8, #0x100
	str	w8, [x20, #4]
	mov	w0, #40
	bl	_udelay
Lloh22:
	adrp	x8, _fd_writetrack_done@GOTPAGE
Lloh23:
	ldr	x8, [x8, _fd_writetrack_done@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	bl	_SET_IRQ_HANDLER
Lloh25:
	adrp	x8, _FDCCMD_WRTRA@GOTPAGE
Lloh26:
	ldr	x8, [x8, _FDCCMD_WRTRA@GOTPAGEOFF]
Lloh27:
	ldr	w19, [x8]
	bl	_get_head_settle_flag
	orr	w8, w0, w19
	str	w8, [x20, #8]
Lloh28:
	adrp	x8, _MotorOn@GOTPAGE
Lloh29:
	ldr	x8, [x8, _MotorOn@GOTPAGEOFF]
	mov	w9, #1
Lloh30:
	str	w9, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_start_timeout
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_ReqTrack,4,2                   ; @ReqTrack
	.comm	_ReqSide,4,2                    ; @ReqSide
	.comm	_PhysTrackBuffer,8,3            ; @PhysTrackBuffer
	.comm	_BUFFER_SIZE,4,2                ; @BUFFER_SIZE
	.comm	_SUDT,8,3                       ; @SUDT
	.comm	_FDCREG_TRACK,4,2               ; @FDCREG_TRACK
	.comm	_dma_wd,12,2                    ; @dma_wd
	.comm	_EXTD_DMA,4,2                   ; @EXTD_DMA
	.comm	_st_dma_ext_dmahi,2,1           ; @st_dma_ext_dmahi
	.comm	_FDCSELREG_STP,4,2              ; @FDCSELREG_STP
	.comm	_fd_writetrack_done,4,2         ; @fd_writetrack_done
	.comm	_FDCCMD_WRTRA,4,2               ; @FDCCMD_WRTRA
	.comm	_MotorOn,4,2                    ; @MotorOn
	.no_dead_strip	_fd_writetrack
.subsections_via_symbols
