	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TuiCalcMenuBoxSize             ## -- Begin function TuiCalcMenuBoxSize
	.p2align	4, 0x90
_TuiCalcMenuBoxSize:                    ## @TuiCalcMenuBoxSize
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %r14
	testq	%r14, %r14
	je	LBB0_1
## %bb.2:
	xorl	%ebx, %ebx
	movq	%r14, %rax
	xorl	%r12d, %r12d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	cmpq	%rax, %rbx
	jae	LBB0_6
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	40(%r15), %rcx
	movq	(%rcx,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	callq	_strlen
	cmpq	%r12, %rax
	cmovaq	%rax, %r12
	movq	(%r15), %rax
	jmp	LBB0_5
LBB0_1:
	xorl	%r12d, %r12d
LBB0_6:
	addq	$18, %r12
	movq	_UiCenterMenu@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.8:
	movq	_UiScreenWidth@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	subq	%r12, %rax
	shrq	%rax
	movq	_UiScreenHeight@GOTPCREL(%rip), %rdx
	movq	_TUI_TITLE_BOX_CHAR_HEIGHT@GOTPCREL(%rip), %rsi
	movq	%r14, %rcx
	notq	%rcx
	addq	(%rdx), %rcx
	movq	(%rsi), %rdx
	subq	%rdx, %rcx
	shrq	%rcx
	addq	%rdx, %rcx
	jmp	LBB0_9
LBB0_7:
	movl	$4, %ecx
	movq	$-1, %rax
LBB0_9:
	movq	%rax, 8(%r15)
	movq	%rcx, 16(%r15)
	addq	%rax, %r12
	movq	%r12, 24(%r15)
	leaq	(%r14,%rcx), %rax
	incq	%rax
	movq	%rax, 32(%r15)
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_UiCenterMenu,8,3               ## @UiCenterMenu
	.comm	_UiScreenWidth,8,3              ## @UiScreenWidth
	.comm	_UiScreenHeight,8,3             ## @UiScreenHeight
	.comm	_TUI_TITLE_BOX_CHAR_HEIGHT,8,3  ## @TUI_TITLE_BOX_CHAR_HEIGHT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TuiCalcMenuBoxSize             ; -- Begin function TuiCalcMenuBoxSize
	.p2align	2
_TuiCalcMenuBoxSize:                    ; @TuiCalcMenuBoxSize
	.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
	mov	x19, x0
	ldr	x20, [x0]
	cbz	x20, LBB0_5
; %bb.1:
	mov	x22, #0
	mov	x21, #0
	mov	x8, x20
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	cmp	x22, x8
	b.hs	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #40]
	ldr	x0, [x9, x22, lsl #3]
	cbz	x0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_strlen
	cmp	x0, x21
	csel	x21, x0, x21, hi
	ldr	x8, [x19]
	b	LBB0_2
LBB0_5:
	mov	x21, #0
LBB0_6:
	add	x8, x21, #18
Lloh0:
	adrp	x9, _UiCenterMenu@GOTPAGE
Lloh1:
	ldr	x9, [x9, _UiCenterMenu@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cbz	x9, LBB0_8
; %bb.7:
Lloh3:
	adrp	x9, _UiScreenWidth@GOTPAGE
Lloh4:
	ldr	x9, [x9, _UiScreenWidth@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	sub	x9, x9, x8
	lsr	x9, x9, #1
Lloh6:
	adrp	x10, _UiScreenHeight@GOTPAGE
Lloh7:
	ldr	x10, [x10, _UiScreenHeight@GOTPAGEOFF]
Lloh8:
	adrp	x11, _TUI_TITLE_BOX_CHAR_HEIGHT@GOTPAGE
Lloh9:
	ldr	x11, [x11, _TUI_TITLE_BOX_CHAR_HEIGHT@GOTPAGEOFF]
Lloh10:
	ldr	x10, [x10]
Lloh11:
	ldr	x11, [x11]
	mvn	x12, x20
	add	x10, x10, x12
	sub	x10, x10, x11
	add	x10, x11, x10, lsr #1
	b	LBB0_9
LBB0_8:
	mov	x9, #-1
	mov	w10, #4
LBB0_9:
	stp	x9, x10, [x19, #8]
	add	x10, x20, x10
	add	x8, x9, x8
	add	x9, x10, #1
	stp	x8, x9, [x19, #24]
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_UiCenterMenu,8,3               ; @UiCenterMenu
	.comm	_UiScreenWidth,8,3              ; @UiScreenWidth
	.comm	_UiScreenHeight,8,3             ; @UiScreenHeight
	.comm	_TUI_TITLE_BOX_CHAR_HEIGHT,8,3  ; @TUI_TITLE_BOX_CHAR_HEIGHT
.subsections_via_symbols
