	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fd_select_drive
_fd_select_drive:                       ## @fd_select_drive
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_SelectedDrive@GOTPCREL(%rip), %r14
	cmpl	%edi, (%r14)
	je	LBB0_8
## %bb.1:
	movl	%edi, %ebx
	callq	_local_irq_save
	movq	_sound_ym@GOTPCREL(%rip), %rax
	movl	$14, (%rax)
	movq	_DSKDRVNONE@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	orb	$14, %cl
	testl	%ebx, %ebx
	jne	LBB0_2
## %bb.3:
	movq	_DSKDRV0@GOTPCREL(%rip), %rdx
	jmp	LBB0_4
LBB0_2:
	movq	_DSKDRV1@GOTPCREL(%rip), %rdx
LBB0_4:
	movb	(%rdx), %dl
	notb	%dl
	andb	%dl, %cl
	movb	%cl, 4(%rax)
	movq	_atari_dont_touch_floppy_select@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	callq	_local_irq_restore
	movq	_FDCREG_TRACK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_UD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_FDC_WRITE
	movl	$25, %edi
	callq	_udelay
	movq	_UDT@GOTPCREL(%rip), %r15
	cmpq	$0, (%r15)
	je	LBB0_7
## %bb.5:
	movq	_FDCSPEED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ATARIHW_PRESENT
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	(%r15), %rax
	movl	(%rax), %eax
	movq	_dma_wd@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_7:
	movl	%ebx, (%r14)
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SelectedDrive,4,2              ## @SelectedDrive
	.comm	_sound_ym,8,2                   ## @sound_ym
	.comm	_DSKDRVNONE,1,0                 ## @DSKDRVNONE
	.comm	_DSKDRV0,1,0                    ## @DSKDRV0
	.comm	_DSKDRV1,1,0                    ## @DSKDRV1
	.comm	_atari_dont_touch_floppy_select,4,2 ## @atari_dont_touch_floppy_select
	.comm	_FDCREG_TRACK,4,2               ## @FDCREG_TRACK
	.comm	_UD,4,2                         ## @UD
	.comm	_UDT,8,3                        ## @UDT
	.comm	_FDCSPEED,4,2                   ## @FDCSPEED
	.comm	_dma_wd,4,2                     ## @dma_wd
	.no_dead_strip	_fd_select_drive
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fd_select_drive
_fd_select_drive:                       ; @fd_select_drive
	.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
Lloh0:
	adrp	x20, _SelectedDrive@GOTPAGE
Lloh1:
	ldr	x20, [x20, _SelectedDrive@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, w0
	b.eq	LBB0_5
; %bb.1:
	mov	x19, x0
	bl	_local_irq_save
Lloh2:
	adrp	x8, _sound_ym@GOTPAGE
Lloh3:
	ldr	x8, [x8, _sound_ym@GOTPAGEOFF]
	mov	w9, #14
	str	w9, [x8]
Lloh4:
	adrp	x9, _DSKDRVNONE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _DSKDRVNONE@GOTPAGEOFF]
	ldrb	w9, [x9]
Lloh6:
	adrp	x10, _DSKDRV0@GOTPAGE
Lloh7:
	ldr	x10, [x10, _DSKDRV0@GOTPAGEOFF]
	orr	w9, w9, #0xe
Lloh8:
	adrp	x11, _DSKDRV1@GOTPAGE
Lloh9:
	ldr	x11, [x11, _DSKDRV1@GOTPAGEOFF]
	cmp	w19, #0
	csel	x10, x10, x11, eq
	ldrb	w10, [x10]
	bic	w9, w9, w10
	strb	w9, [x8, #4]
Lloh10:
	adrp	x8, _atari_dont_touch_floppy_select@GOTPAGE
Lloh11:
	ldr	x8, [x8, _atari_dont_touch_floppy_select@GOTPAGEOFF]
	mov	w9, #1
Lloh12:
	str	w9, [x8]
	bl	_local_irq_restore
Lloh13:
	adrp	x8, _FDCREG_TRACK@GOTPAGE
Lloh14:
	ldr	x8, [x8, _FDCREG_TRACK@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
Lloh16:
	adrp	x8, _UD@GOTPAGE
Lloh17:
	ldr	x8, [x8, _UD@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_FDC_WRITE
	mov	w0, #25
	bl	_udelay
Lloh19:
	adrp	x21, _UDT@GOTPAGE
Lloh20:
	ldr	x21, [x21, _UDT@GOTPAGEOFF]
	ldr	x8, [x21]
	cbz	x8, LBB0_4
; %bb.2:
Lloh21:
	adrp	x8, _FDCSPEED@GOTPAGE
Lloh22:
	ldr	x8, [x8, _FDCSPEED@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_ATARIHW_PRESENT
	cbz	x0, LBB0_4
; %bb.3:
	ldr	x8, [x21]
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _dma_wd@GOTPAGE
Lloh25:
	ldr	x9, [x9, _dma_wd@GOTPAGEOFF]
Lloh26:
	str	w8, [x9]
LBB0_4:
	str	w19, [x20]
LBB0_5:
	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 AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotStr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_SelectedDrive,4,2              ; @SelectedDrive
	.comm	_sound_ym,8,2                   ; @sound_ym
	.comm	_DSKDRVNONE,1,0                 ; @DSKDRVNONE
	.comm	_DSKDRV0,1,0                    ; @DSKDRV0
	.comm	_DSKDRV1,1,0                    ; @DSKDRV1
	.comm	_atari_dont_touch_floppy_select,4,2 ; @atari_dont_touch_floppy_select
	.comm	_FDCREG_TRACK,4,2               ; @FDCREG_TRACK
	.comm	_UD,4,2                         ; @UD
	.comm	_UDT,8,3                        ; @UDT
	.comm	_FDCSPEED,4,2                   ; @FDCSPEED
	.comm	_dma_wd,4,2                     ; @dma_wd
	.no_dead_strip	_fd_select_drive
.subsections_via_symbols
