	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lua_writefile
_lua_writefile:                         ## @lua_writefile
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	$0, -48(%rbp)
	callq	_lua_gettop
	cmpl	$1, %eax
	jle	LBB0_12
## %bb.1:
	movl	%eax, %r12d
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_lua_touserdata
	testq	%rax, %rax
	je	LBB0_12
## %bb.2:
	movq	%rax, %r15
	cmpq	$0, (%rax)
	je	LBB0_12
## %bb.3:
	negl	%r12d
	movl	$2, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_lua_isstring
	testl	%eax, %eax
	je	LBB0_12
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	leal	(%r12,%rbx), %eax
	incl	%eax
	movl	%ebx, %ecx
	incl	%ecx
	movl	%ecx, %ebx
	cmpl	$1, %eax
	jne	LBB0_4
## %bb.6:
	movl	$2, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	leaq	-48(%rbp), %rdx
	callq	_lua_tolstring
	movq	-48(%rbp), %rdx
	movq	(%r15), %rcx
	movq	%rax, %rdi
	movl	$1, %esi
	callq	_fwrite
	cmpq	-48(%rbp), %rax
	jb	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	addq	%rax, %r13
	leal	(%r12,%rbx), %eax
	incl	%eax
	movl	%ebx, %ecx
	incl	%ecx
	movl	%ecx, %ebx
	cmpl	$1, %eax
	jne	LBB0_7
## %bb.10:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_lua_pushinteger
	movl	$1, %eax
	jmp	LBB0_11
LBB0_12:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	%r14, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_luaL_fileresult                ## TAILCALL
LBB0_8:
	movq	%r14, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_luaL_fileresult
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.no_dead_strip	_lua_writefile
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lua_writefile
_lua_writefile:                         ; @lua_writefile
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x0
	str	xzr, [sp, #8]
	bl	_lua_gettop
	cmp	w0, #1
	b.le	LBB0_10
; %bb.1:
	mov	x20, x0
	mov	x0, x19
	mov	w1, #1
	bl	_lua_touserdata
	cbz	x0, LBB0_10
; %bb.2:
	mov	x21, x0
	ldr	x8, [x0]
	cbz	x8, LBB0_10
; %bb.3:
	mov	w22, #1
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	w22, w22, #1
	mov	x0, x19
	mov	x1, x22
	bl	_lua_isstring
	cbz	w0, LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w20, w22
	b.ne	LBB0_4
; %bb.6:
	mov	x22, #0
	mov	w23, #1
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	w23, w23, #1
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x23
	bl	_lua_tolstring
	ldr	x2, [sp, #8]
	ldr	x3, [x21]
	mov	w1, #1
	bl	_fwrite
	ldr	x8, [sp, #8]
	cmp	x0, x8
	b.lo	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x22, x0, x22
	cmp	w20, w23
	b.ne	LBB0_7
; %bb.9:
	mov	x0, x19
	mov	x1, x22
	bl	_lua_pushinteger
	mov	w0, #1
	b	LBB0_12
LBB0_10:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _errno@GOTPAGE
Lloh4:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh5:
	str	w8, [x9]
	mov	x0, x19
	mov	w1, #0
	mov	x2, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_luaL_fileresult
LBB0_11:
	mov	x0, x19
	mov	w1, #0
	mov	x2, #0
	bl	_luaL_fileresult
LBB0_12:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotStr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.no_dead_strip	_lua_writefile
.subsections_via_symbols
