	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tmdc_connect
_tmdc_connect:                          ## @tmdc_connect
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_TMDC_MAX_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	(%rbx,%rbx), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$32, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, 24(%rax)
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_gameport_set_drvdata
	movq	_GAMEPORT_MODE_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_gameport_open
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_tmdc_read_packet
	movl	%eax, (%r12)
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movq	_tmdc_poll@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_gameport_set_poll_handler
	movq	%r14, %rdi
	movl	$20, %esi
	callq	_gameport_set_poll_interval
	movl	(%r12), %eax
	testb	$1, %al
	je	LBB0_8
## %bb.6:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	_tmdc_setup_port
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_12
## %bb.7:
	movl	(%r12), %eax
LBB0_8:
	xorl	%ebx, %ebx
	testb	$2, %al
	je	LBB0_14
## %bb.9:
	addq	-56(%rbp), %r15                 ## 8-byte Folded Reload
	movq	%r12, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	callq	_tmdc_setup_port
	testl	%eax, %eax
	je	LBB0_14
## %bb.10:
	movl	%eax, %r13d
	movq	8(%r12), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	movl	16(%rax), %edi
	callq	_input_unregister_device
	movq	8(%r12), %rax
	movq	(%rax), %rdi
	callq	_kfree
	jmp	LBB0_12
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_4:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_12:
	movq	%r14, %rdi
	callq	_gameport_close
LBB0_13:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_gameport_set_drvdata
	movq	%r12, %rdi
	callq	_kfree
	movl	%r13d, %ebx
LBB0_14:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_16
## %bb.15:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_TMDC_MAX_LENGTH,4,2            ## @TMDC_MAX_LENGTH
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GAMEPORT_MODE_RAW,4,2          ## @GAMEPORT_MODE_RAW
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_tmdc_poll,4,2                  ## @tmdc_poll
	.no_dead_strip	_tmdc_connect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tmdc_connect
_tmdc_connect:                          ; @tmdc_connect
	.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
	sub	sp, sp, #16
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x8, _TMDC_MAX_LENGTH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TMDC_MAX_LENGTH@GOTPAGEOFF]
Lloh5:
	ldr	w23, [x8]
	lsl	x8, x23, #1
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x3fffffff0
	sub	x21, x9, x8
	mov	sp, x21
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w0, #32
	bl	_kzalloc
	cbz	x0, LBB0_8
; %bb.1:
	mov	x20, x0
	str	x19, [x0, #24]
	mov	x0, x19
	mov	x1, x20
	bl	_gameport_set_drvdata
Lloh11:
	adrp	x8, _GAMEPORT_MODE_RAW@GOTPAGE
Lloh12:
	ldr	x8, [x8, _GAMEPORT_MODE_RAW@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x22
	bl	_gameport_open
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.2:
	mov	x0, x19
	mov	x1, x21
	bl	_tmdc_read_packet
	str	w0, [x20]
	cbz	w0, LBB0_9
; %bb.3:
Lloh14:
	adrp	x8, _tmdc_poll@GOTPAGE
Lloh15:
	ldr	x8, [x8, _tmdc_poll@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_gameport_set_poll_handler
	mov	x0, x19
	mov	w1, #20
	bl	_gameport_set_poll_interval
	ldr	w8, [x20]
	tbz	w8, #0, LBB0_6
; %bb.4:
	mov	x0, x20
	mov	w1, #0
	mov	x2, x21
	bl	_tmdc_setup_port
	mov	x22, x0
	cbnz	w0, LBB0_10
; %bb.5:
	ldr	w8, [x20]
LBB0_6:
	tbnz	w8, #1, LBB0_14
; %bb.7:
	mov	w22, #0
	b	LBB0_12
LBB0_8:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_12
LBB0_9:
Lloh20:
	adrp	x8, _ENODEV@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	mov	x0, x19
	bl	_gameport_close
LBB0_11:
	mov	x0, x19
	mov	x1, #0
	bl	_gameport_set_drvdata
	mov	x0, x20
	bl	_kfree
LBB0_12:
	ldur	x8, [x29, #-56]
Lloh23:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh24:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_17
; %bb.13:
	mov	x0, x22
	sub	sp, x29, #48
	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_14:
	add	x2, x21, x23
	mov	x0, x20
	mov	w1, #1
	bl	_tmdc_setup_port
	mov	x22, x0
	cbz	w0, LBB0_12
; %bb.15:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	cbz	x8, LBB0_10
; %bb.16:
	ldr	w0, [x8, #16]
	bl	_input_unregister_device
	ldr	x8, [x20, #8]
	ldr	x0, [x8]
	bl	_kfree
	b	LBB0_10
LBB0_17:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.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	_TMDC_MAX_LENGTH,4,2            ; @TMDC_MAX_LENGTH
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GAMEPORT_MODE_RAW,4,2          ; @GAMEPORT_MODE_RAW
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_tmdc_poll,4,2                  ; @tmdc_poll
	.no_dead_strip	_tmdc_connect
.subsections_via_symbols
