	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ptyflush                       ## -- Begin function ptyflush
	.p2align	4, 0x90
_ptyflush:                              ## @ptyflush
	.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	_pfrontp@GOTPCREL(%rip), %r15
	movl	(%r15), %ebx
	movq	_pbackp@GOTPCREL(%rip), %r12
	subl	(%r12), %ebx
	testl	%ebx, %ebx
	jle	LBB0_2
## %bb.1:
	movq	_TD_REPORT@GOTPCREL(%rip), %rax
	movq	_TD_PTYDATA@GOTPCREL(%rip), %r13
	movl	(%r13), %r14d
	orl	(%rax), %r14d
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_output_data
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_DIAG
	movl	(%r13), %r14d
	movq	(%r12), %rsi
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %edx
	callq	_printdata
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_DIAG
	movq	_pty@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r12), %rsi
	movl	%ebx, %edx
	callq	_write
	movl	%eax, %ebx
LBB0_2:
	testl	%ebx, %ebx
	jns	LBB0_6
## %bb.3:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EWOULDBLOCK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_8
## %bb.4:
	movq	_EINTR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_8
## %bb.5:
	xorl	%edi, %edi
	callq	_cleanup
LBB0_6:
	movslq	%ebx, %rax
	addq	(%r12), %rax
	movq	%rax, (%r12)
	cmpq	(%r15), %rax
	jne	LBB0_8
## %bb.7:
	movq	_ptyobuf@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r15)
	movq	%rax, (%r12)
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pfrontp,8,3                    ## @pfrontp
	.comm	_pbackp,8,3                     ## @pbackp
	.comm	_TD_REPORT,4,2                  ## @TD_REPORT
	.comm	_TD_PTYDATA,4,2                 ## @TD_PTYDATA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"td: ptyflush %d chars\r\n"

L_.str.1:                               ## @.str.1
	.asciz	"pd"

	.comm	_pty,4,2                        ## @pty
	.comm	_errno,8,3                      ## @errno
	.comm	_EWOULDBLOCK,8,3                ## @EWOULDBLOCK
	.comm	_EINTR,8,3                      ## @EINTR
	.comm	_ptyobuf,8,3                    ## @ptyobuf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ptyflush                       ; -- Begin function ptyflush
	.p2align	2
_ptyflush:                              ; @ptyflush
	.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
Lloh0:
	adrp	x21, _pfrontp@GOTPAGE
Lloh1:
	ldr	x21, [x21, _pfrontp@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x22, _pbackp@GOTPAGE
Lloh3:
	ldr	x22, [x22, _pbackp@GOTPAGEOFF]
	ldr	w9, [x22]
	sub	w19, w8, w9
	cmp	w19, #1
	b.lt	LBB0_2
; %bb.1:
Lloh4:
	adrp	x8, _TD_REPORT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _TD_REPORT@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
Lloh7:
	adrp	x23, _TD_PTYDATA@GOTPAGE
Lloh8:
	ldr	x23, [x23, _TD_PTYDATA@GOTPAGEOFF]
	ldr	w9, [x23]
	orr	w20, w9, w8
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_output_data
	mov	x1, x0
	mov	x0, x20
	bl	_DIAG
	ldr	w20, [x23]
	ldr	x1, [x22]
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_printdata
	mov	x1, x0
	mov	x0, x20
	bl	_DIAG
Lloh13:
	adrp	x8, _pty@GOTPAGE
Lloh14:
	ldr	x8, [x8, _pty@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	ldr	x1, [x22]
	mov	x2, x19
	bl	_write
	mov	x19, x0
LBB0_2:
	tbz	w19, #31, LBB0_5
; %bb.3:
Lloh16:
	adrp	x8, _errno@GOTPAGE
Lloh17:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh18:
	ldr	x8, [x8]
Lloh19:
	adrp	x9, _EWOULDBLOCK@GOTPAGE
Lloh20:
	ldr	x9, [x9, _EWOULDBLOCK@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
Lloh22:
	adrp	x10, _EINTR@GOTPAGE
Lloh23:
	ldr	x10, [x10, _EINTR@GOTPAGEOFF]
Lloh24:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.eq	LBB0_7
; %bb.4:
	mov	w0, #0
	bl	_cleanup
LBB0_5:
	ldr	x8, [x22]
	add	x8, x8, w19, sxtw
	str	x8, [x22]
	ldr	x9, [x21]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
Lloh25:
	adrp	x8, _ptyobuf@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ptyobuf@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	str	x8, [x21]
	str	x8, [x22]
LBB0_7:
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_pfrontp,8,3                    ; @pfrontp
	.comm	_pbackp,8,3                     ; @pbackp
	.comm	_TD_REPORT,4,2                  ; @TD_REPORT
	.comm	_TD_PTYDATA,4,2                 ; @TD_PTYDATA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"td: ptyflush %d chars\r\n"

l_.str.1:                               ; @.str.1
	.asciz	"pd"

	.comm	_pty,4,2                        ; @pty
	.comm	_errno,8,3                      ; @errno
	.comm	_EWOULDBLOCK,8,3                ; @EWOULDBLOCK
	.comm	_EINTR,8,3                      ; @EINTR
	.comm	_ptyobuf,8,3                    ; @ptyobuf
.subsections_via_symbols
