	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mrb_io_sysread                 ## -- Begin function mrb_io_sysread
	.p2align	4, 0x90
_mrb_io_sysread:                        ## @mrb_io_sysread
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	xorl	%eax, %eax
	callq	_mrb_nil_value
	movl	%eax, -28(%rbp)
	leaq	L_.str(%rip), %rsi
	leaq	-40(%rbp), %rdx
	leaq	-28(%rbp), %rcx
	movq	%r15, %rdi
	callq	_mrb_get_args
	cmpq	$0, -40(%rbp)
	js	LBB0_1
## %bb.4:
	jne	LBB0_2
## %bb.5:
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_mrb_str_new
	jmp	LBB0_22
LBB0_1:
	movq	_E_ARGUMENT_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r15, %rdi
	callq	_mrb_raise
LBB0_2:
	movl	-28(%rbp), %edi
	callq	_mrb_nil_p
	testq	%rax, %rax
	je	LBB0_3
## %bb.6:
	movq	-40(%rbp), %rdx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_mrb_str_new
	movl	%eax, %edi
	movl	%eax, -28(%rbp)
	jmp	LBB0_7
LBB0_3:
	movl	-28(%rbp), %edi
LBB0_7:
	callq	_RSTRING_LEN
	cltq
	movq	-40(%rbp), %rdx
	movl	-28(%rbp), %esi
	cmpq	%rax, %rdx
	jne	LBB0_8
## %bb.9:
	movl	%esi, %edi
	callq	_RSTRING
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_mrb_str_modify
	jmp	LBB0_10
LBB0_8:
	movq	%r15, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_mrb_str_resize
	movl	%eax, -28(%rbp)
LBB0_10:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_io_get_open_fptr
	movq	%rax, %rbx
	cmpl	$0, 4(%rax)
	jne	LBB0_12
## %bb.11:
	movq	_E_IO_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	movq	%r15, %rdi
	callq	_mrb_raise
LBB0_12:
	movl	(%rbx), %ebx
	movl	-28(%rbp), %edi
	callq	_RSTRING_PTR
	movl	-40(%rbp), %edx
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_read
	cmpl	$-1, %eax
	je	LBB0_17
## %bb.13:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_18
## %bb.14:
	cmpq	$0, -40(%rbp)
	je	LBB0_15
## %bb.16:
	movq	_E_EOF_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.4(%rip), %rdx
	movq	%r15, %rdi
	callq	_mrb_raise
	jmp	LBB0_21
LBB0_17:
	leaq	L_.str.5(%rip), %rsi
	movq	%r15, %rdi
	callq	_mrb_sys_fail
	jmp	LBB0_21
LBB0_18:
	movl	-28(%rbp), %edi
	callq	_RSTRING_LEN
	cmpl	%ebx, %eax
	je	LBB0_21
## %bb.19:
	movl	-28(%rbp), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_mrb_str_resize
	jmp	LBB0_20
LBB0_15:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	callq	_mrb_str_new_cstr
LBB0_20:
	movl	%eax, -28(%rbp)
LBB0_21:
	movl	-28(%rbp), %eax
LBB0_22:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"i|S"

	.comm	_E_ARGUMENT_ERROR,4,2           ## @E_ARGUMENT_ERROR
L_.str.1:                               ## @.str.1
	.asciz	"negative expanding string size"

	.comm	_E_IO_ERROR,4,2                 ## @E_IO_ERROR
L_.str.2:                               ## @.str.2
	.asciz	"not opened for reading"

L_.str.3:                               ## @.str.3
	.space	1

	.comm	_E_EOF_ERROR,4,2                ## @E_EOF_ERROR
L_.str.4:                               ## @.str.4
	.asciz	"sysread failed: End of File"

L_.str.5:                               ## @.str.5
	.asciz	"sysread failed"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mrb_io_sysread                 ; -- Begin function mrb_io_sysread
	.p2align	2
_mrb_io_sysread:                        ; @mrb_io_sysread
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x20, x1
	mov	x19, x0
	bl	_mrb_nil_value
	str	w0, [sp, #12]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, sp
	add	x3, sp, #12
	mov	x0, x19
	bl	_mrb_get_args
	ldr	x8, [sp]
	tbnz	x8, #63, LBB0_3
; %bb.1:
	cbnz	x8, LBB0_4
; %bb.2:
	mov	x0, x19
	mov	x1, #0
	mov	x2, #0
	bl	_mrb_str_new
	b	LBB0_22
LBB0_3:
Lloh2:
	adrp	x8, _E_ARGUMENT_ERROR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _E_ARGUMENT_ERROR@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
Lloh5:
	adrp	x2, l_.str.1@PAGE
Lloh6:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_mrb_raise
LBB0_4:
	ldr	w0, [sp, #12]
	bl	_mrb_nil_p
	cbz	x0, LBB0_6
; %bb.5:
	ldr	x2, [sp]
	mov	x0, x19
	mov	x1, #0
	bl	_mrb_str_new
	str	w0, [sp, #12]
	b	LBB0_7
LBB0_6:
	ldr	w0, [sp, #12]
LBB0_7:
	bl	_RSTRING_LEN
	ldr	x2, [sp]
	ldr	w1, [sp, #12]
	cmp	x2, w0, sxtw
	b.ne	LBB0_9
; %bb.8:
	mov	x0, x1
	bl	_RSTRING
	mov	x1, x0
	mov	x0, x19
	bl	_mrb_str_modify
	b	LBB0_10
LBB0_9:
	mov	x0, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_mrb_str_resize
	str	w0, [sp, #12]
LBB0_10:
	mov	x0, x19
	mov	x1, x20
	bl	_io_get_open_fptr
	mov	x20, x0
	ldr	w8, [x0, #4]
	cbnz	w8, LBB0_12
; %bb.11:
Lloh7:
	adrp	x8, _E_IO_ERROR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _E_IO_ERROR@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
Lloh10:
	adrp	x2, l_.str.2@PAGE
Lloh11:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_mrb_raise
LBB0_12:
	ldr	w20, [x20]
	ldr	w0, [sp, #12]
	bl	_RSTRING_PTR
	mov	x1, x0
	ldr	w2, [sp]
	mov	x0, x20
	bl	_read
	cmn	w0, #1
	b.eq	LBB0_16
; %bb.13:
	mov	x20, x0
	cbnz	w0, LBB0_17
; %bb.14:
	ldr	x8, [sp]
	cbz	x8, LBB0_19
; %bb.15:
Lloh12:
	adrp	x8, _E_EOF_ERROR@GOTPAGE
Lloh13:
	ldr	x8, [x8, _E_EOF_ERROR@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x2, l_.str.4@PAGE
Lloh16:
	add	x2, x2, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_mrb_raise
	b	LBB0_21
LBB0_16:
Lloh17:
	adrp	x1, l_.str.5@PAGE
Lloh18:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	bl	_mrb_sys_fail
	b	LBB0_21
LBB0_17:
	ldr	w0, [sp, #12]
	bl	_RSTRING_LEN
	cmp	w0, w20
	b.eq	LBB0_21
; %bb.18:
	ldr	w1, [sp, #12]
	mov	x0, x19
	mov	x2, x20
	bl	_mrb_str_resize
	b	LBB0_20
LBB0_19:
Lloh19:
	adrp	x1, l_.str.3@PAGE
Lloh20:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_mrb_str_new_cstr
LBB0_20:
	str	w0, [sp, #12]
LBB0_21:
	ldr	w0, [sp, #12]
LBB0_22:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"i|S"

	.comm	_E_ARGUMENT_ERROR,4,2           ; @E_ARGUMENT_ERROR
l_.str.1:                               ; @.str.1
	.asciz	"negative expanding string size"

	.comm	_E_IO_ERROR,4,2                 ; @E_IO_ERROR
l_.str.2:                               ; @.str.2
	.asciz	"not opened for reading"

l_.str.3:                               ; @.str.3
	.space	1

	.comm	_E_EOF_ERROR,4,2                ; @E_EOF_ERROR
l_.str.4:                               ; @.str.4
	.asciz	"sysread failed: End of File"

l_.str.5:                               ; @.str.5
	.asciz	"sysread failed"

.subsections_via_symbols
