	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bgzf_write                     ## -- Begin function bgzf_write
	.p2align	4, 0x90
_bgzf_write:                            ## @bgzf_write
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, %r12
	movq	%rdi, %r15
	movq	_BGZF_BLOCK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	xorl	%edi, %edi
	cmpb	$119, (%r15)
	sete	%dil
	callq	_assert
	testl	%ebx, %ebx
	jle	LBB0_1
## %bb.2:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	cmpl	%r15d, %r13d
	movl	%r15d, %ebx
	jge	LBB0_7
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r13d, -48(%rbp)                ## 4-byte Spill
	movslq	4(%r14), %rdi
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	subl	%edi, %eax
	movl	%ebx, %r15d
	subl	%r13d, %ebx
	cmpl	%ebx, %eax
	cmovll	%eax, %ebx
	shlq	$2, %rdi
	addq	8(%r14), %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	movslq	%ebx, %r13
	addl	4(%r14), %ebx
	movl	%ebx, 4(%r14)
	leaq	(%r12,%r13,4), %r12
	addl	-48(%rbp), %r13d                ## 4-byte Folded Reload
	cmpl	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rdi
	callq	_bgzf_flush
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%r15d, %ebx
	cmpl	%r15d, %r13d
	jl	LBB0_3
	jmp	LBB0_7
LBB0_1:
	xorl	%r13d, %r13d
LBB0_7:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BGZF_BLOCK_SIZE,4,2            ## @BGZF_BLOCK_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bgzf_write                     ; -- Begin function bgzf_write
	.p2align	2
_bgzf_write:                            ; @bgzf_write
	.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
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _BGZF_BLOCK_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BGZF_BLOCK_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	ldrb	w8, [x0]
	cmp	w8, #119
	cset	w0, eq
	bl	_assert
	cmp	w19, #1
	b.lt	LBB0_5
; %bb.1:
	mov	w22, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w22, w19
	b.ge	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21, #8]
	ldrsw	x9, [x21, #4]
	sub	w10, w24, w9
	sub	w11, w19, w22
	cmp	w10, w11
	csel	w23, w10, w11, lt
	add	x0, x8, x9, lsl #2
	mov	x1, x20
	mov	x2, x23
	bl	_memcpy
	ldr	w8, [x21, #4]
	add	w8, w8, w23
	cmp	w8, w24
	str	w8, [x21, #4]
	add	x20, x20, w23, sxtw #2
	add	w22, w23, w22
	b.ne	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	bl	_bgzf_flush
	cbz	x0, LBB0_2
	b	LBB0_6
LBB0_5:
	mov	w22, #0
LBB0_6:
	mov	x0, x22
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_BGZF_BLOCK_SIZE,4,2            ; @BGZF_BLOCK_SIZE
.subsections_via_symbols
