	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcm2835_rng_harvest
_bcm2835_rng_harvest:                   ## @bcm2835_rng_harvest
	.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	%rdi, %r13
	movq	(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$2, %r14d
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	_KTR_DEV@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	16(%r13), %edi
	callq	_device_get_nameunit
	movl	%ebx, %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	movl	%r12d, %ecx
	callq	_CTR2
	cmpl	%r14d, %r12d
	cmovgel	%r14d, %r12d
	movq	_RNG_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	movl	%r12d, %ecx
	callq	_bcm2835_rng_read_multi4
	movslq	%r12d, %rax
	leaq	(%rbx,%rax,4), %rbx
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	addl	-44(%rbp), %eax                 ## 4-byte Folded Reload
                                        ## kill: def $eax killed $eax killed $rax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r12d, %ebx
	movl	-48(%rbp), %eax                 ## 4-byte Reload
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	subl	%ebx, %r14d
	jle	LBB0_8
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	_RNG_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_bcm2835_rng_read4
	movl	%eax, %r12d
	movq	_RND_VAL_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	sarl	%cl, %r12d
	movq	_RND_VAL_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %r12d
	jne	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r13, %rdi
	callq	_bcm2835_rng_stat_inc_underrun
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	incl	%eax
	cmpl	8(%r13), %eax
	jl	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	testl	%r15d, %r15d
	jg	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	incl	%r15d
	movl	16(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_device_printf
	movq	%r13, %rdi
	callq	_bcm2835_rng_stop
	movq	%r13, %rdi
	callq	_bcm2835_rng_start
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_4:
	movl	16(%r13), %edi
	leaq	L_.str(%rip), %rsi
	callq	_device_printf
	movq	%r13, %rdi
	callq	_bcm2835_rng_stop
LBB0_8:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	shll	$2, %esi
	testl	%esi, %esi
	jle	LBB0_10
## %bb.9:
	movq	(%r13), %rdi
	movq	_RANDOM_PURE_BROADCOM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_random_harvest_queue
LBB0_10:
	leaq	12(%r13), %rdi
	movq	_RNG_CALLOUT_TICKS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	_bcm2835_rng_harvest(%rip), %rdx
	movq	%r13, %rcx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_callout_reset                  ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_RNG_STATUS,4,2                 ## @RNG_STATUS
	.comm	_RND_VAL_SHIFT,4,2              ## @RND_VAL_SHIFT
	.comm	_RND_VAL_MASK,4,2               ## @RND_VAL_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"RNG stalled, disabling device\n"

L_.str.1:                               ## @.str.1
	.asciz	"Too many underruns, resetting\n"

	.comm	_KTR_DEV,4,2                    ## @KTR_DEV
L_.str.2:                               ## @.str.2
	.asciz	"%s: %d words available in RNG FIFO"

	.comm	_RNG_DATA,4,2                   ## @RNG_DATA
	.comm	_RANDOM_PURE_BROADCOM,4,2       ## @RANDOM_PURE_BROADCOM
	.comm	_RNG_CALLOUT_TICKS,4,2          ## @RNG_CALLOUT_TICKS
	.no_dead_strip	_bcm2835_rng_harvest
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcm2835_rng_harvest
_bcm2835_rng_harvest:                   ; @bcm2835_rng_harvest
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x0
	mov	w26, #0
	mov	w28, #0
	mov	w23, #0
	mov	w25, #0
	ldr	x20, [x0]
	mov	w27, #2
Lloh0:
	adrp	x21, _RND_VAL_SHIFT@GOTPAGE
Lloh1:
	ldr	x21, [x21, _RND_VAL_SHIFT@GOTPAGEOFF]
Lloh2:
	adrp	x22, _RND_VAL_MASK@GOTPAGE
Lloh3:
	ldr	x22, [x22, _RND_VAL_MASK@GOTPAGEOFF]
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_3 Depth=1
Lloh4:
	adrp	x8, _KTR_DEV@GOTPAGE
Lloh5:
	ldr	x8, [x8, _KTR_DEV@GOTPAGEOFF]
Lloh6:
	ldr	w23, [x8]
	ldr	w0, [x19, #16]
	bl	_device_get_nameunit
	mov	x2, x0
	mov	x0, x23
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x3, x24
	bl	_CTR2
	cmp	w24, w27
	csel	w23, w24, w27, lt
Lloh9:
	adrp	x8, _RNG_DATA@GOTPAGE
Lloh10:
	ldr	x8, [x8, _RNG_DATA@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	mov	x3, x23
	bl	_bcm2835_rng_read_multi4
	add	x20, x20, w23, sxtw #2
	add	w25, w23, w25
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	sub	w27, w27, w23
	cmp	w27, #0
	b.le	LBB0_8
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
Lloh12:
	adrp	x8, _RNG_STATUS@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RNG_STATUS@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bcm2835_rng_read4
	ldr	w8, [x21]
	asr	w8, w0, w8
	ldr	w9, [x22]
	ands	w24, w8, w9
	b.ne	LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x19
	bl	_bcm2835_rng_stat_inc_underrun
	add	w28, w28, #1
	ldr	w8, [x19, #8]
	cmp	w28, w8
	b.lt	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w26, #1
	b.ge	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	add	w26, w26, #1
	ldr	w0, [x19, #16]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
	mov	x0, x19
	bl	_bcm2835_rng_stop
	mov	x0, x19
	bl	_bcm2835_rng_start
	mov	w28, #0
	b	LBB0_2
LBB0_7:
	ldr	w0, [x19, #16]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
	mov	x0, x19
	bl	_bcm2835_rng_stop
LBB0_8:
	lsl	w1, w25, #2
	cmp	w1, #1
	b.lt	LBB0_10
; %bb.9:
	ldr	x0, [x19]
Lloh19:
	adrp	x8, _RANDOM_PURE_BROADCOM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _RANDOM_PURE_BROADCOM@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	bl	_random_harvest_queue
LBB0_10:
	add	x0, x19, #12
Lloh22:
	adrp	x8, _RNG_CALLOUT_TICKS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _RNG_CALLOUT_TICKS@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	adrp	x2, _bcm2835_rng_harvest@PAGE
Lloh26:
	add	x2, x2, _bcm2835_rng_harvest@PAGEOFF
	mov	x3, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_callout_reset
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_RNG_STATUS,4,2                 ; @RNG_STATUS
	.comm	_RND_VAL_SHIFT,4,2              ; @RND_VAL_SHIFT
	.comm	_RND_VAL_MASK,4,2               ; @RND_VAL_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"RNG stalled, disabling device\n"

l_.str.1:                               ; @.str.1
	.asciz	"Too many underruns, resetting\n"

	.comm	_KTR_DEV,4,2                    ; @KTR_DEV
l_.str.2:                               ; @.str.2
	.asciz	"%s: %d words available in RNG FIFO"

	.comm	_RNG_DATA,4,2                   ; @RNG_DATA
	.comm	_RANDOM_PURE_BROADCOM,4,2       ; @RANDOM_PURE_BROADCOM
	.comm	_RNG_CALLOUT_TICKS,4,2          ; @RNG_CALLOUT_TICKS
	.no_dead_strip	_bcm2835_rng_harvest
.subsections_via_symbols
