	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function get_avg_load
LCPI0_0:
	.quad	0x4059000000000000              ## double 100
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_get_avg_load:                          ## @get_avg_load
	.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	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	xorl	%edi, %edi
	testq	%r14, %r14
	setne	%dil
	callq	_assert
	movl	(%r14), %esi
	xorl	%ecx, %ecx
	cmpl	$2, %esi
	jl	LBB0_19
## %bb.1:
	movq	_MAX_CPU_SAMPLES@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	cmpl	(%rax), %esi
	jne	LBB0_2
## %bb.3:
	movl	4(%r14), %eax
	incl	%eax
	cltd
	idivl	%esi
	movslq	%edx, %r8
	jmp	LBB0_4
LBB0_2:
	xorl	%r8d, %r8d
LBB0_4:
	movq	_CPUSTATES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_19
## %bb.5:
	movq	16(%r14), %rdx
	movslq	4(%r14), %rcx
	movq	(%rdx,%rcx,8), %rcx
	movq	(%rdx,%r8,8), %rdi
	cmpq	$4, %rax
	jae	LBB0_8
## %bb.6:
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	LBB0_7
LBB0_8:
	movq	%rax, %rsi
	andq	$-4, %rsi
	leaq	-4(%rsi), %rdx
	movq	%rdx, %r9
	shrq	$2, %r9
	incq	%r9
	testq	%rdx, %rdx
	je	LBB0_9
## %bb.10:
	movq	%r9, %rbx
	andq	$-2, %rbx
	pxor	%xmm0, %xmm0
	xorl	%edx, %edx
	pxor	%xmm1, %xmm1
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movdqu	(%rcx,%rdx,8), %xmm2
	paddq	%xmm0, %xmm2
	movdqu	16(%rcx,%rdx,8), %xmm3
	paddq	%xmm1, %xmm3
	movdqu	32(%rcx,%rdx,8), %xmm0
	paddq	%xmm2, %xmm0
	movdqu	48(%rcx,%rdx,8), %xmm1
	paddq	%xmm3, %xmm1
	movdqu	(%rdi,%rdx,8), %xmm2
	movdqu	16(%rdi,%rdx,8), %xmm3
	movdqu	32(%rdi,%rdx,8), %xmm4
	paddq	%xmm2, %xmm4
	psubq	%xmm4, %xmm0
	movdqu	48(%rdi,%rdx,8), %xmm2
	paddq	%xmm3, %xmm2
	psubq	%xmm2, %xmm1
	addq	$8, %rdx
	addq	$-2, %rbx
	jne	LBB0_11
## %bb.12:
	testb	$1, %r9b
	je	LBB0_14
LBB0_13:
	movdqu	(%rcx,%rdx,8), %xmm2
	paddq	%xmm0, %xmm2
	movdqu	16(%rcx,%rdx,8), %xmm3
	paddq	%xmm1, %xmm3
	movdqu	(%rdi,%rdx,8), %xmm0
	psubq	%xmm0, %xmm2
	movdqu	16(%rdi,%rdx,8), %xmm0
	psubq	%xmm0, %xmm3
	movdqa	%xmm2, %xmm0
	movdqa	%xmm3, %xmm1
LBB0_14:
	paddq	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	jmp	LBB0_15
LBB0_9:
	pxor	%xmm0, %xmm0
	xorl	%edx, %edx
	pxor	%xmm1, %xmm1
	testb	$1, %r9b
	jne	LBB0_13
	jmp	LBB0_14
LBB0_7:
	addq	(%rcx,%rsi,8), %rdx
	subq	(%rdi,%rsi,8), %rdx
	incq	%rsi
LBB0_15:
	cmpq	%rsi, %rax
	jne	LBB0_7
## %bb.16:
	testq	%rdx, %rdx
	je	LBB0_17
## %bb.18:
	movq	16(%r14), %rcx
	movslq	4(%r14), %rsi
	movq	(%rcx,%rsi,8), %rsi
	movq	-8(%rsi,%rax,8), %rsi
	movq	(%rcx,%r8,8), %rcx
	subq	-8(%rcx,%rax,8), %rsi
	xorps	%xmm2, %xmm2
	cvtsi2sd	%rsi, %xmm2
	xorps	%xmm1, %xmm1
	cvtsi2sd	%rdx, %xmm1
	divsd	%xmm1, %xmm2
	movsd	LCPI0_0(%rip), %xmm0            ## xmm0 = mem[0],zero
	mulsd	%xmm0, %xmm2
	subsd	%xmm2, %xmm0
	movsd	%xmm0, -24(%rbp)                ## 8-byte Spill
	movl	8(%r14), %esi
	leaq	L_.str(%rip), %rdi
	callq	_HRDBG
	cvttsd2si	-24(%rbp), %ecx         ## 8-byte Folded Reload
	jmp	LBB0_19
LBB0_17:
	xorl	%ecx, %ecx
LBB0_19:
	movl	%ecx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_CPU_SAMPLES,4,2            ## @MAX_CPU_SAMPLES
	.comm	_CPUSTATES,8,3                  ## @CPUSTATES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CPU no. %d, delta ticks %ld, pct usage %.2f"

	.no_dead_strip	_get_avg_load
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function get_avg_load
_get_avg_load:                          ; @get_avg_load
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [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 b8, -40
	.cfi_offset b9, -48
	mov	x19, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
	ldr	w8, [x19]
	cmp	w8, #2
	b.lt	LBB0_14
; %bb.1:
Lloh0:
	adrp	x9, _MAX_CPU_SAMPLES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MAX_CPU_SAMPLES@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_3
; %bb.2:
	ldr	w9, [x19, #4]
	add	w9, w9, #1
	sdiv	w10, w9, w8
	msub	w8, w10, w8, w9
	sxtw	x8, w8
	b	LBB0_4
LBB0_3:
	mov	x8, #0
LBB0_4:
Lloh3:
	adrp	x9, _CPUSTATES@GOTPAGE
Lloh4:
	ldr	x9, [x9, _CPUSTATES@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cbz	x9, LBB0_14
; %bb.5:
	ldr	x11, [x19, #16]
	ldrsw	x10, [x19, #4]
	ldr	x10, [x11, x10, lsl #3]
	ldr	x11, [x11, x8, lsl #3]
	cmp	x9, #8
	b.hs	LBB0_7
; %bb.6:
	mov	x2, #0
	mov	x12, #0
	b	LBB0_10
LBB0_7:
	and	x12, x9, #0xfffffffffffffff8
	add	x13, x10, #32
	add	x14, x11, #32
	movi.2d	v0, #0000000000000000
	mov	x15, x12
	movi.2d	v1, #0000000000000000
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q4, q5, [x13, #-32]
	ldp	q6, q7, [x13], #64
	add.2d	v0, v4, v0
	add.2d	v1, v5, v1
	add.2d	v2, v6, v2
	add.2d	v3, v7, v3
	ldp	q4, q5, [x14, #-32]
	ldp	q6, q7, [x14], #64
	sub.2d	v0, v0, v4
	sub.2d	v1, v1, v5
	sub.2d	v2, v2, v6
	sub.2d	v3, v3, v7
	subs	x15, x15, #8
	b.ne	LBB0_8
; %bb.9:
	add.2d	v0, v1, v0
	add.2d	v0, v2, v0
	add.2d	v0, v3, v0
	addp.2d	d0, v0
	fmov	x2, d0
	cmp	x9, x12
	b.eq	LBB0_12
LBB0_10:
	sub	x13, x9, x12
	lsl	x12, x12, #3
	add	x11, x11, x12
	add	x10, x10, x12
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x10], #8
	ldr	x14, [x11], #8
	add	x12, x12, x2
	sub	x2, x12, x14
	subs	x13, x13, #1
	b.ne	LBB0_11
LBB0_12:
	cbz	x2, LBB0_14
; %bb.13:
	ldr	x10, [x19, #16]
	ldp	w11, w1, [x19, #4]
                                        ; kill: def $w11 killed $w11 def $x11
	sxtw	x11, w11
	ldr	x11, [x10, x11, lsl #3]
	lsl	x9, x9, #3
	sub	x9, x9, #8
	ldr	x11, [x11, x9]
	ldr	x8, [x10, x8, lsl #3]
	ldr	x8, [x8, x9]
	sub	x8, x11, x8
	scvtf	d0, x8
	scvtf	d1, x2
	fneg	d0, d0
	fdiv	d0, d0, d1
	mov	x8, #4636737291354636288
	fmov	d1, x8
	fmadd	d8, d0, d1, d1
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	fmov	d0, d8
	bl	_HRDBG
	fcvtzs	w0, d8
	b	LBB0_15
LBB0_14:
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #48               ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_CPU_SAMPLES,4,2            ; @MAX_CPU_SAMPLES
	.comm	_CPUSTATES,8,3                  ; @CPUSTATES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CPU no. %d, delta ticks %ld, pct usage %.2f"

	.no_dead_strip	_get_avg_load
.subsections_via_symbols
