	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function open_console
_open_console:                          ## @open_console
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	__PATH_CONSOLE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_revoke
	movl	(%rbx), %edi
	movq	_O_RDWR@GOTPCREL(%rip), %r15
	movq	_O_NONBLOCK@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	orl	(%r15), %esi
	xorl	%eax, %eax
	callq	_open
	cmpl	$-1, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %ebx
	movq	_F_SETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	_F_GETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	xorl	%eax, %eax
	callq	_fcntl
	movl	(%r12), %edx
	notl	%edx
	andl	%eax, %edx
	movl	%ebx, %edi
	movl	%r14d, %esi
	xorl	%eax, %eax
	callq	_fcntl
	movl	%ebx, %edi
	callq	_login_tty
	testq	%rax, %rax
	je	LBB0_11
## %bb.2:
	movl	%ebx, %edi
	callq	_close
LBB0_3:
	movq	__PATH_DEVNULL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r15), %esi
	xorl	%eax, %eax
	callq	_open
	cmpl	$-1, %eax
	je	LBB0_12
## %bb.4:
	movl	%eax, %ebx
	movq	_STDIN_FILENO@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	cmpl	%esi, %eax
	je	LBB0_6
## %bb.5:
	movl	%ebx, %edi
	callq	_dup2
	movl	%ebx, %edi
	callq	_close
LBB0_6:
	movq	__PATH_INITLOG@GOTPCREL(%rip), %rax
	movq	_O_WRONLY@GOTPCREL(%rip), %rcx
	movq	_O_APPEND@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	orl	(%rcx), %esi
	movl	(%rax), %edi
	movq	_O_CREAT@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movl	$420, %edx                      ## imm = 0x1A4
	xorl	%eax, %eax
	callq	_open
	cmpl	$-1, %eax
	je	LBB0_7
## %bb.8:
	movl	%eax, %ebx
	movq	_STDOUT_FILENO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	%esi, %ebx
	je	LBB0_10
## %bb.9:
	movl	%ebx, %edi
	callq	_dup2
	movl	%ebx, %edi
	callq	_close
	jmp	LBB0_10
LBB0_7:
	movl	(%r14), %edi
	movq	_STDOUT_FILENO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_dup2
LBB0_10:
	movq	_STDOUT_FILENO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_STDERR_FILENO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dup2                           ## TAILCALL
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	leaq	L_.str(%rip), %rdi
	callq	_stall
	movl	$1, %edi
	callq	__exit
	.cfi_endproc
                                        ## -- End function
	.comm	__PATH_CONSOLE,4,2              ## @_PATH_CONSOLE
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_NONBLOCK,4,2                 ## @O_NONBLOCK
	.comm	_F_SETFL,4,2                    ## @F_SETFL
	.comm	_F_GETFL,4,2                    ## @F_GETFL
	.comm	__PATH_DEVNULL,4,2              ## @_PATH_DEVNULL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cannot open null device."

	.comm	_STDIN_FILENO,4,2               ## @STDIN_FILENO
	.comm	__PATH_INITLOG,4,2              ## @_PATH_INITLOG
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_STDOUT_FILENO,4,2              ## @STDOUT_FILENO
	.comm	_STDERR_FILENO,4,2              ## @STDERR_FILENO
	.no_dead_strip	_open_console
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function open_console
_open_console:                          ; @open_console
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
Lloh0:
	adrp	x19, __PATH_CONSOLE@GOTPAGE
Lloh1:
	ldr	x19, [x19, __PATH_CONSOLE@GOTPAGEOFF]
	ldr	w0, [x19]
	bl	_revoke
Lloh2:
	adrp	x21, _O_RDWR@GOTPAGE
Lloh3:
	ldr	x21, [x21, _O_RDWR@GOTPAGEOFF]
	ldr	w0, [x19]
	ldr	w8, [x21]
Lloh4:
	adrp	x22, _O_NONBLOCK@GOTPAGE
Lloh5:
	ldr	x22, [x22, _O_NONBLOCK@GOTPAGEOFF]
	ldr	w9, [x22]
	orr	w1, w9, w8
	bl	_open
	cmn	w0, #1
	b.eq	LBB0_3
; %bb.1:
	mov	x19, x0
Lloh6:
	adrp	x8, _F_SETFL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _F_SETFL@GOTPAGEOFF]
Lloh8:
	ldr	w20, [x8]
Lloh9:
	adrp	x8, _F_GETFL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _F_GETFL@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_fcntl
	ldr	w8, [x22]
	bic	w8, w0, w8
	str	x8, [sp]
	mov	x0, x19
	mov	x1, x20
	bl	_fcntl
	mov	x0, x19
	bl	_login_tty
	cbz	x0, LBB0_11
; %bb.2:
	mov	x0, x19
	bl	_close
LBB0_3:
Lloh12:
	adrp	x8, __PATH_DEVNULL@GOTPAGE
Lloh13:
	ldr	x8, [x8, __PATH_DEVNULL@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	ldr	w1, [x21]
	bl	_open
	cmn	w0, #1
	b.eq	LBB0_12
; %bb.4:
	mov	x19, x0
Lloh15:
	adrp	x20, _STDIN_FILENO@GOTPAGE
Lloh16:
	ldr	x20, [x20, _STDIN_FILENO@GOTPAGEOFF]
	ldr	w1, [x20]
	cmp	w0, w1
	b.eq	LBB0_6
; %bb.5:
	mov	x0, x19
	bl	_dup2
	mov	x0, x19
	bl	_close
LBB0_6:
Lloh17:
	adrp	x8, __PATH_INITLOG@GOTPAGE
Lloh18:
	ldr	x8, [x8, __PATH_INITLOG@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
Lloh20:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh21:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
Lloh23:
	adrp	x9, _O_APPEND@GOTPAGE
Lloh24:
	ldr	x9, [x9, _O_APPEND@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh26:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh27:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w8, #420
	str	x8, [sp]
	bl	_open
Lloh29:
	adrp	x21, _STDOUT_FILENO@GOTPAGE
Lloh30:
	ldr	x21, [x21, _STDOUT_FILENO@GOTPAGEOFF]
	cmn	w0, #1
	b.eq	LBB0_9
; %bb.7:
	mov	x19, x0
	ldr	w1, [x21]
	cmp	w0, w1
	b.eq	LBB0_10
; %bb.8:
	mov	x0, x19
	bl	_dup2
	mov	x0, x19
	bl	_close
	b	LBB0_10
LBB0_9:
	ldr	w0, [x20]
	ldr	w1, [x21]
	bl	_dup2
LBB0_10:
	ldr	w0, [x21]
Lloh31:
	adrp	x8, _STDERR_FILENO@GOTPAGE
Lloh32:
	ldr	x8, [x8, _STDERR_FILENO@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_dup2
LBB0_11:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_12:
Lloh34:
	adrp	x0, l_.str@PAGE
Lloh35:
	add	x0, x0, l_.str@PAGEOFF
	bl	_stall
	mov	w0, #1
	bl	__exit
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	__PATH_CONSOLE,4,2              ; @_PATH_CONSOLE
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_NONBLOCK,4,2                 ; @O_NONBLOCK
	.comm	_F_SETFL,4,2                    ; @F_SETFL
	.comm	_F_GETFL,4,2                    ; @F_GETFL
	.comm	__PATH_DEVNULL,4,2              ; @_PATH_DEVNULL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cannot open null device."

	.comm	_STDIN_FILENO,4,2               ; @STDIN_FILENO
	.comm	__PATH_INITLOG,4,2              ; @_PATH_INITLOG
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_STDOUT_FILENO,4,2              ; @STDOUT_FILENO
	.comm	_STDERR_FILENO,4,2              ; @STDERR_FILENO
	.no_dead_strip	_open_console
.subsections_via_symbols
