	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openfile                       ## -- Begin function openfile
	.p2align	4, 0x90
_openfile:                              ## @openfile
	.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
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r13
	cmpb	$0, (%rsi)
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_FATAL
LBB0_2:
	movq	_nfiles@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	testl	%r12d, %r12d
	jle	LBB0_12
## %bb.3:
	xorl	%ebx, %ebx
	movq	_files@GOTPCREL(%rip), %r14
	xorl	%r15d, %r15d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	_FFLUSH@GOTPCREL(%rip), %rcx
	cmpl	%edx, (%rcx)
	je	LBB0_11
LBB0_5:                                 ##   in Loop: Header=BB0_6 Depth=1
	incq	%r15
	movq	_nfiles@GOTPCREL(%rip), %rax
	movslq	(%rax), %r12
	addq	$24, %rbx
	cmpq	%r12, %r15
	jge	LBB0_12
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movq	(%rax,%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rdi
	callq	_strcmp
	testq	%rax, %rax
	jne	LBB0_5
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r14), %rax
	movl	8(%rax,%rbx), %ecx
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	cmpl	%edx, %ecx
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_APPEND@GOTPCREL(%rip), %rsi
	cmpl	%edx, (%rsi)
	jne	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_GT@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ecx
	jne	LBB0_4
LBB0_11:
	movq	16(%rax,%rbx), %rbx
	jmp	LBB0_42
LBB0_12:
	movq	_FFLUSH@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, (%rax)
	jne	LBB0_14
LBB0_41:
	xorl	%ebx, %ebx
	jmp	LBB0_42
LBB0_14:
	movq	_files@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testl	%r12d, %r12d
	jle	LBB0_19
## %bb.15:
	leal	-1(%r12), %esi
	incq	%rsi
	movl	%r12d, %eax
	leaq	16(%rdi), %rdx
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rdx)
	je	LBB0_23
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	incq	%rcx
	addq	$24, %rdx
	cmpq	%rcx, %rax
	jne	LBB0_16
## %bb.18:
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_20
LBB0_19:
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_20:
	movq	_FOPEN_MAX@GOTPCREL(%rip), %r14
	addl	(%r14), %r12d
	leal	(,%r12,8), %eax
	leal	(%rax,%rax,2), %esi
	callq	_realloc
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_22
## %bb.21:
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_FATAL
LBB0_22:
	movq	_nfiles@GOTPCREL(%rip), %r15
	movslq	(%r15), %rax
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,8), %rdi
	movl	(%r14), %eax
	shll	$3, %eax
	leal	(%rax,%rax,2), %edx
	xorl	%esi, %esi
	callq	_memset
	movl	%r12d, (%r15)
	movq	_files@GOTPCREL(%rip), %rax
	movq	%rax, %r12
	movq	%rbx, (%rax)
	jmp	LBB0_24
LBB0_23:
	movq	%rbx, %r12
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
LBB0_24:
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	movq	_stdout@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_fflush
	movq	_GT@GOTPCREL(%rip), %r14
	cmpl	%r15d, (%r14)
	jne	LBB0_27
## %bb.25:
	leaq	L_.str.2(%rip), %rsi
LBB0_26:
	movq	%r13, %rdi
	callq	_fopen
LBB0_34:
	movq	%rax, %rbx
	testq	%rbx, %rbx
	jne	LBB0_35
	jmp	LBB0_41
LBB0_27:
	movq	_APPEND@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_29
## %bb.28:
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdi
	callq	_fopen
	movq	%rax, %rbx
	movl	(%r14), %r15d
	testq	%rbx, %rbx
	jne	LBB0_35
	jmp	LBB0_41
LBB0_29:
	cmpl	$124, %r15d
	jne	LBB0_32
## %bb.30:
	leaq	L_.str.2(%rip), %rsi
	movq	%r13, %rdi
	callq	_popen
	movq	%rax, %rbx
	movl	$124, %r15d
	testq	%rbx, %rbx
	je	LBB0_41
LBB0_35:
	movq	%r13, %rdi
	callq	_tostring
	movq	(%r12), %rcx
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	shlq	$3, %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	(%r12), %rax
	movq	%rbx, 16(%rax,%rdx)
	movq	(%r12), %rax
	movl	%r15d, 8(%rax,%rdx)
LBB0_42:
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_32:
	movq	_LE@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_36
## %bb.33:
	leaq	L_.str.4(%rip), %rsi
	movq	%r13, %rdi
	callq	_popen
	jmp	LBB0_34
LBB0_36:
	movq	_LT@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_39
## %bb.37:
	leaq	L_.str.5(%rip), %rsi
	movq	%r13, %rdi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_40
## %bb.38:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_26
LBB0_39:
	leaq	L_.str.6(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_FATAL
	jmp	LBB0_42
LBB0_40:
	movq	_stdin@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	testq	%rbx, %rbx
	jne	LBB0_35
	jmp	LBB0_41
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"null file name in print or getline"

	.comm	_nfiles,4,2                     ## @nfiles
	.comm	_files,8,3                      ## @files
	.comm	_APPEND,4,2                     ## @APPEND
	.comm	_GT,4,2                         ## @GT
	.comm	_FFLUSH,4,2                     ## @FFLUSH
	.comm	_FOPEN_MAX,4,2                  ## @FOPEN_MAX
L_.str.1:                               ## @.str.1
	.asciz	"cannot grow files for %s and %d files"

	.comm	_stdout,4,2                     ## @stdout
L_.str.2:                               ## @.str.2
	.asciz	"w"

L_.str.3:                               ## @.str.3
	.asciz	"a"

	.comm	_LE,4,2                         ## @LE
L_.str.4:                               ## @.str.4
	.asciz	"r"

	.comm	_LT,4,2                         ## @LT
L_.str.5:                               ## @.str.5
	.asciz	"-"

	.comm	_stdin,8,3                      ## @stdin
L_.str.6:                               ## @.str.6
	.asciz	"illegal redirection %d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openfile                       ; -- Begin function openfile
	.p2align	2
_openfile:                              ; @openfile
	.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	x20, x1
	mov	x19, x0
	ldrb	w8, [x1]
	cbnz	w8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_FATAL
LBB0_2:
Lloh2:
	adrp	x24, _nfiles@GOTPAGE
Lloh3:
	ldr	x24, [x24, _nfiles@GOTPAGEOFF]
	ldr	w8, [x24]
Lloh4:
	adrp	x21, _FFLUSH@GOTPAGE
Lloh5:
	ldr	x21, [x21, _FFLUSH@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_11
; %bb.3:
	mov	x22, #0
	mov	x23, #0
Lloh6:
	adrp	x25, _files@GOTPAGE
Lloh7:
	ldr	x25, [x25, _files@GOTPAGEOFF]
Lloh8:
	adrp	x26, _APPEND@GOTPAGE
Lloh9:
	ldr	x26, [x26, _APPEND@GOTPAGEOFF]
Lloh10:
	adrp	x27, _GT@GOTPAGE
Lloh11:
	ldr	x27, [x27, _GT@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x23, #1
	ldrsw	x8, [x24]
	add	x22, x22, #24
	cmp	x23, x8
	b.ge	LBB0_11
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x25]
	ldr	x1, [x8, x22]
	cbz	x1, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x20
	bl	_strcmp
	cbnz	x0, LBB0_4
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x25]
	add	x9, x8, x22
	ldr	w10, [x9, #8]
	cmp	w10, w19
	b.eq	LBB0_17
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w11, [x26]
	ldr	w12, [x27]
	cmp	w11, w19
	ccmp	w10, w12, #0, eq
	b.eq	LBB0_17
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x21]
	cmp	w9, w19
	b.ne	LBB0_4
; %bb.10:
	add	x8, x8, x22
	ldr	x21, [x8, #16]
	b	LBB0_33
LBB0_11:
	ldr	w9, [x21]
	cmp	w9, w19
	b.ne	LBB0_13
LBB0_12:
	mov	x21, #0
	b	LBB0_33
LBB0_13:
Lloh12:
	adrp	x22, _files@GOTPAGE
Lloh13:
	ldr	x22, [x22, _files@GOTPAGEOFF]
	ldr	x0, [x22]
	subs	w10, w8, #1
	b.lt	LBB0_18
; %bb.14:
	mov	x9, #0
	add	x23, x10, #1
	add	x10, x0, #16
	mov	w11, w8
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x10]
	cbz	x12, LBB0_22
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	add	x9, x9, #1
	add	x10, x10, #24
	cmp	x11, x9
	b.ne	LBB0_15
	b	LBB0_19
LBB0_17:
	ldr	x21, [x9, #16]
	b	LBB0_33
LBB0_18:
	mov	x23, #0
LBB0_19:
Lloh14:
	adrp	x26, _FOPEN_MAX@GOTPAGE
Lloh15:
	ldr	x26, [x26, _FOPEN_MAX@GOTPAGEOFF]
	ldr	w9, [x26]
	add	w25, w9, w8
	add	w8, w25, w25, lsl #1
	lsl	w1, w8, #3
	bl	_realloc
	mov	x21, x0
	cbnz	x0, LBB0_21
; %bb.20:
	stp	x20, x25, [sp]
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_FATAL
LBB0_21:
	ldrsw	x8, [x24]
	mov	w9, #24
	madd	x0, x8, x9, x21
	ldr	w8, [x26]
	add	w8, w8, w8, lsl #1
	lsl	w2, w8, #3
	mov	w1, #0
	bl	_memset
	str	w25, [x24]
	str	x21, [x22]
	b	LBB0_23
LBB0_22:
	mov	x23, x9
LBB0_23:
Lloh18:
	adrp	x8, _stdout@GOTPAGE
Lloh19:
	ldr	x8, [x8, _stdout@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	bl	_fflush
Lloh21:
	adrp	x24, _GT@GOTPAGE
Lloh22:
	ldr	x24, [x24, _GT@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, w19
	b.ne	LBB0_26
; %bb.24:
Lloh23:
	adrp	x1, l_.str.2@PAGE
Lloh24:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_25:
	mov	x0, x20
	bl	_fopen
	mov	x21, x0
	cbnz	x21, LBB0_32
	b	LBB0_33
LBB0_26:
Lloh25:
	adrp	x8, _APPEND@GOTPAGE
Lloh26:
	ldr	x8, [x8, _APPEND@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_28
; %bb.27:
Lloh28:
	adrp	x1, l_.str.3@PAGE
Lloh29:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_fopen
	mov	x21, x0
	ldr	w19, [x24]
	cbnz	x21, LBB0_32
	b	LBB0_33
LBB0_28:
	cmp	w19, #124
	b.ne	LBB0_30
; %bb.29:
Lloh30:
	adrp	x1, l_.str.2@PAGE
Lloh31:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_popen
	mov	x21, x0
	mov	w19, #124
	cbnz	x21, LBB0_32
	b	LBB0_33
LBB0_30:
Lloh32:
	adrp	x8, _LE@GOTPAGE
Lloh33:
	ldr	x8, [x8, _LE@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_34
; %bb.31:
Lloh35:
	adrp	x1, l_.str.4@PAGE
Lloh36:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	bl	_popen
	mov	x21, x0
	cbz	x21, LBB0_33
LBB0_32:
	mov	x0, x20
	bl	_tostring
	ldr	x8, [x22]
	and	x9, x23, #0xffffffff
	add	x9, x9, w23, uxtw #1
	lsl	x9, x9, #3
	str	x0, [x8, x9]
	ldr	x8, [x22]
	add	x8, x8, x9
	str	x21, [x8, #16]
	ldr	x8, [x22]
	add	x8, x8, x9
	str	w19, [x8, #8]
LBB0_33:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_34:
Lloh37:
	adrp	x8, _LT@GOTPAGE
Lloh38:
	ldr	x8, [x8, _LT@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_37
; %bb.35:
Lloh40:
	adrp	x1, l_.str.5@PAGE
Lloh41:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x20
	bl	_strcmp
	cbz	x0, LBB0_38
; %bb.36:
Lloh42:
	adrp	x1, l_.str.4@PAGE
Lloh43:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_25
LBB0_37:
	str	x19, [sp]
Lloh44:
	adrp	x0, l_.str.6@PAGE
Lloh45:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_FATAL
	b	LBB0_12
LBB0_38:
Lloh46:
	adrp	x8, _stdin@GOTPAGE
Lloh47:
	ldr	x8, [x8, _stdin@GOTPAGEOFF]
Lloh48:
	ldr	x21, [x8]
	cbnz	x21, LBB0_32
	b	LBB0_33
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"null file name in print or getline"

	.comm	_nfiles,4,2                     ; @nfiles
	.comm	_files,8,3                      ; @files
	.comm	_APPEND,4,2                     ; @APPEND
	.comm	_GT,4,2                         ; @GT
	.comm	_FFLUSH,4,2                     ; @FFLUSH
	.comm	_FOPEN_MAX,4,2                  ; @FOPEN_MAX
l_.str.1:                               ; @.str.1
	.asciz	"cannot grow files for %s and %d files"

	.comm	_stdout,4,2                     ; @stdout
l_.str.2:                               ; @.str.2
	.asciz	"w"

l_.str.3:                               ; @.str.3
	.asciz	"a"

	.comm	_LE,4,2                         ; @LE
l_.str.4:                               ; @.str.4
	.asciz	"r"

	.comm	_LT,4,2                         ; @LT
l_.str.5:                               ; @.str.5
	.asciz	"-"

	.comm	_stdin,8,3                      ; @stdin
l_.str.6:                               ; @.str.6
	.asciz	"illegal redirection %d"

.subsections_via_symbols
