	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bgzf_read                      ## -- Begin function bgzf_read
	.p2align	4, 0x90
_bgzf_read:                             ## @bgzf_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	%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
	testq	%rdx, %rdx
	jle	LBB0_1
## %bb.2:
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %r14
	xorl	%edi, %edi
	cmpb	$114, (%r14)
	sete	%dil
	callq	_assert
	movl	8(%r14), %eax
	xorl	%r13d, %r13d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rbx
	subq	%r13, %rbx
	movl	%ecx, %ecx
	cmpq	%rcx, %rbx
	cmovgeq	%rcx, %rbx
	movslq	%eax, %rsi
	shlq	$2, %rsi
	addq	32(%r14), %rsi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_memcpy
	movslq	%ebx, %rax
	addl	8(%r14), %ebx
	movl	%ebx, 8(%r14)
	leaq	(%r12,%rax,4), %r12
	addq	%rax, %r13
	movl	%ebx, %eax
	cmpq	%r15, %r13
	jge	LBB0_9
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%r14), %ecx
	subl	%eax, %ecx
	jg	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rdi
	callq	_bgzf_read_block
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	4(%r14), %ecx
	movl	8(%r14), %eax
	subl	%eax, %ecx
	jg	LBB0_8
## %bb.7:
	movl	%eax, %ebx
LBB0_9:
	cmpl	4(%r14), %ebx
	jne	LBB0_11
## %bb.10:
	movl	16(%r14), %edi
	callq	__bgzf_tell
	movl	%eax, 24(%r14)
	movq	$0, 4(%r14)
	jmp	LBB0_11
LBB0_1:
	xorl	%r13d, %r13d
	jmp	LBB0_11
LBB0_5:
	movq	$-1, %r13
LBB0_11:
	movq	%r13, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	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	_bgzf_read                      ; -- Begin function bgzf_read
	.p2align	2
_bgzf_read:                             ; @bgzf_read
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	cmp	x2, #1
	b.lt	LBB0_8
; %bb.1:
	mov	x21, x2
	mov	x22, x1
	mov	x20, x0
	ldrb	w8, [x0]
	cmp	w8, #114
	cset	w0, eq
	bl	_assert
	mov	x19, #0
	ldr	w8, [x20, #8]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	w9, w9
	sub	x10, x21, x19
	cmp	x10, x9
	csel	x23, x10, x9, lt
	ldr	x9, [x20, #32]
	add	x1, x9, w8, sxtw #2
	mov	x0, x22
	mov	x2, x23
	bl	_memcpy
	ldr	w8, [x20, #8]
	add	w8, w8, w23
	str	w8, [x20, #8]
	lsl	x9, x23, #32
	add	x22, x22, x9, asr #30
	add	x19, x19, w23, sxtw
	cmp	x19, x21
	b.ge	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x20, #4]
	sub	w9, w9, w8
	cmp	w9, #0
	b.gt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	bl	_bgzf_read_block
	cbnz	x0, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	w9, w8, [x20, #4]
	sub	w9, w9, w8
	cmp	w9, #1
	b.ge	LBB0_2
LBB0_6:
	ldr	w9, [x20, #4]
	cmp	w8, w9
	b.ne	LBB0_10
; %bb.7:
	ldr	w0, [x20, #16]
	bl	__bgzf_tell
	str	w0, [x20, #24]
	stp	wzr, wzr, [x20, #4]
	b	LBB0_10
LBB0_8:
	mov	x19, #0
	b	LBB0_10
LBB0_9:
	mov	x19, #-1
LBB0_10:
	mov	x0, x19
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
