	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__FAT_ftruncate_r               ## -- Begin function _FAT_ftruncate_r
	.p2align	4, 0x90
__FAT_ftruncate_r:                      ## @_FAT_ftruncate_r
	.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	%rdi, %rbx
	testq	%rdx, %rdx
	js	LBB0_13
## %bb.1:
	movq	%rdx, %r13
	movq	_FILE_MAX_SIZE@GOTPCREL(%rip), %rax
	cmpq	%rdx, (%rax)
	jge	LBB0_3
## %bb.2:
	movq	_EFBIG@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_3:
	movq	%rsi, %r14
	testq	%rsi, %rsi
	je	LBB0_14
## %bb.4:
	cmpl	$0, 76(%r14)
	je	LBB0_14
## %bb.5:
	cmpl	$0, 72(%r14)
	je	LBB0_13
## %bb.6:
	movq	64(%r14), %r15
	leaq	12(%r15), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	__FAT_lock
	movl	(%r14), %eax
	cmpl	%r13d, %eax
	jge	LBB0_17
## %bb.7:
	movq	8(%r14), %rsi
	movq	_CLUSTER_FREE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jne	LBB0_10
## %bb.8:
	movq	%r15, %rdi
	callq	__FAT_fat_linkFreeCluster
	movl	%eax, %r12d
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	__FAT_fat_isValidCluster
	testl	%eax, %eax
	je	LBB0_23
## %bb.9:
	movslq	%r12d, %rax
	movq	%rax, 8(%r14)
	movl	%r12d, 48(%r14)
	movq	$0, 52(%r14)
LBB0_10:
	leaq	48(%r14), %r15
	movl	56(%r14), %eax
	movl	%eax, -56(%rbp)
	movq	48(%r14), %rax
	movq	%rax, -64(%rbp)
	movl	16(%r14), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	%r13d, 16(%r14)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	__FAT_file_extend_r
	xorl	%r12d, %r12d
	cmpl	$1, %eax
	sbbl	%r12d, %r12d
	cmpq	$0, 40(%r14)
	je	LBB0_12
## %bb.11:
	movl	8(%r15), %eax
	movl	%eax, 32(%r14)
	movq	(%r15), %rax
	movq	%rax, 24(%r14)
LBB0_12:
	movl	-56(%rbp), %eax
	movl	%eax, 8(%r15)
	movq	-64(%rbp), %rax
	movq	%rax, (%r15)
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 16(%r14)
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_28
LBB0_13:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_14:
	movq	_EBADF@GOTPCREL(%rip), %rax
LBB0_15:
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movl	$-1, %r12d
LBB0_16:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	xorl	%r12d, %r12d
	cmpl	%r13d, %eax
	jle	LBB0_22
## %bb.18:
	testq	%r13, %r13
	je	LBB0_24
## %bb.19:
	leal	-1(%r13), %eax
	cltd
	idivl	(%r15)
                                        ## kill: def $eax killed $eax def $rax
	leal	1(%rax), %edx
	movl	8(%r14), %esi
	movq	%r15, %rdi
	callq	__FAT_fat_trimChain
	cmpq	$0, 40(%r14)
	je	LBB0_22
## %bb.20:
	movl	%eax, %ecx
	movl	4(%r15), %esi
	movl	%r13d, %eax
	cltd
	idivl	%esi
	movl	%edx, 32(%r14)
	movl	%r13d, %eax
	cltd
	idivl	(%r15)
	testl	%edx, %edx
	je	LBB0_26
## %bb.21:
	movl	%edx, %eax
	cltd
	idivl	%esi
	jmp	LBB0_27
LBB0_23:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	__FAT_unlock
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_24:
	movl	8(%r14), %esi
	movq	%r15, %rdi
	callq	__FAT_fat_clearLinks
	movq	_CLUSTER_FREE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r14)
	movl	%eax, 24(%r14)
	movq	$0, 28(%r14)
LBB0_22:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
LBB0_28:
	movl	%r13d, (%r14)
	movl	$1, 20(%r14)
	callq	__FAT_unlock
	jmp	LBB0_16
LBB0_26:
	movl	8(%r15), %eax
LBB0_27:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, 28(%r14)
	movl	%ecx, 24(%r14)
	jmp	LBB0_28
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,8,3                     ## @EINVAL
	.comm	_FILE_MAX_SIZE,8,3              ## @FILE_MAX_SIZE
	.comm	_EFBIG,8,3                      ## @EFBIG
	.comm	_EBADF,8,3                      ## @EBADF
	.comm	_CLUSTER_FREE,8,3               ## @CLUSTER_FREE
	.comm	_ENOSPC,8,3                     ## @ENOSPC
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__FAT_ftruncate_r               ; -- Begin function _FAT_ftruncate_r
	.p2align	2
__FAT_ftruncate_r:                      ; @_FAT_ftruncate_r
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x0
	tbnz	x2, #63, LBB0_13
; %bb.1:
	mov	x20, x2
Lloh0:
	adrp	x8, _FILE_MAX_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FILE_MAX_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x2
	b.ge	LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _EFBIG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EFBIG@GOTPAGEOFF]
	b	LBB0_15
LBB0_3:
	mov	x19, x1
	cbz	x1, LBB0_14
; %bb.4:
	ldr	w8, [x19, #76]
	cbz	w8, LBB0_14
; %bb.5:
	ldr	w8, [x19, #72]
	cbz	w8, LBB0_13
; %bb.6:
	ldr	x23, [x19, #64]
	add	x21, x23, #12
	mov	x0, x21
	bl	__FAT_lock
	ldr	w8, [x19]
	cmp	w8, w20
	b.ge	LBB0_17
; %bb.7:
	ldr	x1, [x19, #8]
Lloh5:
	adrp	x8, _CLUSTER_FREE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CLUSTER_FREE@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cmp	x1, x8
	b.ne	LBB0_10
; %bb.8:
	mov	x0, x23
	bl	__FAT_fat_linkFreeCluster
	mov	x24, x0
	mov	x0, x23
	mov	x1, x24
	bl	__FAT_fat_isValidCluster
	cbz	w0, LBB0_23
; %bb.9:
	sxtw	x8, w24
	str	x8, [x19, #8]
	stp	wzr, wzr, [x19, #52]
	str	w24, [x19, #48]
LBB0_10:
	mov	x23, x19
	ldr	x8, [x23, #48]!
	str	x8, [sp]
	ldr	w8, [x19, #56]
	str	w8, [sp, #8]
	ldr	w24, [x19, #16]
	str	w20, [x19, #16]
	mov	x0, x22
	mov	x1, x19
	bl	__FAT_file_extend_r
	cmp	w0, #0
	csetm	w22, eq
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_12
; %bb.11:
	ldr	x8, [x23]
	str	x8, [x19, #24]
	ldr	w8, [x23, #8]
	str	w8, [x19, #32]
LBB0_12:
	ldr	x8, [sp]
	str	x8, [x23]
	ldr	w8, [sp, #8]
	str	w8, [x23, #8]
	str	w24, [x19, #16]
	b	LBB0_27
LBB0_13:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_15
LBB0_14:
Lloh10:
	adrp	x8, _EBADF@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBADF@GOTPAGEOFF]
LBB0_15:
	ldr	x8, [x8]
	str	x8, [x22]
	mov	w22, #-1
LBB0_16:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_17:
	b.le	LBB0_22
; %bb.18:
	cbz	x20, LBB0_24
; %bb.19:
	sub	w8, w20, #1
	ldr	w9, [x23]
	sdiv	w8, w8, w9
	add	w2, w8, #1
	ldr	w1, [x19, #8]
	mov	x0, x23
	bl	__FAT_fat_trimChain
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_22
; %bb.20:
	ldp	w9, w8, [x23]
	sdiv	w10, w20, w8
	msub	w10, w10, w8, w20
	str	w10, [x19, #32]
	sdiv	w10, w20, w9
	msub	w9, w10, w9, w20
	cbz	w9, LBB0_25
; %bb.21:
	sdiv	w8, w9, w8
	b	LBB0_26
LBB0_22:
	mov	w22, #0
	b	LBB0_27
LBB0_23:
	mov	x0, x21
	bl	__FAT_unlock
Lloh12:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
	b	LBB0_15
LBB0_24:
	ldr	w1, [x19, #8]
	mov	x0, x23
	bl	__FAT_fat_clearLinks
	mov	w22, #0
Lloh14:
	adrp	x8, _CLUSTER_FREE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _CLUSTER_FREE@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	str	x8, [x19, #8]
	stp	wzr, wzr, [x19, #28]
	str	w8, [x19, #24]
	b	LBB0_27
LBB0_25:
	ldr	w8, [x23, #8]
LBB0_26:
	mov	w22, #0
	stp	w0, w8, [x19, #24]
LBB0_27:
	str	w20, [x19]
	mov	w8, #1
	str	w8, [x19, #20]
	mov	x0, x21
	bl	__FAT_unlock
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,8,3                     ; @EINVAL
	.comm	_FILE_MAX_SIZE,8,3              ; @FILE_MAX_SIZE
	.comm	_EFBIG,8,3                      ; @EFBIG
	.comm	_EBADF,8,3                      ; @EBADF
	.comm	_CLUSTER_FREE,8,3               ; @CLUSTER_FREE
	.comm	_ENOSPC,8,3                     ; @ENOSPC
.subsections_via_symbols
