	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function terminal_alloc
_terminal_alloc:                        ## @terminal_alloc
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_TC_BUFSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	%r12, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %r14
	movq	_tstr@GOTPCREL(%rip), %rax
	subq	(%rax), %r13
	sarq	$2, %r13
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	%r12d, %edx
	callq	_memset
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	cmpb	$0, (%rdi)
	je	LBB0_2
## %bb.3:
	callq	_strlen
	movq	%rax, %rbx
	movq	(%r14,%r13,8), %r12
	testq	%r12, %r12
	je	LBB0_4
## %bb.8:
	movq	%r12, %rdi
	callq	_strlen
	cmpq	%rax, %rbx
	ja	LBB0_5
## %bb.9:
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_strcpy
	jmp	LBB0_22
LBB0_2:
	movq	$0, (%r14,%r13,8)
LBB0_22:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_24
## %bb.23:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	testq	%rbx, %rbx
	je	LBB0_22
LBB0_5:
	movq	%rbx, %r12
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movslq	8(%rbx), %rdi
	leal	3(%rdi), %eax
	movq	_TC_BUFSIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	cmpl	%edx, %eax
	jge	LBB0_6
## %bb.10:
	addq	16(%rbx), %rdi
	movq	%rdi, (%r14,%r13,8)
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_strcpy
	movl	8(%rbx), %eax
	addl	%r12d, %eax
	incl	%eax
	movl	%eax, 8(%rbx)
	jmp	LBB0_22
LBB0_6:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %r8
	movq	_T_str@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jle	LBB0_7
## %bb.11:
	leaq	(%r14,%rax,8), %rdi
	xorl	%ebx, %ebx
	movq	%r14, %rcx
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_12 Depth=1
	addq	$8, %rcx
	cmpq	%rdi, %rcx
	jae	LBB0_19
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_16 Depth 2
	movq	(%rcx), %rsi
	testq	%rsi, %rsi
	je	LBB0_18
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movb	(%rsi), %al
	testb	%al, %al
	je	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	cmpq	(%r14,%r13,8), %rsi
	je	LBB0_18
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=1
	incq	%rsi
	incq	%rbx
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movb	%al, -1(%r15,%rbx)
	movzbl	(%rsi), %eax
	incq	%rsi
	incq	%rbx
	testb	%al, %al
	jne	LBB0_16
## %bb.17:                              ##   in Loop: Header=BB0_12 Depth=1
	movb	$0, -1(%r15,%rbx)
	jmp	LBB0_18
LBB0_7:
	xorl	%ebx, %ebx
LBB0_19:
	movq	%r8, %r12
	movq	16(%r8), %rdi
	movq	%r15, %rsi
	callq	_memcpy
	movl	%ebx, 8(%r12)
	leal	3(%rbx), %eax
	movq	_TC_BUFSIZE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_20
## %bb.21:
	movslq	%ebx, %rdi
	addq	16(%r12), %rdi
	movq	%rdi, (%r14,%r13,8)
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_strcpy
	movl	8(%r12), %eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	addl	%ecx, %eax
	incl	%eax
	movl	%eax, 8(%r12)
	jmp	LBB0_22
LBB0_20:
	movl	24(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fprintf
	jmp	LBB0_22
LBB0_24:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_TC_BUFSIZE,4,2                 ## @TC_BUFSIZE
	.comm	_tstr,8,3                       ## @tstr
	.comm	_T_str,8,3                      ## @T_str
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Out of termcap string space.\n"

	.no_dead_strip	_terminal_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function terminal_alloc
_terminal_alloc:                        ; @terminal_alloc
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	sub	sp, sp, #16
	mov	x20, x2
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
Lloh3:
	adrp	x25, _TC_BUFSIZE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _TC_BUFSIZE@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x9, x2
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x2, #15
	and	x9, x9, #0x1fffffff0
	sub	x22, x8, x9
	mov	sp, x22
	ldr	x24, [x0]
Lloh7:
	adrp	x8, _tstr@GOTPAGE
Lloh8:
	ldr	x8, [x8, _tstr@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	sub	x8, x1, x8
	asr	x26, x8, #2
	mov	x0, x22
	mov	w1, #0
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memset
	cbz	x20, LBB0_5
; %bb.1:
	ldrb	w8, [x20]
	cbz	w8, LBB0_5
; %bb.2:
	mov	x0, x20
	bl	_strlen
	mov	x21, x0
	ldr	x23, [x24, x26, lsl #3]
	cbz	x23, LBB0_6
; %bb.3:
	mov	x0, x23
	bl	_strlen
	cmp	x21, x0
	b.hi	LBB0_7
; %bb.4:
	mov	x0, x23
	mov	x1, x20
	bl	_strcpy
	b	LBB0_23
LBB0_5:
	str	xzr, [x24, x26, lsl #3]
	b	LBB0_23
LBB0_6:
	cbz	x21, LBB0_23
LBB0_7:
	ldrsw	x8, [x19, #8]
	add	w9, w8, #3
	ldr	w2, [x25]
	cmp	w9, w2
	b.ge	LBB0_9
; %bb.8:
	ldr	x9, [x19, #16]
	add	x0, x9, x8
	b	LBB0_21
LBB0_9:
Lloh10:
	adrp	x8, _T_str@GOTPAGE
Lloh11:
	ldr	x8, [x8, _T_str@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cmp	x8, #1
	b.lt	LBB0_18
; %bb.10:
	mov	x23, #0
	add	x8, x24, x8, lsl #3
	mov	x9, x24
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	add	x9, x9, #8
	cmp	x9, x8
	b.hs	LBB0_19
LBB0_12:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_16 Depth 2
	ldr	x11, [x9]
	cbz	x11, LBB0_11
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldrb	w10, [x11]
	cbz	w10, LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x12, [x24, x26, lsl #3]
	cmp	x11, x12
	b.eq	LBB0_11
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=1
	add	x11, x11, #1
LBB0_16:                                ;   Parent Loop BB0_12 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	strb	w10, [x22, x23]
	add	x23, x23, #1
	ldrb	w10, [x11], #1
	cbnz	w10, LBB0_16
; %bb.17:                               ;   in Loop: Header=BB0_12 Depth=1
	strb	wzr, [x22, x23]
	add	x23, x23, #1
	b	LBB0_11
LBB0_18:
	mov	x23, #0
LBB0_19:
	ldr	x0, [x19, #16]
	mov	x1, x22
	bl	_memcpy
	str	w23, [x19, #8]
	add	w8, w23, #3
	ldr	w9, [x25]
	cmp	w8, w9
	b.ge	LBB0_22
; %bb.20:
	ldr	x8, [x19, #16]
	add	x0, x8, w23, sxtw
LBB0_21:
	str	x0, [x24, x26, lsl #3]
	mov	x1, x20
	bl	_strcpy
	ldr	w8, [x19, #8]
	add	w8, w21, w8
	add	w8, w8, #1
	str	w8, [x19, #8]
	b	LBB0_23
LBB0_22:
	ldr	w0, [x19, #24]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fprintf
LBB0_23:
	ldur	x8, [x29, #-72]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_25
; %bb.24:
	sub	sp, x29, #64
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_25:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_TC_BUFSIZE,4,2                 ; @TC_BUFSIZE
	.comm	_tstr,8,3                       ; @tstr
	.comm	_T_str,8,3                      ; @T_str
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Out of termcap string space.\n"

	.no_dead_strip	_terminal_alloc
.subsections_via_symbols
