	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tty_open
_tty_open:                              ## @tty_open
	.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	%r8, %r14
	movq	%rcx, %r15
	testl	%edi, %edi
	je	LBB0_3
## %bb.1:
	testl	%esi, %esi
	je	LBB0_3
## %bb.2:
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_3:
	testl	%edi, %edi
	je	LBB0_5
## %bb.4:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	testl	%esi, %esi
	je	LBB0_8
## %bb.6:
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %esi
LBB0_8:
	movq	(%r15), %rdi
	callq	_open
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:
	movl	%eax, %r12d
	cmpq	$0, 16(%r15)
	je	LBB0_13
## %bb.11:
	leaq	8(%r15), %rsi
	movl	%r12d, %edi
	callq	_tcgetattr
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_CATCH_EINTR
	testl	%ebx, %ebx
	jne	LBB0_14
## %bb.12:
	movl	%r12d, %edi
	callq	_raw
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
LBB0_13:
	movq	(%r15), %rax
	movq	%rax, (%r14)
	movl	%r12d, %ebx
	jmp	LBB0_14
LBB0_9:
	movq	_errno@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_errno,4,2                      ## @errno
	.no_dead_strip	_tty_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tty_open
_tty_open:                              ; @tty_open
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x4
	mov	x20, x3
	cbz	w0, LBB0_3
; %bb.1:
	cbz	w1, LBB0_3
; %bb.2:
Lloh0:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	b	LBB0_6
LBB0_3:
	cbz	w0, LBB0_5
; %bb.4:
Lloh3:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	b	LBB0_6
LBB0_5:
Lloh6:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w1, #0
	csel	w1, w8, wzr, ne
LBB0_6:
	ldr	x0, [x20]
	bl	_open
	tbnz	w0, #31, LBB0_11
; %bb.7:
	mov	x21, x0
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_10
; %bb.8:
	add	x1, x20, #8
	mov	x0, x21
	bl	_tcgetattr
	mov	x22, x0
	bl	_CATCH_EINTR
	cbnz	w22, LBB0_12
; %bb.9:
	mov	x0, x21
	bl	_raw
	mov	x22, x0
	cbnz	w0, LBB0_12
LBB0_10:
	ldr	x8, [x20]
	str	x8, [x19]
	mov	x22, x21
	b	LBB0_12
LBB0_11:
Lloh9:
	adrp	x8, _errno@GOTPAGE
Lloh10:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_12:
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_errno,4,2                      ; @errno
	.no_dead_strip	_tty_open
.subsections_via_symbols
