	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function modepage_edit
_modepage_edit:                         ## @modepage_edit
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_stdin@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	callq	_fileno
	movl	%eax, %edi
	callq	_isatty
	testl	%eax, %eax
	je	LBB0_17
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_getenv
	movq	%rax, %r14
	testq	%rax, %rax
	jne	LBB0_3
## %bb.2:
	movq	_DEFAULT_EDITOR@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
LBB0_3:
	movq	_edit_path@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	callq	_mkstemp
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_5
## %bb.4:
	movq	_EX_CANTCREAT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_errx
LBB0_5:
	movq	_cleanup_editfile@GOTPCREL(%rip), %rdi
	callq	_atexit
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edi
	callq	_fdopen
	movq	_edit_file@GOTPCREL(%rip), %r13
	movq	%rax, (%r13)
	testq	%rax, %rax
	jne	LBB0_7
## %bb.6:
	movq	_EX_NOINPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rdx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
	movq	(%r13), %rax
LBB0_7:
	movq	%rax, %rdi
	movl	$1, %esi
	callq	_modepage_write
	movl	%eax, %ebx
	movq	(%r13), %rdi
	callq	_fclose
	movq	$0, (%r13)
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.10:
	movq	%r14, %rdi
	callq	_strlen
	movq	%rax, %r15
	movq	(%r12), %rbx
	movq	%rbx, %rdi
	callq	_strlen
	leaq	(%r15,%rax), %rdi
	addq	$2, %rdi
	callq	_malloc
	movq	%rax, %r15
	testq	%rax, %rax
	jne	LBB0_12
## %bb.11:
	movq	_EX_OSERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_err
	movq	(%r12), %rbx
LBB0_12:
	leaq	L_.str.5(%rip), %rsi
	movq	%r15, %rdi
	movq	%r14, %rdx
	movq	%rbx, %rcx
	callq	_sprintf
	movq	%r15, %rdi
	callq	_system
	cmpl	$-1, %eax
	jne	LBB0_14
## %bb.13:
	movq	_EX_UNAVAILABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.6(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_err
LBB0_14:
	movq	%r15, %rdi
	callq	_free
	movq	(%r12), %rdi
	leaq	L_.str.7(%rip), %rsi
	callq	_fopen
	movq	%rax, (%r13)
	testq	%rax, %rax
	jne	LBB0_16
## %bb.15:
	movq	_EX_NOINPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rdx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_err
	movq	(%r13), %rax
LBB0_16:
	movq	%rax, %rdi
	callq	_modepage_read
	jmp	LBB0_9
LBB0_17:
	movq	(%rbx), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_modepage_read                  ## TAILCALL
LBB0_8:
	leaq	L_.str.4(%rip), %rdi
	callq	_warnx
LBB0_9:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_cleanup_editfile               ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_stdin,8,3                      ## @stdin
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"EDITOR"

	.comm	_DEFAULT_EDITOR,8,3             ## @DEFAULT_EDITOR
	.comm	_edit_path,8,3                  ## @edit_path
	.comm	_EX_CANTCREAT,4,2               ## @EX_CANTCREAT
L_.str.1:                               ## @.str.1
	.asciz	"mkstemp failed"

L_.str.2:                               ## @.str.2
	.asciz	"w"

	.comm	_edit_file,8,3                  ## @edit_file
	.comm	_EX_NOINPUT,4,2                 ## @EX_NOINPUT
L_.str.3:                               ## @.str.3
	.asciz	"%s"

L_.str.4:                               ## @.str.4
	.asciz	"no editable entries"

	.comm	_EX_OSERR,4,2                   ## @EX_OSERR
L_.str.5:                               ## @.str.5
	.asciz	"%s %s"

	.comm	_EX_UNAVAILABLE,4,2             ## @EX_UNAVAILABLE
L_.str.6:                               ## @.str.6
	.asciz	"could not invoke %s"

L_.str.7:                               ## @.str.7
	.asciz	"r"

	.no_dead_strip	_modepage_edit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function modepage_edit
_modepage_edit:                         ; @modepage_edit
	.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
Lloh0:
	adrp	x19, _stdin@GOTPAGE
Lloh1:
	ldr	x19, [x19, _stdin@GOTPAGEOFF]
	ldr	x0, [x19]
	bl	_fileno
	bl	_isatty
	cbz	w0, LBB0_13
; %bb.1:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_getenv
Lloh4:
	adrp	x8, _DEFAULT_EDITOR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _DEFAULT_EDITOR@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	cmp	x0, #0
	csel	x19, x8, x0, eq
Lloh7:
	adrp	x22, _edit_path@GOTPAGE
Lloh8:
	ldr	x22, [x22, _edit_path@GOTPAGEOFF]
	ldr	x0, [x22]
	bl	_mkstemp
	mov	x20, x0
	cmn	w0, #1
	b.ne	LBB0_3
; %bb.2:
Lloh9:
	adrp	x8, _EX_CANTCREAT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EX_CANTCREAT@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_errx
LBB0_3:
Lloh14:
	adrp	x0, _cleanup_editfile@GOTPAGE
Lloh15:
	ldr	x0, [x0, _cleanup_editfile@GOTPAGEOFF]
	bl	_atexit
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_fdopen
Lloh18:
	adrp	x23, _edit_file@GOTPAGE
Lloh19:
	ldr	x23, [x23, _edit_file@GOTPAGEOFF]
	str	x0, [x23]
	cbnz	x0, LBB0_5
; %bb.4:
Lloh20:
	adrp	x8, _EX_NOINPUT@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EX_NOINPUT@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	ldr	x8, [x22]
	str	x8, [sp]
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_err
	ldr	x0, [x23]
LBB0_5:
	mov	w1, #1
	bl	_modepage_write
	mov	x20, x0
	ldr	x0, [x23]
	bl	_fclose
	str	xzr, [x23]
	cbz	w20, LBB0_14
; %bb.6:
	mov	x0, x19
	bl	_strlen
	mov	x20, x0
	ldr	x21, [x22]
	mov	x0, x21
	bl	_strlen
	add	x8, x20, x0
	add	x0, x8, #2
	bl	_malloc
	mov	x20, x0
	cbnz	x0, LBB0_8
; %bb.7:
Lloh25:
	adrp	x8, _EX_OSERR@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EX_OSERR@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
	mov	x1, #0
	bl	_err
	ldr	x21, [x22]
LBB0_8:
Lloh28:
	adrp	x1, l_.str.5@PAGE
Lloh29:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	mov	x3, x21
	bl	_sprintf
	mov	x0, x20
	bl	_system
	cmn	w0, #1
	b.ne	LBB0_10
; %bb.9:
Lloh30:
	adrp	x8, _EX_UNAVAILABLE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EX_UNAVAILABLE@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
	str	x19, [sp]
Lloh33:
	adrp	x1, l_.str.6@PAGE
Lloh34:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_err
LBB0_10:
	mov	x0, x20
	bl	_free
	ldr	x0, [x22]
Lloh35:
	adrp	x1, l_.str.7@PAGE
Lloh36:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_fopen
	str	x0, [x23]
	cbnz	x0, LBB0_12
; %bb.11:
Lloh37:
	adrp	x8, _EX_NOINPUT@GOTPAGE
Lloh38:
	ldr	x8, [x8, _EX_NOINPUT@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	ldr	x8, [x22]
	str	x8, [sp]
Lloh40:
	adrp	x1, l_.str.3@PAGE
Lloh41:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_err
	ldr	x0, [x23]
LBB0_12:
	bl	_modepage_read
	b	LBB0_15
LBB0_13:
	ldr	x0, [x19]
	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
	b	_modepage_read
LBB0_14:
Lloh42:
	adrp	x0, l_.str.4@PAGE
Lloh43:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_warnx
LBB0_15:
	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
	b	_cleanup_editfile
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_stdin,8,3                      ; @stdin
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"EDITOR"

	.comm	_DEFAULT_EDITOR,8,3             ; @DEFAULT_EDITOR
	.comm	_edit_path,8,3                  ; @edit_path
	.comm	_EX_CANTCREAT,4,2               ; @EX_CANTCREAT
l_.str.1:                               ; @.str.1
	.asciz	"mkstemp failed"

l_.str.2:                               ; @.str.2
	.asciz	"w"

	.comm	_edit_file,8,3                  ; @edit_file
	.comm	_EX_NOINPUT,4,2                 ; @EX_NOINPUT
l_.str.3:                               ; @.str.3
	.asciz	"%s"

l_.str.4:                               ; @.str.4
	.asciz	"no editable entries"

	.comm	_EX_OSERR,4,2                   ; @EX_OSERR
l_.str.5:                               ; @.str.5
	.asciz	"%s %s"

	.comm	_EX_UNAVAILABLE,4,2             ; @EX_UNAVAILABLE
l_.str.6:                               ; @.str.6
	.asciz	"could not invoke %s"

l_.str.7:                               ; @.str.7
	.asciz	"r"

	.no_dead_strip	_modepage_edit
.subsections_via_symbols
