	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function db_query
_db_query:                              ## @db_query
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	callq	_checkdb
	movq	%rax, %r15
	movq	%r12, %rdi
	movl	$-1, %esi
	callq	_luaL_checkstring
	movq	%rax, %rbx
	movq	$0, -40(%rbp)
	movq	%rax, %rdi
	callq	_strlen
	leaq	-40(%rbp), %rcx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_libretrodb_query_compile
	cmpq	$0, -40(%rbp)
	je	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	callq	_lua_pushnil
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_lua_pushstring
	jmp	LBB0_6
LBB0_2:
	movq	%rax, %r14
	movq	%r12, %rdi
	movl	$4, %esi
	callq	_lua_newuserdata
	movq	%r15, %rdi
	movq	%rax, %rsi
	movq	%r14, %rdx
	callq	_libretrodb_cursor_open
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	%eax, %r15d
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_lua_pop
	movq	%r12, %rdi
	callq	_lua_pushnil
	negl	%r15d
	movl	%r15d, %edi
	callq	_strerror
	movq	%r12, %rdi
	movq	%rax, %rsi
	callq	_lua_pushstring
	jmp	LBB0_5
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	callq	_luaL_getmetatable
	movq	%r12, %rdi
	movl	$-2, %esi
	callq	_lua_setmetatable
	movq	%r12, %rdi
	callq	_lua_pushnil
LBB0_5:
	movq	%r14, %rdi
	callq	_libretrodb_query_free
LBB0_6:
	movl	$2, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"RarchDB.Cursor"

	.no_dead_strip	_db_query
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function db_query
_db_query:                              ; @db_query
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	bl	_checkdb
	mov	x21, x0
	mov	x0, x19
	mov	w1, #-1
	bl	_luaL_checkstring
	mov	x20, x0
	str	xzr, [sp, #8]
	bl	_strlen
	mov	x2, x0
	add	x3, sp, #8
	mov	x0, x21
	mov	x1, x20
	bl	_libretrodb_query_compile
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_lua_pushnil
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_lua_pushstring
	b	LBB0_6
LBB0_2:
	mov	x20, x0
	mov	x0, x19
	mov	w1, #4
	bl	_lua_newuserdata
	mov	x1, x0
	mov	x0, x21
	mov	x2, x20
	bl	_libretrodb_cursor_open
	cbz	w0, LBB0_4
; %bb.3:
	mov	x21, x0
	mov	x0, x19
	mov	w1, #1
	bl	_lua_pop
	mov	x0, x19
	bl	_lua_pushnil
	neg	w0, w21
	bl	_strerror
	mov	x1, x0
	mov	x0, x19
	bl	_lua_pushstring
	b	LBB0_5
LBB0_4:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_luaL_getmetatable
	mov	x0, x19
	mov	w1, #-2
	bl	_lua_setmetatable
	mov	x0, x19
	bl	_lua_pushnil
LBB0_5:
	mov	x0, x20
	bl	_libretrodb_query_free
LBB0_6:
	mov	w0, #2
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"RarchDB.Cursor"

	.no_dead_strip	_db_query
.subsections_via_symbols
