	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttyflush                       ## -- Begin function ttyflush
	.p2align	4, 0x90
_ttyflush:                              ## @ttyflush
	.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
	movl	%edi, %r12d
	movq	_ttyoring@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_ring_full_count
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_ring_full_consecutive
	movl	%eax, %r13d
	testl	%eax, %eax
	jle	LBB0_1
## %bb.4:
	testl	%r12d, %r12d
	je	LBB0_6
## %bb.5:
	xorl	%eax, %eax
	callq	_TerminalFlushOutput
	movl	%r13d, %ebx
	jmp	LBB0_7
LBB0_1:
	movl	%r13d, %eax
LBB0_2:
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jns	LBB0_15
## %bb.3:
	movl	$-1, %eax
	jmp	LBB0_18
LBB0_6:
	movq	8(%r15), %rdi
	movl	%r13d, %esi
	callq	_TerminalWrite
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_2
LBB0_7:
	movq	_termdata@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.8:
	movq	8(%r15), %rsi
	movl	$62, %edi
	movl	%ebx, %edx
	callq	_Dump
LBB0_9:
	cmpl	%ebx, %r13d
	jne	LBB0_14
## %bb.10:
	cmpl	%ebx, %r14d
	jle	LBB0_14
## %bb.11:
	movl	%r14d, %eax
	subl	%r13d, %eax
	testl	%r12d, %r12d
	jne	LBB0_13
## %bb.12:
	movq	(%r15), %rdi
	movl	%eax, %esi
	callq	_TerminalWrite
LBB0_13:
	xorl	%ebx, %ebx
	testl	%eax, %eax
	cmovgl	%eax, %ebx
	addl	%r13d, %ebx
LBB0_14:
	movq	_ttyoring@GOTPCREL(%rip), %rdi
	movl	%ebx, %esi
	callq	_ring_consumed
LBB0_15:
	movl	%r14d, %eax
	subl	%ebx, %eax
	jne	LBB0_17
## %bb.16:
	xorl	%eax, %eax
	negl	%r14d
	sbbl	%eax, %eax
	jmp	LBB0_18
LBB0_17:
	incl	%eax
LBB0_18:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ttyoring,16,3                  ## @ttyoring
	.comm	_termdata,8,3                   ## @termdata
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttyflush                       ; -- Begin function ttyflush
	.p2align	2
_ttyflush:                              ; @ttyflush
	.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	x21, x0
Lloh0:
	adrp	x22, _ttyoring@GOTPAGE
Lloh1:
	ldr	x22, [x22, _ttyoring@GOTPAGEOFF]
	mov	x0, x22
	bl	_ring_full_count
	mov	x19, x0
	mov	x0, x22
	bl	_ring_full_consecutive
	mov	x20, x0
	cmp	w0, #1
	b.lt	LBB0_3
; %bb.1:
	cbz	w21, LBB0_6
; %bb.2:
	bl	_TerminalFlushOutput
	mov	x23, x20
	b	LBB0_7
LBB0_3:
	mov	x23, x20
LBB0_4:
	tbnz	w23, #31, LBB0_16
; %bb.5:
	mov	w23, #0
	b	LBB0_14
LBB0_6:
	ldr	x0, [x22, #8]
	mov	x1, x20
	bl	_TerminalWrite
	mov	x23, x0
	cmp	w0, #1
	b.lt	LBB0_4
LBB0_7:
Lloh2:
	adrp	x8, _termdata@GOTPAGE
Lloh3:
	ldr	x8, [x8, _termdata@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cbz	x8, LBB0_9
; %bb.8:
	ldr	x1, [x22, #8]
	mov	w0, #62
	mov	x2, x23
	bl	_Dump
LBB0_9:
	cmp	w20, w23
	ccmp	w19, w23, #4, eq
	b.le	LBB0_13
; %bb.10:
	sub	w1, w19, w20
	cbnz	w21, LBB0_12
; %bb.11:
	ldr	x0, [x22]
	bl	_TerminalWrite
	mov	x1, x0
LBB0_12:
	cmp	w1, #0
	csel	w8, w1, wzr, gt
	add	w23, w8, w20
LBB0_13:
Lloh5:
	adrp	x0, _ttyoring@GOTPAGE
Lloh6:
	ldr	x0, [x0, _ttyoring@GOTPAGEOFF]
	mov	x1, x23
	bl	_ring_consumed
LBB0_14:
	sub	w8, w19, w23
	cmp	w19, #0
	csetm	w9, ne
	cmp	w19, w23
	csinc	w0, w9, w8, eq
LBB0_15:
	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
LBB0_16:
	mov	w0, #-1
	b	LBB0_15
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_ttyoring,16,3                  ; @ttyoring
	.comm	_termdata,8,3                   ; @termdata
.subsections_via_symbols
