	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2                               ## -- Begin function calc_hist
LCPI0_0:
	.long	0x3f800000                      ## float 1
LCPI0_1:
	.long	0x3f000000                      ## float 0.5
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_calc_hist:                             ## @calc_hist
	.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
	movl	%edx, %r14d
	movl	%esi, %r12d
	movq	%rdi, %r15
	leal	4(,%r14,4), %edi
	callq	_palloc
	testl	%r14d, %r14d
	js	LBB0_20
## %bb.1:
	leal	-1(%r12), %ecx
	cvtsi2ss	%ecx, %xmm1
	movss	LCPI0_0(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	divss	%xmm1, %xmm0
	movabsq	$-4294967296, %r9               ## imm = 0xFFFFFFFF00000000
	incl	%r14d
	movl	%r12d, %r8d
	negl	%r8d
	xorl	%r13d, %r13d
	xorps	%xmm1, %xmm1
	movss	LCPI0_1(%rip), %xmm2            ## xmm2 = mem[0],zero,zero,zero
	xorps	%xmm3, %xmm3
	xorl	%edi, %edi
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	movaps	%xmm3, %xmm5
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	movss	%xmm4, (%rax,%r13,4)
	incq	%r13
	movaps	%xmm5, %xmm3
	cmpq	%r14, %r13
	je	LBB0_20
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	cmpl	%r12d, %edi
	jge	LBB0_10
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%edi, %r10d
	movslq	%edi, %rcx
	movl	%r12d, %r11d
	subl	%edi, %r11d
	leaq	(%r15,%rcx,4), %rdi
	imulq	%r9, %rcx
	leaq	(%r8,%r10), %rdx
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movslq	(%rdi,%rbx,4), %rsi
	cmpq	%rsi, %r13
	jl	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	addq	%r9, %rcx
	incq	%rbx
	movl	%ebx, %esi
	addl	%edx, %esi
	jne	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r10, %rdi
	addq	%rbx, %rdi
	cmpl	%r12d, %r10d
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	decl	%r11d
	xorps	%xmm4, %xmm4
	cvtsi2ss	%r11d, %xmm4
	xorps	%xmm5, %xmm5
	ucomiss	%xmm1, %xmm3
	ja	LBB0_17
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	addq	%rbx, %r10
	testl	%ebx, %ebx
	je	LBB0_9
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r9, %rdx
	subq	%rcx, %rdx
	negq	%rcx
	sarq	$30, %rcx
	movl	(%r15,%rcx), %ecx
	sarq	$30, %rdx
	subl	(%r15,%rdx), %ecx
	xorps	%xmm5, %xmm5
	cvtsi2ss	%ecx, %xmm5
	decl	%ebx
	xorps	%xmm4, %xmm4
	cvtsi2ss	%ebx, %xmm4
	testl	%ecx, %ecx
	jle	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_2 Depth=1
	movaps	%xmm2, %xmm6
	divss	%xmm5, %xmm6
	addss	%xmm6, %xmm4
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r10d, %edi
	ucomiss	%xmm1, %xmm3
	jbe	LBB0_18
LBB0_17:                                ##   in Loop: Header=BB0_2 Depth=1
	movaps	%xmm2, %xmm6
	divss	%xmm3, %xmm6
	addss	%xmm6, %xmm4
LBB0_18:                                ##   in Loop: Header=BB0_2 Depth=1
	mulss	%xmm0, %xmm4
	jmp	LBB0_19
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r10d, %edi
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	xorps	%xmm4, %xmm4
	ucomiss	%xmm4, %xmm3
	jbe	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movaps	%xmm0, %xmm4
	divss	%xmm3, %xmm4
	jmp	LBB0_12
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_calc_hist
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_hist
_calc_hist:                             ; @calc_hist
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	lsl	w8, w2, #2
	add	w0, w8, #4
	bl	_palloc
	tbnz	w21, #31, LBB0_19
; %bb.1:
	mov	x8, #0
	mov	w12, #0
	sub	w9, w19, #1
	scvtf	s0, w9
	fmov	s1, #1.00000000
	fdiv	s0, s1, s0
	add	w9, w21, #1
	neg	w10, w19
	movi	d2, #0000000000000000
	mov	x11, #-4294967296
	fmov	s1, #0.50000000
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	fmov	s3, s2
	fdiv	s4, s0, s2
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	s4, [x0, x8, lsl #2]
	add	x8, x8, #1
	fmov	s2, s3
	cmp	x8, x9
	b.eq	LBB0_19
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	cmp	w12, w19
	b.ge	LBB0_17
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x13, #0
	mov	w16, w12
	sxtw	x14, w12
	sub	w15, w19, w12
	neg	x14, x14, lsl #32
	add	x17, x20, w12, sxtw #2
	add	x1, x10, w12, uxtw
LBB0_6:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrsw	x2, [x17, x13, lsl #2]
	cmp	x8, x2
	b.lt	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	add	x14, x14, x11
	add	x13, x13, #1
	cmn	w1, w13
	b.ne	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x12, x13, w12, uxtw
	cmp	w16, w19
	b.eq	LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	sub	w13, w15, #1
	scvtf	s4, w13
	movi	d3, #0000000000000000
	b	LBB0_13
LBB0_10:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x12, x13, w12, uxtw
	cbz	w13, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	neg	x15, x14
	asr	x15, x15, #30
	ldr	w15, [x20, x15]
	sub	x14, x11, x14
	asr	x14, x14, #30
	ldr	w14, [x20, x14]
	sub	w14, w15, w14
	scvtf	s3, w14
	sub	w13, w13, #1
	scvtf	s4, w13
	cmp	w14, #0
	b.le	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_4 Depth=1
	fdiv	s5, s1, s3
	fadd	s4, s5, s4
LBB0_13:                                ;   in Loop: Header=BB0_4 Depth=1
                                        ; kill: def $w12 killed $w12 killed $x12 def $x12
	fcmp	s2, #0.0
	b.le	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_4 Depth=1
	fdiv	s2, s1, s2
	fadd	s4, s2, s4
LBB0_15:                                ;   in Loop: Header=BB0_4 Depth=1
	fmul	s4, s0, s4
	b	LBB0_3
LBB0_16:                                ;   in Loop: Header=BB0_4 Depth=1
                                        ; kill: def $w12 killed $w12 killed $x12 def $x12
LBB0_17:                                ;   in Loop: Header=BB0_4 Depth=1
	movi	d4, #0000000000000000
	fcmp	s2, #0.0
	b.gt	LBB0_2
; %bb.18:                               ;   in Loop: Header=BB0_4 Depth=1
	fmov	s3, s2
	b	LBB0_3
LBB0_19:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_calc_hist
.subsections_via_symbols
