	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alsa_midi_set_output
_alsa_midi_set_output:                  ## @alsa_midi_set_output
	.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	%rdi, %rbx
	testq	%rsi, %rsi
	je	LBB0_7
## %bb.1:
	movl	4(%rbx), %edi
	movq	_SND_SEQ_PORT_CAP_WRITE@GOTPCREL(%rip), %rax
	movq	_SND_SEQ_PORT_CAP_SUBS_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	leaq	8(%rbx), %rcx
	callq	_alsa_midi_get_port
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_16
## %bb.2:
	movl	4(%rbx), %edi
	movq	_SND_SEQ_PORT_CAP_READ@GOTPCREL(%rip), %rax
	movq	_SND_SEQ_PORT_CAP_SUBS_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_SND_SEQ_PORT_TYPE_APPLICATION@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_snd_seq_create_simple_port
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_11
## %bb.3:
	movl	4(%rbx), %edi
	callq	_snd_seq_client_id
	movl	%eax, 20(%rbx)
	movl	%r15d, 16(%rbx)
	movl	12(%rbx), %edx
	movl	4(%rbx), %edi
	movl	8(%rbx), %ecx
	movl	%r15d, %esi
	callq	_snd_seq_connect_to
	testl	%eax, %eax
	js	LBB0_12
## %bb.4:
	movl	4(%rbx), %edi
	callq	_snd_seq_alloc_queue
	movl	%eax, (%rbx)
	testl	%eax, %eax
	js	LBB0_13
## %bb.5:
	movl	4(%rbx), %edi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_snd_seq_start_queue
	movl	$1, %r14d
	testl	%eax, %eax
	jns	LBB0_16
## %bb.6:
	leaq	L_.str.4(%rip), %rdi
	movl	%eax, %esi
	callq	_RARCH_ERR
	xorl	%r14d, %r14d
	jmp	LBB0_16
LBB0_7:
	movl	(%rbx), %esi
	testl	%esi, %esi
	js	LBB0_9
## %bb.8:
	movl	4(%rbx), %edi
	xorl	%edx, %edx
	callq	_snd_seq_stop_queue
	movl	(%rbx), %esi
	movl	4(%rbx), %edi
	callq	_snd_seq_free_queue
	movl	$-1, (%rbx)
LBB0_9:
	movl	16(%rbx), %esi
	movl	$1, %r14d
	testl	%esi, %esi
	js	LBB0_16
## %bb.10:
	movl	4(%rbx), %edi
	callq	_snd_seq_delete_simple_port
	movl	$-1, 16(%rbx)
	jmp	LBB0_16
LBB0_11:
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	jmp	LBB0_15
LBB0_12:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_14
LBB0_13:
	leaq	L_.str.3(%rip), %rdi
LBB0_14:
	movl	%eax, %esi
LBB0_15:
	callq	_RARCH_ERR
LBB0_16:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SND_SEQ_PORT_CAP_WRITE,4,2     ## @SND_SEQ_PORT_CAP_WRITE
	.comm	_SND_SEQ_PORT_CAP_SUBS_WRITE,4,2 ## @SND_SEQ_PORT_CAP_SUBS_WRITE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out"

	.comm	_SND_SEQ_PORT_CAP_READ,4,2      ## @SND_SEQ_PORT_CAP_READ
	.comm	_SND_SEQ_PORT_CAP_SUBS_READ,4,2 ## @SND_SEQ_PORT_CAP_SUBS_READ
	.comm	_SND_SEQ_PORT_TYPE_APPLICATION,4,2 ## @SND_SEQ_PORT_TYPE_APPLICATION
L_.str.1:                               ## @.str.1
	.asciz	"[MIDI]: snd_seq_create_simple_port failed with error %d.\n"

L_.str.2:                               ## @.str.2
	.asciz	"[MIDI]: snd_seq_connect_to failed with error %d.\n"

L_.str.3:                               ## @.str.3
	.asciz	"[MIDI]: snd_seq_alloc_queue failed with error %d.\n"

L_.str.4:                               ## @.str.4
	.asciz	"[MIDI]: snd_seq_start_queue failed with error %d.\n"

	.no_dead_strip	_alsa_midi_set_output
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alsa_midi_set_output
_alsa_midi_set_output:                  ; @alsa_midi_set_output
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	cbz	x1, LBB0_7
; %bb.1:
	ldr	w0, [x19, #4]
Lloh0:
	adrp	x8, _SND_SEQ_PORT_CAP_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SND_SEQ_PORT_CAP_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SND_SEQ_PORT_CAP_SUBS_WRITE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SND_SEQ_PORT_CAP_SUBS_WRITE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w2, w9, w8
	add	x3, x19, #8
	bl	_alsa_midi_get_port
	cbz	w0, LBB0_16
; %bb.2:
	ldr	w0, [x19, #4]
Lloh6:
	adrp	x8, _SND_SEQ_PORT_CAP_READ@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SND_SEQ_PORT_CAP_READ@GOTPAGEOFF]
Lloh8:
	adrp	x9, _SND_SEQ_PORT_CAP_SUBS_READ@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SND_SEQ_PORT_CAP_SUBS_READ@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh12:
	adrp	x8, _SND_SEQ_PORT_TYPE_APPLICATION@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SND_SEQ_PORT_TYPE_APPLICATION@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_snd_seq_create_simple_port
	mov	x20, x0
	tbnz	w0, #31, LBB0_12
; %bb.3:
	ldr	w0, [x19, #4]
	bl	_snd_seq_client_id
	stp	w20, w0, [x19, #16]
	ldp	w3, w2, [x19, #8]
	ldr	w0, [x19, #4]
	mov	x1, x20
	bl	_snd_seq_connect_to
	tbnz	w0, #31, LBB0_13
; %bb.4:
	ldr	w0, [x19, #4]
	bl	_snd_seq_alloc_queue
	mov	x1, x0
	str	w0, [x19]
	tbnz	w0, #31, LBB0_14
; %bb.5:
	ldr	w0, [x19, #4]
	mov	x2, #0
	bl	_snd_seq_start_queue
	tbz	w0, #31, LBB0_11
; %bb.6:
	mov	x1, x0
Lloh17:
	adrp	x0, l_.str.4@PAGE
Lloh18:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_15
LBB0_7:
	ldr	w1, [x19]
	tbnz	w1, #31, LBB0_9
; %bb.8:
	ldr	w0, [x19, #4]
	mov	x2, #0
	bl	_snd_seq_stop_queue
	ldp	w1, w0, [x19]
	bl	_snd_seq_free_queue
	mov	w8, #-1
	str	w8, [x19]
LBB0_9:
	ldr	w1, [x19, #16]
	tbnz	w1, #31, LBB0_11
; %bb.10:
	ldr	w0, [x19, #4]
	bl	_snd_seq_delete_simple_port
	mov	w8, #-1
	str	w8, [x19, #16]
	mov	w0, #1
	b	LBB0_16
LBB0_11:
	mov	w0, #1
	b	LBB0_16
LBB0_12:
Lloh19:
	adrp	x0, l_.str.1@PAGE
Lloh20:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	b	LBB0_15
LBB0_13:
	mov	x1, x0
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_15
LBB0_14:
Lloh23:
	adrp	x0, l_.str.3@PAGE
Lloh24:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_15:
	bl	_RARCH_ERR
	mov	w0, #0
LBB0_16:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_SND_SEQ_PORT_CAP_WRITE,4,2     ; @SND_SEQ_PORT_CAP_WRITE
	.comm	_SND_SEQ_PORT_CAP_SUBS_WRITE,4,2 ; @SND_SEQ_PORT_CAP_SUBS_WRITE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out"

	.comm	_SND_SEQ_PORT_CAP_READ,4,2      ; @SND_SEQ_PORT_CAP_READ
	.comm	_SND_SEQ_PORT_CAP_SUBS_READ,4,2 ; @SND_SEQ_PORT_CAP_SUBS_READ
	.comm	_SND_SEQ_PORT_TYPE_APPLICATION,4,2 ; @SND_SEQ_PORT_TYPE_APPLICATION
l_.str.1:                               ; @.str.1
	.asciz	"[MIDI]: snd_seq_create_simple_port failed with error %d.\n"

l_.str.2:                               ; @.str.2
	.asciz	"[MIDI]: snd_seq_connect_to failed with error %d.\n"

l_.str.3:                               ; @.str.3
	.asciz	"[MIDI]: snd_seq_alloc_queue failed with error %d.\n"

l_.str.4:                               ; @.str.4
	.asciz	"[MIDI]: snd_seq_start_queue failed with error %d.\n"

	.no_dead_strip	_alsa_midi_set_output
.subsections_via_symbols
