	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function reservoir_get_next_S
LCPI0_0:
	.quad	0x4036000000000000              ## double 22
LCPI0_1:
	.quad	0x3ff0000000000000              ## double 1
LCPI0_2:
	.quad	0xbff0000000000000              ## double -1
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_reservoir_get_next_S
	.p2align	4, 0x90
_reservoir_get_next_S:                  ## @reservoir_get_next_S
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$128, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	cvtsi2sd	%esi, %xmm2
	movsd	LCPI0_0(%rip), %xmm1            ## xmm1 = mem[0],zero
	mulsd	%xmm2, %xmm1
	ucomisd	%xmm0, %xmm1
	movapd	%xmm0, -48(%rbp)                ## 16-byte Spill
	movsd	%xmm2, -56(%rbp)                ## 8-byte Spill
	jae	LBB0_1
## %bb.4:
	movl	%esi, %ebx
	movsd	(%r14), %xmm3                   ## xmm3 = mem[0],zero
	movapd	%xmm0, %xmm1
	subsd	%xmm2, %xmm1
	movsd	LCPI0_1(%rip), %xmm2            ## xmm2 = mem[0],zero
	movapd	%xmm1, -112(%rbp)               ## 16-byte Spill
	addsd	%xmm2, %xmm1
	addsd	%xmm2, %xmm0
	movapd	%xmm0, -128(%rbp)               ## 16-byte Spill
	movapd	%xmm1, -96(%rbp)                ## 16-byte Spill
	divsd	%xmm1, %xmm0
	movapd	%xmm0, -144(%rbp)               ## 16-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movsd	%xmm6, -80(%rbp)                ## 8-byte Spill
	movl	8(%r14), %edi
	callq	_sampler_random_fract
	callq	_log
	cltd
	idivl	%ebx
	negl	%eax
	movl	%eax, %edi
	callq	_exp
	movsd	%xmm0, -32(%rbp)                ## 8-byte Spill
	movsd	-80(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	callq	_log
	cltd
	idivl	%ebx
	movl	%eax, %edi
	callq	_exp
	movsd	-32(%rbp), %xmm4                ## 8-byte Reload
                                        ## xmm4 = mem[0],zero
	movsd	-24(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	divsd	-48(%rbp), %xmm1                ## 16-byte Folded Reload
	ucomisd	%xmm0, %xmm1
	movapd	%xmm4, %xmm3
	jae	LBB0_11
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	movsd	%xmm3, -24(%rbp)                ## 8-byte Spill
	movl	8(%r14), %edi
	callq	_sampler_random_fract
	movapd	%xmm0, %xmm3
	movsd	-24(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	addsd	LCPI0_2(%rip), %xmm0
	movsd	%xmm0, -24(%rbp)                ## 8-byte Spill
	movsd	-24(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	mulsd	-48(%rbp), %xmm0                ## 16-byte Folded Reload
	movsd	%xmm0, -24(%rbp)                ## 8-byte Spill
	movsd	-24(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	xorps	%xmm2, %xmm2
	roundsd	$9, %xmm0, %xmm2
	movapd	-144(%rbp), %xmm1               ## 16-byte Reload
	movapd	%xmm1, %xmm0
	movsd	%xmm3, -32(%rbp)                ## 8-byte Spill
	mulsd	%xmm3, %xmm0
	mulsd	%xmm1, %xmm0
	movapd	-96(%rbp), %xmm1                ## 16-byte Reload
	movsd	%xmm2, -64(%rbp)                ## 8-byte Spill
	addsd	%xmm2, %xmm1
	movapd	%xmm1, -80(%rbp)                ## 16-byte Spill
	mulsd	%xmm1, %xmm0
	movsd	-24(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	addsd	-48(%rbp), %xmm1                ## 16-byte Folded Reload
	movsd	%xmm1, -24(%rbp)                ## 8-byte Spill
	divsd	-24(%rbp), %xmm0                ## 8-byte Folded Reload
	callq	_log
	cltd
	idivl	%ebx
	movl	%eax, %edi
	callq	_exp
	movapd	-80(%rbp), %xmm7                ## 16-byte Reload
	movapd	-96(%rbp), %xmm2                ## 16-byte Reload
	movsd	-24(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	movapd	-48(%rbp), %xmm5                ## 16-byte Reload
	movapd	%xmm1, %xmm4
	divsd	%xmm7, %xmm4
	mulsd	%xmm2, %xmm4
	divsd	%xmm5, %xmm4
	ucomisd	%xmm0, %xmm4
	jae	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movapd	-128(%rbp), %xmm8               ## 16-byte Reload
	movsd	-32(%rbp), %xmm3                ## 8-byte Reload
                                        ## xmm3 = mem[0],zero
	mulsd	%xmm8, %xmm3
	divsd	%xmm2, %xmm3
	movsd	-64(%rbp), %xmm4                ## 8-byte Reload
                                        ## xmm4 = mem[0],zero
	movapd	%xmm4, %xmm0
	addsd	%xmm5, %xmm0
	movapd	%xmm0, %xmm6
	addsd	LCPI0_1(%rip), %xmm6
	mulsd	%xmm3, %xmm6
	divsd	%xmm1, %xmm6
	movsd	-56(%rbp), %xmm1                ## 8-byte Reload
                                        ## xmm1 = mem[0],zero
	cmpltsd	%xmm4, %xmm1
	andpd	%xmm1, %xmm7
	movapd	%xmm1, %xmm2
	andnpd	%xmm8, %xmm2
	orpd	%xmm7, %xmm2
	ucomisd	%xmm2, %xmm0
	jb	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movapd	-112(%rbp), %xmm3               ## 16-byte Reload
	addsd	%xmm4, %xmm3
	movapd	%xmm1, %xmm4
	andnpd	%xmm3, %xmm4
	andpd	%xmm5, %xmm1
	orpd	%xmm4, %xmm1
	movsd	LCPI0_2(%rip), %xmm4            ## xmm4 = mem[0],zero
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movapd	%xmm0, %xmm3
	divsd	%xmm1, %xmm3
	mulsd	%xmm3, %xmm6
	addsd	%xmm4, %xmm1
	addsd	%xmm4, %xmm0
	ucomisd	%xmm2, %xmm0
	jae	LBB0_9
	jmp	LBB0_10
LBB0_1:
	movl	8(%r14), %edi
	callq	_sampler_random_fract
	movsd	-56(%rbp), %xmm5                ## 8-byte Reload
                                        ## xmm5 = mem[0],zero
	movapd	-48(%rbp), %xmm4                ## 16-byte Reload
	addsd	LCPI0_1(%rip), %xmm4
	movapd	%xmm4, %xmm1
	subsd	%xmm5, %xmm1
	divsd	%xmm4, %xmm1
	xorpd	%xmm6, %xmm6
	ucomisd	%xmm0, %xmm1
	jbe	LBB0_12
## %bb.2:
	xorpd	%xmm6, %xmm6
	movsd	LCPI0_1(%rip), %xmm2            ## xmm2 = mem[0],zero
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	addsd	%xmm2, %xmm6
	addsd	%xmm2, %xmm4
	movapd	%xmm4, %xmm3
	subsd	%xmm5, %xmm3
	divsd	%xmm4, %xmm3
	mulsd	%xmm3, %xmm1
	ucomisd	%xmm0, %xmm1
	ja	LBB0_3
	jmp	LBB0_12
LBB0_6:
	divsd	%xmm0, %xmm4
LBB0_11:
	movsd	%xmm4, (%r14)
	movsd	-64(%rbp), %xmm6                ## 8-byte Reload
                                        ## xmm6 = mem[0],zero
LBB0_12:
	movapd	%xmm6, %xmm0
	addq	$128, %rsp
	popq	%rbx
	popq	%r14
	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	_reservoir_get_next_S           ; -- Begin function reservoir_get_next_S
	.p2align	2
_reservoir_get_next_S:                  ; @reservoir_get_next_S
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	d15, d14, [sp, #32]             ; 16-byte Folded Spill
	stp	d13, d12, [sp, #48]             ; 16-byte Folded Spill
	stp	d11, d10, [sp, #64]             ; 16-byte Folded Spill
	stp	d9, d8, [sp, #80]               ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset b8, -40
	.cfi_offset b9, -48
	.cfi_offset b10, -56
	.cfi_offset b11, -64
	.cfi_offset b12, -72
	.cfi_offset b13, -80
	.cfi_offset b14, -88
	.cfi_offset b15, -96
	fmov	d8, d0
	mov	x19, x0
	scvtf	d1, w1
	fmov	d0, #22.00000000
	fmul	d0, d1, d0
	fcmp	d0, d8
	str	d1, [sp, #24]                   ; 8-byte Folded Spill
	b.ge	LBB0_7
; %bb.1:
	mov	x20, x1
	ldr	d11, [x19]
	fsub	d0, d8, d1
	fmov	d1, #1.00000000
	str	d0, [sp, #8]                    ; 8-byte Folded Spill
	fadd	d15, d0, d1
	fadd	d0, d8, d1
	str	d0, [sp, #16]                   ; 8-byte Folded Spill
	fdiv	d13, d0, d15
	fmov	d14, #-1.00000000
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19, #8]
	bl	_sampler_random_fract
	bl	_log
	sdiv	w8, w0, w20
	neg	w0, w8
	bl	_exp
	fmov	d11, d0
	fmov	d0, d10
	bl	_log
	sdiv	w0, w0, w20
	bl	_exp
	fdiv	d1, d12, d8
	fcmp	d0, d1
	b.ls	LBB0_11
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	ldr	w0, [x19, #8]
	bl	_sampler_random_fract
	fmov	d10, d0
	fadd	d0, d11, d14
	fmul	d0, d0, d8
	frintm	d9, d0
	fmul	d1, d13, d10
	fmul	d1, d13, d1
	fadd	d11, d15, d9
	fmul	d1, d1, d11
	fadd	d12, d0, d8
	fdiv	d0, d1, d12
	bl	_log
	sdiv	w0, w0, w20
	bl	_exp
	fdiv	d1, d12, d11
	fmul	d1, d15, d1
	fdiv	d1, d1, d8
	fcmp	d0, d1
	b.ls	LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	d4, d3, [sp, #16]               ; 16-byte Folded Reload
	fmul	d0, d4, d10
	fdiv	d1, d0, d15
	fadd	d0, d9, d8
	fmov	d2, #1.00000000
	fadd	d2, d0, d2
	fmul	d1, d1, d2
	fdiv	d10, d1, d12
	fcmp	d9, d3
	fcsel	d1, d11, d4, gt
	fcmp	d0, d1
	b.lt	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	d2, [sp, #8]                    ; 8-byte Folded Reload
	fadd	d2, d2, d9
	fcmp	d9, d3
	fcsel	d2, d8, d2, gt
LBB0_6:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	fdiv	d3, d0, d2
	fmul	d10, d10, d3
	fadd	d2, d2, d14
	fadd	d0, d0, d14
	fcmp	d0, d1
	b.ge	LBB0_6
	b	LBB0_2
LBB0_7:
	ldr	w0, [x19, #8]
	bl	_sampler_random_fract
	ldr	d5, [sp, #24]                   ; 8-byte Folded Reload
	fmov	d1, #1.00000000
	fadd	d2, d8, d1
	fsub	d3, d2, d5
	fdiv	d3, d3, d2
	movi	d9, #0000000000000000
	fcmp	d3, d0
	b.le	LBB0_12
; %bb.8:
	movi	d9, #0000000000000000
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	fadd	d9, d9, d1
	fadd	d2, d2, d1
	fsub	d4, d2, d5
	fdiv	d4, d4, d2
	fmul	d3, d3, d4
	fcmp	d3, d0
	b.gt	LBB0_9
	b	LBB0_12
LBB0_10:
	fdiv	d11, d1, d0
LBB0_11:
	str	d11, [x19]
LBB0_12:
	fmov	d0, d9
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #80]               ; 16-byte Folded Reload
	ldp	d11, d10, [sp, #64]             ; 16-byte Folded Reload
	ldp	d13, d12, [sp, #48]             ; 16-byte Folded Reload
	ldp	d15, d14, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
