	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sb_midi_open
_sb_midi_open:                          ## @sb_midi_open
	.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	_midi_devs@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%edi, %rcx
	movq	(%rax,%rcx,8), %rax
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.3:
	movq	%rdx, %r14
	movl	%esi, %r15d
	leaq	36(%rbx), %r12
	movq	%r12, %rdi
	callq	_spin_lock_irqsave
	cmpl	$0, (%rbx)
	je	LBB0_5
## %bb.4:
	movq	%r12, %rdi
	callq	_spin_unlock_irqrestore
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
LBB0_1:
	movq	_ENXIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
LBB0_5:
	movl	$1, (%rbx)
	movq	%r12, %rdi
	callq	_spin_unlock_irqrestore
	movq	_IMODE_MIDI@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	$0, 24(%rbx)
	movq	%rbx, %rdi
	callq	_sb_dsp_reset
	movq	%rbx, %rdi
	movl	$53, %esi
	callq	_sb_dsp_command
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	$1, 4(%rbx)
	movq	_OPEN_READ@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	testl	%r15d, (%rcx)
	je	LBB0_9
## %bb.8:
	movl	$1, 8(%rbx)
	movq	%r14, 16(%rbx)
	jmp	LBB0_9
LBB0_6:
	movl	$0, (%rbx)
	movq	_EIO@GOTPCREL(%rip), %rcx
LBB0_2:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_midi_devs,8,3                  ## @midi_devs
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_IMODE_MIDI,4,2                 ## @IMODE_MIDI
	.comm	_EIO,4,2                        ## @EIO
	.comm	_OPEN_READ,4,2                  ## @OPEN_READ
	.no_dead_strip	_sb_midi_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sb_midi_open
_sb_midi_open:                          ; @sb_midi_open
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
Lloh0:
	adrp	x8, _midi_devs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _midi_devs@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x8, [x8, w0, sxtw #3]
	ldr	x20, [x8]
	cbz	x20, LBB0_3
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	add	x22, x20, #36
	mov	x0, x22
	bl	_spin_lock_irqsave
	ldr	w8, [x20]
	cbz	w8, LBB0_6
; %bb.2:
	mov	x0, x22
	bl	_spin_unlock_irqrestore
Lloh3:
	adrp	x8, _EBUSY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
Lloh5:
	adrp	x8, _ENXIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_6:
	mov	w23, #1
	str	w23, [x20]
	mov	x0, x22
	bl	_spin_unlock_irqrestore
Lloh7:
	adrp	x8, _IMODE_MIDI@GOTPAGE
Lloh8:
	ldr	x8, [x8, _IMODE_MIDI@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [x20, #32]
	str	xzr, [x20, #24]
	mov	x0, x20
	bl	_sb_dsp_reset
	mov	x0, x20
	mov	w1, #53
	bl	_sb_dsp_command
	cbz	w0, LBB0_9
; %bb.7:
	str	w23, [x20, #4]
Lloh10:
	adrp	x8, _OPEN_READ@GOTPAGE
Lloh11:
	ldr	x8, [x8, _OPEN_READ@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_10
; %bb.8:
	mov	w0, #0
	mov	w8, #1
	str	w8, [x20, #8]
	str	x19, [x20, #16]
	b	LBB0_5
LBB0_9:
	str	wzr, [x20]
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_4
LBB0_10:
	mov	w0, #0
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_midi_devs,8,3                  ; @midi_devs
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_IMODE_MIDI,4,2                 ; @IMODE_MIDI
	.comm	_EIO,4,2                        ; @EIO
	.comm	_OPEN_READ,4,2                  ; @OPEN_READ
	.no_dead_strip	_sb_midi_open
.subsections_via_symbols
