	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function str_gsub
_str_gsub:                              ## @str_gsub
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	-64(%rbp), %rdx
	movl	$1, %esi
	callq	_luaL_checklstring
	movq	%rax, %r15
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_luaL_checkstring
	movq	%rax, %r14
	movq	%rbx, %rdi
	movl	$3, %esi
	callq	_lua_type
	movl	%eax, %r13d
	movq	-64(%rbp), %rdx
	incq	%rdx
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_luaL_optint
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movb	(%r14), %al
	xorl	%r12d, %r12d
	movb	%al, -41(%rbp)                  ## 1-byte Spill
	cmpb	$94, %al
	sete	%r12b
	addq	%r14, %r12
	addl	$-3, %r13d
	xorl	%esi, %esi
	cmpl	$4, %r13d
	setb	%sil
	leaq	L_.str(%rip), %rcx
	movq	%rbx, %rdi
	movl	$3, %edx
	callq	_luaL_argcheck
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_luaL_buffinit
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, -80(%rbp)
	movq	%r15, %rax
	addq	-64(%rbp), %rax
	movq	%r15, -104(%rbp)
	movq	%rax, -96(%rbp)
	xorl	%r13d, %r13d
	leaq	-104(%rbp), %r14
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_1:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %r15
	cmpb	$94, -41(%rbp)                  ## 1-byte Folded Reload
	je	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	-52(%rbp), %r13d                ## 4-byte Folded Reload
	jge	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, -88(%rbp)
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_match
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %rbx
	incl	%r13d
	movq	%r14, %rdi
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdx
	movq	%rax, %rcx
	callq	_add_value
	cmpq	%r15, %rbx
	ja	LBB0_1
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpq	-96(%rbp), %r15
	jae	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movsbl	(%r15), %esi
	incq	%r15
	leaq	-48(%rbp), %rdi
	callq	_luaL_addchar
	movq	%r15, %rbx
	jmp	LBB0_1
LBB0_8:
	movq	%r15, %rbx
LBB0_9:
	movl	-96(%rbp), %edx
	subl	%ebx, %edx
	leaq	-48(%rbp), %r14
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_luaL_addlstring
	movq	%r14, %rdi
	callq	_luaL_pushresult
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	callq	_lua_pushinteger
	movl	$2, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"string/function/table expected"

	.no_dead_strip	_str_gsub
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function str_gsub
_str_gsub:                              ; @str_gsub
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	mov	x19, x0
	add	x2, sp, #40
	mov	w1, #1
	bl	_luaL_checklstring
	mov	x20, x0
	mov	x0, x19
	mov	w1, #2
	bl	_luaL_checkstring
	mov	x21, x0
	mov	x0, x19
	mov	w1, #3
	bl	_lua_type
	mov	x24, x0
	ldr	x8, [sp, #40]
	add	x2, x8, #1
	mov	x0, x19
	mov	w1, #4
	bl	_luaL_optint
	mov	x22, x0
	mov	x8, x21
	ldrb	w25, [x8], #1
	cmp	w25, #94
	csel	x23, x21, x8, ne
	sub	w8, w24, #3
	cmp	w8, #4
	cset	w1, lo
Lloh0:
	adrp	x3, l_.str@PAGE
Lloh1:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x19
	mov	w2, #3
	bl	_luaL_argcheck
	add	x1, sp, #4
	mov	x0, x19
	bl	_luaL_buffinit
	mov	w21, #0
	str	x19, [sp, #32]
	ldr	x8, [sp, #40]
	add	x8, x20, x8
	stp	x20, x8, [sp, #8]
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x20, x24
	cmp	w25, #94
	b.eq	LBB0_8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w21, w22
	b.ge	LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	str	xzr, [sp, #24]
	add	x0, sp, #8
	mov	x1, x20
	mov	x2, x23
	bl	_match
	cbz	x0, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x24, x0
	add	w21, w21, #1
	add	x0, sp, #8
	add	x1, sp, #4
	mov	x2, x20
	mov	x3, x24
	bl	_add_value
	cmp	x24, x20
	b.hi	LBB0_1
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [sp, #16]
	cmp	x20, x8
	b.hs	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldrsb	w1, [x20], #1
	add	x0, sp, #4
	bl	_luaL_addchar
	mov	x24, x20
	b	LBB0_1
LBB0_7:
	mov	x24, x20
LBB0_8:
	ldr	w8, [sp, #16]
	sub	w2, w8, w24
	add	x0, sp, #4
	mov	x1, x24
	bl	_luaL_addlstring
	add	x0, sp, #4
	bl	_luaL_pushresult
	mov	x0, x19
	mov	x1, x21
	bl	_lua_pushinteger
	mov	w0, #2
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"string/function/table expected"

	.no_dead_strip	_str_gsub
.subsections_via_symbols
