	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stream_read
_stream_read:                           ## @stream_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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rdi, %r14
	movl	%ebx, -40(%rbp)
	callq	_stream_is_zipped
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	_backup_buff@GOTPCREL(%rip), %rax
	movl	$1, %edi
	cmpq	%r15, (%rax)
	je	LBB0_4
## %bb.2:
	movq	_io_buff@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_PREVSIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	addq	%rax, %rcx
	cmpq	%r15, %rcx
	je	LBB0_4
## %bb.3:
	xorl	%edi, %edi
	cmpq	%r15, %rax
	sete	%dil
LBB0_4:
	callq	_assert
	movq	_KFS_BINLOG_ZIP_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rbx, %rax
	cmovbeq	%rbx, %rax
	movl	%eax, -36(%rbp)
	movq	(%r14), %rsi
	movq	16(%r14), %rdi
	leaq	-36(%rbp), %rcx
	leaq	-40(%rbp), %r8
	movq	%r15, %rdx
	callq	_kfs_bz_decode
	testq	%rax, %rax
	js	LBB0_5
## %bb.6:
	movslq	-36(%rbp), %rcx
	cmpq	%rbx, %rcx
	jae	LBB0_10
## %bb.7:
	movq	(%r14), %rdx
	movq	16(%r14), %rax
	movq	8(%rax), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
                                        ## kill: def $ecx killed $ecx killed $rcx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_kprintf
	movl	$-1, %ebx
	jmp	LBB0_12
LBB0_8:
	movq	16(%r14), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_read
	movq	%rax, %r15
	movl	%ebx, %eax
	cmpq	%rbx, %r15
	je	LBB0_11
## %bb.9:
	movq	_stats@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	8(%r14), %rcx
	addq	%r15, (%rax,%rcx,8)
	movq	16(%r14), %rax
	movq	8(%rax), %rax
	movl	(%rax), %r12d
	movq	%r14, %rdi
	callq	_stream_tell
	leaq	L_.str.3(%rip), %rdi
	movl	%r12d, %esi
	movq	%rax, %rdx
	movq	%r15, %rcx
	movq	%rbx, %r8
	xorl	%eax, %eax
	callq	_kprintf
	movq	16(%r14), %rax
	movl	(%rax), %ebx
	movq	_SEEK_CUR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%ebx, %edi
	xorl	%esi, %esi
	callq	_lseek
	leaq	L_.str.4(%rip), %rsi
	movl	$2, %edi
	movl	%ebx, %edx
	movq	%rax, %rcx
	callq	_vkprintf
	movl	$-1, %ebx
	jmp	LBB0_12
LBB0_5:
	movq	(%r14), %rdx
	movq	16(%r14), %rax
	movq	8(%rax), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_kprintf
	movl	$-1, %ebx
	jmp	LBB0_12
LBB0_10:
	movl	-40(%rbp), %eax
LBB0_11:
	cltq
	movq	_stats@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	8(%r14), %rdx
	addq	%rax, (%rcx,%rdx,8)
	addq	%rbx, (%r14)
LBB0_12:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_backup_buff,8,3                ## @backup_buff
	.comm	_io_buff,8,3                    ## @io_buff
	.comm	_PREVSIZE,8,3                   ## @PREVSIZE
	.comm	_KFS_BINLOG_ZIP_CHUNK_SIZE,8,3  ## @KFS_BINLOG_ZIP_CHUNK_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kfs_bz_decode file '%s' from offset %lld failed.\n"

L_.str.1:                               ## @.str.1
	.asciz	"kfs_bz_decode file '%s' from offset %lld retuned %d bytes, expected %d bytes.\n"

	.comm	_stats,8,3                      ## @stats
L_.str.3:                               ## @.str.3
	.asciz	"read '%s' from offset %lld. Read %lld bytes of expected %lld.\n"

L_.str.4:                               ## @.str.4
	.asciz	"lseek (%d, 0, SEEK_CUR) = %lld\n"

	.comm	_SEEK_CUR,4,2                   ## @SEEK_CUR
	.no_dead_strip	_stream_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stream_read
_stream_read:                           ; @stream_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	str	w19, [sp, #28]
	bl	_stream_is_zipped
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _backup_buff@GOTPAGE
Lloh1:
	ldr	x8, [x8, _backup_buff@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x21
	b.eq	LBB0_5
; %bb.2:
Lloh3:
	adrp	x8, _io_buff@GOTPAGE
Lloh4:
	ldr	x8, [x8, _io_buff@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _PREVSIZE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _PREVSIZE@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	mov	w10, #1
	cmp	x8, x21
	cset	w11, eq
	add	x8, x8, x9
	cmp	x8, x21
	csel	w0, w10, w11, eq
	b	LBB0_6
LBB0_3:
	ldr	x8, [x20, #16]
	ldr	w0, [x8]
	mov	x1, x21
	mov	x2, x19
	bl	_read
	mov	x8, x19
	cmp	x0, x19
	b.eq	LBB0_12
; %bb.4:
	mov	x21, x0
Lloh9:
	adrp	x8, _stats@GOTPAGE
Lloh10:
	ldr	x8, [x8, _stats@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	ldp	x9, x10, [x20, #8]
	lsl	x9, x9, #3
	ldr	x11, [x8, x9]
	add	x11, x11, x0
	str	x11, [x8, x9]
	ldr	x8, [x10, #8]
	ldr	w22, [x8]
	mov	x0, x20
	bl	_stream_tell
	mov	x2, x0
	stp	x21, x19, [sp]
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x22
	bl	_kprintf
	ldr	x8, [x20, #16]
	ldr	w19, [x8]
Lloh14:
	adrp	x8, _SEEK_CUR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SEEK_CUR@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_lseek
	mov	x3, x0
Lloh17:
	adrp	x1, l_.str.4@PAGE
Lloh18:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #2
	mov	x2, x19
	bl	_vkprintf
	mov	w19, #-1
	b	LBB0_13
LBB0_5:
	mov	w0, #1
LBB0_6:
	bl	_assert
Lloh19:
	adrp	x8, _KFS_BINLOG_ZIP_CHUNK_SIZE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _KFS_BINLOG_ZIP_CHUNK_SIZE@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	cmp	x8, x19
	csel	x8, x8, x19, hi
	str	w8, [sp, #24]
	ldr	x0, [x20, #16]
	ldr	x1, [x20]
	add	x3, sp, #24
	add	x4, sp, #28
	mov	x2, x21
	bl	_kfs_bz_decode
	tbnz	x0, #63, LBB0_9
; %bb.7:
	ldrsw	x8, [sp, #24]
	cmp	x8, x19
	b.hs	LBB0_11
; %bb.8:
	ldr	x9, [x20, #16]
	ldr	x9, [x9, #8]
	ldr	w1, [x9]
	ldr	x2, [x20]
                                        ; kill: def $w19 killed $w19 killed $x19 def $x19
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	stp	x8, x19, [sp]
Lloh22:
	adrp	x0, l_.str.1@PAGE
Lloh23:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_10
LBB0_9:
	ldr	x8, [x20, #16]
	ldr	x8, [x8, #8]
	ldr	w1, [x8]
	ldr	x2, [x20]
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
LBB0_10:
	bl	_kprintf
	mov	w19, #-1
	b	LBB0_13
LBB0_11:
	ldr	w8, [sp, #28]
LBB0_12:
Lloh26:
	adrp	x9, _stats@GOTPAGE
Lloh27:
	ldr	x9, [x9, _stats@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	ldr	x10, [x20, #8]
	lsl	x10, x10, #3
	ldr	x11, [x9, x10]
	add	x8, x11, w8, sxtw
	str	x8, [x9, x10]
	ldr	x8, [x20]
	add	x8, x8, x19
	str	x8, [x20]
LBB0_13:
	mov	x0, x19
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_backup_buff,8,3                ; @backup_buff
	.comm	_io_buff,8,3                    ; @io_buff
	.comm	_PREVSIZE,8,3                   ; @PREVSIZE
	.comm	_KFS_BINLOG_ZIP_CHUNK_SIZE,8,3  ; @KFS_BINLOG_ZIP_CHUNK_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kfs_bz_decode file '%s' from offset %lld failed.\n"

l_.str.1:                               ; @.str.1
	.asciz	"kfs_bz_decode file '%s' from offset %lld retuned %d bytes, expected %d bytes.\n"

	.comm	_stats,8,3                      ; @stats
l_.str.3:                               ; @.str.3
	.asciz	"read '%s' from offset %lld. Read %lld bytes of expected %lld.\n"

l_.str.4:                               ; @.str.4
	.asciz	"lseek (%d, 0, SEEK_CUR) = %lld\n"

	.comm	_SEEK_CUR,4,2                   ; @SEEK_CUR
	.no_dead_strip	_stream_read
.subsections_via_symbols
