	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __card_writecmd
___card_writecmd:                       ## @__card_writecmd
	.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	$152, %rsp
	.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)
	movq	_CARDIO_ERROR_NOCARD@GOTPCREL(%rip), %r13
	testq	%rdi, %rdi
	js	LBB0_23
## %bb.1:
	movq	%rdi, %r14
	movq	_MAX_DRIVE@GOTPCREL(%rip), %rax
	cmpq	%rdi, (%rax)
	jle	LBB0_23
## %bb.2:
	movq	%rdx, %r15
	movq	%rsi, %rbx
	orb	$64, (%rsi)
	movq	%rsi, %rdi
	movq	%rdx, %rsi
	callq	___make_crc7
	movl	%eax, %r12d
	movl	%eax, -180(%rbp)
	movq	__ioWPFlag@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_14
## %bb.3:
	testq	%r15, %r15
	jle	LBB0_14
## %bb.4:
	cmpq	$8, %r15
	jae	LBB0_6
## %bb.5:
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_6:
	movq	%r15, %rax
	andq	$-8, %rax
	leaq	-8(%rax), %rcx
	movq	%rcx, %rdx
	shrq	$3, %rdx
	incq	%rdx
	testq	%rcx, %rcx
	je	LBB0_7
## %bb.8:
	movq	%rdx, %rsi
	andq	$-2, %rsi
	xorl	%ecx, %ecx
	pcmpeqd	%xmm0, %xmm0
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	(%rbx,%rcx,4), %xmm1
	movdqu	16(%rbx,%rcx,4), %xmm2
	movdqu	32(%rbx,%rcx,4), %xmm3
	movdqu	48(%rbx,%rcx,4), %xmm4
	pxor	%xmm0, %xmm1
	pxor	%xmm0, %xmm2
	movdqu	%xmm1, (%rbx,%rcx,4)
	movdqu	%xmm2, 16(%rbx,%rcx,4)
	pxor	%xmm0, %xmm3
	pxor	%xmm0, %xmm4
	movdqu	%xmm3, 32(%rbx,%rcx,4)
	movdqu	%xmm4, 48(%rbx,%rcx,4)
	addq	$16, %rcx
	addq	$-2, %rsi
	jne	LBB0_9
## %bb.10:
	testb	$1, %dl
	je	LBB0_12
LBB0_11:
	movdqu	(%rbx,%rcx,4), %xmm0
	movdqu	16(%rbx,%rcx,4), %xmm1
	pcmpeqd	%xmm2, %xmm2
	pxor	%xmm2, %xmm0
	pxor	%xmm2, %xmm1
	movdqu	%xmm0, (%rbx,%rcx,4)
	movdqu	%xmm1, 16(%rbx,%rcx,4)
LBB0_12:
	cmpq	%r15, %rax
	je	LBB0_14
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	notl	(%rbx,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	LBB0_13
LBB0_14:
	movq	%r14, %rdi
	callq	___exi_wait
	movq	_EXI_DEVICE_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	__ioCardFreq@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_EXI_Select
	testq	%rax, %rax
	je	LBB0_25
## %bb.15:
	movq	__ioClrFlag@GOTPCREL(%rip), %rax
	movd	(%rax), %xmm0                   ## xmm0 = mem[0],zero,zero,zero
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	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	_EXI_WRITE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	leaq	-176(%rbp), %rsi
	movq	%r14, %rdi
	movl	$10, %edx
	callq	_EXI_ImmEx
	testq	%rax, %rax
	je	LBB0_16
## %bb.18:
	orl	$1, %r12d
	movl	%r12d, -180(%rbp)
	movq	__ioWPFlag@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_20
## %bb.19:
	notl	%r12d
	movl	%r12d, -180(%rbp)
LBB0_20:
	movl	(%r13), %ecx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%r15d, %edx
	callq	_EXI_ImmEx
	testq	%rax, %rax
	je	LBB0_16
## %bb.21:
	movl	(%r13), %ecx
	leaq	-180(%rbp), %rsi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_EXI_ImmEx
	movq	%rax, %rbx
	movq	%r14, %rdi
	callq	_EXI_Deselect
	movq	%r14, %rdi
	callq	_EXI_Unlock
	testq	%rbx, %rbx
	je	LBB0_17
## %bb.22:
	movq	_CARDIO_ERROR_READY@GOTPCREL(%rip), %r13
	jmp	LBB0_23
LBB0_16:
	movq	%r14, %rdi
	callq	_EXI_Deselect
	movq	%r14, %rdi
	callq	_EXI_Unlock
LBB0_17:
	movq	_CARDIO_ERROR_IOERROR@GOTPCREL(%rip), %r13
	jmp	LBB0_23
LBB0_25:
	movq	%r14, %rdi
	callq	_EXI_Unlock
LBB0_23:
	movq	(%r13), %rax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_26
## %bb.24:
	addq	$152, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	xorl	%ecx, %ecx
	testb	$1, %dl
	jne	LBB0_11
	jmp	LBB0_12
LBB0_26:
	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	__ioWPFlag,8,3                  ## @_ioWPFlag
	.comm	_EXI_DEVICE_0,4,2               ## @EXI_DEVICE_0
	.comm	__ioCardFreq,4,2                ## @_ioCardFreq
	.comm	__ioClrFlag,4,2                 ## @_ioClrFlag
	.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_writecmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __card_writecmd
___card_writecmd:                       ; @__card_writecmd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #224
	.cfi_def_cfa_offset 224
	stp	x24, x23, [sp, #160]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #176]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #192]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #208]            ; 16-byte Folded Spill
	add	x29, sp, #208
	.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
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, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
	tbnz	x0, #63, LBB0_18
; %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_18
; %bb.2:
	mov	x20, x2
	mov	x21, x1
	ldr	w8, [x1]
	orr	w8, w8, #0x40
	str	w8, [x1]
	mov	x0, x1
	mov	x1, x2
	bl	___make_crc7
	mov	x22, x0
	str	w0, [sp, #12]
Lloh8:
	adrp	x23, __ioWPFlag@GOTPAGE
Lloh9:
	ldr	x23, [x23, __ioWPFlag@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, #0
	ccmp	x20, #1, #8, ne
	b.lt	LBB0_10
; %bb.3:
	cmp	x20, #16
	b.hs	LBB0_5
; %bb.4:
	mov	x8, #0
	b	LBB0_8
LBB0_5:
	and	x8, x20, #0xfffffffffffffff0
	add	x9, x21, #32
	mov	x10, x8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x9, #-32]
	ldp	q2, q3, [x9]
	mvn.16b	v0, v0
	mvn.16b	v1, v1
	mvn.16b	v2, v2
	mvn.16b	v3, v3
	stp	q0, q1, [x9, #-32]
	stp	q2, q3, [x9], #64
	subs	x10, x10, #16
	b.ne	LBB0_6
; %bb.7:
	cmp	x8, x20
	b.eq	LBB0_10
LBB0_8:
	sub	x9, x20, x8
	add	x8, x21, x8, lsl #2
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8]
	mvn	w10, w10
	str	w10, [x8], #4
	subs	x9, x9, #1
	b.ne	LBB0_9
LBB0_10:
	mov	x0, x19
	bl	___exi_wait
Lloh10:
	adrp	x8, _EXI_DEVICE_0@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EXI_DEVICE_0@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
Lloh13:
	adrp	x8, __ioCardFreq@GOTPAGE
Lloh14:
	ldr	x8, [x8, __ioCardFreq@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_EXI_Select
	cbz	x0, LBB0_17
; %bb.11:
Lloh16:
	adrp	x8, __ioClrFlag@GOTPAGE
Lloh17:
	ldr	x8, [x8, __ioClrFlag@GOTPAGEOFF]
	ld1r.4s	{ v0 }, [x8]
	stp	q0, q0, [sp, #16]
	stp	q0, q0, [sp, #48]
	stp	q0, q0, [sp, #80]
	stp	q0, q0, [sp, #112]
Lloh18:
	adrp	x24, _EXI_WRITE@GOTPAGE
Lloh19:
	ldr	x24, [x24, _EXI_WRITE@GOTPAGEOFF]
	ldr	w3, [x24]
	add	x1, sp, #16
	mov	x0, x19
	mov	w2, #10
	bl	_EXI_ImmEx
	cbz	x0, LBB0_16
; %bb.12:
	orr	w8, w22, #0x1
	str	w8, [sp, #12]
	ldr	x9, [x23]
	cbz	x9, LBB0_14
; %bb.13:
	mvn	w8, w8
	str	w8, [sp, #12]
LBB0_14:
	ldr	w3, [x24]
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_EXI_ImmEx
	cbz	x0, LBB0_16
; %bb.15:
	ldr	w3, [x24]
	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
Lloh20:
	adrp	x8, _CARDIO_ERROR_READY@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CARDIO_ERROR_READY@GOTPAGEOFF]
Lloh22:
	adrp	x9, _CARDIO_ERROR_IOERROR@GOTPAGE
Lloh23:
	ldr	x9, [x9, _CARDIO_ERROR_IOERROR@GOTPAGEOFF]
	cmp	x20, #0
	csel	x8, x9, x8, eq
	b	LBB0_18
LBB0_16:
	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]
	b	LBB0_18
LBB0_17:
	mov	x0, x19
	bl	_EXI_Unlock
Lloh26:
	adrp	x8, _CARDIO_ERROR_NOCARD@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CARDIO_ERROR_NOCARD@GOTPAGEOFF]
LBB0_18:
	ldr	x0, [x8]
	ldur	x8, [x29, #-56]
Lloh28:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh29:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.19:
	ldp	x29, x30, [sp, #208]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #192]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #176]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #160]            ; 16-byte Folded Reload
	add	sp, sp, #224
	ret
LBB0_20:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_DRIVE,8,3                  ; @MAX_DRIVE
	.comm	_CARDIO_ERROR_NOCARD,8,3        ; @CARDIO_ERROR_NOCARD
	.comm	__ioWPFlag,8,3                  ; @_ioWPFlag
	.comm	_EXI_DEVICE_0,4,2               ; @EXI_DEVICE_0
	.comm	__ioCardFreq,4,2                ; @_ioCardFreq
	.comm	__ioClrFlag,4,2                 ; @_ioClrFlag
	.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_writecmd
.subsections_via_symbols
