	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lua_replace
_lua_replace:                           ## @lua_replace
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	cmpl	$-10001, %esi                   ## imm = 0xD8EF
	jne	LBB0_3
## %bb.1:
	movq	(%rbx), %rax
	cmpq	8(%rbx), %rax
	jne	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_luaG_runerror
LBB0_3:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_api_checknelems
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_index2adr
	movl	%eax, %r15d
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_api_checkvalidindex
	cmpl	$-10001, %r14d                  ## imm = 0xD8EF
	jne	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	callq	_curr_func
	movq	%rax, %r14
	movq	16(%rbx), %rdi
	decq	%rdi
	callq	_ttistable
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_luai_apicheck
	movq	16(%rbx), %rdi
	decq	%rdi
	callq	_hvalue
	movl	%eax, (%r14)
	movq	16(%rbx), %rdx
	decq	%rdx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	jmp	LBB0_7
LBB0_5:
	movq	16(%rbx), %rdx
	decq	%rdx
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_setobj
	cmpl	$-10003, %r14d                  ## imm = 0xD8ED
	jg	LBB0_8
## %bb.6:
	movq	%rbx, %rdi
	callq	_curr_func
	movq	16(%rbx), %rdx
	decq	%rdx
	movq	%rbx, %rdi
	movq	%rax, %rsi
LBB0_7:
	callq	_luaC_barrier
LBB0_8:
	decq	16(%rbx)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no calling environment"

	.no_dead_strip	_lua_replace
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lua_replace
_lua_replace:                           ; @lua_replace
	.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	x20, x1
	mov	x19, x0
	mov	w22, #-10001
	cmp	w1, w22
	b.ne	LBB0_3
; %bb.1:
	ldp	x8, x9, [x19]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_luaG_runerror
LBB0_3:
	mov	x0, x19
	mov	w1, #1
	bl	_api_checknelems
	mov	x0, x19
	mov	x1, x20
	bl	_index2adr
	mov	x21, x0
	mov	x0, x19
	mov	x1, x21
	bl	_api_checkvalidindex
	cmp	w20, w22
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_curr_func
	mov	x20, x0
	ldr	x8, [x19, #16]
	sub	x0, x8, #1
	bl	_ttistable
	mov	x1, x0
	mov	x0, x19
	bl	_luai_apicheck
	ldr	x8, [x19, #16]
	sub	x0, x8, #1
	bl	_hvalue
	str	w0, [x20]
	ldr	x8, [x19, #16]
	sub	x2, x8, #1
	mov	x0, x19
	mov	x1, x20
	b	LBB0_7
LBB0_5:
	ldr	x8, [x19, #16]
	sub	x2, x8, #1
	mov	x0, x19
	mov	x1, x21
	bl	_setobj
	mov	w8, #-10003
	cmp	w20, w8
	b.gt	LBB0_8
; %bb.6:
	mov	x0, x19
	bl	_curr_func
	mov	x1, x0
	ldr	x8, [x19, #16]
	sub	x2, x8, #1
	mov	x0, x19
LBB0_7:
	bl	_luaC_barrier
LBB0_8:
	ldr	x8, [x19, #16]
	sub	x8, x8, #1
	str	x8, [x19, #16]
	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 AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no calling environment"

	.no_dead_strip	_lua_replace
.subsections_via_symbols
