	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_file_write                     ## -- Begin function file_write
	.p2align	4, 0x90
_file_write:                            ## @file_write
	.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	%r9d, -60(%rbp)                 ## 4-byte Spill
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	movq	%rsi, %r12
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %rax
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	je	LBB0_18
## %bb.1:
	movq	%rcx, %rbx
	movl	%edx, %r14d
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_SEEK_CUR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r15d, %esi
	callq	_lseek
	testq	%rax, %rax
	js	LBB0_11
LBB0_17:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %r13
	subl	%r15d, %r14d
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_18
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	movl	(%rbx), %esi
	testl	%esi, %esi
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	movl	%esi, (%rbx)
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r14d, %edi
	callq	_MIN
	movl	%eax, %r15d
	subl	%eax, (%rbx)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpl	$0, (%rax)
	movslq	%r15d, %rbx
	je	LBB0_14
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%rbx,%r13), %r12
	movq	%r13, %rax
	testl	%r15d, %r15d
	jle	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rax
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpb	$0, (%rax)
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	incq	%rax
	cmpq	%r12, %rax
	jb	LBB0_7
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%r12, %rax
	je	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	%r13, %rsi
	movl	%r15d, %edx
	callq	_write
	cmpl	%r15d, %eax
	jne	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_2 Depth=1
	addq	%rbx, %r13
	movq	%r13, %r12
	jmp	LBB0_17
LBB0_18:
	subl	-72(%rbp), %r12d                ## 4-byte Folded Reload
	jmp	LBB0_19
LBB0_15:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	jmp	LBB0_12
LBB0_11:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
LBB0_12:
	movl	$1, %edi
	movq	16(%rbp), %rcx
	callq	_syswarn
	movl	$-1, %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SEEK_CUR,4,2                   ## @SEEK_CUR
	.comm	_errno,4,2                      ## @errno
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"File seek on %s"

L_.str.1:                               ## @.str.1
	.asciz	"Failed write to file %s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_file_write                     ; -- Begin function file_write
	.p2align	2
_file_write:                            ; @file_write
	.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
	str	x6, [sp, #8]                    ; 8-byte Folded Spill
	mov	x19, x1
	mov	x20, x1
	cbz	w2, LBB0_15
; %bb.1:
	mov	x21, x5
	mov	x22, x4
	mov	x23, x3
	mov	x24, x2
	mov	x25, x0
	mov	w28, #1
	mov	x20, x19
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh0:
	adrp	x8, _SEEK_CUR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SEEK_CUR@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x0, x25
	mov	x1, x27
	bl	_lseek
	mov	x20, x26
	tbnz	x0, #63, LBB0_17
; %bb.3:                                ;   in Loop: Header=BB0_4 Depth=1
	sub	w24, w24, w27
	cbz	w24, LBB0_15
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	ldr	w1, [x23]
	cbnz	w1, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	str	w28, [x22]
	str	w21, [x23]
	mov	x1, x21
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x24
	bl	_MIN
	mov	x27, x0
	ldr	w8, [x23]
	sub	w8, w8, w0
	str	w8, [x23]
	ldr	w8, [x22]
	add	x26, x20, w0, sxtw
	cbz	w8, LBB0_13
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x8, x20
	cmp	w27, #1
	b.lt	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x8, x20
LBB0_9:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrb	w9, [x8]
	cbnz	w9, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	add	x8, x8, #1
	cmp	x8, x26
	b.lo	LBB0_9
LBB0_11:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	x8, x26
	b.eq	LBB0_2
; %bb.12:                               ;   in Loop: Header=BB0_4 Depth=1
	str	wzr, [x22]
LBB0_13:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x25
	mov	x1, x20
	mov	x2, x27
	bl	_write
	cmp	w0, w27
	b.ne	LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_4 Depth=1
	mov	x20, x26
	sub	w24, w24, w27
	cbnz	w24, LBB0_4
LBB0_15:
	sub	w0, w20, w19
	b	LBB0_19
LBB0_16:
Lloh3:
	adrp	x8, _errno@GOTPAGE
Lloh4:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x2, l_.str.1@PAGE
Lloh7:
	add	x2, x2, l_.str.1@PAGEOFF
	b	LBB0_18
LBB0_17:
Lloh8:
	adrp	x8, _errno@GOTPAGE
Lloh9:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	adrp	x2, l_.str@PAGE
Lloh12:
	add	x2, x2, l_.str@PAGEOFF
LBB0_18:
	mov	w0, #1
	ldr	x3, [sp, #8]                    ; 8-byte Folded Reload
	bl	_syswarn
	mov	w0, #-1
LBB0_19:
	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	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_SEEK_CUR,4,2                   ; @SEEK_CUR
	.comm	_errno,4,2                      ; @errno
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"File seek on %s"

l_.str.1:                               ; @.str.1
	.asciz	"Failed write to file %s"

.subsections_via_symbols
