	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function writefat
LCPI0_0:
	.long	15                              ## 0xf
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_writefat
	.p2align	4, 0x90
_writefat:                              ## @writefat
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movq	%rdx, %r12
	movq	%rsi, %r14
	movl	%edi, -52(%rbp)                 ## 4-byte Spill
	movq	_FSOK@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	(%rsi), %r15
	movq	8(%rsi), %rsi
	movq	%r15, %rdi
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	callq	_calloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	$0, 56(%r14)
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.3:
	movl	64(%r14), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	movabsq	$1095216660735, %rax            ## imm = 0xFF000000FF
	movq	%rax, 4(%rcx)
	movl	16(%r14), %eax
	cmpl	$128, %eax
	je	LBB0_7
## %bb.4:
	cmpl	$129, %eax
	jne	LBB0_5
## %bb.6:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, %rax
	addq	$16, %rax
	movl	$255, 12(%rcx)
	jmp	LBB0_12
LBB0_1:
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	xorl	%eax, %eax
	callq	_perr
	jmp	LBB0_10
LBB0_8:
	movl	16(%r14), %ebx
	movq	24(%r14), %rax
	xorl	%edx, %edx
	testq	%rax, %rax
	cmovgq	%rax, %rdx
	leaq	-80(%rbp), %rcx
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	%r14, %rsi
	callq	__readfat
	testl	%eax, %eax
	je	LBB0_9
## %bb.11:
	xorl	%eax, %eax
	cmpl	$129, %ebx
	sete	%al
	addl	$3, %eax
	cmpl	$128, %ebx
	movl	$8, %ebx
	cmovnel	%eax, %ebx
	movq	-80(%rbp), %rsi
	movl	%r13d, -68(%rbp)                ## 4-byte Spill
	movq	%r15, %r13
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_memcpy
	movq	-80(%rbp), %rdi
	callq	_free
	leaq	(%r15,%rbx,4), %rax
	movq	%r13, %r15
	movl	-68(%rbp), %r13d                ## 4-byte Reload
	jmp	LBB0_12
LBB0_7:
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [15,255,255,255]
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movups	%xmm0, 12(%rcx)
	movq	%rcx, %rax
	addq	$32, %rax
	movl	$15, 28(%rcx)
	jmp	LBB0_12
LBB0_5:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	addq	$12, %rax
LBB0_12:
	movq	_CLUST_FIRST@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	movq	32(%r14), %rcx
	cmpq	%rcx, %rdi
	jge	LBB0_19
## %bb.13:
	movq	_CLUST_FREE@GOTPCREL(%rip), %r9
	movl	$240, %r8d
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_29:                                ##   in Loop: Header=BB0_14 Depth=1
	movl	%edx, (%rax)
	movl	(%r12,%rdi,4), %edx
	sarl	$8, %edx
	movl	%edx, 4(%rax)
	addq	$8, %rax
LBB0_38:                                ##   in Loop: Header=BB0_14 Depth=1
	incq	%rdi
	cmpq	%rcx, %rdi
	jge	LBB0_19
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	16(%r14), %edx
	cmpl	$129, %edx
	je	LBB0_27
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	cmpl	$128, %edx
	jne	LBB0_30
## %bb.16:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	(%r12,%rdi,4), %edx
	cmpl	(%r9), %edx
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_14 Depth=1
	incq	56(%r14)
LBB0_18:                                ##   in Loop: Header=BB0_14 Depth=1
	movl	%edx, (%rax)
	movl	(%r12,%rdi,4), %edx
	sarl	$8, %edx
	movl	%edx, 4(%rax)
	movswl	2(%r12,%rdi,4), %edx
	movl	%edx, 8(%rax)
	movl	12(%rax), %edx
	andl	%r8d, %edx
	movl	%edx, 12(%rax)
	movzbl	3(%r12,%rdi,4), %esi
	andl	$15, %esi
	orl	%edx, %esi
	movl	%esi, 12(%rax)
	addq	$16, %rax
	jmp	LBB0_38
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_14 Depth=1
	movl	(%r12,%rdi,4), %edx
	cmpl	(%r9), %edx
	jne	LBB0_29
## %bb.28:                              ##   in Loop: Header=BB0_14 Depth=1
	incq	56(%r14)
	jmp	LBB0_29
	.p2align	4, 0x90
LBB0_30:                                ##   in Loop: Header=BB0_14 Depth=1
	movl	(%r12,%rdi,4), %edx
	cmpl	(%r9), %edx
	jne	LBB0_32
## %bb.31:                              ##   in Loop: Header=BB0_14 Depth=1
	incq	56(%r14)
LBB0_32:                                ##   in Loop: Header=BB0_14 Depth=1
	movl	%edx, (%rax)
	movl	(%r12,%rdi,4), %esi
	shrl	$8, %esi
	andl	$15, %esi
	movl	%esi, 4(%rax)
	leaq	1(%rdi), %rbx
	cmpq	%rcx, %rbx
	jge	LBB0_33
## %bb.34:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	4(%r12,%rdi,4), %edx
	cmpl	(%r9), %edx
	jne	LBB0_36
## %bb.35:                              ##   in Loop: Header=BB0_14 Depth=1
	incq	56(%r14)
LBB0_36:                                ##   in Loop: Header=BB0_14 Depth=1
	shll	$4, %edx
	orl	%esi, %edx
	movl	%edx, 4(%rax)
	movl	4(%r12,%rdi,4), %edx
	sarl	$4, %edx
	movl	%edx, 8(%rax)
	addq	$12, %rax
	jmp	LBB0_37
LBB0_33:                                ##   in Loop: Header=BB0_14 Depth=1
	addq	$4, %rax
LBB0_37:                                ##   in Loop: Header=BB0_14 Depth=1
	movq	%rbx, %rdi
	jmp	LBB0_38
LBB0_19:
	cmpl	$0, 40(%r14)
	jle	LBB0_25
## %bb.20:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	imulq	%r15, %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_SEEK_SET@GOTPCREL(%rip), %r15
	xorl	%r12d, %r12d
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_21 Depth=1
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_perr
	movq	_FSFATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
LBB0_24:                                ##   in Loop: Header=BB0_21 Depth=1
	incq	%r12
	movslq	40(%r14), %rax
	cmpq	%rax, %r12
	jge	LBB0_25
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rbx
	imulq	%r12, %rbx
	addq	48(%r14), %rbx
	imulq	8(%r14), %rbx
	movl	(%r15), %edx
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	%rbx, %rsi
	callq	_lseek
	cmpq	%rbx, %rax
	jne	LBB0_23
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=1
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_write
	cmpq	%rbx, %rax
	jne	LBB0_23
	jmp	LBB0_24
LBB0_25:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	movl	%r13d, %eax
	jmp	LBB0_26
LBB0_9:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
LBB0_10:
	movq	_FSFATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_26:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FSOK,4,2                       ## @FSOK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No space for FAT sectors (%zu)"

	.comm	_FSFATAL,4,2                    ## @FSFATAL
	.comm	_CLUST_FIRST,8,3                ## @CLUST_FIRST
	.comm	_CLUST_FREE,4,2                 ## @CLUST_FREE
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
L_.str.1:                               ## @.str.1
	.asciz	"Unable to write FAT"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function writefat
lCPI0_0:
	.long	15                              ; 0xf
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_writefat
	.p2align	2
_writefat:                              ; @writefat
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x26, x3
	mov	x25, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _FSOK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FSOK@GOTPAGEOFF]
Lloh2:
	ldr	w19, [x8]
	ldp	x23, x24, [x1]
	mov	x0, x23
	mov	x1, x24
	bl	_calloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x22, x0
	str	xzr, [x20, #56]
	cbz	w26, LBB0_6
; %bb.2:
	ldr	x8, [x20, #64]
	str	w8, [x22]
	movi	d0, #0x0000ff000000ff
	stur	d0, [x22, #4]
	ldr	w8, [x20, #16]
	cmp	w8, #128
	b.eq	LBB0_8
; %bb.3:
	cmp	w8, #129
	b.ne	LBB0_9
; %bb.4:
	add	x8, x22, #16
	mov	w9, #255
	str	w9, [x22, #12]
	b	LBB0_10
LBB0_5:
	str	x23, [sp]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_perr
	b	LBB0_36
LBB0_6:
	ldr	w26, [x20, #16]
	ldr	x8, [x20, #24]
	cmp	x8, #0
	csel	x2, x8, xzr, gt
	add	x3, sp, #8
	mov	x0, x21
	mov	x1, x20
	bl	__readfat
	cbz	w0, LBB0_35
; %bb.7:
	cmp	w26, #129
	mov	w8, #3
	cinc	w8, w8, eq
	mov	w9, #8
	cmp	w26, #128
	csel	w26, w9, w8, eq
	ldr	x1, [sp, #8]
	mov	x0, x22
	mov	x2, x26
	bl	_memcpy
	ldr	x0, [sp, #8]
	bl	_free
	add	x8, x22, w26, uxtw #2
	b	LBB0_10
LBB0_8:
Lloh5:
	adrp	x8, lCPI0_0@PAGE
Lloh6:
	ldr	q0, [x8, lCPI0_0@PAGEOFF]
	stur	q0, [x22, #12]
	add	x8, x22, #32
	mov	w9, #15
	str	w9, [x22, #28]
	b	LBB0_10
LBB0_9:
	add	x8, x22, #12
LBB0_10:
Lloh7:
	adrp	x9, _CLUST_FIRST@GOTPAGE
Lloh8:
	ldr	x9, [x9, _CLUST_FIRST@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	ldr	x10, [x20, #32]
	cmp	x9, x10
	b.ge	LBB0_28
; %bb.11:
Lloh10:
	adrp	x11, _CLUST_FREE@GOTPAGE
Lloh11:
	ldr	x11, [x11, _CLUST_FREE@GOTPAGEOFF]
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_14 Depth=1
	str	w12, [x8]
	ldr	w12, [x25, x9, lsl #2]
	asr	w12, w12, #8
	str	w12, [x8, #4]
	add	x8, x8, #8
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x9, x9, #1
	cmp	x9, x10
	b.ge	LBB0_28
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x20, #16]
	cmp	w12, #129
	b.eq	LBB0_19
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	cmp	w12, #128
	b.ne	LBB0_21
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	w12, [x25, x9, lsl #2]
	ldr	w13, [x11]
	cmp	w12, w13
	b.ne	LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x13, [x20, #56]
	add	x13, x13, #1
	str	x13, [x20, #56]
LBB0_18:                                ;   in Loop: Header=BB0_14 Depth=1
	str	w12, [x8]
	add	x12, x25, x9, lsl #2
	ldr	w13, [x12]
	asr	w13, w13, #8
	str	w13, [x8, #4]
	ldrsh	w13, [x12, #2]
	ldr	w14, [x8, #12]
	and	w14, w14, #0xf0
	stp	w13, w14, [x8, #8]
	ldrb	w12, [x12, #3]
	bfxil	w14, w12, #0, #4
	str	w14, [x8, #12]
	add	x8, x8, #16
	b	LBB0_13
LBB0_19:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	w12, [x25, x9, lsl #2]
	ldr	w13, [x11]
	cmp	w12, w13
	b.ne	LBB0_12
; %bb.20:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x13, [x20, #56]
	add	x13, x13, #1
	str	x13, [x20, #56]
	b	LBB0_12
LBB0_21:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	w12, [x25, x9, lsl #2]
	ldr	w13, [x11]
	cmp	w12, w13
	b.ne	LBB0_23
; %bb.22:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x13, [x20, #56]
	add	x13, x13, #1
	str	x13, [x20, #56]
LBB0_23:                                ;   in Loop: Header=BB0_14 Depth=1
	str	w12, [x8]
	ldr	w12, [x25, x9, lsl #2]
	ubfx	w12, w12, #8, #4
	mov	x13, x8
	str	w12, [x13, #4]!
	add	x9, x9, #1
	cmp	x9, x10
	b.ge	LBB0_27
; %bb.24:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	w13, [x25, x9, lsl #2]
	ldr	w14, [x11]
	cmp	w13, w14
	b.ne	LBB0_26
; %bb.25:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x14, [x20, #56]
	add	x14, x14, #1
	str	x14, [x20, #56]
LBB0_26:                                ;   in Loop: Header=BB0_14 Depth=1
	bfi	w12, w13, #4, #28
	str	w12, [x8, #4]
	ldr	w12, [x25, x9, lsl #2]
	asr	w12, w12, #4
	str	w12, [x8, #8]
	add	x8, x8, #12
	b	LBB0_13
LBB0_27:                                ;   in Loop: Header=BB0_14 Depth=1
	mov	x8, x13
	b	LBB0_13
LBB0_28:
	ldr	w8, [x20, #40]
	cmp	w8, #1
	b.lt	LBB0_34
; %bb.29:
	mov	x26, #0
	mul	x23, x24, x23
Lloh12:
	adrp	x27, _SEEK_SET@GOTPAGE
Lloh13:
	ldr	x27, [x27, _SEEK_SET@GOTPAGEOFF]
Lloh14:
	adrp	x28, _FSFATAL@GOTPAGE
Lloh15:
	ldr	x28, [x28, _FSFATAL@GOTPAGEOFF]
Lloh16:
	adrp	x24, l_.str.1@PAGE
Lloh17:
	add	x24, x24, l_.str.1@PAGEOFF
	b	LBB0_32
LBB0_30:                                ;   in Loop: Header=BB0_32 Depth=1
	mov	x0, x24
	bl	_perr
	ldr	w19, [x28]
LBB0_31:                                ;   in Loop: Header=BB0_32 Depth=1
	add	x26, x26, #1
	ldrsw	x8, [x20, #40]
	cmp	x26, x8
	b.ge	LBB0_34
LBB0_32:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #48]
	ldp	x9, x10, [x20]
	madd	x8, x9, x26, x8
	mul	x25, x8, x10
	ldr	w2, [x27]
	mov	x0, x21
	mov	x1, x25
	bl	_lseek
	cmp	x0, x25
	b.ne	LBB0_30
; %bb.33:                               ;   in Loop: Header=BB0_32 Depth=1
	mov	x0, x21
	mov	x1, x22
	mov	x2, x23
	bl	_write
	cmp	x0, x23
	b.ne	LBB0_30
	b	LBB0_31
LBB0_34:
	mov	x0, x22
	bl	_free
	b	LBB0_37
LBB0_35:
	mov	x0, x22
	bl	_free
LBB0_36:
Lloh18:
	adrp	x8, _FSFATAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _FSFATAL@GOTPAGEOFF]
Lloh20:
	ldr	w19, [x8]
LBB0_37:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdr	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_FSOK,4,2                       ; @FSOK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No space for FAT sectors (%zu)"

	.comm	_FSFATAL,4,2                    ; @FSFATAL
	.comm	_CLUST_FIRST,8,3                ; @CLUST_FIRST
	.comm	_CLUST_FREE,4,2                 ; @CLUST_FREE
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
l_.str.1:                               ; @.str.1
	.asciz	"Unable to write FAT"

.subsections_via_symbols
