	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tty_write
_tty_write:                             ## @tty_write
	.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	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	movq	8(%rdi), %r12
	leaq	8(%r12), %rbx
	movq	%rbx, %rdi
	callq	_lock
	cmpq	$0, 16(%r12)
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_unlock
	movq	__EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	jmp	LBB0_35
LBB0_2:
	movq	_O_NONBLOCK_@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	andl	(%r13), %eax
	sete	%cl
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	12(%r12), %r13d
	movq	%rbx, %rdi
	callq	_unlock
	movq	_OPOST_@GOTPCREL(%rip), %rax
	testl	%r13d, (%rax)
	je	LBB0_3
## %bb.4:
	leaq	(%r14,%r14), %rdi
	callq	_malloc
	movq	%rax, %rsi
	testq	%r14, %r14
	je	LBB0_5
## %bb.6:
	movq	_ONLCR_@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	_ONLRET_@GOTPCREL(%rip), %rax
	movq	_OCRNL_@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	testl	%r13d, (%rcx)
	movl	(%rax), %edi
	sete	%dl
	leal	(%rdx,%rdx,2), %r8d
	addl	$10, %r8d
	cmpq	$1, %r14
	jne	LBB0_8
## %bb.7:
	xorl	%ebx, %ebx
	xorl	%edx, %edx
LBB0_22:
	testb	$1, %r14b
	je	LBB0_23
## %bb.24:
	movb	(%r15,%rbx), %al
	cmpb	$13, %al
	je	LBB0_29
## %bb.25:
	cmpb	$10, %al
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jne	LBB0_26
## %bb.27:
	movb	$10, %r8b
	testl	%r13d, %r9d
	je	LBB0_30
## %bb.28:
	movb	$13, (%rsi,%rdx)
	incq	%rdx
	jmp	LBB0_30
LBB0_3:
	xorl	%r13d, %r13d
	movq	%r15, %rsi
	movq	%r14, %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_32
LBB0_5:
	xorl	%edx, %edx
LBB0_23:
	movq	%rsi, %r13
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_32
LBB0_8:
	movq	%r14, %rax
	andq	$-2, %rax
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_9 Depth=1
	movb	%cl, (%rsi,%rdx)
	incq	%rdx
LBB0_21:                                ##   in Loop: Header=BB0_9 Depth=1
	addq	$2, %rbx
	cmpq	%rbx, %rax
	je	LBB0_22
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movzbl	(%r15,%rbx), %ecx
	cmpb	$10, %cl
	je	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpb	$13, %cl
	jne	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%r8d, %ecx
	testl	%r13d, %edi
	jne	LBB0_15
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=1
	movb	$10, %cl
	testl	%r13d, %r9d
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=1
	movb	$13, (%rsi,%rdx)
	incq	%rdx
LBB0_14:                                ##   in Loop: Header=BB0_9 Depth=1
	movb	%cl, (%rsi,%rdx)
	incq	%rdx
LBB0_15:                                ##   in Loop: Header=BB0_9 Depth=1
	movzbl	1(%r15,%rbx), %ecx
	cmpb	$13, %cl
	je	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpb	$10, %cl
	jne	LBB0_20
## %bb.17:                              ##   in Loop: Header=BB0_9 Depth=1
	movb	$10, %cl
	testl	%r13d, %r9d
	je	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_9 Depth=1
	movb	$13, (%rsi,%rdx)
	incq	%rdx
	jmp	LBB0_20
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_9 Depth=1
	movl	%r8d, %ecx
	testl	%r13d, %edi
	jne	LBB0_21
	jmp	LBB0_20
LBB0_29:
	testl	%r13d, %edi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jne	LBB0_31
	jmp	LBB0_30
LBB0_26:
	movl	%eax, %r8d
LBB0_30:
	movb	%r8b, (%rsi,%rdx)
	incq	%rdx
LBB0_31:
	movq	%rsi, %r13
LBB0_32:
	movq	(%r12), %rax
	movq	(%rax), %rax
	movq	%r12, %rdi
	callq	*(%rax)
	movl	%eax, %ebx
	testq	%r13, %r13
	je	LBB0_34
## %bb.33:
	movq	%r13, %rdi
	callq	_free
LBB0_34:
	testl	%ebx, %ebx
	cmovsl	%ebx, %r14d
LBB0_35:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	__EIO,4,2                       ## @_EIO
	.comm	_O_NONBLOCK_,4,2                ## @O_NONBLOCK_
	.comm	_OPOST_,4,2                     ## @OPOST_
	.comm	_ONLRET_,4,2                    ## @ONLRET_
	.comm	_OCRNL_,4,2                     ## @OCRNL_
	.comm	_ONLCR_,4,2                     ## @ONLCR_
	.no_dead_strip	_tty_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tty_write
_tty_write:                             ; @tty_write
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x2
	mov	x21, x1
	mov	x22, x0
	ldr	x20, [x0, #8]
	add	x23, x20, #8
	mov	x0, x23
	bl	_lock
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x23
	bl	_unlock
Lloh0:
	adrp	x8, __EIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, __EIO@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	b	LBB0_18
LBB0_2:
	ldr	w8, [x22]
Lloh3:
	adrp	x9, _O_NONBLOCK_@GOTPAGE
Lloh4:
	ldr	x9, [x9, _O_NONBLOCK_@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w22, eq
	ldr	w24, [x20, #12]
	mov	x0, x23
	bl	_unlock
Lloh6:
	adrp	x8, _OPOST_@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OPOST_@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	tst	w8, w24
	b.eq	LBB0_14
; %bb.3:
	lsl	x0, x19, #1
	bl	_malloc
	mov	x23, x0
	mov	x2, #0
	cbz	x19, LBB0_13
; %bb.4:
Lloh9:
	adrp	x8, _ONLCR_@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ONLCR_@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	and	w8, w8, w24
Lloh12:
	adrp	x9, _ONLRET_@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ONLRET_@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	and	w9, w9, w24
Lloh15:
	adrp	x10, _OCRNL_@GOTPAGE
Lloh16:
	ldr	x10, [x10, _OCRNL_@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	tst	w10, w24
	mov	w11, #10
	mov	w10, #13
	csel	w11, w10, w11, eq
	mov	x12, x19
	b	LBB0_8
LBB0_5:                                 ;   in Loop: Header=BB0_8 Depth=1
	mov	w13, #10
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	strb	w13, [x23, x2]
	add	x2, x2, #1
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x21, x21, #1
	subs	x12, x12, #1
	b.eq	LBB0_13
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w13, [x21]
	cmp	w13, #10
	b.eq	LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w13, #13
	b.ne	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	mov	x13, x11
	cbnz	w9, LBB0_7
	b	LBB0_6
LBB0_11:                                ;   in Loop: Header=BB0_8 Depth=1
	cbz	w8, LBB0_5
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=1
	strb	w10, [x23, x2]
	add	x2, x2, #1
	b	LBB0_5
LBB0_13:
	mov	x21, x23
	b	LBB0_15
LBB0_14:
	mov	x23, #0
	mov	x2, x19
LBB0_15:
	ldr	x8, [x20]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x20
	mov	x1, x21
	mov	x3, x22
	blr	x8
	mov	x20, x0
	cbz	x23, LBB0_17
; %bb.16:
	mov	x0, x23
	bl	_free
LBB0_17:
	cmp	w20, #0
	csel	w0, w20, w19, lt
LBB0_18:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	__EIO,4,2                       ; @_EIO
	.comm	_O_NONBLOCK_,4,2                ; @O_NONBLOCK_
	.comm	_OPOST_,4,2                     ; @OPOST_
	.comm	_ONLRET_,4,2                    ; @ONLRET_
	.comm	_OCRNL_,4,2                     ; @OCRNL_
	.comm	_ONLCR_,4,2                     ; @ONLCR_
	.no_dead_strip	_tty_write
.subsections_via_symbols
