	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mrb_io_syswrite                ## -- Begin function mrb_io_syswrite
	.p2align	4, 0x90
_mrb_io_syswrite:                       ## @mrb_io_syswrite
	.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, %r14
	callq	_io_get_open_fptr
	movq	%rax, %r15
	cmpl	$0, 8(%rax)
	jne	LBB0_2
## %bb.1:
	movq	_E_IO_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	callq	_mrb_raise
LBB0_2:
	leaq	L_.str.1(%rip), %rsi
	leaq	-36(%rbp), %rdx
	movq	%r14, %rdi
	callq	_mrb_get_args
	movl	-36(%rbp), %edi
	callq	_mrb_type
	movq	_MRB_TT_STRING@GOTPCREL(%rip), %rcx
	movl	-36(%rbp), %r12d
	cmpq	(%rcx), %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rdx
	movq	%r14, %rdi
	movl	%r12d, %esi
	xorl	%ecx, %ecx
	callq	_mrb_funcall
	movl	%eax, %r12d
LBB0_4:
	movl	(%r15), %ebx
	cmpl	$-1, %ebx
	jne	LBB0_6
## %bb.5:
	movl	4(%r15), %ebx
LBB0_6:
	movl	%r12d, %edi
	callq	_RSTRING_PTR
	movl	%eax, %r15d
	movl	%r12d, %edi
	callq	_RSTRING_LEN
	movl	%ebx, %edi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_write
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_mrb_sys_fail
LBB0_8:
	movl	%ebx, %edi
	callq	_mrb_fixnum_value
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_E_IO_ERROR,4,2                 ## @E_IO_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"not opened for writing"

L_.str.1:                               ## @.str.1
	.asciz	"S"

	.comm	_MRB_TT_STRING,8,3              ## @MRB_TT_STRING
L_.str.2:                               ## @.str.2
	.asciz	"to_s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mrb_io_syswrite                ; -- Begin function mrb_io_syswrite
	.p2align	2
_mrb_io_syswrite:                       ; @mrb_io_syswrite
	.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	_io_get_open_fptr
	mov	x20, x0
	ldr	w8, [x0, #8]
	cbnz	w8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _E_IO_ERROR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _E_IO_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x2, l_.str@PAGE
Lloh4:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_mrb_raise
LBB0_2:
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x2, sp, #12
	mov	x0, x19
	bl	_mrb_get_args
	ldr	w0, [sp, #12]
	bl	_mrb_type
Lloh7:
	adrp	x8, _MRB_TT_STRING@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MRB_TT_STRING@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	ldr	w21, [sp, #12]
	cmp	x0, x8
	b.eq	LBB0_4
; %bb.3:
Lloh10:
	adrp	x2, l_.str.2@PAGE
Lloh11:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	x1, x21
	mov	w3, #0
	bl	_mrb_funcall
	mov	x21, x0
LBB0_4:
	ldr	w22, [x20]
	cmn	w22, #1
	b.ne	LBB0_6
; %bb.5:
	ldr	w22, [x20, #4]
LBB0_6:
	mov	x0, x21
	bl	_RSTRING_PTR
	mov	x20, x0
	mov	x0, x21
	bl	_RSTRING_LEN
	mov	x2, x0
	mov	x0, x22
	mov	x1, x20
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_write
	mov	x20, x0
	cmn	w0, #1
	b.ne	LBB0_8
; %bb.7:
	mov	x0, x19
	mov	w1, #0
	bl	_mrb_sys_fail
LBB0_8:
	mov	x0, x20
	bl	_mrb_fixnum_value
	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	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_E_IO_ERROR,4,2                 ; @E_IO_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"not opened for writing"

l_.str.1:                               ; @.str.1
	.asciz	"S"

	.comm	_MRB_TT_STRING,8,3              ; @MRB_TT_STRING
l_.str.2:                               ; @.str.2
	.asciz	"to_s"

.subsections_via_symbols
