	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tinsert
_tinsert:                               ## @tinsert
	.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, %r14
	movq	_TAB_RW@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$1, %esi
	callq	_aux_getn
	movl	%eax, %ebx
	leal	1(%rbx), %r12d
	movq	%r14, %rdi
	callq	_lua_gettop
	cmpl	$2, %eax
	je	LBB0_5
## %bb.1:
	cmpl	$3, %eax
	jne	LBB0_6
## %bb.2:
	movq	%r14, %rdi
	movl	$2, %esi
	callq	_luaL_checkinteger
	movl	%eax, %r15d
	testl	%eax, %eax
	setg	%al
	cmpl	%r12d, %r15d
	setle	%cl
	andb	%al, %cl
	movzbl	%cl, %esi
	leaq	L_.str(%rip), %rcx
	movq	%r14, %rdi
	movl	$2, %edx
	callq	_luaL_argcheck
	cmpl	%r15d, %ebx
	jl	LBB0_4
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%rbx), %r12d
	movq	%r14, %rdi
	movl	$1, %esi
	movl	%ebx, %edx
	callq	_lua_geti
	movq	%r14, %rdi
	movl	$1, %esi
	movl	%r12d, %edx
	callq	_lua_seti
	leal	-1(%rbx), %eax
	cmpl	%r15d, %ebx
	movl	%eax, %ebx
	jg	LBB0_3
LBB0_4:
	movl	%r15d, %r12d
LBB0_5:
	movq	%r14, %rdi
	movl	$1, %esi
	movl	%r12d, %edx
	callq	_lua_seti
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_luaL_error                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_TAB_RW,4,2                     ## @TAB_RW
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"position out of bounds"

L_.str.1:                               ## @.str.1
	.asciz	"wrong number of arguments to 'insert'"

	.no_dead_strip	_tinsert
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tinsert
_tinsert:                               ; @tinsert
	.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
Lloh0:
	adrp	x8, _TAB_RW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TAB_RW@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	w1, #1
	bl	_aux_getn
	mov	x20, x0
	add	w22, w0, #1
	mov	x0, x19
	bl	_lua_gettop
	cmp	w0, #2
	b.eq	LBB0_4
; %bb.1:
	cmp	w0, #3
	b.ne	LBB0_6
; %bb.2:
	mov	x0, x19
	mov	w1, #2
	bl	_luaL_checkinteger
	mov	x21, x0
	cmp	w0, #0
	ccmp	w0, w22, #0, gt
	cset	w1, le
Lloh3:
	adrp	x3, l_.str@PAGE
Lloh4:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x19
	mov	w2, #2
	bl	_luaL_argcheck
	cmp	w20, w21
	b.lt	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	w22, w20, #1
	mov	x0, x19
	mov	w1, #1
	mov	x2, x20
	bl	_lua_geti
	mov	x0, x19
	mov	w1, #1
	mov	x2, x22
	bl	_lua_seti
	sub	w8, w20, #1
	cmp	w20, w21
	mov	x20, x8
	b.gt	LBB0_3
	b	LBB0_5
LBB0_4:
	mov	x21, x22
LBB0_5:
	mov	x0, x19
	mov	w1, #1
	mov	x2, x21
	bl	_lua_seti
	mov	w0, #0
	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
LBB0_6:
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	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
	b	_luaL_error
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_TAB_RW,4,2                     ; @TAB_RW
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"position out of bounds"

l_.str.1:                               ; @.str.1
	.asciz	"wrong number of arguments to 'insert'"

	.no_dead_strip	_tinsert
.subsections_via_symbols
