	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rjpeg_build_huffman
_rjpeg_build_huffman:                   ## @rjpeg_build_huffman
	.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
	movq	%rdi, %r13
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	%rcx, %rdx
	cmpq	$16, %rcx
	je	LBB0_6
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	leaq	1(%rdx), %rcx
	cmpl	$0, (%rsi,%rdx,4)
	jle	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movslq	%r8d, %rdi
	shlq	$2, %rdi
	addq	(%r13), %rdi
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%ecx, (%rdi,%rax,4)
	incq	%rax
	cmpl	(%rsi,%rdx,4), %eax
	jl	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	addl	%eax, %r8d
	jmp	LBB0_5
LBB0_6:
	movq	(%r13), %rdx
	movslq	%r8d, %rax
	movl	$0, (%rdx,%rax,4)
	movq	8(%r13), %r8
	xorl	%edi, %edi
	movl	$1, %eax
	xorl	%r15d, %r15d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movb	$16, %cl
	subb	%al, %cl
	movl	%edi, %esi
	shll	%cl, %esi
	movq	24(%r13), %rcx
	movl	%esi, (%rcx,%rax,4)
	addl	%edi, %edi
	incq	%rax
	cmpq	$17, %rax
	je	LBB0_13
LBB0_7:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	movl	%r15d, %ecx
	subl	%edi, %ecx
	movl	%ecx, (%r8,%rax,4)
	movslq	%r15d, %rsi
	movl	(%rdx,%rsi,4), %ecx
	cmpq	%rcx, %rax
	jne	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	16(%r13), %rcx
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_7 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%edi, (%rcx,%rsi,4)
	movl	4(%rdx,%rsi,4), %ebx
	incq	%rsi
	incl	%edi
	cmpq	%rbx, %rax
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	$1, %ebx
	movl	%eax, %ecx
	shll	%cl, %ebx
	leal	-1(%rdi), %ecx
	movl	%esi, %r15d
	cmpl	%ebx, %ecx
	jl	LBB0_12
## %bb.11:
	xorl	%r14d, %r14d
	jmp	LBB0_26
LBB0_13:
	movl	$-1, 68(%rcx)
	movq	32(%r13), %rdi
	movq	_FAST_BITS@GOTPCREL(%rip), %r12
	movb	(%r12), %cl
	movl	$1, %r14d
	movl	$1, %edx
	shll	%cl, %edx
	movl	$255, %esi
	callq	_memset
	testl	%r15d, %r15d
	jle	LBB0_26
## %bb.14:
	movl	(%r12), %r11d
	movl	%r15d, %r10d
	xorl	%esi, %esi
	movl	$1, %r8d
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_24:                                ##   in Loop: Header=BB0_15 Depth=1
	incq	%rsi
	cmpq	%r10, %rsi
	je	LBB0_25
LBB0_15:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_20 Depth 2
                                        ##     Child Loop BB0_23 Depth 2
	movq	(%r13), %rax
	movl	%r11d, %ecx
	subl	(%rax,%rsi,4), %ecx
	jl	LBB0_24
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	cmpl	$31, %ecx
	je	LBB0_24
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	movl	$1, %edx
	shll	%cl, %edx
	movq	16(%r13), %rax
	movl	(%rax,%rsi,4), %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	cmpl	$2, %edx
	cmovll	%r8d, %edx
	movslq	%eax, %r9
	leaq	-1(%rdx), %rax
	movl	%edx, %ecx
	andl	$3, %ecx
	cmpq	$3, %rax
	jae	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=1
	xorl	%edi, %edi
	jmp	LBB0_21
LBB0_19:                                ##   in Loop: Header=BB0_15 Depth=1
	andl	$2147483644, %edx               ## imm = 0x7FFFFFFC
	leaq	(,%r9,8), %rax
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	32(%r13), %rbx
	addq	%rax, %rbx
	movq	%rsi, (%rbx,%rdi,8)
	movq	32(%r13), %rbx
	addq	%rax, %rbx
	movq	%rsi, 8(%rbx,%rdi,8)
	movq	32(%r13), %rbx
	addq	%rax, %rbx
	movq	%rsi, 16(%rbx,%rdi,8)
	movq	32(%r13), %rbx
	addq	%rax, %rbx
	movq	%rsi, 24(%rbx,%rdi,8)
	addq	$4, %rdi
	cmpq	%rdi, %rdx
	jne	LBB0_20
LBB0_21:                                ##   in Loop: Header=BB0_15 Depth=1
	testq	%rcx, %rcx
	je	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_15 Depth=1
	addq	%r9, %rdi
	.p2align	4, 0x90
LBB0_23:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	32(%r13), %rax
	movq	%rsi, (%rax,%rdi,8)
	incq	%rdi
	decq	%rcx
	jne	LBB0_23
	jmp	LBB0_24
LBB0_25:
	movl	$1, %r14d
LBB0_26:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FAST_BITS,4,2                  ## @FAST_BITS
	.no_dead_strip	_rjpeg_build_huffman
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rjpeg_build_huffman
_rjpeg_build_huffman:                   ; @rjpeg_build_huffman
	.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	x19, x0
	mov	x9, #0
	mov	w10, #0
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x9, x8
	cmp	x8, #16
	b.eq	LBB0_6
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	ldr	w11, [x1, x9, lsl #2]
	add	x8, x9, #1
	cmp	w11, #1
	b.lt	LBB0_1
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x11, #0
	ldr	x12, [x19]
	add	x12, x12, w10, sxtw #2
LBB0_4:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	str	w8, [x12, x11, lsl #2]
	ldr	w13, [x1, x9, lsl #2]
	add	x11, x11, #1
	cmp	w11, w13
	b.lt	LBB0_4
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w10, w10, w11
	b	LBB0_1
LBB0_6:
	mov	w11, #0
	mov	w21, #0
	ldp	x8, x9, [x19]
	str	wzr, [x8, w10, sxtw #2]
	add	x10, x8, #4
	mov	w12, #1
	mov	w13, #16
	mov	w14, #1
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	sub	w15, w13, w14
	lsl	w16, w11, w15
	ldr	x15, [x19, #24]
	str	w16, [x15, x14, lsl #2]
	lsl	w11, w11, #1
	add	x14, x14, #1
	cmp	x14, #17
	b.eq	LBB0_13
LBB0_8:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	sub	w15, w21, w11
	str	w15, [x9, x14, lsl #2]
	ldr	w15, [x8, w21, sxtw #2]
	cmp	x14, x15
	b.ne	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sxtw	x15, w21
	ldr	x16, [x19, #16]
	lsl	x17, x15, #2
	add	x15, x16, x17
	add	x16, x10, x17
LBB0_10:                                ;   Parent Loop BB0_8 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	str	w11, [x15], #4
	add	w11, w11, #1
	ldr	w17, [x16], #4
	add	w21, w21, #1
	cmp	x14, x17
	b.eq	LBB0_10
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	lsl	w15, w12, w14
	sub	w16, w11, #1
	cmp	w16, w15
	b.lt	LBB0_7
; %bb.12:
	mov	w20, #0
	b	LBB0_21
LBB0_13:
	mov	w8, #-1
	str	w8, [x15, #68]
	ldr	x0, [x19, #32]
Lloh0:
	adrp	x22, _FAST_BITS@GOTPAGE
Lloh1:
	ldr	x22, [x22, _FAST_BITS@GOTPAGEOFF]
	ldr	w8, [x22]
	mov	w20, #1
	lsl	w2, w20, w8
	mov	w1, #255
	bl	_memset
	cmp	w21, #1
	b.lt	LBB0_21
; %bb.14:
	mov	x8, #0
	ldr	w9, [x22]
	mov	w10, w21
	b	LBB0_16
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=1
	add	x8, x8, #1
	cmp	x8, x10
	b.eq	LBB0_20
LBB0_16:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_19 Depth 2
	ldr	x11, [x19]
	ldr	w11, [x11, x8, lsl #2]
	subs	w11, w9, w11
	b.lt	LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	cmp	w11, #31
	b.eq	LBB0_15
; %bb.18:                               ;   in Loop: Header=BB0_16 Depth=1
	lsl	w12, w20, w11
	ldr	x13, [x19, #16]
	ldr	w13, [x13, x8, lsl #2]
	lsl	w13, w13, w11
	cmp	w12, #1
	csinc	w11, w12, wzr, gt
	sbfiz	x12, x13, #3, #32
LBB0_19:                                ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x13, [x19, #32]
	str	x8, [x13, x12]
	add	x12, x12, #8
	subs	x11, x11, #1
	b.ne	LBB0_19
	b	LBB0_15
LBB0_20:
	mov	w20, #1
LBB0_21:
	mov	x0, x20
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_FAST_BITS,4,2                  ; @FAST_BITS
	.no_dead_strip	_rjpeg_build_huffman
.subsections_via_symbols
