	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tty_poll
_tty_poll:                              ## @tty_poll
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r15
	leaq	16(%r15), %r14
	movq	%r14, %rdi
	callq	_lock
	movq	_POLL_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	cmpq	$0, 40(%r15)
	je	LBB0_2
## %bb.1:
	movq	_POLL_READ@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_POLL_ERR@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_POLL_HUP@GOTPCREL(%rip), %rax
LBB0_8:
	orl	(%rax), %ebx
	jmp	LBB0_9
LBB0_2:
	movq	%r15, %rdi
	callq	_pty_is_half_closed_master
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_POLL_READ@GOTPCREL(%rip), %rax
	movq	_POLL_HUP@GOTPCREL(%rip), %rcx
	orl	(%rax), %ebx
	orl	(%rcx), %ebx
LBB0_9:
	movq	24(%r15), %rax
	cmpq	_pty_master@GOTPCREL(%rip), %rax
	jne	LBB0_12
## %bb.10:
	cmpq	$0, 8(%r15)
	je	LBB0_12
## %bb.11:
	movq	_POLL_PRI@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
LBB0_12:
	movq	%r14, %rdi
	callq	_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_ICANON_@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 32(%r15)
	je	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	callq	_tty_canon_size
	cmpq	$-1, %rax
	jne	LBB0_7
	jmp	LBB0_9
LBB0_6:
	cmpq	$0, (%r15)
	jle	LBB0_9
LBB0_7:
	movq	_POLL_READ@GOTPCREL(%rip), %rax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_POLL_WRITE,4,2                 ## @POLL_WRITE
	.comm	_POLL_READ,4,2                  ## @POLL_READ
	.comm	_POLL_ERR,4,2                   ## @POLL_ERR
	.comm	_POLL_HUP,4,2                   ## @POLL_HUP
	.comm	_ICANON_,4,2                    ## @ICANON_
	.comm	_pty_master,4,2                 ## @pty_master
	.comm	_POLL_PRI,4,2                   ## @POLL_PRI
	.no_dead_strip	_tty_poll
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tty_poll
_tty_poll:                              ; @tty_poll
	.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
	ldr	x21, [x0]
	add	x19, x21, #16
	mov	x0, x19
	bl	_lock
Lloh0:
	adrp	x8, _POLL_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _POLL_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
	ldr	x8, [x21, #40]
	cbz	x8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _POLL_READ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _POLL_READ@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	orr	w8, w8, w20
Lloh6:
	adrp	x9, _POLL_ERR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _POLL_ERR@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh9:
	adrp	x9, _POLL_HUP@GOTPAGE
Lloh10:
	ldr	x9, [x9, _POLL_HUP@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w20, w8, w9
	b	LBB0_7
LBB0_2:
	mov	x0, x21
	bl	_pty_is_half_closed_master
	cbz	x0, LBB0_4
; %bb.3:
Lloh12:
	adrp	x8, _POLL_READ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _POLL_READ@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _POLL_HUP@GOTPAGE
Lloh16:
	ldr	x9, [x9, _POLL_HUP@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w8, w8, w20
	orr	w20, w8, w9
	b	LBB0_7
LBB0_4:
	ldr	w8, [x21, #32]
Lloh18:
	adrp	x9, _ICANON_@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ICANON_@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.5:
	mov	x0, x21
	bl	_tty_canon_size
	cmn	x0, #1
	b.eq	LBB0_7
LBB0_6:
Lloh21:
	adrp	x8, _POLL_READ@GOTPAGE
Lloh22:
	ldr	x8, [x8, _POLL_READ@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	orr	w20, w8, w20
LBB0_7:
	ldr	x8, [x21, #24]
Lloh24:
	adrp	x9, _pty_master@GOTPAGE
Lloh25:
	ldr	x9, [x9, _pty_master@GOTPAGEOFF]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.8:
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_10
; %bb.9:
Lloh26:
	adrp	x8, _POLL_PRI@GOTPAGE
Lloh27:
	ldr	x8, [x8, _POLL_PRI@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	orr	w20, w8, w20
LBB0_10:
	mov	x0, x19
	bl	_unlock
	mov	x0, x20
	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
LBB0_11:
	ldr	x8, [x21]
	cmp	x8, #1
	b.ge	LBB0_6
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_POLL_WRITE,4,2                 ; @POLL_WRITE
	.comm	_POLL_READ,4,2                  ; @POLL_READ
	.comm	_POLL_ERR,4,2                   ; @POLL_ERR
	.comm	_POLL_HUP,4,2                   ; @POLL_HUP
	.comm	_ICANON_,4,2                    ; @ICANON_
	.comm	_pty_master,4,2                 ; @pty_master
	.comm	_POLL_PRI,4,2                   ; @POLL_PRI
	.no_dead_strip	_tty_poll
.subsections_via_symbols
