	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function cache_download_next_file
LCPI0_0:
	.quad	0xbff0000000000000              ## double -1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_cache_download_next_file:              ## @cache_download_next_file
	.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
	movq	_simulation_stats@GOTPCREL(%rip), %r14
	cmpl	$0, 12(%r14)
	je	LBB0_30
## %bb.1:
	movq	_next_download_file_time@GOTPCREL(%rip), %r12
	movq	(%r12), %rbx
	leaq	L_.str(%rip), %rsi
	movl	$3, %edi
	movq	%rbx, %rdx
	callq	_vkprintf
	movq	_uncached_ptr@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	_heap_uncached@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rcx,%rax,8), %rdi
	movl	%ebx, %esi
	callq	_cache_add
	movq	(%r15), %rax
	cmpq	%rax, (%r14)
	jae	LBB0_5
## %bb.4:
	movq	%rax, (%r14)
	jmp	LBB0_5
LBB0_2:
	xorl	%eax, %eax
LBB0_5:
	leaq	1(%rax), %rdx
	movq	%rdx, (%r15)
	movq	_heap_uncached_files@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rcx, %rdx
	jbe	LBB0_10
## %bb.6:
	testq	%rcx, %rcx
	je	LBB0_9
## %bb.7:
	movl	%ebx, %edi
	jmp	LBB0_8
LBB0_10:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	_heap_uncached@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	8(%rcx,%rax,8), %r15
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_cache_get_uri_size
	movq	%rax, %r12
	movq	_simulation_params@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_11
## %bb.12:
	movq	%r12, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rbx
	jmp	LBB0_13
LBB0_9:
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r12)
	jmp	LBB0_30
LBB0_11:
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	movl	%eax, %ebx
LBB0_13:
	cmpq	$1, %rdx
	sbbq	$-1, %rbx
	movq	_next_download_file_time@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	addq	%rbx, %rax
	movq	_INT_MAX@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setle	%dil
	callq	_assert
	addq	(%r14), %rbx
	movq	%rbx, (%r14)
	movq	_next_priority_lists_request_time@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jge	LBB0_30
## %bb.14:
	movq	8(%r13), %r13
	subq	%r12, %r13
	movq	%r13, %rdi
	shrq	$63, %rdi
	xorl	$1, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_assert
	movq	_cached_ptr@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%r15, %rdi
	callq	_cache_get_uri_heuristic
	movsd	%xmm0, -48(%rbp)                ## 8-byte Spill
	movq	_cached_bytes@GOTPCREL(%rip), %rcx
	movq	_heap_cached_files@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpq	%r13, (%rcx)
	setg	%cl
	jle	LBB0_21
## %bb.15:
	cmpl	%eax, %r14d
	jg	LBB0_21
## %bb.16:
	movslq	%r14d, %rbx
	movsd	-48(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	addsd	LCPI0_0(%rip), %xmm0
	movsd	%xmm0, -48(%rbp)                ## 8-byte Spill
	xorl	%r12d, %r12d
	movq	_heap_cached@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	callq	_cache_get_uri_heuristic
	ucomisd	-48(%rbp), %xmm0                ## 8-byte Folded Reload
	jae	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movl	$1, %esi
	callq	_cache_get_uri_size
	addq	%rax, %r12
	leaq	1(%rbx), %r14
	movq	_cached_bytes@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	subq	%r12, %rcx
	movq	_heap_cached_files@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpq	%r13, %rcx
	setg	%cl
	jle	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_17 Depth=1
	movslq	%eax, %rdx
	cmpq	%rdx, %rbx
	movq	%r14, %rbx
	jl	LBB0_17
LBB0_21:
	testb	%cl, %cl
	je	LBB0_23
## %bb.22:
	cmpl	%eax, %r14d
	jle	LBB0_23
## %bb.25:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
LBB0_8:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_resend_priority_lists_request  ## TAILCALL
LBB0_23:
	movq	_cached_ptr@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	cmpl	%r14d, %eax
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jge	LBB0_24
## %bb.26:
	movq	_heap_cached@GOTPCREL(%rip), %r12
	movq	_simulation_stats@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rcx
	leal	1(%rax), %edx
	movl	%edx, (%r13)
	cltq
	movq	(%rcx,%rax,8), %rdi
	movl	%ebx, %esi
	callq	_cache_remove
	movl	(%r13), %eax
	cmpl	%r14d, %eax
	jl	LBB0_27
	jmp	LBB0_28
LBB0_18:
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_next_download_file_time@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	jmp	LBB0_30
LBB0_24:
	movq	_simulation_stats@GOTPCREL(%rip), %r15
LBB0_28:
	decl	%eax
	cmpl	%eax, 8(%r15)
	jge	LBB0_30
## %bb.29:
	movl	%eax, 8(%r15)
LBB0_30:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_simulation_stats,16,3          ## @simulation_stats
	.comm	_next_download_file_time,8,3    ## @next_download_file_time
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"<%d> cache_download_next_file\n"

	.comm	_uncached_ptr,8,3               ## @uncached_ptr
	.comm	_heap_uncached,8,3              ## @heap_uncached
	.comm	_heap_uncached_files,8,3        ## @heap_uncached_files
	.comm	_INT_MAX,8,3                    ## @INT_MAX
	.comm	_simulation_params,16,3         ## @simulation_params
	.comm	_next_priority_lists_request_time,8,3 ## @next_priority_lists_request_time
	.comm	_cached_ptr,4,2                 ## @cached_ptr
	.comm	_cached_bytes,8,3               ## @cached_bytes
	.comm	_heap_cached_files,4,2          ## @heap_cached_files
	.comm	_heap_cached,8,3                ## @heap_cached
	.no_dead_strip	_cache_download_next_file
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cache_download_next_file
_cache_download_next_file:              ; @cache_download_next_file
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [sp, #-112]!            ; 16-byte Folded Spill
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	.cfi_offset b8, -104
	.cfi_offset b9, -112
Lloh0:
	adrp	x22, _simulation_stats@GOTPAGE
Lloh1:
	ldr	x22, [x22, _simulation_stats@GOTPAGEOFF]
	ldr	w8, [x22, #12]
	cbz	w8, LBB0_19
; %bb.1:
Lloh2:
	adrp	x23, _next_download_file_time@GOTPAGE
Lloh3:
	ldr	x23, [x23, _next_download_file_time@GOTPAGEOFF]
	ldr	x19, [x23]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #3
	mov	x2, x19
	bl	_vkprintf
Lloh6:
	adrp	x21, _uncached_ptr@GOTPAGE
Lloh7:
	ldr	x21, [x21, _uncached_ptr@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh8:
	adrp	x20, _heap_uncached@GOTPAGE
Lloh9:
	ldr	x20, [x20, _heap_uncached@GOTPAGEOFF]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	x9, [x20]
	ldr	x0, [x9, x8, lsl #3]
	mov	x1, x19
	bl	_cache_add
	ldr	x8, [x21]
	ldr	x9, [x22]
	cmp	x9, x8
	b.hs	LBB0_4
; %bb.3:
	str	x8, [x22]
LBB0_4:
	add	x8, x8, #1
	str	x8, [x21]
Lloh10:
	adrp	x9, _heap_uncached_files@GOTPAGE
Lloh11:
	ldr	x9, [x9, _heap_uncached_files@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ls	LBB0_7
; %bb.5:
	cbnz	x9, LBB0_20
LBB0_6:
Lloh13:
	adrp	x8, _INT_MAX@GOTPAGE
Lloh14:
	ldr	x8, [x8, _INT_MAX@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	str	x8, [x23]
	b	LBB0_19
LBB0_7:
	ldr	x9, [x20]
	ldr	x20, [x9, x8, lsl #3]
	mov	x0, x20
	mov	w1, #1
	bl	_cache_get_uri_size
	mov	x21, x0
Lloh16:
	adrp	x24, _simulation_params@GOTPAGE
Lloh17:
	ldr	x24, [x24, _simulation_params@GOTPAGEOFF]
	ldr	x8, [x24]
	sdiv	x9, x0, x8
	msub	x8, x9, x8, x0
	cmp	x8, #0
	cinc	x25, x9, ne
	ldr	x8, [x23]
Lloh18:
	adrp	x9, _INT_MAX@GOTPAGE
Lloh19:
	ldr	x9, [x9, _INT_MAX@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x8, x25, x8
	cmp	x8, x9
	cset	w0, le
	bl	_assert
	ldr	x8, [x23]
Lloh21:
	adrp	x9, _next_priority_lists_request_time@GOTPAGE
Lloh22:
	ldr	x9, [x9, _next_priority_lists_request_time@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	add	x8, x8, x25
	cmp	x8, x9
	str	x8, [x23]
	b.ge	LBB0_19
; %bb.8:
	ldr	x8, [x24, #8]
	sub	x25, x8, x21
	lsr	x8, x25, #63
	eor	w0, w8, #0x1
	bl	_assert
Lloh24:
	adrp	x21, _cached_ptr@GOTPAGE
Lloh25:
	ldr	x21, [x21, _cached_ptr@GOTPAGEOFF]
	ldr	w26, [x21]
	mov	x0, x20
	bl	_cache_get_uri_heuristic
Lloh26:
	adrp	x20, _cached_bytes@GOTPAGE
Lloh27:
	ldr	x20, [x20, _cached_bytes@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x8, x25
	cset	w8, gt
Lloh28:
	adrp	x27, _heap_cached_files@GOTPAGE
Lloh29:
	ldr	x27, [x27, _heap_cached_files@GOTPAGEOFF]
	ldr	w9, [x27]
	ccmp	w26, w9, #0, gt
	b.gt	LBB0_13
; %bb.9:
	mov	x28, #0
	sxtw	x26, w26
	fmov	d1, #-1.00000000
	fadd	d8, d0, d1
Lloh30:
	adrp	x24, _heap_cached@GOTPAGE
Lloh31:
	ldr	x24, [x24, _heap_cached@GOTPAGEOFF]
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x24]
	ldr	x0, [x8, x26, lsl #3]
	bl	_cache_get_uri_heuristic
	fcmp	d0, d8
	b.ge	LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x8, [x24]
	ldr	x0, [x8, x26, lsl #3]
	mov	w1, #1
	bl	_cache_get_uri_size
	add	x10, x26, #1
	ldr	x8, [x20]
	add	x28, x0, x28
	sub	x8, x8, x28
	cmp	x8, x25
	cset	w8, gt
	ldr	w9, [x27]
	sxtw	x11, w9
	ccmp	x26, x11, #0, gt
	mov	x26, x10
	b.lt	LBB0_10
; %bb.12:
	mov	x26, x10
LBB0_13:
	cmp	w8, #0
	ccmp	w26, w9, #4, ne
	b.gt	LBB0_20
; %bb.14:
	ldr	w8, [x21]
	cmp	w8, w26
	b.ge	LBB0_17
; %bb.15:
Lloh32:
	adrp	x20, _heap_cached@GOTPAGE
Lloh33:
	ldr	x20, [x20, _heap_cached@GOTPAGEOFF]
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x20]
	add	w10, w8, #1
	str	w10, [x21]
	ldr	x0, [x9, w8, sxtw #3]
	mov	x1, x19
	bl	_cache_remove
	ldr	w8, [x21]
	cmp	w8, w26
	b.lt	LBB0_16
LBB0_17:
	ldr	w9, [x22, #8]
	sub	w8, w8, #1
	cmp	w9, w8
	b.ge	LBB0_19
; %bb.18:
	str	w8, [x22, #8]
LBB0_19:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #112              ; 16-byte Folded Reload
	ret
LBB0_20:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #112              ; 16-byte Folded Reload
	b	_resend_priority_lists_request
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_simulation_stats,16,3          ; @simulation_stats
	.comm	_next_download_file_time,8,3    ; @next_download_file_time
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"<%d> cache_download_next_file\n"

	.comm	_uncached_ptr,8,3               ; @uncached_ptr
	.comm	_heap_uncached,8,3              ; @heap_uncached
	.comm	_heap_uncached_files,8,3        ; @heap_uncached_files
	.comm	_INT_MAX,8,3                    ; @INT_MAX
	.comm	_simulation_params,16,3         ; @simulation_params
	.comm	_next_priority_lists_request_time,8,3 ; @next_priority_lists_request_time
	.comm	_cached_ptr,4,2                 ; @cached_ptr
	.comm	_cached_bytes,8,3               ; @cached_bytes
	.comm	_heap_cached_files,4,2          ; @heap_cached_files
	.comm	_heap_cached,8,3                ; @heap_cached
	.no_dead_strip	_cache_download_next_file
.subsections_via_symbols
