	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gettermname
_gettermname:                           ## @gettermname
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_resettermname@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movq	$0, (%rax)
	movq	_gettermname.tnamep(%rip), %rdi
	movq	_unknown@GOTPCREL(%rip), %r14
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.3:
	cmpq	(%r14), %rdi
	je	LBB0_5
## %bb.4:
	callq	_free
LBB0_5:
	leaq	L_.str(%rip), %rdi
	callq	_env_getvalue
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	movq	%rax, %rbx
	leaq	-20(%rbp), %rdx
	movq	%rax, %rdi
	movl	$1, %esi
	callq	_setupterm
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rbx, %rdi
	callq	_strlen
	cmpl	$40, %eax
	jg	LBB0_10
## %bb.9:
	movq	(%r14), %rax
	movq	%rbx, (%rax)
	movq	%rbx, %rdi
	callq	_upcase
	jmp	LBB0_11
LBB0_1:
	movq	_gettermname.next(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_14
	jmp	LBB0_15
LBB0_10:
	movq	_name_unknown@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r14), %rcx
	movq	%rax, (%rcx)
LBB0_11:
	movq	(%r14), %rax
	jmp	LBB0_12
LBB0_7:
	movq	_termbuf@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	callq	_mklist
LBB0_12:
	movq	%rax, _gettermname.tnamep(%rip)
	cmpq	$0, (%rax)
	jne	LBB0_15
LBB0_14:
	movq	_gettermname.tnamep(%rip), %rax
LBB0_15:
	leaq	8(%rax), %rcx
	movq	%rcx, _gettermname.next(%rip)
	movq	(%rax), %rax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_gettermname.tnamep,8,3 ## @gettermname.tnamep
.zerofill __DATA,__bss,_gettermname.next,8,3 ## @gettermname.next
	.comm	_resettermname,8,3              ## @resettermname
	.comm	_unknown,8,3                    ## @unknown
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"TERM"

	.comm	_termbuf,4,2                    ## @termbuf
	.comm	_name_unknown,8,3               ## @name_unknown
	.no_dead_strip	_gettermname
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gettermname
_gettermname:                           ; @gettermname
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
Lloh0:
	adrp	x8, _resettermname@GOTPAGE
Lloh1:
	ldr	x8, [x8, _resettermname@GOTPAGEOFF]
	ldr	x9, [x8]
	adrp	x21, _gettermname.tnamep@PAGE
	adrp	x20, _gettermname.next@PAGE
	cbz	x9, LBB0_7
; %bb.1:
	str	xzr, [x8]
	ldr	x0, [x21, _gettermname.tnamep@PAGEOFF]
Lloh2:
	adrp	x22, _unknown@GOTPAGE
Lloh3:
	ldr	x22, [x22, _unknown@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x0, #0
	ccmp	x0, x8, #4, ne
	b.eq	LBB0_3
; %bb.2:
	bl	_free
LBB0_3:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_env_getvalue
	cbz	x0, LBB0_8
; %bb.4:
	mov	x19, x0
	add	x2, sp, #12
	mov	w1, #1
	bl	_setupterm
	cbz	x0, LBB0_10
; %bb.5:
	mov	x0, x19
	bl	_strlen
	cmp	w0, #40
	b.gt	LBB0_8
; %bb.6:
	ldr	x8, [x22]
	str	x19, [x8]
	mov	x0, x19
	bl	_upcase
	b	LBB0_9
LBB0_7:
	ldr	x0, [x20, _gettermname.next@PAGEOFF]
	b	LBB0_12
LBB0_8:
Lloh6:
	adrp	x8, _name_unknown@GOTPAGE
Lloh7:
	ldr	x8, [x8, _name_unknown@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	ldr	x9, [x22]
	str	x8, [x9]
LBB0_9:
	ldr	x0, [x22]
	b	LBB0_11
LBB0_10:
Lloh9:
	adrp	x8, _termbuf@GOTPAGE
Lloh10:
	ldr	x8, [x8, _termbuf@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_mklist
LBB0_11:
	str	x0, [x21, _gettermname.tnamep@PAGEOFF]
LBB0_12:
	ldr	x8, [x0]
	ldr	x9, [x21, _gettermname.tnamep@PAGEOFF]
	cmp	x8, #0
	csel	x8, x9, x0, eq
	add	x9, x8, #8
	str	x9, [x20, _gettermname.next@PAGEOFF]
	ldr	x0, [x8]
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_gettermname.tnamep,8,3 ; @gettermname.tnamep
.zerofill __DATA,__bss,_gettermname.next,8,3 ; @gettermname.next
	.comm	_resettermname,8,3              ; @resettermname
	.comm	_unknown,8,3                    ; @unknown
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"TERM"

	.comm	_termbuf,4,2                    ; @termbuf
	.comm	_name_unknown,8,3               ; @name_unknown
	.no_dead_strip	_gettermname
.subsections_via_symbols
