	.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, %r15
	leaq	-80(%rbp), %rdx
	movl	$1, %esi
	callq	_luaL_checklstring
	movq	%rax, %r13
	leaq	-56(%rbp), %rdx
	movq	%r15, %rdi
	movl	$2, %esi
	callq	_luaL_checklstring
	movq	%rax, %r14
	movq	%r15, %rdi
	movl	$3, %esi
	callq	_lua_type
	movl	%eax, %ebx
	movq	-80(%rbp), %rdx
	incq	%rdx
	movq	%r15, %rdi
	movl	$4, %esi
	callq	_luaL_optinteger
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movb	(%r14), %r12b
	movq	_LUA_TNUMBER@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	sete	%al
	movq	_LUA_TSTRING@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	sete	%cl
	orb	%al, %cl
	movq	_LUA_TFUNCTION@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	sete	%al
	movq	_LUA_TTABLE@GOTPCREL(%rip), %rdx
	movl	%ebx, -60(%rbp)                 ## 4-byte Spill
	cmpl	(%rdx), %ebx
	sete	%dl
	orb	%al, %dl
	orb	%cl, %dl
	movzbl	%dl, %esi
	leaq	L_.str(%rip), %rcx
	movq	%r15, %rdi
	movl	$3, %edx
	callq	_luaL_argcheck
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	callq	_luaL_buffinit
	movb	%r12b, -41(%rbp)                ## 1-byte Spill
	cmpb	$94, %r12b
	jne	LBB0_1
## %bb.2:
	incq	%r14
	movq	-56(%rbp), %r9
	decq	%r9
	movq	%r9, -56(%rbp)
	jmp	LBB0_3
LBB0_1:
	movq	-56(%rbp), %r9
LBB0_3:
	movq	-80(%rbp), %rcx
	leaq	-72(%rbp), %r12
	movq	%r12, %rdi
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	movq	%r15, %rsi
	movq	%r13, %rdx
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	%r14, %r8
	callq	_prepstate
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%r14
	movq	%r12, %rdi
	leaq	-48(%rbp), %rsi
	movq	%r13, %rdx
	movq	%rbx, %rcx
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	callq	_add_value
	movq	%rbx, %r15
	movq	%rbx, %r13
	cmpb	$94, -41(%rbp)                  ## 1-byte Folded Reload
	je	LBB0_11
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	-104(%rbp), %r14                ## 8-byte Folded Reload
	jge	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r12, %rdi
	callq	_reprepstate
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	callq	_match
	testq	%rax, %rax
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%rax, %rbx
	cmpq	%r15, %rax
	jne	LBB0_7
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	cmpq	-72(%rbp), %r13
	jae	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movsbl	(%r13), %esi
	incq	%r13
	leaq	-48(%rbp), %rdi
	callq	_luaL_addchar
	cmpb	$94, -41(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_4
LBB0_11:
	movl	-72(%rbp), %edx
	subl	%r13d, %edx
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_luaL_addlstring
	movq	%rbx, %rdi
	callq	_luaL_pushresult
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	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
	.comm	_LUA_TNUMBER,4,2                ## @LUA_TNUMBER
	.comm	_LUA_TSTRING,4,2                ## @LUA_TSTRING
	.comm	_LUA_TFUNCTION,4,2              ## @LUA_TFUNCTION
	.comm	_LUA_TTABLE,4,2                 ## @LUA_TTABLE
	.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	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	add	x2, sp, #24
	mov	w1, #1
	bl	_luaL_checklstring
	mov	x20, x0
	add	x2, sp, #16
	mov	x0, x19
	mov	w1, #2
	bl	_luaL_checklstring
	mov	x21, x0
	mov	x0, x19
	mov	w1, #3
	bl	_lua_type
	mov	x22, x0
	ldr	x8, [sp, #24]
	add	x2, x8, #1
	mov	x0, x19
	mov	w1, #4
	bl	_luaL_optinteger
	mov	x23, x0
Lloh0:
	adrp	x8, _LUA_TNUMBER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LUA_TNUMBER@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w22, w8
Lloh3:
	adrp	x8, _LUA_TSTRING@GOTPAGE
Lloh4:
	ldr	x8, [x8, _LUA_TSTRING@GOTPAGEOFF]
	ldrb	w26, [x21]
Lloh5:
	ldr	w8, [x8]
	ccmp	w22, w8, #4, ne
Lloh6:
	adrp	x8, _LUA_TFUNCTION@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LUA_TFUNCTION@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ccmp	w22, w8, #4, ne
Lloh9:
	adrp	x8, _LUA_TTABLE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _LUA_TTABLE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	ccmp	w22, w8, #4, ne
	cset	w1, eq
Lloh12:
	adrp	x3, l_.str@PAGE
Lloh13:
	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
	cmp	w26, #94
	b.ne	LBB0_2
; %bb.1:
	add	x21, x21, #1
	ldr	x8, [sp, #16]
	sub	x5, x8, #1
	str	x5, [sp, #16]
	b	LBB0_3
LBB0_2:
	ldr	x5, [sp, #16]
LBB0_3:
	ldr	x3, [sp, #24]
	add	x0, sp, #8
	mov	x1, x19
	mov	x2, x20
	mov	x4, x21
	bl	_prepstate
	mov	x27, #0
	mov	x24, #0
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x24, x24, #1
	add	x0, sp, #8
	add	x1, sp, #4
	mov	x2, x20
	mov	x3, x25
	mov	x4, x22
	bl	_add_value
	mov	x27, x25
	mov	x20, x25
	cmp	w26, #94
	b.eq	LBB0_10
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x24, x23
	b.ge	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x0, sp, #8
	bl	_reprepstate
	add	x0, sp, #8
	mov	x1, x20
	mov	x2, x21
	bl	_match
	cbz	x0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x25, x0
	cmp	x0, x27
	b.ne	LBB0_4
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [sp, #8]
	cmp	x20, x8
	b.hs	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	ldrsb	w1, [x20], #1
	add	x0, sp, #4
	bl	_luaL_addchar
	cmp	w26, #94
	b.ne	LBB0_5
LBB0_10:
	ldr	w8, [sp, #8]
	sub	w2, w8, w20
	add	x0, sp, #4
	mov	x1, x20
	bl	_luaL_addlstring
	add	x0, sp, #4
	bl	_luaL_pushresult
	mov	x0, x19
	mov	x1, x24
	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
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_LUA_TNUMBER,4,2                ; @LUA_TNUMBER
	.comm	_LUA_TSTRING,4,2                ; @LUA_TSTRING
	.comm	_LUA_TFUNCTION,4,2              ; @LUA_TFUNCTION
	.comm	_LUA_TTABLE,4,2                 ; @LUA_TTABLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"string/function/table expected"

	.no_dead_strip	_str_gsub
.subsections_via_symbols
