	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __card_writecmd0
___card_writecmd0:                      ## @__card_writecmd0
	.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	$568, %rsp                      ## imm = 0x238
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	pxor	%xmm0, %xmm0
	movdqa	%xmm0, -592(%rbp)
	movl	$0, -576(%rbp)
	movq	_CARDIO_ERROR_NOCARD@GOTPCREL(%rip), %r12
	testq	%rdi, %rdi
	js	LBB0_18
## %bb.1:
	movq	%rdi, %r15
	movq	_MAX_DRIVE@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jle	LBB0_18
## %bb.2:
	movq	__ioClrFlag@GOTPCREL(%rip), %rbx
	movl	$255, (%rbx)
	movl	$64, -592(%rbp)
	leaq	-592(%rbp), %rdi
	movl	$5, %esi
	callq	___make_crc7
	movl	%eax, %r14d
	movq	__ioWPFlag@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_3
## %bb.4:
	movl	$0, (%rbx)
	pcmpeqd	%xmm0, %xmm0
	pxor	-592(%rbp), %xmm0
	movdqa	%xmm0, -592(%rbp)
	notl	-576(%rbp)
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_3:
	movl	(%rbx), %eax
LBB0_5:
	movd	%eax, %xmm0
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	movdqa	%xmm0, -560(%rbp)
	movdqa	%xmm0, -544(%rbp)
	movdqa	%xmm0, -528(%rbp)
	movdqa	%xmm0, -512(%rbp)
	movdqa	%xmm0, -496(%rbp)
	movdqa	%xmm0, -480(%rbp)
	movdqa	%xmm0, -464(%rbp)
	movdqa	%xmm0, -448(%rbp)
	movdqa	%xmm0, -432(%rbp)
	movdqa	%xmm0, -416(%rbp)
	movdqa	%xmm0, -400(%rbp)
	movdqa	%xmm0, -384(%rbp)
	movdqa	%xmm0, -368(%rbp)
	movdqa	%xmm0, -352(%rbp)
	movdqa	%xmm0, -336(%rbp)
	movdqa	%xmm0, -320(%rbp)
	movdqa	%xmm0, -304(%rbp)
	movdqa	%xmm0, -288(%rbp)
	movdqa	%xmm0, -272(%rbp)
	movdqa	%xmm0, -256(%rbp)
	movdqa	%xmm0, -240(%rbp)
	movdqa	%xmm0, -224(%rbp)
	movdqa	%xmm0, -208(%rbp)
	movdqa	%xmm0, -192(%rbp)
	movdqa	%xmm0, -176(%rbp)
	movdqa	%xmm0, -160(%rbp)
	movdqa	%xmm0, -144(%rbp)
	movdqa	%xmm0, -128(%rbp)
	movdqa	%xmm0, -112(%rbp)
	movdqa	%xmm0, -96(%rbp)
	movdqa	%xmm0, -80(%rbp)
	movdqa	%xmm0, -64(%rbp)
	movq	%r15, %rdi
	callq	___exi_wait
	movq	_EXI_DEVICE_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	__ioCardFreq@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_EXI_SelectSD
	testq	%rax, %rax
	je	LBB0_12
## %bb.6:
	movl	%r14d, -600(%rbp)               ## 4-byte Spill
	movl	$20, %r14d
	movq	_EXI_WRITE@GOTPCREL(%rip), %r13
	leaq	-560(%rbp), %rbx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %ecx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	$128, %edx
	callq	_EXI_ImmEx
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=1
	decl	%r14d
	jne	LBB0_8
## %bb.11:
	movq	%r15, %rdi
	callq	_EXI_Deselect
	movq	_EXI_DEVICE_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	__ioCardFreq@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_EXI_Select
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movl	-600(%rbp), %eax                ## 4-byte Reload
	orl	$1, %eax
	movl	%eax, -596(%rbp)
	movq	__ioWPFlag@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	je	LBB0_15
## %bb.14:
	notl	%eax
	movl	%eax, -596(%rbp)
LBB0_15:
	movl	(%r13), %ecx
	leaq	-592(%rbp), %rsi
	movq	%r15, %rdi
	movl	$5, %edx
	callq	_EXI_ImmEx
	testq	%rax, %rax
	je	LBB0_9
## %bb.16:
	movl	(%r13), %ecx
	leaq	-596(%rbp), %rsi
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_EXI_ImmEx
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_EXI_Deselect
	movq	%r15, %rdi
	callq	_EXI_Unlock
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.17:
	movq	_CARDIO_ERROR_READY@GOTPCREL(%rip), %r12
	jmp	LBB0_18
LBB0_12:
	movq	%r15, %rdi
	callq	_EXI_Unlock
	jmp	LBB0_18
LBB0_9:
	movq	%r15, %rdi
	callq	_EXI_Deselect
	movq	%r15, %rdi
	callq	_EXI_Unlock
LBB0_10:
	movq	_CARDIO_ERROR_IOERROR@GOTPCREL(%rip), %r12
LBB0_18:
	movq	(%r12), %rax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_20
## %bb.19:
	addq	$568, %rsp                      ## imm = 0x238
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_DRIVE,8,3                  ## @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ## @CARDIO_ERROR_NOCARD
	.comm	__ioClrFlag,4,2                 ## @_ioClrFlag
	.comm	__ioWPFlag,8,3                  ## @_ioWPFlag
	.comm	_EXI_DEVICE_0,4,2               ## @EXI_DEVICE_0
	.comm	__ioCardFreq,4,2                ## @_ioCardFreq
	.comm	_EXI_WRITE,4,2                  ## @EXI_WRITE
	.comm	_CARDIO_ERROR_IOERROR,8,3       ## @CARDIO_ERROR_IOERROR
	.comm	_CARDIO_ERROR_READY,8,3         ## @CARDIO_ERROR_READY
	.no_dead_strip	___card_writecmd0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __card_writecmd0
___card_writecmd0:                      ; @__card_writecmd0
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	sub	sp, sp, #576
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	stur	xzr, [sp, #28]
	stur	xzr, [sp, #20]
Lloh3:
	adrp	x8, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
	tbnz	x0, #63, LBB0_16
; %bb.1:
	mov	x19, x0
Lloh5:
	adrp	x9, _MAX_DRIVE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MAX_DRIVE@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x9, x0
	b.le	LBB0_16
; %bb.2:
	add	x22, sp, #48
Lloh8:
	adrp	x23, __ioClrFlag@GOTPAGE
Lloh9:
	ldr	x23, [x23, __ioClrFlag@GOTPAGEOFF]
	mov	w8, #255
	str	w8, [x23]
	mov	w8, #64
	str	w8, [sp, #16]
	add	x0, sp, #16
	mov	w1, #5
	bl	___make_crc7
	mov	x20, x0
Lloh10:
	adrp	x21, __ioWPFlag@GOTPAGE
Lloh11:
	ldr	x21, [x21, __ioWPFlag@GOTPAGEOFF]
	ldr	x8, [x21]
	cbz	x8, LBB0_4
; %bb.3:
	mov	w8, #0
	str	wzr, [x23]
	ldr	q0, [sp, #16]
	mvn.16b	v0, v0
	str	q0, [sp, #16]
	ldr	w9, [sp, #32]
	mvn	w9, w9
	str	w9, [sp, #32]
	b	LBB0_5
LBB0_4:
	ldr	w8, [x23]
LBB0_5:
	dup.4s	v0, w8
	stp	q0, q0, [sp, #48]
	stp	q0, q0, [sp, #80]
	stp	q0, q0, [sp, #112]
	stp	q0, q0, [x22, #96]
	stp	q0, q0, [x22, #128]
	stp	q0, q0, [x22, #160]
	stp	q0, q0, [x22, #192]
	stp	q0, q0, [x22, #224]
	stp	q0, q0, [x22, #256]
	stp	q0, q0, [x22, #288]
	stp	q0, q0, [x22, #320]
	stp	q0, q0, [x22, #352]
	stp	q0, q0, [x22, #384]
	stp	q0, q0, [x22, #416]
	stp	q0, q0, [x22, #448]
	stp	q0, q0, [x22, #480]
	mov	x0, x19
	bl	___exi_wait
Lloh12:
	adrp	x23, _EXI_DEVICE_0@GOTPAGE
Lloh13:
	ldr	x23, [x23, _EXI_DEVICE_0@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh14:
	adrp	x24, __ioCardFreq@GOTPAGE
Lloh15:
	ldr	x24, [x24, __ioCardFreq@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	x0, x19
	bl	_EXI_SelectSD
	cbz	x0, LBB0_14
; %bb.6:
	mov	w25, #20
Lloh16:
	adrp	x22, _EXI_WRITE@GOTPAGE
Lloh17:
	ldr	x22, [x22, _EXI_WRITE@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w3, [x22]
	add	x1, sp, #48
	mov	x0, x19
	mov	w2, #128
	bl	_EXI_ImmEx
	cbz	x0, LBB0_15
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	subs	w25, w25, #1
	b.ne	LBB0_7
; %bb.9:
	mov	x0, x19
	bl	_EXI_Deselect
	ldr	w1, [x23]
	ldr	w2, [x24]
	mov	x0, x19
	bl	_EXI_Select
	cbz	x0, LBB0_14
; %bb.10:
	orr	w8, w20, #0x1
	str	w8, [sp, #12]
	ldr	x9, [x21]
	cbz	x9, LBB0_12
; %bb.11:
	mvn	w8, w8
	str	w8, [sp, #12]
LBB0_12:
	ldr	w3, [x22]
	add	x1, sp, #16
	mov	x0, x19
	mov	w2, #5
	bl	_EXI_ImmEx
	cbz	x0, LBB0_15
; %bb.13:
	ldr	w3, [x22]
	add	x1, sp, #12
	mov	x0, x19
	mov	w2, #1
	bl	_EXI_ImmEx
	mov	x20, x0
	mov	x0, x19
	bl	_EXI_Deselect
	mov	x0, x19
	bl	_EXI_Unlock
Lloh18:
	adrp	x8, _CARDIO_ERROR_READY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _CARDIO_ERROR_READY@GOTPAGEOFF]
Lloh20:
	adrp	x9, _CARDIO_ERROR_IOERROR@GOTPAGE
Lloh21:
	ldr	x9, [x9, _CARDIO_ERROR_IOERROR@GOTPAGEOFF]
	cmp	x20, #0
	csel	x8, x9, x8, eq
	b	LBB0_16
LBB0_14:
	mov	x0, x19
	bl	_EXI_Unlock
Lloh22:
	adrp	x8, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
	b	LBB0_16
LBB0_15:
	mov	x0, x19
	bl	_EXI_Deselect
	mov	x0, x19
	bl	_EXI_Unlock
Lloh24:
	adrp	x8, _CARDIO_ERROR_IOERROR@GOTPAGE
Lloh25:
	ldr	x8, [x8, _CARDIO_ERROR_IOERROR@GOTPAGEOFF]
LBB0_16:
	ldr	x0, [x8]
	ldur	x8, [x29, #-72]
Lloh26:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh27:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_18
; %bb.17:
	add	sp, sp, #576
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_18:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_DRIVE,8,3                  ; @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ; @CARDIO_ERROR_NOCARD
	.comm	__ioClrFlag,4,2                 ; @_ioClrFlag
	.comm	__ioWPFlag,8,3                  ; @_ioWPFlag
	.comm	_EXI_DEVICE_0,4,2               ; @EXI_DEVICE_0
	.comm	__ioCardFreq,4,2                ; @_ioCardFreq
	.comm	_EXI_WRITE,4,2                  ; @EXI_WRITE
	.comm	_CARDIO_ERROR_IOERROR,8,3       ; @CARDIO_ERROR_IOERROR
	.comm	_CARDIO_ERROR_READY,8,3         ; @CARDIO_ERROR_READY
	.no_dead_strip	___card_writecmd0
.subsections_via_symbols
