	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_choosekey                      ## -- Begin function choosekey
	.p2align	4, 0x90
_choosekey:                             ## @choosekey
	.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
	subq	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	xorl	%eax, %eax
	callq	_clrscr
	leaq	L_.str(%rip), %rsi
	leaq	-128(%rbp), %r15
	movq	%r15, %rdi
	movq	%rbx, %rdx
	callq	_sprintf
	movq	%r15, %rdi
	callq	_strlen
	movl	$78, %ebx
	movl	$78, %ecx
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	movl	$8, %esi
	callq	_gotoxy
	movq	%r15, %rdi
	callq	_cputs
	movl	$34, %edi
	movl	$9, %esi
	callq	_gotoxy
	leaq	L_.str.1(%rip), %rdi
	callq	_cputs
	movq	_keynames@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	movslq	%r14d, %rcx
	movq	(%rax,%rcx,8), %rdx
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_sprintf
	movq	%r15, %rdi
	callq	_strlen
	subl	%eax, %ebx
	movl	%ebx, %edi
	shrl	$31, %edi
	addl	%ebx, %edi
	sarl	%edi
	movl	$11, %esi
	callq	_gotoxy
	movq	%r15, %rdi
	callq	_cputs
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_kbhit
	testq	%rax, %rax
	jne	LBB0_1
## %bb.2:
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_key_init
	movq	_hi@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	movq	_lo@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	cmpl	%edx, %eax
	jne	LBB0_3
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	jmp	LBB0_12
LBB0_3:
	movq	_buffer@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	movq	(%r13), %r8
	movl	$1073807361, %r9d               ## imm = 0x40010001
	movl	$393217, %r10d                  ## imm = 0x60001
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_4 Depth=1
	btl	%ecx, %r10d
	jae	LBB0_6
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=1
	cmpl	%edx, %eax
	je	LBB0_12
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%edx, %rcx
	incl	%edx
	movl	%edx, (%rbx)
	cmpl	$100, %edx
                                        ## kill: def $edx killed $edx def $rdx
	cmovel	%r14d, %edx
	movl	(%rsi,%rcx,4), %edi
	movl	%edx, (%rbx)
	leal	-59(%rdi), %ecx
	cmpl	$10, %ecx
	jb	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	leal	-70(%rdi), %ecx
	cmpl	$18, %ecx
	jbe	LBB0_19
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	leal	-167(%rdi), %ecx
	cmpl	$30, %ecx
	ja	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	btl	%ecx, %r9d
	jb	LBB0_11
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	testl	$65280, %edi                    ## imm = 0xFF00
	jne	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movzbl	%dil, %edi
	movq	(%r8,%rdi,8), %rcx
	movzbl	(%rcx), %ecx
	cmpb	$63, %cl
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	cmpb	$35, %cl
	je	LBB0_11
## %bb.13:
	cmpl	$1, %edi
	movl	$255, %r13d
	cmovnel	%edi, %r13d
	movq	(%r8,%r13,8), %rdx
	leaq	L_.str.2(%rip), %rsi
	leaq	-128(%rbp), %rdi
	callq	_sprintf
	movl	$1, %edi
	movl	$11, %esi
	callq	_gotoxy
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_clreol
	leaq	-128(%rbp), %rdi
	callq	_strlen
	movl	$78, %ecx
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	movl	$11, %esi
	callq	_gotoxy
	leaq	-128(%rbp), %rdi
	callq	_cputs
	movl	(%r12), %eax
	movq	(%r15), %rcx
	movl	(%rbx), %edx
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	cmpl	%edx, %eax
	je	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_14 Depth=1
	movslq	%edx, %rsi
	incl	%edx
	movl	%edx, (%rbx)
	movzbl	1(%rcx,%rsi,4), %esi
	cmpl	$100, %edx
	cmovel	%r14d, %edx
	movl	%edx, (%rbx)
                                        ## kill: def $edx killed $edx def $rdx
	testl	%esi, %esi
	je	LBB0_14
## %bb.17:
	xorl	%eax, %eax
	callq	_key_done
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_20
## %bb.18:
	movl	%r13d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	jmp	LBB0_15
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Press key for %s"

L_.str.1:                               ## @.str.1
	.asciz	"(ESC=none)"

L_.str.2:                               ## @.str.2
	.asciz	"Current setting: %s"

	.comm	_keynames,8,3                   ## @keynames
	.comm	_hi,4,2                         ## @hi
	.comm	_lo,4,2                         ## @lo
	.comm	_buffer,8,3                     ## @buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_choosekey                      ; -- Begin function choosekey
	.p2align	2
_choosekey:                             ; @choosekey
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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, x1
	mov	x20, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
	bl	_clrscr
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	add	x0, sp, #8
	mov	x2, x20
	bl	_sprintf
	add	x0, sp, #8
	bl	_strlen
	mov	w20, #78
	sub	w8, w20, w0
	mov	w21, #79
	sub	w9, w21, w0
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #1
	mov	w1, #8
	bl	_gotoxy
	add	x0, sp, #8
	bl	_cputs
	mov	w0, #34
	mov	w1, #9
	bl	_gotoxy
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_cputs
Lloh7:
	adrp	x23, _keynames@GOTPAGE
Lloh8:
	ldr	x23, [x23, _keynames@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x2, [x8, w19, sxtw #3]
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	add	x0, sp, #8
	bl	_sprintf
	add	x0, sp, #8
	bl	_strlen
	sub	w8, w20, w0
	sub	w9, w21, w0
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #1
	mov	w1, #11
	bl	_gotoxy
	add	x0, sp, #8
	bl	_cputs
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	bl	_kbhit
	cbnz	x0, LBB0_1
; %bb.2:
	bl	_key_init
Lloh11:
	adrp	x21, _hi@GOTPAGE
Lloh12:
	ldr	x21, [x21, _hi@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh13:
	adrp	x20, _lo@GOTPAGE
Lloh14:
	ldr	x20, [x20, _lo@GOTPAGEOFF]
	ldr	w9, [x20]
	cmp	w8, w9
	b.ne	LBB0_4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	b	LBB0_3
LBB0_4:
Lloh15:
	adrp	x22, _buffer@GOTPAGE
Lloh16:
	ldr	x22, [x22, _buffer@GOTPAGEOFF]
	ldr	x11, [x22]
	ldr	x10, [x23]
	mov	w12, #1
	mov	w13, #1
	movk	w13, #6, lsl #16
	mov	w14, #1
	movk	w14, #16385, lsl #16
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	cmp	w8, w9
	b.eq	LBB0_3
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	add	w16, w9, #1
	str	w16, [x20]
	ldr	w15, [x11, w9, sxtw #2]
	cmp	w16, #100
	csinc	w9, wzr, w9, eq
	str	w9, [x20]
	sub	w16, w15, #59
	cmp	w16, #10
	b.lo	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	sub	w16, w15, #70
	cmp	w16, #18
	lsl	w16, w12, w16
	and	w16, w16, w13
	ccmp	w16, #0, #4, ls
	b.ne	LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	sub	w16, w15, #167
	cmp	w16, #30
	lsl	w16, w12, w16
	and	w16, w16, w14
	ccmp	w16, #0, #4, ls
	and	w16, w15, #0xff00
	ccmp	w16, #0, #0, eq
	b.ne	LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	and	w15, w15, #0xff
	ldr	x16, [x10, w15, uxtw #3]
	ldrb	w16, [x16]
	cmp	w16, #63
	b.eq	LBB0_5
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	cmp	w16, #35
	b.eq	LBB0_5
; %bb.11:
	mov	w8, #255
	cmp	w15, #1
	csel	w19, w8, w15, eq
	ldr	x2, [x10, w19, uxtw #3]
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	add	x0, sp, #8
	bl	_sprintf
	mov	w0, #1
	mov	w1, #11
	bl	_gotoxy
	bl	_clreol
	add	x0, sp, #8
	bl	_strlen
	mov	w8, #78
	sub	w8, w8, w0
	mov	w9, #79
	sub	w9, w9, w0
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #1
	mov	w1, #11
	bl	_gotoxy
	add	x0, sp, #8
	bl	_cputs
	ldr	w8, [x21]
	ldr	x9, [x22]
	ldr	w10, [x20]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	cmp	w8, w10
	b.eq	LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	add	w11, w10, #1
	str	w11, [x20]
	add	x12, x9, w10, sxtw #2
	ldrb	w12, [x12, #1]
	lsl	w12, w12, #8
	cmp	w11, #100
	csinc	w10, wzr, w10, eq
	str	w10, [x20]
	cbz	w12, LBB0_12
; %bb.14:
	bl	_key_done
	ldur	x8, [x29, #-56]
Lloh19:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh20:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_17
; %bb.15:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	b	LBB0_16
LBB0_17:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Press key for %s"

l_.str.1:                               ; @.str.1
	.asciz	"(ESC=none)"

l_.str.2:                               ; @.str.2
	.asciz	"Current setting: %s"

	.comm	_keynames,8,3                   ; @keynames
	.comm	_hi,4,2                         ; @hi
	.comm	_lo,4,2                         ; @lo
	.comm	_buffer,8,3                     ; @buffer
.subsections_via_symbols
