	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alsa_midi_set_input
_alsa_midi_set_input:                   ## @alsa_midi_set_input
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.3:
	movl	(%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
	leaq	12(%rbx), %r15
	movq	%r15, %rcx
	callq	_alsa_midi_get_port
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_9
## %bb.4:
	movl	(%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
	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, %r12d
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movl	(%rbx), %edi
	callq	_snd_seq_client_id
	leaq	4(%rbx), %r14
	movl	%eax, 8(%rbx)
	movl	%r12d, 4(%rbx)
	leaq	-40(%rbp), %rdi
	callq	_snd_seq_port_subscribe_alloca
	movq	-40(%rbp), %rdi
	movq	%r15, %rsi
	callq	_snd_seq_port_subscribe_set_sender
	movq	-40(%rbp), %rdi
	movq	%r14, %rsi
	callq	_snd_seq_port_subscribe_set_dest
	movl	(%rbx), %edi
	movq	-40(%rbp), %rsi
	callq	_snd_seq_subscribe_port
	movl	%eax, %r14d
	testl	%eax, %eax
	jns	LBB0_8
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	movl	%r14d, %esi
	callq	_RARCH_ERR
LBB0_8:
	notl	%r14d
	shrl	$31, %r14d
	jmp	LBB0_9
LBB0_1:
	movl	4(%rbx), %esi
	movl	$1, %r14d
	testl	%esi, %esi
	js	LBB0_9
## %bb.2:
	movl	(%rbx), %edi
	callq	_snd_seq_delete_simple_port
	movl	$-1, 4(%rbx)
	jmp	LBB0_9
LBB0_5:
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	callq	_RARCH_ERR
LBB0_9:
	movl	%r14d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.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
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"in"

	.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
	.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_subscribe_port failed with error %d.\n"

	.no_dead_strip	_alsa_midi_set_input
.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_input
_alsa_midi_set_input:                   ; @alsa_midi_set_input
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	cbz	x1, LBB0_6
; %bb.1:
	mov	x20, x19
	ldr	w0, [x20], #12
Lloh0:
	adrp	x8, _SND_SEQ_PORT_CAP_READ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SND_SEQ_PORT_CAP_READ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SND_SEQ_PORT_CAP_SUBS_READ@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SND_SEQ_PORT_CAP_SUBS_READ@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x3, x20
	bl	_alsa_midi_get_port
	cbz	w0, LBB0_10
; %bb.2:
	ldr	w0, [x19]
Lloh6:
	adrp	x8, _SND_SEQ_PORT_CAP_WRITE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SND_SEQ_PORT_CAP_WRITE@GOTPAGEOFF]
Lloh8:
	adrp	x9, _SND_SEQ_PORT_CAP_SUBS_WRITE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SND_SEQ_PORT_CAP_SUBS_WRITE@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	x21, x0
	tbnz	w0, #31, LBB0_9
; %bb.3:
	ldr	w0, [x19]
	bl	_snd_seq_client_id
	str	w0, [x19, #8]
	mov	x22, x19
	str	w21, [x22, #4]!
	add	x0, sp, #8
	bl	_snd_seq_port_subscribe_alloca
	ldr	x0, [sp, #8]
	mov	x1, x20
	bl	_snd_seq_port_subscribe_set_sender
	ldr	x0, [sp, #8]
	mov	x1, x22
	bl	_snd_seq_port_subscribe_set_dest
	ldr	w0, [x19]
	ldr	x1, [sp, #8]
	bl	_snd_seq_subscribe_port
	mov	x19, x0
	tbz	w0, #31, LBB0_5
; %bb.4:
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	bl	_RARCH_ERR
LBB0_5:
	mvn	w8, w19
	lsr	w0, w8, #31
	b	LBB0_10
LBB0_6:
	ldr	w1, [x19, #4]
	tbnz	w1, #31, LBB0_8
; %bb.7:
	ldr	w0, [x19]
	bl	_snd_seq_delete_simple_port
	mov	w8, #-1
	str	w8, [x19, #4]
LBB0_8:
	mov	w0, #1
	b	LBB0_10
LBB0_9:
Lloh19:
	adrp	x0, l_.str.1@PAGE
Lloh20:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	bl	_RARCH_ERR
	mov	w0, #0
LBB0_10:
	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
	add	sp, sp, #64
	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
	.cfi_endproc
                                        ; -- End function
	.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
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"in"

	.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
	.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_subscribe_port failed with error %d.\n"

	.no_dead_strip	_alsa_midi_set_input
.subsections_via_symbols
