	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_stream_file_read               ## -- Begin function stream_file_read
	.p2align	4, 0x90
_stream_file_read:                      ## @stream_file_read
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rdi, %rbx
	cmpl	$-1, %esi
	je	LBB0_1
## %bb.3:
	movl	%esi, %r12d
	movl	4(%rbx), %ecx
	movl	8(%rbx), %edx
	callq	_GET_PAGE
	movl	8(%rbx), %edx
	addl	%r12d, %edx
	movl	4(%rbx), %ecx
	callq	_GET_PAGE
	xorl	%edi, %edi
	movl	$1, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	movq	%rax, %r15
	movq	%rbx, %rdi
	movq	%rax, %rcx
	callq	_stream_file_read_pages
	addl	%r12d, 8(%rbx)
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%r12d, %edx
	jmp	LBB0_5
LBB0_1:
	movl	4(%rbx), %edi
	imull	(%rbx), %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	%rax, %r15
	movl	4(%rbx), %ecx
	movl	8(%rbx), %edx
	callq	_GET_PAGE
	movl	(%rbx), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movq	%r15, %rcx
	callq	_stream_file_read_pages
	movl	12(%rbx), %eax
	movl	%eax, 8(%rbx)
	movq	%r14, %rdi
	movq	%r15, %rsi
                                        ## implicit-def: $edx
LBB0_5:
	callq	_memcpy
	movq	%r15, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_free                           ## TAILCALL
LBB0_6:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_stream_file_read               ; -- Begin function stream_file_read
	.p2align	2
_stream_file_read:                      ; @stream_file_read
	.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	x19, x2
	mov	x20, x0
	cmn	w1, #1
	b.eq	LBB0_3
; %bb.1:
	mov	x22, x1
	ldp	w3, w2, [x20, #4]
	bl	_GET_PAGE
	ldp	w3, w8, [x20, #4]
	add	w2, w8, w22
	bl	_GET_PAGE
	mov	w0, #0
	mov	w1, #1
	bl	_calloc
	cbz	x0, LBB0_6
; %bb.2:
	mov	x21, x0
	mov	x0, x20
	mov	x3, x21
	bl	_stream_file_read_pages
	ldr	w8, [x20, #8]
	add	w8, w8, w22
	str	w8, [x20, #8]
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	b	LBB0_5
LBB0_3:
	ldp	w8, w9, [x20]
	mul	w0, w9, w8
	bl	_malloc
	cbz	x0, LBB0_6
; %bb.4:
	mov	x21, x0
	ldp	w3, w2, [x20, #4]
	bl	_GET_PAGE
	ldr	w2, [x20]
	mov	x0, x20
	mov	w1, #0
	mov	x3, x21
	bl	_stream_file_read_pages
	ldr	w8, [x20, #12]
	str	w8, [x20, #8]
	mov	x0, x19
	mov	x1, x21
                                        ; implicit-def: $w2
LBB0_5:
	bl	_memcpy
	mov	x0, x21
	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
	b	_free
LBB0_6:
	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
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
