	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.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	$56, %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)
	movabsq	$28548172592670068, %rax        ## imm = 0x656C69665F6574
	movq	%rax, -65(%rbp)
	movabsq	$8386093307208561766, %rax      ## imm = 0x7461636E75727466
	movq	%rax, -72(%rbp)
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	leaq	-72(%rbp), %rdi
	movl	$384, %edx                      ## imm = 0x180
	xorl	%eax, %eax
	callq	_open
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	leaq	-72(%rbp), %rdx
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_2:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdi
	xorl	%eax, %eax
	callq	_open
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	jns	LBB0_4
## %bb.3:
	movq	_errno@GOTPCREL(%rip), %r15
	movl	(%r15), %r12d
	leaq	-72(%rbp), %r14
	movq	%r14, %rdi
	callq	_unlink
	movl	%r12d, (%r15)
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_4:
	leaq	-72(%rbp), %rdi
	callq	_unlink
	movl	%ebx, %edi
	movl	$-1, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jne	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_6:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_8:
	movq	_lengths_count@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_28
## %bb.9:
	movq	_lengths@GOTPCREL(%rip), %r12
	xorl	%r14d, %r14d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_56:                                ##   in Loop: Header=BB0_10 Depth=1
	incq	%r14
	movq	_lengths_count@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r14
	jge	LBB0_19
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rax
	movl	(%rax,%r14,4), %r15d
	movl	%ebx, %edi
	movl	%r15d, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jns	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$1, %edi
	leaq	L_.str.4(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_err
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	%ebx, %edi
	leaq	-80(%rbp), %rsi
	callq	_fstat
	testq	%rax, %rax
	jns	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$1, %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	-80(%rbp), %ecx
	cmpl	%r15d, %ecx
	je	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$-1, %edi
	leaq	L_.str.6(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_errx
LBB0_16:                                ##   in Loop: Header=BB0_10 Depth=1
	testl	%r15d, %r15d
	je	LBB0_56
## %bb.17:                              ##   in Loop: Header=BB0_10 Depth=1
	leal	-1(%r15), %ecx
	movl	%ebx, %edi
	leaq	-73(%rbp), %rsi
	movl	$1, %edx
	callq	_pread
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_18
## %bb.52:                              ##   in Loop: Header=BB0_10 Depth=1
	cmpl	$1, %r13d
	jne	LBB0_53
	jmp	LBB0_54
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	$1, %edi
	leaq	L_.str.7(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_err
LBB0_53:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	$-1, %edi
	leaq	L_.str.8(%rip), %rsi
	movl	%r15d, %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_errx
LBB0_54:                                ##   in Loop: Header=BB0_10 Depth=1
	movsbl	-73(%rbp), %r8d
	testl	%r8d, %r8d
	je	LBB0_56
## %bb.55:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$-1, %edi
	leaq	L_.str.9(%rip), %rsi
	movl	%r15d, %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_errx
	jmp	LBB0_56
LBB0_19:
	movl	%eax, %r13d
	testl	%r13d, %r13d
	jle	LBB0_28
## %bb.20:
	incq	%r13
	leaq	-80(%rbp), %r15
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_21 Depth=1
	decq	%r13
	cmpq	$1, %r13
	jbe	LBB0_28
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	leal	-2(%r13), %eax
	movq	(%r12), %rcx
	movl	(%rcx,%rax,4), %r14d
	movl	%ebx, %edi
	movl	%r14d, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jns	LBB0_23
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=1
	movl	$1, %edi
	leaq	L_.str.10(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_err
LBB0_23:                                ##   in Loop: Header=BB0_21 Depth=1
	movl	%ebx, %edi
	movq	%r15, %rsi
	callq	_fstat
	testq	%rax, %rax
	jns	LBB0_25
## %bb.24:                              ##   in Loop: Header=BB0_21 Depth=1
	movl	$1, %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
LBB0_25:                                ##   in Loop: Header=BB0_21 Depth=1
	movl	-80(%rbp), %ecx
	cmpl	%r14d, %ecx
	je	LBB0_27
## %bb.26:                              ##   in Loop: Header=BB0_21 Depth=1
	movl	$-1, %edi
	leaq	L_.str.11(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_errx
	jmp	LBB0_27
LBB0_28:
	movl	%ebx, %edi
	callq	_close
	movl	-84(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	xorl	%esi, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jne	LBB0_30
## %bb.29:
	leaq	L_.str.12(%rip), %rsi
	movl	$-1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_30:
	movq	_errno@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movq	_EINVAL@GOTPCREL(%rip), %r15
	cmpl	(%r15), %eax
	je	LBB0_32
## %bb.31:
	leaq	L_.str.13(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_32:
	movl	%ebx, %edi
	callq	_close
	movq	_PF_UNIX@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_socket
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_34
## %bb.33:
	leaq	L_.str.14(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_34:
	movl	%ebx, %edi
	xorl	%esi, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jne	LBB0_36
## %bb.35:
	leaq	L_.str.15(%rip), %rsi
	movl	$-1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_36:
	movl	(%r14), %eax
	cmpl	(%r15), %eax
	je	LBB0_38
## %bb.37:
	leaq	L_.str.16(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_38:
	movl	%ebx, %edi
	callq	_close
	leaq	-56(%rbp), %rdi
	callq	_pipe
	testq	%rax, %rax
	jns	LBB0_40
## %bb.39:
	leaq	L_.str.17(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_40:
	movl	-56(%rbp), %edi
	xorl	%esi, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jne	LBB0_42
## %bb.41:
	leaq	L_.str.18(%rip), %rsi
	movl	$-1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_42:
	movl	(%r14), %eax
	cmpl	(%r15), %eax
	je	LBB0_44
## %bb.43:
	leaq	L_.str.19(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_44:
	movl	-56(%rbp), %edi
	callq	_close
	movl	-52(%rbp), %edi
	callq	_close
	xorl	%eax, %eax
	callq	_kqueue
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_46
## %bb.45:
	leaq	L_.str.20(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_46:
	movl	-56(%rbp), %edi
	xorl	%esi, %esi
	callq	_ftruncate
	testq	%rax, %rax
	jne	LBB0_48
## %bb.47:
	leaq	L_.str.21(%rip), %rsi
	movl	$-1, %edi
	xorl	%eax, %eax
	callq	_errx
LBB0_48:
	movl	(%r14), %eax
	cmpl	(%r15), %eax
	je	LBB0_50
## %bb.49:
	leaq	L_.str.22(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_err
LBB0_50:
	movl	%ebx, %edi
	callq	_close
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_51
## %bb.57:
	xorl	%eax, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_51:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L___const.main.path:                    ## @__const.main.path
	.asciz	"ftruncate_file"

	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_CREAT,4,2                    ## @O_CREAT
L_.str:                                 ## @.str
	.asciz	"open(%s, O_RDWR|O_CREAT, 0600)"

	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_errno,4,2                      ## @errno
L_.str.1:                               ## @.str.1
	.asciz	"open(%s, O_RDONLY)"

L_.str.2:                               ## @.str.2
	.asciz	"ftruncate(fd, -1) succeeded unexpectedly"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.3:                               ## @.str.3
	.asciz	"ftruncate(fd, -1) returned wrong error"

	.comm	_lengths_count,4,2              ## @lengths_count
	.comm	_lengths,8,3                    ## @lengths
L_.str.4:                               ## @.str.4
	.asciz	"ftruncate(%jd) up"

L_.str.5:                               ## @.str.5
	.asciz	"stat"

L_.str.6:                               ## @.str.6
	.asciz	"fstat with len=%jd returned len %jd up"

L_.str.7:                               ## @.str.7
	.asciz	"pread on len %jd up"

L_.str.8:                               ## @.str.8
	.asciz	"pread len %jd size %jd up"

L_.str.9:                               ## @.str.9
	.asciz	"pread length %jd size %jd ch %d up"

L_.str.10:                              ## @.str.10
	.asciz	"ftruncate(%jd) down"

L_.str.11:                              ## @.str.11
	.asciz	"fstat(%jd) returned %jd down"

L_.str.12:                              ## @.str.12
	.asciz	"ftruncate(read_only_fd) succeeded"

L_.str.13:                              ## @.str.13
	.asciz	"ftruncate(read_only_fd) returned wrong error"

	.comm	_PF_UNIX,4,2                    ## @PF_UNIX
	.comm	_SOCK_STREAM,4,2                ## @SOCK_STREAM
L_.str.14:                              ## @.str.14
	.asciz	"socket(PF_UNIX, SOCK_STREAM, 0)"

L_.str.15:                              ## @.str.15
	.asciz	"ftruncate(socket) succeeded"

L_.str.16:                              ## @.str.16
	.asciz	"ftruncate(socket) returned wrong error"

L_.str.17:                              ## @.str.17
	.asciz	"pipe"

L_.str.18:                              ## @.str.18
	.asciz	"ftruncate(pipe) succeeded"

L_.str.19:                              ## @.str.19
	.asciz	"ftruncate(pipe) returned wrong error"

L_.str.20:                              ## @.str.20
	.asciz	"kqueue"

L_.str.21:                              ## @.str.21
	.asciz	"ftruncate(kqueue) succeeded"

L_.str.22:                              ## @.str.22
	.asciz	"ftruncate(kqueue) returned wrong error"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, l___const.main.path@PAGE
Lloh4:
	add	x9, x9, l___const.main.path@PAGEOFF
	str	x8, [sp, #72]
	ldr	x8, [x9]
	str	x8, [sp, #48]
	ldur	x8, [x9, #7]
Lloh5:
	adrp	x9, _O_RDWR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _O_RDWR@GOTPAGEOFF]
	stur	x8, [sp, #55]
Lloh7:
	ldr	w8, [x9]
Lloh8:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	w8, #384
	str	x8, [sp]
	add	x19, sp, #48
	add	x0, sp, #48
	bl	_open
	mov	x20, x0
	tbz	w0, #31, LBB0_2
; %bb.1:
	str	x19, [sp]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_2:
Lloh13:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	add	x19, sp, #48
	add	x0, sp, #48
	bl	_open
Lloh16:
	adrp	x26, _errno@GOTPAGE
Lloh17:
	ldr	x26, [x26, _errno@GOTPAGEOFF]
	str	w0, [sp, #32]                   ; 4-byte Folded Spill
	tbz	w0, #31, LBB0_4
; %bb.3:
	ldr	w21, [x26]
	add	x0, sp, #48
	bl	_unlink
	str	w21, [x26]
	str	x19, [sp]
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_4:
	add	x0, sp, #48
	bl	_unlink
	mov	x0, x20
	mov	w1, #-1
	bl	_ftruncate
	cbnz	x0, LBB0_6
; %bb.5:
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_6:
	ldr	w8, [x26]
Lloh22:
	adrp	x27, _EINVAL@GOTPAGE
Lloh23:
	ldr	x27, [x27, _EINVAL@GOTPAGEOFF]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_8
; %bb.7:
Lloh24:
	adrp	x1, l_.str.3@PAGE
Lloh25:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_8:
Lloh26:
	adrp	x23, _lengths_count@GOTPAGE
Lloh27:
	ldr	x23, [x23, _lengths_count@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_33
; %bb.9:
	mov	x21, #0
Lloh28:
	adrp	x19, _lengths@GOTPAGE
Lloh29:
	ldr	x19, [x19, _lengths@GOTPAGEOFF]
Lloh30:
	adrp	x22, l_.str.5@PAGE
Lloh31:
	add	x22, x22, l_.str.5@PAGEOFF
Lloh32:
	adrp	x24, l_.str.8@PAGE
Lloh33:
	add	x24, x24, l_.str.8@PAGEOFF
Lloh34:
	adrp	x25, l_.str.9@PAGE
Lloh35:
	add	x25, x25, l_.str.9@PAGEOFF
Lloh36:
	adrp	x26, l_.str.6@PAGE
Lloh37:
	add	x26, x26, l_.str.6@PAGEOFF
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x21, x21, #1
	ldrsw	x8, [x23]
	cmp	x21, x8
	b.ge	LBB0_24
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	ldr	w27, [x8, x21, lsl #2]
	mov	x0, x20
	mov	x1, x27
	bl	_ftruncate
	tbz	x0, #63, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x8, x27
	str	x8, [sp]
	mov	w0, #1
Lloh38:
	adrp	x1, l_.str.4@PAGE
Lloh39:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_err
LBB0_13:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x1, sp, #40
	mov	x0, x20
	bl	_fstat
	tbz	x0, #63, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w0, #1
	mov	x1, x22
	bl	_err
LBB0_15:                                ;   in Loop: Header=BB0_11 Depth=1
	ldr	w8, [sp, #40]
	cmp	w8, w27
	b.eq	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x9, x27
	stp	x9, x8, [sp]
	mov	w0, #-1
	mov	x1, x26
	bl	_errx
LBB0_17:                                ;   in Loop: Header=BB0_11 Depth=1
	cbz	w27, LBB0_10
; %bb.18:                               ;   in Loop: Header=BB0_11 Depth=1
	sub	w3, w27, #1
	add	x1, sp, #39
	mov	x0, x20
	mov	w2, #1
	bl	_pread
	mov	x28, x0
	tbnz	w0, #31, LBB0_21
; %bb.19:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w28, #1
	b.ne	LBB0_22
; %bb.20:                               ;   in Loop: Header=BB0_11 Depth=1
	ldrsb	w8, [sp, #39]
	cbnz	w8, LBB0_23
	b	LBB0_10
LBB0_21:                                ;   in Loop: Header=BB0_11 Depth=1
	mov	x8, x27
	str	x8, [sp]
	mov	w0, #1
Lloh40:
	adrp	x1, l_.str.7@PAGE
Lloh41:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_err
LBB0_22:                                ;   in Loop: Header=BB0_11 Depth=1
	stp	x27, x28, [sp]
	mov	w0, #-1
	mov	x1, x24
	bl	_errx
	ldrsb	w8, [sp, #39]
	cbz	w8, LBB0_10
LBB0_23:                                ;   in Loop: Header=BB0_11 Depth=1
                                        ; kill: def $w28 killed $w28 killed $x28 def $x28
                                        ; kill: def $w27 killed $w27 killed $x27 def $x27
	stp	x28, x8, [sp, #8]
	str	x27, [sp]
	mov	w0, #-1
	mov	x1, x25
	bl	_errx
	b	LBB0_10
LBB0_24:
	and	x8, x8, #0xffffffff
	cmp	w8, #1
Lloh42:
	adrp	x26, _errno@GOTPAGE
Lloh43:
	ldr	x26, [x26, _errno@GOTPAGEOFF]
Lloh44:
	adrp	x27, _EINVAL@GOTPAGE
Lloh45:
	ldr	x27, [x27, _EINVAL@GOTPAGEOFF]
	b.lt	LBB0_33
; %bb.25:
	add	x25, x8, #1
Lloh46:
	adrp	x21, l_.str.10@PAGE
Lloh47:
	add	x21, x21, l_.str.10@PAGEOFF
Lloh48:
	adrp	x22, l_.str.5@PAGE
Lloh49:
	add	x22, x22, l_.str.5@PAGEOFF
Lloh50:
	adrp	x23, l_.str.11@PAGE
Lloh51:
	add	x23, x23, l_.str.11@PAGEOFF
	b	LBB0_27
LBB0_26:                                ;   in Loop: Header=BB0_27 Depth=1
	sub	x25, x25, #1
	cmp	x25, #1
	b.ls	LBB0_33
LBB0_27:                                ; =>This Inner Loop Header: Depth=1
	sub	w8, w25, #2
	ldr	x9, [x19]
	ldr	w24, [x9, w8, uxtw #2]
	mov	x0, x20
	mov	x1, x24
	bl	_ftruncate
	tbz	x0, #63, LBB0_29
; %bb.28:                               ;   in Loop: Header=BB0_27 Depth=1
	str	x24, [sp]
	mov	w0, #1
	mov	x1, x21
	bl	_err
LBB0_29:                                ;   in Loop: Header=BB0_27 Depth=1
	add	x1, sp, #40
	mov	x0, x20
	bl	_fstat
	tbz	x0, #63, LBB0_31
; %bb.30:                               ;   in Loop: Header=BB0_27 Depth=1
	mov	w0, #1
	mov	x1, x22
	bl	_err
LBB0_31:                                ;   in Loop: Header=BB0_27 Depth=1
	ldr	w8, [sp, #40]
	cmp	w8, w24
	b.eq	LBB0_26
; %bb.32:                               ;   in Loop: Header=BB0_27 Depth=1
                                        ; kill: def $w24 killed $w24 killed $x24 def $x24
	stp	x24, x8, [sp]
	mov	w0, #-1
	mov	x1, x23
	bl	_errx
	b	LBB0_26
LBB0_33:
	mov	x0, x20
	bl	_close
	ldr	w19, [sp, #32]                  ; 4-byte Folded Reload
	mov	x0, x19
	mov	w1, #0
	bl	_ftruncate
	cbnz	x0, LBB0_35
; %bb.34:
Lloh52:
	adrp	x1, l_.str.12@PAGE
Lloh53:
	add	x1, x1, l_.str.12@PAGEOFF
	mov	w0, #-1
	bl	_errx
LBB0_35:
	ldr	w8, [x26]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_37
; %bb.36:
Lloh54:
	adrp	x1, l_.str.13@PAGE
Lloh55:
	add	x1, x1, l_.str.13@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_37:
	mov	x0, x19
	bl	_close
Lloh56:
	adrp	x8, _PF_UNIX@GOTPAGE
Lloh57:
	ldr	x8, [x8, _PF_UNIX@GOTPAGEOFF]
Lloh58:
	ldr	w0, [x8]
Lloh59:
	adrp	x8, _SOCK_STREAM@GOTPAGE
Lloh60:
	ldr	x8, [x8, _SOCK_STREAM@GOTPAGEOFF]
Lloh61:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_socket
	mov	x19, x0
	tbz	w0, #31, LBB0_39
; %bb.38:
Lloh62:
	adrp	x1, l_.str.14@PAGE
Lloh63:
	add	x1, x1, l_.str.14@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_39:
	mov	x0, x19
	mov	w1, #0
	bl	_ftruncate
	cbnz	x0, LBB0_41
; %bb.40:
Lloh64:
	adrp	x1, l_.str.15@PAGE
Lloh65:
	add	x1, x1, l_.str.15@PAGEOFF
	mov	w0, #-1
	bl	_errx
LBB0_41:
	ldr	w8, [x26]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_43
; %bb.42:
Lloh66:
	adrp	x1, l_.str.16@PAGE
Lloh67:
	add	x1, x1, l_.str.16@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_43:
	mov	x0, x19
	bl	_close
	add	x0, sp, #64
	bl	_pipe
	tbz	x0, #63, LBB0_45
; %bb.44:
Lloh68:
	adrp	x1, l_.str.17@PAGE
Lloh69:
	add	x1, x1, l_.str.17@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_45:
	ldr	w0, [sp, #64]
	mov	w1, #0
	bl	_ftruncate
	cbnz	x0, LBB0_47
; %bb.46:
Lloh70:
	adrp	x1, l_.str.18@PAGE
Lloh71:
	add	x1, x1, l_.str.18@PAGEOFF
	mov	w0, #-1
	bl	_errx
LBB0_47:
	ldr	w8, [x26]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_49
; %bb.48:
Lloh72:
	adrp	x1, l_.str.19@PAGE
Lloh73:
	add	x1, x1, l_.str.19@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_49:
	ldr	w0, [sp, #64]
	bl	_close
	ldr	w0, [sp, #68]
	bl	_close
	bl	_kqueue
	mov	x19, x0
	tbz	w0, #31, LBB0_51
; %bb.50:
Lloh74:
	adrp	x1, l_.str.20@PAGE
Lloh75:
	add	x1, x1, l_.str.20@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_51:
	ldr	w0, [sp, #64]
	mov	w1, #0
	bl	_ftruncate
	cbnz	x0, LBB0_53
; %bb.52:
Lloh76:
	adrp	x1, l_.str.21@PAGE
Lloh77:
	add	x1, x1, l_.str.21@PAGEOFF
	mov	w0, #-1
	bl	_errx
LBB0_53:
	ldr	w8, [x26]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_55
; %bb.54:
Lloh78:
	adrp	x1, l_.str.22@PAGE
Lloh79:
	add	x1, x1, l_.str.22@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_55:
	mov	x0, x19
	bl	_close
	ldr	x8, [sp, #72]
Lloh80:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh81:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh82:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_57
; %bb.56:
	mov	w0, #0
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_57:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpAdd	Lloh50, Lloh51
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh52, Lloh53
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpAdd	Lloh62, Lloh63
	.loh AdrpAdd	Lloh64, Lloh65
	.loh AdrpAdd	Lloh66, Lloh67
	.loh AdrpAdd	Lloh68, Lloh69
	.loh AdrpAdd	Lloh70, Lloh71
	.loh AdrpAdd	Lloh72, Lloh73
	.loh AdrpAdd	Lloh74, Lloh75
	.loh AdrpAdd	Lloh76, Lloh77
	.loh AdrpAdd	Lloh78, Lloh79
	.loh AdrpLdrGotLdr	Lloh80, Lloh81, Lloh82
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l___const.main.path:                    ; @__const.main.path
	.asciz	"ftruncate_file"

	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_CREAT,4,2                    ; @O_CREAT
l_.str:                                 ; @.str
	.asciz	"open(%s, O_RDWR|O_CREAT, 0600)"

	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_errno,4,2                      ; @errno
l_.str.1:                               ; @.str.1
	.asciz	"open(%s, O_RDONLY)"

l_.str.2:                               ; @.str.2
	.asciz	"ftruncate(fd, -1) succeeded unexpectedly"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.3:                               ; @.str.3
	.asciz	"ftruncate(fd, -1) returned wrong error"

	.comm	_lengths_count,4,2              ; @lengths_count
	.comm	_lengths,8,3                    ; @lengths
l_.str.4:                               ; @.str.4
	.asciz	"ftruncate(%jd) up"

l_.str.5:                               ; @.str.5
	.asciz	"stat"

l_.str.6:                               ; @.str.6
	.asciz	"fstat with len=%jd returned len %jd up"

l_.str.7:                               ; @.str.7
	.asciz	"pread on len %jd up"

l_.str.8:                               ; @.str.8
	.asciz	"pread len %jd size %jd up"

l_.str.9:                               ; @.str.9
	.asciz	"pread length %jd size %jd ch %d up"

l_.str.10:                              ; @.str.10
	.asciz	"ftruncate(%jd) down"

l_.str.11:                              ; @.str.11
	.asciz	"fstat(%jd) returned %jd down"

l_.str.12:                              ; @.str.12
	.asciz	"ftruncate(read_only_fd) succeeded"

l_.str.13:                              ; @.str.13
	.asciz	"ftruncate(read_only_fd) returned wrong error"

	.comm	_PF_UNIX,4,2                    ; @PF_UNIX
	.comm	_SOCK_STREAM,4,2                ; @SOCK_STREAM
l_.str.14:                              ; @.str.14
	.asciz	"socket(PF_UNIX, SOCK_STREAM, 0)"

l_.str.15:                              ; @.str.15
	.asciz	"ftruncate(socket) succeeded"

l_.str.16:                              ; @.str.16
	.asciz	"ftruncate(socket) returned wrong error"

l_.str.17:                              ; @.str.17
	.asciz	"pipe"

l_.str.18:                              ; @.str.18
	.asciz	"ftruncate(pipe) succeeded"

l_.str.19:                              ; @.str.19
	.asciz	"ftruncate(pipe) returned wrong error"

l_.str.20:                              ; @.str.20
	.asciz	"kqueue"

l_.str.21:                              ; @.str.21
	.asciz	"ftruncate(kqueue) succeeded"

l_.str.22:                              ; @.str.22
	.asciz	"ftruncate(kqueue) returned wrong error"

.subsections_via_symbols
