	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_cow_header               ## -- Begin function write_cow_header
	.p2align	4, 0x90
_write_cow_header:                      ## @write_cow_header
	.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
	movq	%r9, -64(%rbp)                  ## 8-byte Spill
	movl	%r8d, %r15d
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	%rdx, %r13
	movl	%esi, %r12d
	movq	%rdi, %rbx
	movl	%esi, %edi
	xorl	%esi, %esi
	callq	_cow_seek_file
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	$64, %edi
	callq	_cow_malloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r15
	movq	_COW_MAGIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movq	%rax, 56(%r15)
	movq	_COW_VERSION@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movq	%rax, 48(%r15)
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	%r13, %rdi
	callq	_strlen
	cmpl	$8, %eax
	jb	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rdi
	movl	$7, %edx
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_cow_printf
	jmp	LBB0_14
LBB0_1:
	movl	%eax, %r14d
	movl	%eax, %esi
	negl	%esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_cow_printf
	jmp	LBB0_15
LBB0_3:
	negl	%r14d
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_cow_printf
	jmp	LBB0_15
LBB0_6:
	movq	(%r15), %rdi
	movl	$8, %esi
	movq	%r13, %rdx
	callq	_absolutize
	testq	%rax, %rax
	jne	LBB0_14
## %bb.7:
	movq	(%r15), %rdi
	leaq	-72(%rbp), %rsi
	callq	_os_file_modtime
	movq	(%r15), %rsi
	testl	%eax, %eax
	js	LBB0_8
## %bb.10:
	movq	%rsi, %rdi
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_cow_file_size
	testl	%eax, %eax
	js	LBB0_11
## %bb.12:
	movl	-72(%rbp), %edi
	callq	_htonl
	movq	%rax, 40(%r15)
	movq	(%rbx), %rdi
	callq	_htonll
	movl	%eax, 32(%r15)
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	callq	_htonl
	movq	%rax, 24(%r15)
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_htonl
	movq	%rax, 16(%r15)
	movq	_COW_BITMAP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r15)
	movl	%r12d, %edi
	movq	%r15, %rsi
	movl	$64, %edx
	callq	_cow_write_file
	xorl	%r14d, %r14d
	cmpl	$64, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %ebx
	movl	%eax, %edx
	negl	%edx
	leaq	L_.str.5(%rip), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_cow_printf
	movl	%ebx, %r14d
	jmp	LBB0_14
LBB0_8:
	movl	%eax, %r14d
	movl	%eax, %edx
	negl	%edx
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_9
LBB0_11:
	movl	%eax, %r14d
	movq	(%r15), %rsi
	movl	%eax, %edx
	negl	%edx
	leaq	L_.str.4(%rip), %rdi
LBB0_9:
	xorl	%eax, %eax
	callq	_cow_printf
LBB0_14:
	movq	%r15, %rdi
	callq	_cow_free
LBB0_15:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write_cow_header - lseek failed, err = %d\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"write_cow_header - failed to allocate COW V3 header\n"

	.comm	_COW_MAGIC,4,2                  ## @COW_MAGIC
	.comm	_COW_VERSION,4,2                ## @COW_VERSION
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"Backing file name \"%s\" is too long - names are limited to %zd characters\n"

L_.str.3:                               ## @.str.3
	.asciz	"write_cow_header - backing file '%s' mtime request failed, err = %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"write_cow_header - couldn't get size of backing file '%s', err = %d\n"

	.comm	_COW_BITMAP,4,2                 ## @COW_BITMAP
L_.str.5:                               ## @.str.5
	.asciz	"write_cow_header - write of header to new COW file '%s' failed, err = %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_cow_header               ; -- Begin function write_cow_header
	.p2align	2
_write_cow_header:                      ; @write_cow_header
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x25, x5
	mov	x23, x4
	mov	x24, x3
	mov	x26, x2
	mov	x22, x1
	mov	x20, x0
	mov	x0, x1
	mov	w1, #0
	bl	_cow_seek_file
	tbnz	w0, #31, LBB0_5
; %bb.1:
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
	mov	w0, #64
	bl	_cow_malloc
	cbz	x0, LBB0_6
; %bb.2:
	mov	x19, x0
Lloh3:
	adrp	x8, _COW_MAGIC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _COW_MAGIC@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_htonl
	str	x0, [x19, #56]
Lloh6:
	adrp	x8, _COW_VERSION@GOTPAGE
Lloh7:
	ldr	x8, [x8, _COW_VERSION@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_htonl
	str	x0, [x19, #48]
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w21, w8
	mov	x0, x26
	bl	_strlen
	cmp	w0, #8
	b.lo	LBB0_7
; %bb.3:
	mov	w8, #7
	stp	x26, x8, [sp]
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_4:
	bl	_cow_printf
	b	LBB0_8
LBB0_5:
	mov	x21, x0
	neg	w8, w0
	str	x8, [sp]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_cow_printf
	b	LBB0_9
LBB0_6:
	neg	w21, w21
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_cow_printf
	b	LBB0_9
LBB0_7:
	ldr	x0, [x19]
	mov	w1, #8
	mov	x2, x26
	bl	_absolutize
	cbz	x0, LBB0_10
LBB0_8:
	mov	x0, x19
	bl	_cow_free
LBB0_9:
	mov	x0, x21
	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
	add	sp, sp, #112
	ret
LBB0_10:
	ldr	x0, [x19]
	add	x1, sp, #24
	bl	_os_file_modtime
	mov	x21, x0
	ldr	x0, [x19]
	tbnz	w21, #31, LBB0_14
; %bb.11:
	mov	x1, x25
	bl	_cow_file_size
	tbnz	w0, #31, LBB0_15
; %bb.12:
	ldr	w0, [sp, #24]
	bl	_htonl
	str	x0, [x19, #40]
	ldr	x0, [x25]
	bl	_htonll
	str	w0, [x19, #32]
	mov	x0, x24
	bl	_htonl
	str	x0, [x19, #24]
	mov	x0, x23
	bl	_htonl
	str	x0, [x19, #16]
Lloh18:
	adrp	x8, _COW_BITMAP@GOTPAGE
Lloh19:
	ldr	x8, [x8, _COW_BITMAP@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x19, #8]
	mov	x0, x22
	mov	x1, x19
	mov	w2, #64
	bl	_cow_write_file
	cmp	w0, #64
	b.ne	LBB0_16
; %bb.13:
	mov	w21, #0
	b	LBB0_8
LBB0_14:
	neg	w8, w21
	stp	x0, x8, [sp]
Lloh21:
	adrp	x0, l_.str.3@PAGE
Lloh22:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_4
LBB0_15:
	mov	x21, x0
	ldr	x8, [x19]
	neg	w9, w0
	stp	x8, x9, [sp]
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_4
LBB0_16:
	mov	x21, x0
	neg	w8, w0
	stp	x20, x8, [sp]
Lloh25:
	adrp	x0, l_.str.5@PAGE
Lloh26:
	add	x0, x0, l_.str.5@PAGEOFF
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write_cow_header - lseek failed, err = %d\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"write_cow_header - failed to allocate COW V3 header\n"

	.comm	_COW_MAGIC,4,2                  ; @COW_MAGIC
	.comm	_COW_VERSION,4,2                ; @COW_VERSION
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"Backing file name \"%s\" is too long - names are limited to %zd characters\n"

l_.str.3:                               ; @.str.3
	.asciz	"write_cow_header - backing file '%s' mtime request failed, err = %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"write_cow_header - couldn't get size of backing file '%s', err = %d\n"

	.comm	_COW_BITMAP,4,2                 ; @COW_BITMAP
l_.str.5:                               ; @.str.5
	.asciz	"write_cow_header - write of header to new COW file '%s' failed, err = %d\n"

.subsections_via_symbols
