	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CARD_Open                      ## -- Begin function CARD_Open
	.p2align	4, 0x90
_CARD_Open:                             ## @CARD_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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	$0, -40(%rbp)
	movq	_EXI_CHANNEL_0@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jg	LBB0_2
## %bb.1:
	movq	%rdi, %r12
	movq	_EXI_CHANNEL_2@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jle	LBB0_2
## %bb.3:
	movq	%rdx, %r14
	movq	%rsi, %r15
	movl	$-1, (%rdx)
	leaq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	___card_getcntrlblock
	testq	%rax, %rax
	js	LBB0_4
## %bb.5:
	movq	-40(%rbp), %rdi
	movq	_card_gamecode@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_card_company@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	-48(%rbp), %r8
	movq	%r15, %rsi
	callq	___card_getfilenum
	movq	-40(%rbp), %rdi
	testq	%rax, %rax
	js	LBB0_6
## %bb.7:
	callq	___card_getdirblock
	movq	(%rax), %rax
	movq	-48(%rbp), %rdx
	movl	(%rax,%rdx,8), %ecx
	movq	-40(%rbp), %rdi
	cmpl	$5, %ecx
	jl	LBB0_9
## %bb.8:
	cmpl	(%rdi), %ecx
	jge	LBB0_9
## %bb.10:
	movq	%r12, 24(%r14)
	movl	%edx, (%r14)
	movq	$0, 16(%r14)
	movl	4(%rdi), %esi
	imull	4(%rax,%rdx,8), %esi
	movl	%esi, 4(%r14)
	movl	%ecx, 8(%r14)
	movq	_CARD_ERROR_READY@GOTPCREL(%rip), %rbx
	jmp	LBB0_11
LBB0_2:
	movq	_CARD_ERROR_NOCARD@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	jmp	LBB0_12
LBB0_4:
	movq	%rax, %rbx
	jmp	LBB0_12
LBB0_9:
	movq	_CARD_ERROR_BROKEN@GOTPCREL(%rip), %rbx
LBB0_11:
	movq	(%rbx), %rsi
	callq	___card_putcntrlblock
	movq	(%rbx), %rbx
	jmp	LBB0_12
LBB0_6:
	movq	%rax, %rbx
	movq	%rax, %rsi
	callq	___card_putcntrlblock
LBB0_12:
	movq	%rbx, %rax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EXI_CHANNEL_0,8,3              ## @EXI_CHANNEL_0
	.comm	_EXI_CHANNEL_2,8,3              ## @EXI_CHANNEL_2
	.comm	_CARD_ERROR_NOCARD,8,3          ## @CARD_ERROR_NOCARD
	.comm	_card_gamecode,8,3              ## @card_gamecode
	.comm	_card_company,8,3               ## @card_company
	.comm	_CARD_ERROR_BROKEN,8,3          ## @CARD_ERROR_BROKEN
	.comm	_CARD_ERROR_READY,8,3           ## @CARD_ERROR_READY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CARD_Open                      ; -- Begin function CARD_Open
	.p2align	2
_CARD_Open:                             ; @CARD_Open
	.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
	str	xzr, [sp]
Lloh0:
	adrp	x8, _EXI_CHANNEL_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EXI_CHANNEL_0@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _EXI_CHANNEL_2@GOTPAGE
Lloh4:
	ldr	x9, [x9, _EXI_CHANNEL_2@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x0
	ccmp	x9, x0, #4, le
	b.gt	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _CARD_ERROR_NOCARD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CARD_ERROR_NOCARD@GOTPAGEOFF]
Lloh8:
	ldr	x22, [x8]
	b	LBB0_11
LBB0_2:
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	mov	w8, #-1
	str	w8, [x2]
	mov	x1, sp
	bl	___card_getcntrlblock
	tbnz	x0, #63, LBB0_7
; %bb.3:
	ldr	x0, [sp]
Lloh9:
	adrp	x8, _card_gamecode@GOTPAGE
Lloh10:
	ldr	x8, [x8, _card_gamecode@GOTPAGEOFF]
Lloh11:
	ldr	x2, [x8]
Lloh12:
	adrp	x8, _card_company@GOTPAGE
Lloh13:
	ldr	x8, [x8, _card_company@GOTPAGEOFF]
Lloh14:
	ldr	x3, [x8]
	add	x4, sp, #8
	mov	x1, x21
	bl	___card_getfilenum
	mov	x22, x0
	ldr	x0, [sp]
	tbnz	x22, #63, LBB0_10
; %bb.4:
	bl	___card_getdirblock
	ldr	x9, [x0]
	ldp	x0, x10, [sp]
	lsl	x8, x10, #3
	ldr	w8, [x9, x8]
	cmp	w8, #5
	b.lt	LBB0_8
; %bb.5:
	ldr	w11, [x0]
	cmp	w8, w11
	b.ge	LBB0_8
; %bb.6:
	str	w10, [x19]
	stp	xzr, x20, [x19, #16]
	add	x9, x9, x10, lsl #3
	ldr	w9, [x9, #4]
	ldr	w10, [x0, #4]
	mul	w9, w10, w9
	stp	w9, w8, [x19, #4]
Lloh15:
	adrp	x19, _CARD_ERROR_READY@GOTPAGE
Lloh16:
	ldr	x19, [x19, _CARD_ERROR_READY@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:
	mov	x22, x0
	b	LBB0_11
LBB0_8:
Lloh17:
	adrp	x19, _CARD_ERROR_BROKEN@GOTPAGE
Lloh18:
	ldr	x19, [x19, _CARD_ERROR_BROKEN@GOTPAGEOFF]
LBB0_9:
	ldr	x1, [x19]
	bl	___card_putcntrlblock
	ldr	x22, [x19]
	b	LBB0_11
LBB0_10:
	mov	x1, x22
	bl	___card_putcntrlblock
LBB0_11:
	mov	x0, x22
	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 AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_EXI_CHANNEL_0,8,3              ; @EXI_CHANNEL_0
	.comm	_EXI_CHANNEL_2,8,3              ; @EXI_CHANNEL_2
	.comm	_CARD_ERROR_NOCARD,8,3          ; @CARD_ERROR_NOCARD
	.comm	_card_gamecode,8,3              ; @card_gamecode
	.comm	_card_company,8,3               ; @card_company
	.comm	_CARD_ERROR_BROKEN,8,3          ; @CARD_ERROR_BROKEN
	.comm	_CARD_ERROR_READY,8,3           ; @CARD_ERROR_READY
.subsections_via_symbols
