	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function matchbalance
_matchbalance:                          ## @matchbalance
	.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
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movb	(%rdx), %r8b
	testb	%r8b, %r8b
	je	LBB0_2
## %bb.1:
	cmpb	$0, 1(%r14)
	je	LBB0_2
## %bb.3:
	cmpb	%r8b, (%rbx)
	je	LBB0_4
	jmp	LBB0_10
LBB0_2:
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_luaL_error
	movb	(%r14), %r8b
	cmpb	%r8b, (%rbx)
	jne	LBB0_10
LBB0_4:
	movq	(%r15), %rsi
	leaq	1(%rbx), %rax
	cmpq	%rsi, %rax
	jae	LBB0_10
## %bb.5:
	movb	1(%r14), %dl
	leaq	2(%rbx), %rax
	notq	%rbx
	addq	%rsi, %rbx
	movl	$1, %esi
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	xorl	%edi, %edi
	cmpb	%r8b, %cl
	sete	%dil
	addl	%edi, %esi
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	incq	%rax
	decq	%rbx
	je	LBB0_10
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movzbl	-1(%rax), %ecx
	cmpb	%dl, %cl
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	decl	%esi
	jne	LBB0_9
	jmp	LBB0_11
LBB0_10:
	xorl	%eax, %eax
LBB0_11:
	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	"unbalanced pattern"

	.no_dead_strip	_matchbalance
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function matchbalance
_matchbalance:                          ; @matchbalance
	.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, x2
	mov	x19, x1
	mov	x21, x0
	ldrb	w8, [x2]
	cbz	w8, LBB0_2
; %bb.1:
	ldrb	w9, [x20, #1]
	cbnz	w9, LBB0_3
LBB0_2:
	ldr	w0, [x21, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_luaL_error
	ldrb	w8, [x20]
LBB0_3:
	ldrb	w9, [x19]
	cmp	w9, w8
	b.ne	LBB0_10
; %bb.4:
	ldr	x10, [x21]
	add	x9, x19, #1
	cmp	x9, x10
	b.hs	LBB0_10
; %bb.5:
	ldrb	w9, [x20, #1]
	add	x0, x19, #2
	mvn	x11, x19
	add	x10, x11, x10
	mov	w11, #1
	b	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	cmp	w12, w8
	cinc	w11, w11, eq
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x0, x0, #1
	subs	x10, x10, #1
	b.eq	LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldurb	w12, [x0, #-1]
	cmp	w12, w9
	b.ne	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	subs	w11, w11, #1
	b.ne	LBB0_7
	b	LBB0_11
LBB0_10:
	mov	x0, #0
LBB0_11:
	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	"unbalanced pattern"

	.no_dead_strip	_matchbalance
.subsections_via_symbols
