	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function str_sub
_str_sub:                               ## @str_sub
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movl	$1, %r12d
	leaq	-40(%rbp), %rdx
	movl	$1, %esi
	callq	_luaL_checklstring
	movq	%rax, %r14
	movq	%r15, %rdi
	movl	$2, %esi
	callq	_luaL_checkinteger
	movq	-40(%rbp), %rsi
	movl	%eax, %edi
	callq	_posrelat
	movl	%eax, %ebx
	movq	%r15, %rdi
	movl	$3, %esi
	movl	$-1, %edx
	callq	_luaL_optinteger
	movq	-40(%rbp), %rsi
	movl	%eax, %edi
	callq	_posrelat
	cmpl	$2, %ebx
	cmovgel	%ebx, %r12d
	movl	-40(%rbp), %ecx
	cmpl	%ecx, %eax
	cmovll	%eax, %ecx
	subl	%r12d, %ecx
	jge	LBB0_1
## %bb.2:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_lua_pushliteral
	jmp	LBB0_3
LBB0_1:
	movl	%r12d, %eax
	leaq	(%r14,%rax), %rsi
	decq	%rsi
	movslq	%ecx, %rdx
	incq	%rdx
	movq	%r15, %rdi
	callq	_lua_pushlstring
LBB0_3:
	movl	$1, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

	.no_dead_strip	_str_sub
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function str_sub
_str_sub:                               ; @str_sub
	.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
	mov	x19, x0
	add	x2, sp, #8
	mov	w1, #1
	bl	_luaL_checklstring
	mov	x20, x0
	mov	x0, x19
	mov	w1, #2
	bl	_luaL_checkinteger
	ldr	x1, [sp, #8]
	bl	_posrelat
	mov	x21, x0
	mov	x0, x19
	mov	w1, #3
	mov	w2, #-1
	bl	_luaL_optinteger
	ldr	x1, [sp, #8]
	bl	_posrelat
	cmp	w21, #1
	csinc	w8, w21, wzr, gt
	ldr	w9, [sp, #8]
	cmp	w0, w9
	csel	w9, w0, w9, lt
	subs	w9, w9, w8
	b.ge	LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_lua_pushliteral
	b	LBB0_3
LBB0_2:
	add	x8, x20, w8, uxtw
	sub	x1, x8, #1
	sxtw	x8, w9
	add	x2, x8, #1
	mov	x0, x19
	bl	_lua_pushlstring
LBB0_3:
	mov	w0, #1
	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 AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

	.no_dead_strip	_str_sub
.subsections_via_symbols
