	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amiga_floppy_change
_amiga_floppy_change:                   ## @amiga_floppy_change
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r15
	movq	_unit@GOTPCREL(%rip), %rax
	movq	%r15, %rbx
	subq	(%rax), %rbx
	shrq	$4, %rbx
	cmpb	$0, _amiga_floppy_change.first_time(%rip)
	je	LBB0_1
## %bb.2:
	movl	%ebx, %edi
	callq	_get_fdc
	movl	%ebx, %edi
	callq	_fd_select
	movq	_ciaa@GOTPCREL(%rip), %rax
	movq	_DSKCHANGE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	andl	(%rax), %r12d
	movl	%ebx, %edi
	callq	_fd_deselect
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_rel_fdc
	testl	%r12d, %r12d
	jne	LBB0_4
	jmp	LBB0_3
LBB0_1:
	movb	$1, _amiga_floppy_change.first_time(%rip)
LBB0_3:
	movl	%ebx, %edi
	callq	_fd_probe
	movl	$-1, (%r15)
	movq	$0, 8(%r15)
	movq	_writepending@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_writefromint@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movl	$1, %r14d
LBB0_4:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_unit,8,3                       ## @unit
.zerofill __DATA,__bss,_amiga_floppy_change.first_time,1,2 ## @amiga_floppy_change.first_time
	.comm	_ciaa,4,2                       ## @ciaa
	.comm	_DSKCHANGE,4,2                  ## @DSKCHANGE
	.comm	_writepending,8,3               ## @writepending
	.comm	_writefromint,8,3               ## @writefromint
	.no_dead_strip	_amiga_floppy_change
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amiga_floppy_change
_amiga_floppy_change:                   ; @amiga_floppy_change
	.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	x8, _unit@GOTPAGE
Lloh1:
	ldr	x8, [x8, _unit@GOTPAGEOFF]
	ldr	x20, [x0]
Lloh2:
	ldr	x8, [x8]
	sub	x8, x20, x8
	lsr	x19, x8, #4
	adrp	x8, _amiga_floppy_change.first_time@PAGE
	ldrb	w9, [x8, _amiga_floppy_change.first_time@PAGEOFF]
	tbz	w9, #0, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_get_fdc
	mov	x0, x19
	bl	_fd_select
Lloh3:
	adrp	x8, _ciaa@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ciaa@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _DSKCHANGE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DSKCHANGE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	and	w21, w9, w8
	mov	x0, x19
	bl	_fd_deselect
	bl	_rel_fdc
	cbz	w21, LBB0_4
; %bb.2:
	mov	w0, #0
	b	LBB0_5
LBB0_3:
	mov	w9, #1
	strb	w9, [x8, _amiga_floppy_change.first_time@PAGEOFF]
LBB0_4:
	mov	x0, x19
	bl	_fd_probe
	mov	w8, #-1
	str	w8, [x20]
Lloh9:
	adrp	x8, _writepending@GOTPAGE
Lloh10:
	ldr	x8, [x8, _writepending@GOTPAGEOFF]
	str	xzr, [x20, #8]
Lloh11:
	str	xzr, [x8]
Lloh12:
	adrp	x8, _writefromint@GOTPAGE
Lloh13:
	ldr	x8, [x8, _writefromint@GOTPAGEOFF]
Lloh14:
	str	xzr, [x8]
	mov	w0, #1
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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotStr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotStr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_unit,8,3                       ; @unit
.zerofill __DATA,__bss,_amiga_floppy_change.first_time,1,2 ; @amiga_floppy_change.first_time
	.comm	_ciaa,4,2                       ; @ciaa
	.comm	_DSKCHANGE,4,2                  ; @DSKCHANGE
	.comm	_writepending,8,3               ; @writepending
	.comm	_writefromint,8,3               ; @writefromint
	.no_dead_strip	_amiga_floppy_change
.subsections_via_symbols
