	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function build_tree
_build_tree:                            ## @build_tree
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	8(%rsi), %rcx
	movq	16(%rsi), %r12
	movq	8(%rcx), %r9
	movl	(%rcx), %r14d
	movq	$0, (%rdi)
	movq	_HEAP_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, 8(%rdi)
	xorl	%r8d, %r8d
	testl	%r14d, %r14d
	jle	LBB0_1
## %bb.14:
	leaq	(,%r14,8), %r10
	movl	$-1, %r11d
	xorl	%ecx, %ecx
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%rbx,%rbx,2), %rax
	leaq	(%r12,%rax,8), %rax
	addq	$16, %rax
LBB0_18:                                ##   in Loop: Header=BB0_15 Depth=1
	movq	$0, (%rax)
	incq	%rbx
	addq	$8, %rcx
	addq	$24, %rdi
	cmpq	%rcx, %r10
	je	LBB0_2
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$0, (%rdi)
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	(%r15), %rax
	movq	16(%r15), %r11
	leaq	1(%rax), %rdx
	movq	%rdx, (%r15)
	movl	%ebx, 4(%r11,%rax,4)
	movq	24(%r15), %rax
	addq	%rcx, %rax
	movl	%ebx, %r11d
	jmp	LBB0_18
LBB0_2:
	movq	(%r15), %rdx
	cmpq	$1, %rdx
	jbe	LBB0_3
LBB0_7:
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%r11, -56(%rbp)                 ## 8-byte Spill
	movl	%r11d, (%rsi)
	shrq	%rdx
	testl	%edx, %edx
	jle	LBB0_11
## %bb.8:
	movl	%edx, %ebx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	callq	_pqdownheap
	leaq	-1(%rbx), %rax
	cmpq	$1, %rbx
	movq	%rax, %rbx
	ja	LBB0_9
## %bb.10:
	xorl	%edx, %edx
LBB0_11:
	movslq	%edx, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rax,2), %rax
	leaq	(%r12,%rax,8), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movslq	%r14d, %r14
	leaq	(%r14,%r14,2), %rax
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	leaq	(%r12,%rax,8), %r12
	movq	%r14, %rbx
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	_pqremove
	movq	8(%r15), %rax
	movq	16(%r15), %rcx
	movq	_SMALLEST@GOTPCREL(%rip), %r9
	movq	(%r9), %rdx
	movslq	(%rcx,%rdx,4), %rdx
	movl	%r13d, -4(%rcx,%rax,4)
	leaq	-2(%rax), %rsi
	movq	%rsi, 8(%r15)
	movl	%edx, -8(%rcx,%rax,4)
	leaq	(%rdx,%rdx,2), %r8
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax,%r8,8), %esi
	movq	-72(%rbp), %r10                 ## 8-byte Reload
	addl	(%r10), %esi
	movl	%esi, (%r12)
	movq	24(%r15), %rsi
	movq	(%rsi,%r13,8), %rdi
	movq	(%rsi,%rdx,8), %rdx
	cmpq	%rdx, %rdi
	cmovgq	%rdi, %rdx
	incq	%rdx
	movq	%rdx, (%rsi,%r14,8)
	movq	%r14, 8(%rax,%r8,8)
	movq	%rax, %rsi
	movq	%r14, 8(%r10)
	incq	%rbx
	movq	(%r9), %rdx
	movl	%r14d, (%rcx,%rdx,4)
	movq	%r15, %rdi
	callq	_pqdownheap
	addq	$24, %r12
	cmpq	$1, (%r15)
	movq	%rbx, %r14
	ja	LBB0_12
## %bb.13:
	movq	8(%r15), %rax
	movq	16(%r15), %rcx
	movq	_SMALLEST@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	(%rcx,%rdx,4), %edx
	leaq	-1(%rax), %rsi
	movq	%rsi, 8(%r15)
	movl	%edx, -4(%rcx,%rax,4)
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_gen_bitlen
	movl	32(%r15), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_gen_codes                      ## TAILCALL
LBB0_1:
	movl	$-1, %r11d
	xorl	%edx, %edx
LBB0_3:
	movq	16(%r15), %rbx
	movq	24(%r15), %rdi
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	(%r15), %rdx
	cmpq	$2, %rdx
	jae	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%r11), %eax
	cmpl	$2, %r11d
	cmovll	%eax, %r11d
	cmovgel	%r8d, %eax
	leaq	1(%rdx), %rcx
	movq	%rcx, (%r15)
	movl	%eax, 4(%rbx,%rdx,4)
	cltq
	leaq	(%rax,%rax,2), %rcx
	movl	$1, (%r12,%rcx,8)
	movq	$0, (%rdi,%rax,8)
	decl	52(%r15)
	testq	%r9, %r9
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	16(%r9,%rcx,8), %eax
	subl	%eax, 48(%r15)
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_HEAP_SIZE,8,3                  ## @HEAP_SIZE
	.comm	_SMALLEST,8,3                   ## @SMALLEST
	.comm	_stderr,4,2                     ## @stderr
	.no_dead_strip	_build_tree
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function build_tree
_build_tree:                            ; @build_tree
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.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
	mov	x20, x0
	ldp	x9, x19, [x1, #8]
	ldr	x8, [x9, #8]
	ldr	w24, [x9]
	str	xzr, [x0]
Lloh0:
	adrp	x9, _HEAP_SIZE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HEAP_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	str	x9, [x0, #8]
	cmp	w24, #1
	b.lt	LBB0_14
; %bb.1:
	mov	x9, #0
	mov	x10, #0
	lsl	x11, x24, #3
	mov	w16, #-1
	mov	w12, #24
	mov	x13, x19
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	madd	x14, x10, x12, x19
	add	x14, x14, #16
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x14]
	add	x10, x10, #1
	add	x9, x9, #8
	add	x13, x13, #24
	cmp	x11, x9
	b.eq	LBB0_6
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w14, [x13]
	cbz	w14, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x14, [x20]
	add	x14, x14, #1
	str	x14, [x20]
	ldp	x15, x16, [x20, #16]
	str	w10, [x15, x14, lsl #2]
	add	x14, x16, x9
	mov	x16, x10
	b	LBB0_3
LBB0_6:
	ldr	x9, [x20]
	cmp	x9, #1
	b.ls	LBB0_15
LBB0_7:
	str	x1, [sp, #8]                    ; 8-byte Folded Spill
	str	w16, [sp, #4]                   ; 4-byte Folded Spill
	str	w16, [x1]
	lsr	x23, x9, #1
	cmp	w23, #1
	b.lt	LBB0_11
; %bb.8:
	ubfx	x23, x9, #1, #32
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_pqdownheap
	subs	x23, x23, #1
	b.hi	LBB0_9
; %bb.10:
	mov	w23, #0
LBB0_11:
	mov	x8, x23
	sxtw	x25, w8
	mov	w8, #24
	smaddl	x27, w23, w8, x19
	add	x28, x27, #8
	sxtw	x26, w24
	add	x8, x26, w24, sxtw #1
	lsl	x21, x8, #3
Lloh3:
	adrp	x24, _SMALLEST@GOTPAGE
Lloh4:
	ldr	x24, [x24, _SMALLEST@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_pqremove
	ldr	x8, [x24]
	ldp	x10, x9, [x20, #8]
	ldrsw	x8, [x9, x8, lsl #2]
	add	x11, x9, x10, lsl #2
	stur	w23, [x11, #-4]
	sub	x10, x10, #2
	str	w8, [x9, x10, lsl #2]
	ldr	w11, [x27]
	mov	w12, #24
	madd	x12, x8, x12, x19
	ldr	w13, [x12]
	add	w11, w13, w11
	str	w11, [x19, x21]
	str	x10, [x20, #8]
	ldr	x10, [x20, #24]
	ldr	x11, [x10, x25, lsl #3]
	ldr	x8, [x10, x8, lsl #3]
	cmp	x11, x8
	csel	x8, x11, x8, gt
	add	x8, x8, #1
	str	x8, [x10, x26, lsl #3]
	str	x26, [x12, #8]
	str	x26, [x28]
	add	x22, x26, #1
	ldr	x2, [x24]
	str	w26, [x9, x2, lsl #2]
	mov	x0, x20
	mov	x1, x19
	bl	_pqdownheap
	ldr	x8, [x20]
	add	x21, x21, #24
	mov	x26, x22
	cmp	x8, #1
	b.hi	LBB0_12
; %bb.13:
	ldr	x8, [x24]
	ldp	x10, x9, [x20, #8]
	ldr	w8, [x9, x8, lsl #2]
	sub	x10, x10, #1
	str	x10, [x20, #8]
	str	w8, [x9, x10, lsl #2]
	mov	x0, x20
	ldr	x1, [sp, #8]                    ; 8-byte Folded Reload
	bl	_gen_bitlen
	ldr	w2, [x20, #32]
	mov	x0, x19
	ldr	w1, [sp, #4]                    ; 4-byte Folded Reload
	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
	add	sp, sp, #112
	b	_gen_codes
LBB0_14:
	mov	x9, #0
	mov	w16, #-1
LBB0_15:
	ldp	x10, x11, [x20, #16]
	mov	w12, #24
	mov	w13, #1
	mov	x14, x16
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	x9, [x20]
	mov	x14, x16
	cmp	x9, #2
	b.hs	LBB0_7
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	cmp	w14, #2
	cinc	w16, w14, lt
	csinc	w14, wzr, w14, ge
	add	x9, x9, #1
	str	w14, [x10, x9, lsl #2]
	smull	x15, w14, w12
	str	w13, [x19, x15]
	str	x9, [x20]
	str	xzr, [x11, w14, sxtw #3]
	ldr	w9, [x20, #52]
	sub	w9, w9, #1
	str	w9, [x20, #52]
	cbz	x8, LBB0_16
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	sxtw	x9, w14
	madd	x9, x9, x12, x8
	ldr	w9, [x9, #16]
	ldr	w14, [x20, #48]
	sub	w9, w14, w9
	str	w9, [x20, #48]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_HEAP_SIZE,8,3                  ; @HEAP_SIZE
	.comm	_SMALLEST,8,3                   ; @SMALLEST
	.comm	_stderr,4,2                     ; @stderr
	.no_dead_strip	_build_tree
.subsections_via_symbols
