	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function floppy_grab_irq_and_dma
_floppy_grab_irq_and_dma:               ## @floppy_grab_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	%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	_floppy_usage_lock@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	_usage_count@GOTPCREL(%rip), %r15
	movl	(%r15), %ebx
	leal	1(%rbx), %eax
	movl	%eax, (%r15)
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%r12d, %r12d
	testl	%ebx, %ebx
	jne	LBB0_29
## %bb.1:
	xorl	%eax, %eax
	callq	_flush_scheduled_work
	xorl	%eax, %eax
	callq	_fd_request_irq
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_FLOPPY_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_DPRINT
LBB0_28:
	movq	_floppy_usage_lock@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	decl	(%r15)
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movl	$-1, %r12d
	jmp	LBB0_29
LBB0_3:
	xorl	%eax, %eax
	callq	_fd_request_dma
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	movq	_FLOPPY_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	callq	_DPRINT
	movq	_can_use_virtual_dma@GOTPCREL(%rip), %rcx
	movl	(%rcx), %eax
	testb	$2, %al
	jne	LBB0_5
## %bb.23:
	testb	$1, %al
	jne	LBB0_6
## %bb.24:
	xorl	%eax, %eax
	callq	_fd_free_irq
	jmp	LBB0_28
LBB0_5:
	movl	$1, (%rcx)
	movq	_use_virtual_dma@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_6:
	movq	_fdc@GOTPCREL(%rip), %r14
	movq	$0, (%r14)
	movq	_N_FDC@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	testq	%rax, %rax
	jle	LBB0_17
## %bb.7:
	xorl	%edi, %edi
	movq	_FDCS@GOTPCREL(%rip), %rbx
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=1
	incq	%rdi
	movq	%rdi, (%r14)
	cmpq	%rax, %rdi
	jge	LBB0_12
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rcx
	cmpl	$-1, (%rcx)
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	callq	_floppy_request_regions
	testq	%rax, %rax
	jne	LBB0_25
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r14), %rdi
	movq	(%r13), %rax
	jmp	LBB0_11
LBB0_12:
	movq	$0, (%r14)
	testq	%rax, %rax
	jle	LBB0_17
## %bb.13:
	xorl	%ecx, %ecx
	movq	_FD_DOR@GOTPCREL(%rip), %r15
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_14 Depth=1
	incq	%rcx
	movq	%rcx, (%r14)
	cmpq	%rax, %rcx
	jge	LBB0_17
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdx
	cmpl	$-1, (%rdx)
	je	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	$1, %edi
	callq	_reset_fdc_info
	movq	(%rbx), %rax
	movl	4(%rax), %edi
	movl	(%r15), %esi
	callq	_fd_outb
	movq	(%r14), %rcx
	movq	(%r13), %rax
	jmp	LBB0_16
LBB0_17:
	movq	$0, (%r14)
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	movl	$-1, %esi
	movl	$8, %edx
	callq	_set_dor
	movq	$0, (%r14)
	movq	(%r13), %rax
	testq	%rax, %rax
	jle	LBB0_22
## %bb.18:
	movq	%r13, %rbx
	xorl	%ecx, %ecx
	movq	_FDCS@GOTPCREL(%rip), %r15
	movq	_FD_DOR@GOTPCREL(%rip), %r13
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_19 Depth=1
	incq	%rcx
	movq	%rcx, (%r14)
	cmpq	%rax, %rcx
	jge	LBB0_22
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rdx
	cmpl	$-1, (%rdx)
	je	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	movl	4(%rdx), %edi
	movl	(%r13), %esi
	callq	_fd_outb
	movq	(%r14), %rcx
	movq	(%rbx), %rax
	jmp	LBB0_21
LBB0_22:
	movq	$0, (%r14)
	movq	_irqdma_allocated@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_29:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	xorl	%eax, %eax
	callq	_fd_free_irq
	xorl	%eax, %eax
	callq	_fd_free_dma
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	leaq	-1(%rax), %rdi
	movq	%rdi, (%r14)
	testq	%rax, %rax
	jle	LBB0_28
## %bb.26:                              ##   in Loop: Header=BB0_27 Depth=1
	callq	_floppy_release_regions
	jmp	LBB0_27
	.cfi_endproc
                                        ## -- End function
	.comm	_floppy_usage_lock,4,2          ## @floppy_usage_lock
	.comm	_usage_count,4,2                ## @usage_count
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unable to grab IRQ%d for the floppy driver\n"

	.comm	_FLOPPY_IRQ,4,2                 ## @FLOPPY_IRQ
L_.str.1:                               ## @.str.1
	.asciz	"Unable to grab DMA%d for the floppy driver\n"

	.comm	_FLOPPY_DMA,4,2                 ## @FLOPPY_DMA
	.comm	_can_use_virtual_dma,4,2        ## @can_use_virtual_dma
	.comm	_use_virtual_dma,4,2            ## @use_virtual_dma
	.comm	_fdc,8,3                        ## @fdc
	.comm	_N_FDC,8,3                      ## @N_FDC
	.comm	_FDCS,8,3                       ## @FDCS
	.comm	_FD_DOR,4,2                     ## @FD_DOR
	.comm	_irqdma_allocated,4,2           ## @irqdma_allocated
	.no_dead_strip	_floppy_grab_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_grab_irq_and_dma
_floppy_grab_irq_and_dma:               ; @floppy_grab_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	x20, _usage_count@GOTPAGE
Lloh3:
	ldr	x20, [x20, _usage_count@GOTPAGEOFF]
	ldr	w21, [x20]
	add	w8, w21, #1
	str	w8, [x20]
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	cbz	w21, LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_27
LBB0_2:
	bl	_flush_scheduled_work
	bl	_fd_request_irq
	cbz	x0, LBB0_5
; %bb.3:
Lloh4:
	adrp	x8, _FLOPPY_IRQ@GOTPAGE
Lloh5:
	ldr	x8, [x8, _FLOPPY_IRQ@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DPRINT
LBB0_4:
Lloh9:
	adrp	x19, _floppy_usage_lock@GOTPAGE
Lloh10:
	ldr	x19, [x19, _floppy_usage_lock@GOTPAGEOFF]
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	w8, [x20]
	sub	w8, w8, #1
	str	w8, [x20]
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	w0, #-1
	b	LBB0_27
LBB0_5:
	bl	_fd_request_dma
	cbz	x0, LBB0_10
; %bb.6:
Lloh11:
	adrp	x8, _FLOPPY_DMA@GOTPAGE
Lloh12:
	ldr	x8, [x8, _FLOPPY_DMA@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DPRINT
Lloh16:
	adrp	x8, _can_use_virtual_dma@GOTPAGE
Lloh17:
	ldr	x8, [x8, _can_use_virtual_dma@GOTPAGEOFF]
	ldr	w9, [x8]
	tbnz	w9, #1, LBB0_9
; %bb.7:
	tbnz	w9, #0, LBB0_10
; %bb.8:
	bl	_fd_free_irq
	b	LBB0_4
LBB0_9:
	mov	w9, #1
	str	w9, [x8]
Lloh18:
	adrp	x8, _use_virtual_dma@GOTPAGE
Lloh19:
	ldr	x8, [x8, _use_virtual_dma@GOTPAGEOFF]
Lloh20:
	str	w9, [x8]
LBB0_10:
Lloh21:
	adrp	x19, _fdc@GOTPAGE
Lloh22:
	ldr	x19, [x19, _fdc@GOTPAGEOFF]
	str	xzr, [x19]
Lloh23:
	adrp	x21, _N_FDC@GOTPAGE
Lloh24:
	ldr	x21, [x21, _N_FDC@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh25:
	adrp	x22, _FDCS@GOTPAGE
Lloh26:
	ldr	x22, [x22, _FDCS@GOTPAGEOFF]
	cmp	x8, #1
	b.lt	LBB0_21
; %bb.11:
	mov	x0, #0
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	add	x0, x0, #1
	str	x0, [x19]
	cmp	x0, x8
	b.ge	LBB0_16
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x22]
	ldr	w9, [x9]
	cmn	w9, #1
	b.eq	LBB0_12
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	bl	_floppy_request_regions
	cbnz	x0, LBB0_28
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x0, [x19]
	ldr	x8, [x21]
	b	LBB0_12
LBB0_16:
	str	xzr, [x19]
	cmp	x8, #1
	b.lt	LBB0_21
; %bb.17:
	mov	x9, #0
Lloh27:
	adrp	x20, _FD_DOR@GOTPAGE
Lloh28:
	ldr	x20, [x20, _FD_DOR@GOTPAGEOFF]
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=1
	add	x9, x9, #1
	str	x9, [x19]
	cmp	x9, x8
	b.ge	LBB0_21
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x22]
	ldr	w10, [x10]
	cmn	w10, #1
	b.eq	LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	mov	w0, #1
	bl	_reset_fdc_info
	ldr	x8, [x22]
	ldr	w0, [x8, #4]
	ldr	w1, [x20]
	bl	_fd_outb
	ldr	x9, [x19]
	ldr	x8, [x21]
	b	LBB0_18
LBB0_21:
	str	xzr, [x19]
	mov	w0, #0
	mov	w1, #-1
	mov	w2, #8
	bl	_set_dor
	str	xzr, [x19]
	ldr	x8, [x21]
	cmp	x8, #1
	b.lt	LBB0_26
; %bb.22:
	mov	x9, #0
Lloh29:
	adrp	x20, _FD_DOR@GOTPAGE
Lloh30:
	ldr	x20, [x20, _FD_DOR@GOTPAGEOFF]
	b	LBB0_24
LBB0_23:                                ;   in Loop: Header=BB0_24 Depth=1
	add	x9, x9, #1
	str	x9, [x19]
	cmp	x9, x8
	b.ge	LBB0_26
LBB0_24:                                ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x22]
	ldr	w11, [x10]
	cmn	w11, #1
	b.eq	LBB0_23
; %bb.25:                               ;   in Loop: Header=BB0_24 Depth=1
	ldr	w0, [x10, #4]
	ldr	w1, [x20]
	bl	_fd_outb
	ldr	x9, [x19]
	ldr	x8, [x21]
	b	LBB0_23
LBB0_26:
	mov	w0, #0
	str	xzr, [x19]
Lloh31:
	adrp	x8, _irqdma_allocated@GOTPAGE
Lloh32:
	ldr	x8, [x8, _irqdma_allocated@GOTPAGEOFF]
	mov	w9, #1
Lloh33:
	str	w9, [x8]
LBB0_27:
	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
LBB0_28:
	bl	_fd_free_irq
	bl	_fd_free_dma
	ldr	x8, [x19]
	subs	x0, x8, #1
	str	x0, [x19]
	b.lt	LBB0_4
LBB0_29:                                ; =>This Inner Loop Header: Depth=1
	bl	_floppy_release_regions
	ldr	x8, [x19]
	sub	x0, x8, #1
	str	x0, [x19]
	cmp	x8, #0
	b.gt	LBB0_29
	b	LBB0_4
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotStr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotStr	Lloh31, Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_floppy_usage_lock,4,2          ; @floppy_usage_lock
	.comm	_usage_count,4,2                ; @usage_count
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unable to grab IRQ%d for the floppy driver\n"

	.comm	_FLOPPY_IRQ,4,2                 ; @FLOPPY_IRQ
l_.str.1:                               ; @.str.1
	.asciz	"Unable to grab DMA%d for the floppy driver\n"

	.comm	_FLOPPY_DMA,4,2                 ; @FLOPPY_DMA
	.comm	_can_use_virtual_dma,4,2        ; @can_use_virtual_dma
	.comm	_use_virtual_dma,4,2            ; @use_virtual_dma
	.comm	_fdc,8,3                        ; @fdc
	.comm	_N_FDC,8,3                      ; @N_FDC
	.comm	_FDCS,8,3                       ; @FDCS
	.comm	_FD_DOR,4,2                     ; @FD_DOR
	.comm	_irqdma_allocated,4,2           ; @irqdma_allocated
	.no_dead_strip	_floppy_grab_irq_and_dma
.subsections_via_symbols
