	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function floppy_release_irq_and_dma
_floppy_release_irq_and_dma:            ## @floppy_release_irq_and_dma
	.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	_floppy_usage_lock@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	_usage_count@GOTPCREL(%rip), %rax
	decq	(%rax)
	setne	%bl
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	testb	%bl, %bl
	jne	LBB0_12
## %bb.1:
	movq	_irqdma_allocated@GOTPCREL(%rip), %rbx
	cmpq	$0, (%rbx)
	je	LBB0_3
## %bb.2:
	xorl	%eax, %eax
	callq	_fd_disable_dma
	xorl	%eax, %eax
	callq	_fd_free_dma
	xorl	%eax, %eax
	callq	_fd_free_irq
	movq	$0, (%rbx)
LBB0_3:
	xorl	%edi, %edi
	movl	$-1, %esi
	movl	$8, %edx
	callq	_set_dor
	xorl	%eax, %eax
	callq	_floppy_enable_hlt
	movq	_floppy_track_buffer@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.4:
	movq	_max_buffer_sectors@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	testl	%edx, %edx
	je	LBB0_6
## %bb.5:
	movslq	%edx, %rsi
	shlq	$10, %rsi
	movq	$0, (%rax)
	movl	$0, (%rcx)
	movq	_buffer_max@GOTPCREL(%rip), %rax
	movl	$-1, (%rax)
	movq	_buffer_min@GOTPCREL(%rip), %rax
	movl	$-1, (%rax)
	callq	_fd_dma_mem_free
LBB0_6:
	movq	_fdc@GOTPCREL(%rip), %rbx
	movl	(%rbx), %r14d
	movl	$0, (%rbx)
	movq	_N_FDC@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	testl	%eax, %eax
	jle	LBB0_11
## %bb.7:
	xorl	%edi, %edi
	movq	_FDCS@GOTPCREL(%rip), %r12
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	incl	%edi
	movl	%edi, (%rbx)
	cmpl	%eax, %edi
	jge	LBB0_11
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rcx
	cmpl	$-1, (%rcx)
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	callq	_floppy_release_regions
	movl	(%rbx), %edi
	movl	(%r15), %eax
	jmp	LBB0_10
LBB0_11:
	movl	%r14d, (%rbx)
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_floppy_usage_lock,4,2          ## @floppy_usage_lock
	.comm	_usage_count,8,3                ## @usage_count
	.comm	_irqdma_allocated,8,3           ## @irqdma_allocated
	.comm	_floppy_track_buffer,8,3        ## @floppy_track_buffer
	.comm	_max_buffer_sectors,4,2         ## @max_buffer_sectors
	.comm	_buffer_max,4,2                 ## @buffer_max
	.comm	_buffer_min,4,2                 ## @buffer_min
	.comm	_fdc,4,2                        ## @fdc
	.comm	_N_FDC,4,2                      ## @N_FDC
	.comm	_FDCS,8,3                       ## @FDCS
	.comm	_fd_timeout,4,2                 ## @fd_timeout
	.comm	_fd_timer,4,2                   ## @fd_timer
	.comm	_floppy_work,4,2                ## @floppy_work
	.comm	_motor_off_timer,8,3            ## @motor_off_timer
	.comm	_timeout_message,4,2            ## @timeout_message
	.no_dead_strip	_floppy_release_irq_and_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function floppy_release_irq_and_dma
_floppy_release_irq_and_dma:            ; @floppy_release_irq_and_dma
	.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	x19, _floppy_usage_lock@GOTPAGE
Lloh1:
	ldr	x19, [x19, _floppy_usage_lock@GOTPAGEOFF]
	mov	x0, x19
	bl	_spin_lock_irqsave
Lloh2:
	adrp	x8, _usage_count@GOTPAGE
Lloh3:
	ldr	x8, [x8, _usage_count@GOTPAGEOFF]
	ldr	x9, [x8]
	sub	x20, x9, #1
	str	x20, [x8]
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	cbnz	x20, LBB0_11
; %bb.1:
Lloh4:
	adrp	x19, _irqdma_allocated@GOTPAGE
Lloh5:
	ldr	x19, [x19, _irqdma_allocated@GOTPAGEOFF]
	ldr	x8, [x19]
	cbz	x8, LBB0_3
; %bb.2:
	bl	_fd_disable_dma
	bl	_fd_free_dma
	bl	_fd_free_irq
	str	xzr, [x19]
LBB0_3:
	mov	w19, #-1
	mov	w0, #0
	mov	w1, #-1
	mov	w2, #8
	bl	_set_dor
	bl	_floppy_enable_hlt
Lloh6:
	adrp	x8, _floppy_track_buffer@GOTPAGE
Lloh7:
	ldr	x8, [x8, _floppy_track_buffer@GOTPAGEOFF]
	ldr	x0, [x8]
Lloh8:
	adrp	x9, _max_buffer_sectors@GOTPAGE
Lloh9:
	ldr	x9, [x9, _max_buffer_sectors@GOTPAGEOFF]
	ldr	w10, [x9]
	cmp	x0, #0
	ccmp	w10, #0, #4, ne
	b.eq	LBB0_5
; %bb.4:
	sxtw	x10, w10
	lsl	x1, x10, #10
	str	xzr, [x8]
	str	wzr, [x9]
Lloh10:
	adrp	x8, _buffer_max@GOTPAGE
Lloh11:
	ldr	x8, [x8, _buffer_max@GOTPAGEOFF]
Lloh12:
	str	w19, [x8]
Lloh13:
	adrp	x8, _buffer_min@GOTPAGE
Lloh14:
	ldr	x8, [x8, _buffer_min@GOTPAGEOFF]
Lloh15:
	str	w19, [x8]
	bl	_fd_dma_mem_free
LBB0_5:
Lloh16:
	adrp	x19, _fdc@GOTPAGE
Lloh17:
	ldr	x19, [x19, _fdc@GOTPAGEOFF]
	ldr	w20, [x19]
	str	wzr, [x19]
Lloh18:
	adrp	x21, _N_FDC@GOTPAGE
Lloh19:
	ldr	x21, [x21, _N_FDC@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.6:
	mov	w0, #0
Lloh20:
	adrp	x22, _FDCS@GOTPAGE
Lloh21:
	ldr	x22, [x22, _FDCS@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	w0, w0, #1
	str	w0, [x19]
	cmp	w0, w8
	b.ge	LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x22]
	ldr	w9, [x9]
	cmn	w9, #1
	b.eq	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	bl	_floppy_release_regions
	ldr	w0, [x19]
	ldr	w8, [x21]
	b	LBB0_7
LBB0_10:
	str	w20, [x19]
LBB0_11:
	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	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotStr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_floppy_usage_lock,4,2          ; @floppy_usage_lock
	.comm	_usage_count,8,3                ; @usage_count
	.comm	_irqdma_allocated,8,3           ; @irqdma_allocated
	.comm	_floppy_track_buffer,8,3        ; @floppy_track_buffer
	.comm	_max_buffer_sectors,4,2         ; @max_buffer_sectors
	.comm	_buffer_max,4,2                 ; @buffer_max
	.comm	_buffer_min,4,2                 ; @buffer_min
	.comm	_fdc,4,2                        ; @fdc
	.comm	_N_FDC,4,2                      ; @N_FDC
	.comm	_FDCS,8,3                       ; @FDCS
	.comm	_fd_timeout,4,2                 ; @fd_timeout
	.comm	_fd_timer,4,2                   ; @fd_timer
	.comm	_floppy_work,4,2                ; @floppy_work
	.comm	_motor_off_timer,8,3            ; @motor_off_timer
	.comm	_timeout_message,4,2            ; @timeout_message
	.no_dead_strip	_floppy_release_irq_and_dma
.subsections_via_symbols
