	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function idetape_chrdev_release
_idetape_chrdev_release:                ## @idetape_chrdev_release
	.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	(%rsi), %rax
	movq	24(%rax), %r14
	callq	_iminor
	movl	%eax, %ebx
	xorl	%eax, %eax
	callq	_lock_kernel
	movq	8(%r14), %r15
	movq	_IDE_DBG_FUNC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_ide_debug_log
	movq	(%r15), %rax
	movq	_IDETAPE_DIR_WRITE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_idetape_write_release
	movq	(%r15), %rax
LBB0_2:
	movq	_IDETAPE_DIR_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.3:
	cmpl	$127, %ebx
	ja	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_ide_tape_discard_merge_buffer
LBB0_5:
	cmpl	$127, %ebx
	ja	LBB0_8
## %bb.6:
	movq	_IDE_AFLAG_MEDIUM_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ilog2
	movl	%eax, %edi
	movq	%r14, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	callq	_idetape_rewind_tape
LBB0_8:
	movq	(%r15), %rax
	movq	_IDETAPE_DIR_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.9:
	movq	8(%r15), %rax
	movq	_DOOR_LOCKED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.10:
	movl	16(%r15), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_ide_set_media_lock
	testl	%eax, %eax
	jne	LBB0_12
## %bb.11:
	movq	_DOOR_UNLOCKED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r15)
LBB0_12:
	movq	_IDE_AFLAG_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ilog2
	movl	%eax, %edi
	movq	%r14, %rsi
	callq	_clear_bit
	movq	%r15, %rdi
	callq	_ide_tape_put
	xorl	%eax, %eax
	callq	_unlock_kernel
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IDE_DBG_FUNC,4,2               ## @IDE_DBG_FUNC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"enter"

	.comm	_IDETAPE_DIR_WRITE,8,3          ## @IDETAPE_DIR_WRITE
	.comm	_IDETAPE_DIR_READ,8,3           ## @IDETAPE_DIR_READ
	.comm	_IDE_AFLAG_MEDIUM_PRESENT,4,2   ## @IDE_AFLAG_MEDIUM_PRESENT
	.comm	_IDETAPE_DIR_NONE,8,3           ## @IDETAPE_DIR_NONE
	.comm	_DOOR_LOCKED,8,3                ## @DOOR_LOCKED
	.comm	_DOOR_UNLOCKED,8,3              ## @DOOR_UNLOCKED
	.comm	_IDE_AFLAG_BUSY,4,2             ## @IDE_AFLAG_BUSY
	.no_dead_strip	_idetape_chrdev_release
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function idetape_chrdev_release
_idetape_chrdev_release:                ; @idetape_chrdev_release
	.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
	ldr	x8, [x1]
	ldr	x19, [x8, #24]
	bl	_iminor
	mov	x21, x0
	bl	_lock_kernel
	ldr	x20, [x19, #8]
Lloh0:
	adrp	x8, _IDE_DBG_FUNC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IDE_DBG_FUNC@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_ide_debug_log
	ldr	x8, [x20]
Lloh5:
	adrp	x9, _IDETAPE_DIR_WRITE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _IDETAPE_DIR_WRITE@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x19
	mov	x1, x21
	bl	_idetape_write_release
	ldr	x8, [x20]
LBB0_2:
Lloh8:
	adrp	x9, _IDETAPE_DIR_READ@GOTPAGE
Lloh9:
	ldr	x9, [x9, _IDETAPE_DIR_READ@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	cmp	w21, #127
	b.hi	LBB0_5
; %bb.4:
	mov	x0, x19
	mov	w1, #1
	bl	_ide_tape_discard_merge_buffer
LBB0_5:
	cmp	w21, #127
	b.hi	LBB0_8
; %bb.6:
Lloh11:
	adrp	x8, _IDE_AFLAG_MEDIUM_PRESENT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _IDE_AFLAG_MEDIUM_PRESENT@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	bl	_ilog2
	mov	x1, x19
	bl	_test_bit
	cbz	x0, LBB0_8
; %bb.7:
	mov	x0, x19
	bl	_idetape_rewind_tape
LBB0_8:
	ldr	x8, [x20]
Lloh14:
	adrp	x9, _IDETAPE_DIR_NONE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _IDETAPE_DIR_NONE@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.9:
	ldr	x8, [x20, #8]
Lloh17:
	adrp	x9, _DOOR_LOCKED@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DOOR_LOCKED@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.10:
	ldr	w1, [x20, #16]
	mov	x0, x19
	mov	w2, #0
	bl	_ide_set_media_lock
	cbnz	w0, LBB0_12
; %bb.11:
Lloh20:
	adrp	x8, _DOOR_UNLOCKED@GOTPAGE
Lloh21:
	ldr	x8, [x8, _DOOR_UNLOCKED@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	str	x8, [x20, #8]
LBB0_12:
Lloh23:
	adrp	x8, _IDE_AFLAG_BUSY@GOTPAGE
Lloh24:
	ldr	x8, [x8, _IDE_AFLAG_BUSY@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	bl	_ilog2
	mov	x1, x19
	bl	_clear_bit
	mov	x0, x20
	bl	_ide_tape_put
	bl	_unlock_kernel
	mov	w0, #0
	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	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_IDE_DBG_FUNC,4,2               ; @IDE_DBG_FUNC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"enter"

	.comm	_IDETAPE_DIR_WRITE,8,3          ; @IDETAPE_DIR_WRITE
	.comm	_IDETAPE_DIR_READ,8,3           ; @IDETAPE_DIR_READ
	.comm	_IDE_AFLAG_MEDIUM_PRESENT,4,2   ; @IDE_AFLAG_MEDIUM_PRESENT
	.comm	_IDETAPE_DIR_NONE,8,3           ; @IDETAPE_DIR_NONE
	.comm	_DOOR_LOCKED,8,3                ; @DOOR_LOCKED
	.comm	_DOOR_UNLOCKED,8,3              ; @DOOR_UNLOCKED
	.comm	_IDE_AFLAG_BUSY,4,2             ; @IDE_AFLAG_BUSY
	.no_dead_strip	_idetape_chrdev_release
.subsections_via_symbols
