	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MSG_WriteBits                  ## -- Begin function MSG_WriteBits
	.p2align	4, 0x90
_MSG_WriteBits:                         ## @MSG_WriteBits
	.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	_oldsize@GOTPCREL(%rip), %rax
	addl	%edx, (%rax)
	movl	%esi, -44(%rbp)
	cmpq	$0, 24(%rdi)
	jne	LBB0_28
## %bb.1:
	movl	%edx, %r12d
	movl	%esi, %r15d
	movq	%rdi, %r14
	testl	%edx, %edx
	je	LBB0_3
## %bb.2:
	leal	-33(%r12), %eax
	cmpl	$-65, %eax
	ja	LBB0_4
LBB0_3:
	movq	_ERR_DROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edx
	callq	_Com_Error
LBB0_4:
	movl	%r12d, %edx
	negl	%edx
	cmovsl	%r12d, %edx
	cmpq	$0, 32(%r14)
	je	LBB0_14
## %bb.5:
	movslq	(%r14), %rdi
	movl	%edx, %eax
	shrl	$3, %eax
	addl	%edi, %eax
	cmpl	4(%r14), %eax
	jg	LBB0_6
## %bb.7:
	cmpl	$32, %edx
	je	LBB0_12
## %bb.8:
	cmpl	$16, %edx
	je	LBB0_11
## %bb.9:
	cmpl	$8, %edx
	jne	LBB0_13
## %bb.10:
	movq	8(%r14), %rax
	movl	%r15d, (%rax,%rdi,4)
	incl	(%r14)
	addl	$8, 16(%r14)
	jmp	LBB0_28
LBB0_14:
	movl	%edx, %ecx
	negb	%cl
	shll	%cl, %r15d
	shrl	%cl, %r15d
	movl	%edx, %r13d
	movl	%edx, %ebx
	andl	$7, %ebx
	je	LBB0_15
## %bb.16:
	movl	16(%r14), %eax
	addl	%ebx, %eax
	movl	4(%r14), %ecx
	shll	$3, %ecx
	cmpl	%ecx, %eax
	jg	LBB0_6
## %bb.17:
	leaq	16(%r14), %r12
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movl	%r15d, %edi
	andl	$1, %edi
	movq	8(%r14), %rsi
	movq	%r12, %rdx
	callq	_Huff_putBit
	sarl	%r15d
	decl	%ebx
	jne	LBB0_18
## %bb.19:
	movl	%r13d, %ebx
	andl	$2147483640, %ebx               ## imm = 0x7FFFFFF8
	testl	%ebx, %ebx
	jne	LBB0_21
	jmp	LBB0_26
LBB0_15:
	movl	%r13d, %ebx
	testl	%ebx, %ebx
	je	LBB0_26
LBB0_21:
	leaq	16(%r14), %r12
	movl	4(%r14), %r8d
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movzbl	%r15b, %esi
	movq	8(%r14), %rdx
	shll	$3, %r8d
	movq	_msgHuff@GOTPCREL(%rip), %rdi
	movq	%r12, %rcx
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_Huff_offsetTransmit
	sarl	$8, %r15d
	movl	4(%r14), %r8d
	leal	(,%r8,8), %eax
	cmpl	%eax, 16(%r14)
	jg	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_23 Depth=1
	addl	$8, %r13d
	cmpl	%ebx, %r13d
	jb	LBB0_23
## %bb.25:
	movl	%r15d, -44(%rbp)
LBB0_26:
	movl	16(%r14), %eax
	movl	%eax, %ecx
	sarl	$3, %ecx
	incl	%ecx
	movl	%ecx, (%r14)
	testb	$7, %al
	jne	LBB0_28
## %bb.27:
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	movq	8(%r14), %rax
	sarl	$3, %ecx
	movslq	%ecx, %rcx
	movl	$0, (%rax,%rcx,4)
	jmp	LBB0_28
LBB0_12:
	shlq	$2, %rdi
	addq	8(%r14), %rdi
	leaq	-44(%rbp), %rsi
	callq	_CopyLittleLong
	addl	$4, (%r14)
	addl	$32, 16(%r14)
	jmp	LBB0_28
LBB0_11:
	movw	%r15w, -46(%rbp)
	shlq	$2, %rdi
	addq	8(%r14), %rdi
	leaq	-46(%rbp), %rsi
	callq	_CopyLittleShort
	addl	$2, (%r14)
	addl	$16, 16(%r14)
	jmp	LBB0_28
LBB0_13:
	movq	_ERR_DROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_Com_Error                      ## TAILCALL
LBB0_24:
	movl	%r15d, -44(%rbp)
LBB0_6:
	movq	_qtrue@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r14)
LBB0_28:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_oldsize,4,2                    ## @oldsize
	.comm	_ERR_DROP,4,2                   ## @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MSG_WriteBits: bad bits %i"

	.comm	_qtrue,8,3                      ## @qtrue
L_.str.1:                               ## @.str.1
	.asciz	"can't write %d bits"

	.comm	_msgHuff,4,2                    ## @msgHuff
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_MSG_WriteBits                  ; -- Begin function MSG_WriteBits
	.p2align	2
_MSG_WriteBits:                         ; @MSG_WriteBits
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	str	w1, [sp, #12]
Lloh0:
	adrp	x8, _oldsize@GOTPAGE
Lloh1:
	ldr	x8, [x8, _oldsize@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, w2
	str	w9, [x8]
	ldr	x8, [x0, #24]
	cbnz	x8, LBB0_38
; %bb.1:
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	cbz	w2, LBB0_3
; %bb.2:
	sub	w8, w20, #33
	cmn	w8, #65
	b.hi	LBB0_4
LBB0_3:
Lloh2:
	adrp	x8, _ERR_DROP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ERR_DROP@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_Com_Error
LBB0_4:
	cmp	w20, #0
	cneg	w20, w20, mi
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_10
; %bb.5:
	ldp	w8, w9, [x19]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	w10, w8, w20, lsr #3
	cmp	w10, w9
	b.gt	LBB0_37
; %bb.6:
	cmp	w20, #32
	b.eq	LBB0_14
; %bb.7:
	cmp	w20, #16
	b.eq	LBB0_15
; %bb.8:
	cmp	w20, #8
	b.ne	LBB0_16
; %bb.9:
	ldr	x9, [x19, #8]
	str	w21, [x9, x8, lsl #2]
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	ldr	w8, [x19, #16]
	add	w8, w8, #8
	str	w8, [x19, #16]
	b	LBB0_38
LBB0_10:
	neg	w8, w20
	mov	w9, #-1
	lsr	w8, w9, w8
	and	w23, w8, w21
	ands	w22, w20, #0x7
	b.eq	LBB0_29
; %bb.11:
	mov	x21, x19
	ldr	w8, [x21, #16]!
	add	w8, w8, w22
	ldur	w9, [x21, #-12]
	cmp	w8, w9, lsl #3
	b.gt	LBB0_37
; %bb.12:
	and	w0, w23, #0x1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #1
	b.ne	LBB0_17
; %bb.13:
	asr	w23, w23, #1
	b	LBB0_28
LBB0_14:
	ldr	x9, [x19, #8]
	add	x0, x9, x8, lsl #2
	add	x1, sp, #12
	bl	_CopyLittleLong
	ldr	w8, [x19]
	add	w8, w8, #4
	str	w8, [x19]
	ldr	w8, [x19, #16]
	add	w8, w8, #32
	str	w8, [x19, #16]
	b	LBB0_38
LBB0_15:
	strh	w21, [sp, #10]
	ldr	x9, [x19, #8]
	add	x0, x9, x8, lsl #2
	add	x1, sp, #10
	bl	_CopyLittleShort
	ldr	w8, [x19]
	add	w8, w8, #2
	str	w8, [x19]
	ldr	w8, [x19, #16]
	add	w8, w8, #16
	str	w8, [x19, #16]
	b	LBB0_38
LBB0_16:
Lloh7:
	adrp	x8, _ERR_DROP@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ERR_DROP@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_Com_Error
LBB0_17:
	ubfx	w0, w23, #1, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #2
	b.ne	LBB0_19
; %bb.18:
	asr	w23, w23, #2
	b	LBB0_28
LBB0_19:
	ubfx	w0, w23, #2, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #3
	b.ne	LBB0_21
; %bb.20:
	asr	w23, w23, #3
	b	LBB0_28
LBB0_21:
	ubfx	w0, w23, #3, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #4
	b.ne	LBB0_23
; %bb.22:
	asr	w23, w23, #4
	b	LBB0_28
LBB0_23:
	ubfx	w0, w23, #4, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #5
	b.ne	LBB0_25
; %bb.24:
	asr	w23, w23, #5
	b	LBB0_28
LBB0_25:
	ubfx	w0, w23, #5, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #6
	b.ne	LBB0_27
; %bb.26:
	asr	w23, w23, #6
	b	LBB0_28
LBB0_27:
	ubfx	w0, w23, #6, #1
	ldr	x1, [x19, #8]
	mov	x2, x21
	bl	_Huff_putBit
	asr	w23, w23, #7
LBB0_28:
	and	w20, w20, #0x7ffffff8
LBB0_29:
	cbz	w20, LBB0_34
; %bb.30:
	mov	w24, #0
	add	x21, x19, #16
	ldr	w8, [x19, #4]
Lloh12:
	adrp	x22, _msgHuff@GOTPAGE
Lloh13:
	ldr	x22, [x22, _msgHuff@GOTPAGEOFF]
LBB0_31:                                ; =>This Inner Loop Header: Depth=1
	and	w1, w23, #0xff
	ldr	x2, [x19, #8]
	lsl	w4, w8, #3
	mov	x0, x22
	mov	x3, x21
	bl	_Huff_offsetTransmit
	asr	w23, w23, #8
	ldr	w9, [x19, #16]
	ldr	w8, [x19, #4]
	cmp	w9, w8, lsl #3
	b.gt	LBB0_36
; %bb.32:                               ;   in Loop: Header=BB0_31 Depth=1
	add	w24, w24, #8
	cmp	w24, w20
	b.lo	LBB0_31
; %bb.33:
	str	w23, [sp, #12]
LBB0_34:
	ldr	w8, [x19, #16]
	asr	w9, w8, #3
	add	w9, w9, #1
	str	w9, [x19]
	tst	w8, #0x7
	b.ne	LBB0_38
; %bb.35:
	ldr	x9, [x19, #8]
	add	w10, w8, #7
	cmp	w8, #0
	csel	w8, w10, w8, lt
	asr	w8, w8, #3
	str	wzr, [x9, w8, sxtw #2]
	b	LBB0_38
LBB0_36:
	str	w23, [sp, #12]
LBB0_37:
Lloh14:
	adrp	x8, _qtrue@GOTPAGE
Lloh15:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	str	x8, [x19, #24]
LBB0_38:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_oldsize,4,2                    ; @oldsize
	.comm	_ERR_DROP,4,2                   ; @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MSG_WriteBits: bad bits %i"

	.comm	_qtrue,8,3                      ; @qtrue
l_.str.1:                               ; @.str.1
	.asciz	"can't write %d bits"

	.comm	_msgHuff,4,2                    ; @msgHuff
.subsections_via_symbols
