	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tty_Cooked
_tty_Cooked:                            ## @tty_Cooked
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	8(%rdi), %edi
	callq	_device2tty
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_tty_Offline
	movl	(%rbx), %edi
	movq	_TCIOFLUSH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_tcflush
	movq	%rbx, %rdi
	callq	_physical_IsSync
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	movl	(%rbx), %edi
	movq	_TCSAFLUSH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_tcsetattr
	cmpl	$-1, %eax
	jne	LBB0_3
## %bb.2:
	movq	_LogWARN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%rbx), %edx
	leaq	L_.str(%rip), %rsi
	callq	_log_Printf
LBB0_3:
	movq	%rbx, %rdi
	callq	_UnloadLineDiscipline
	movl	(%rbx), %edi
	movq	_F_GETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_fcntl
	cmpl	$-1, %eax
	je	LBB0_4
## %bb.5:
	movl	(%rbx), %edi
	movq	_F_SETFL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_O_NONBLOCK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, %edx
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_fcntl                          ## TAILCALL
LBB0_4:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TCIOFLUSH,4,2                  ## @TCIOFLUSH
	.comm	_TCSAFLUSH,4,2                  ## @TCSAFLUSH
	.comm	_LogWARN,4,2                    ## @LogWARN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: tcsetattr: Unable to restore device settings\n"

	.comm	_F_GETFL,4,2                    ## @F_GETFL
	.comm	_F_SETFL,4,2                    ## @F_SETFL
	.comm	_O_NONBLOCK,4,2                 ## @O_NONBLOCK
	.no_dead_strip	_tty_Cooked
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tty_Cooked
_tty_Cooked:                            ; @tty_Cooked
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	w0, [x0, #8]
	bl	_device2tty
	mov	x20, x0
	mov	x0, x19
	bl	_tty_Offline
	ldr	w0, [x19]
Lloh0:
	adrp	x8, _TCIOFLUSH@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TCIOFLUSH@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_tcflush
	mov	x0, x19
	bl	_physical_IsSync
	cbnz	w0, LBB0_3
; %bb.1:
	ldr	w0, [x19]
Lloh3:
	adrp	x8, _TCSAFLUSH@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TCSAFLUSH@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_tcsetattr
	cmn	w0, #1
	b.ne	LBB0_3
; %bb.2:
Lloh6:
	adrp	x8, _LogWARN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LogWARN@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	ldr	w2, [x19, #4]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_log_Printf
LBB0_3:
	mov	x0, x19
	bl	_UnloadLineDiscipline
	ldr	w0, [x19]
Lloh11:
	adrp	x8, _F_GETFL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _F_GETFL@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_fcntl
	cmn	w0, #1
	b.eq	LBB0_5
; %bb.4:
	ldr	w8, [x19]
Lloh14:
	adrp	x9, _F_SETFL@GOTPAGE
Lloh15:
	ldr	x9, [x9, _F_SETFL@GOTPAGEOFF]
Lloh16:
	adrp	x10, _O_NONBLOCK@GOTPAGE
Lloh17:
	ldr	x10, [x10, _O_NONBLOCK@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x9]
Lloh19:
	ldr	w9, [x10]
	bic	w2, w0, w9
	mov	x0, x8
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_fcntl
LBB0_5:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_TCIOFLUSH,4,2                  ; @TCIOFLUSH
	.comm	_TCSAFLUSH,4,2                  ; @TCSAFLUSH
	.comm	_LogWARN,4,2                    ; @LogWARN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: tcsetattr: Unable to restore device settings\n"

	.comm	_F_GETFL,4,2                    ; @F_GETFL
	.comm	_F_SETFL,4,2                    ; @F_SETFL
	.comm	_O_NONBLOCK,4,2                 ; @O_NONBLOCK
	.no_dead_strip	_tty_Cooked
.subsections_via_symbols
