	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ui__getch                      ## -- Begin function ui__getch
	.p2align	4, 0x90
_ui__getch:                             ## @ui__getch
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %ebx
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_ui__setup_sigwinch
	leaq	-28(%rbp), %r14
	movq	%r14, %rdi
	callq	_FD_ZERO
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	_FD_SET
	leaq	-40(%rbp), %r8
	testl	%ebx, %ebx
	cmoveq	%r15, %r8
	je	LBB0_2
## %bb.1:
	movl	%ebx, -40(%rbp)
	movl	$0, -36(%rbp)
LBB0_2:
	leaq	-28(%rbp), %rsi
	movl	$1, %edi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_select
	cmpl	$-1, %eax
	je	LBB0_5
## %bb.3:
	testl	%eax, %eax
	jne	LBB0_8
## %bb.4:
	movq	_K_TIMER@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_12
LBB0_5:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EINTR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.6:
	movq	_K_RESIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_12
LBB0_8:
	xorl	%eax, %eax
	callq	_SLang_getkey
	movl	%eax, %ebx
	movq	_K_ESC@GOTPCREL(%rip), %r15
	cmpl	(%r15), %eax
	jne	LBB0_12
## %bb.9:
	leaq	-28(%rbp), %r14
	movq	%r14, %rdi
	callq	_FD_ZERO
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	_FD_SET
	movabsq	$85899345920, %rax              ## imm = 0x1400000000
	movq	%rax, -40(%rbp)
	leaq	-40(%rbp), %r8
	movl	$1, %edi
	movq	%r14, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_select
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movl	%ebx, %edi
	callq	_SLang_ungetkey
	xorl	%eax, %eax
	callq	_SLkp_getkey
	movl	%eax, %ebx
	jmp	LBB0_12
LBB0_7:
	movq	_K_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_12
LBB0_10:
	movl	(%r15), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_K_TIMER,4,2                    ## @K_TIMER
	.comm	_errno,8,3                      ## @errno
	.comm	_EINTR,8,3                      ## @EINTR
	.comm	_K_RESIZE,4,2                   ## @K_RESIZE
	.comm	_K_ERROR,4,2                    ## @K_ERROR
	.comm	_K_ESC,4,2                      ## @K_ESC
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function ui__getch
lCPI0_0:
	.long	0                               ; 0x0
	.long	20                              ; 0x14
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_ui__getch
	.p2align	2
_ui__getch:                             ; @ui__getch
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x20, x0
	cmp	w0, #0
	add	x8, sp, #8
	csel	x19, xzr, x8, eq
	bl	_ui__setup_sigwinch
	add	x0, sp, #4
	bl	_FD_ZERO
	add	x1, sp, #4
	mov	w0, #0
	bl	_FD_SET
	cbz	w20, LBB0_2
; %bb.1:
	stp	w20, wzr, [sp, #8]
LBB0_2:
	add	x1, sp, #4
	mov	w0, #1
	mov	x2, #0
	mov	x3, #0
	mov	x4, x19
	bl	_select
	cmn	w0, #1
	b.eq	LBB0_5
; %bb.3:
	cbnz	w0, LBB0_7
; %bb.4:
Lloh0:
	adrp	x8, _K_TIMER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _K_TIMER@GOTPAGEOFF]
Lloh2:
	ldr	w19, [x8]
	b	LBB0_12
LBB0_5:
Lloh3:
	adrp	x8, _errno@GOTPAGE
Lloh4:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _EINTR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _EINTR@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.6:
Lloh9:
	adrp	x8, _K_RESIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _K_RESIZE@GOTPAGEOFF]
Lloh11:
	ldr	w19, [x8]
	b	LBB0_12
LBB0_7:
	bl	_SLang_getkey
	mov	x19, x0
Lloh12:
	adrp	x20, _K_ESC@GOTPAGE
Lloh13:
	ldr	x20, [x20, _K_ESC@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w0, w8
	b.ne	LBB0_12
; %bb.8:
	add	x0, sp, #4
	bl	_FD_ZERO
	add	x1, sp, #4
	mov	w0, #0
	bl	_FD_SET
Lloh14:
	adrp	x8, lCPI0_0@PAGE
Lloh15:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [sp, #8]
	add	x1, sp, #4
	add	x4, sp, #8
	mov	w0, #1
	mov	x2, #0
	mov	x3, #0
	bl	_select
	cbz	w0, LBB0_11
; %bb.9:
	mov	x0, x19
	bl	_SLang_ungetkey
	bl	_SLkp_getkey
	mov	x19, x0
	b	LBB0_12
LBB0_10:
Lloh16:
	adrp	x8, _K_ERROR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _K_ERROR@GOTPAGEOFF]
Lloh18:
	ldr	w19, [x8]
	b	LBB0_12
LBB0_11:
	ldr	w19, [x20]
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_K_TIMER,4,2                    ; @K_TIMER
	.comm	_errno,8,3                      ; @errno
	.comm	_EINTR,8,3                      ; @EINTR
	.comm	_K_RESIZE,4,2                   ; @K_RESIZE
	.comm	_K_ERROR,4,2                    ; @K_ERROR
	.comm	_K_ESC,4,2                      ; @K_ESC
.subsections_via_symbols
