	.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	%rdi, %r14
	movq	_oldsize@GOTPCREL(%rip), %rax
	addl	%edx, (%rax)
	movslq	(%rdi), %rax
	subq	8(%rdi), %rax
	cmpq	$3, %rax
	ja	LBB0_2
## %bb.1:
	movq	_qtrue@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r14)
	jmp	LBB0_28
LBB0_2:
	movl	%edx, %r12d
	movl	%esi, %r13d
	testl	%edx, %edx
	je	LBB0_4
## %bb.3:
	leal	-33(%r12), %eax
	cmpl	$-65, %eax
	jbe	LBB0_4
## %bb.5:
	cmpl	$32, %r12d
	je	LBB0_12
## %bb.6:
	testl	%r12d, %r12d
	jle	LBB0_9
LBB0_7:
	movl	$-1, %eax
	movl	%r12d, %ecx
	shll	%cl, %eax
	testl	%r13d, %r13d
	js	LBB0_11
## %bb.8:
	notl	%eax
	cmpl	%r13d, %eax
	jge	LBB0_12
	jmp	LBB0_11
LBB0_4:
	movq	_ERR_DROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edx
	callq	_Com_Error
	testl	%r12d, %r12d
	jg	LBB0_7
LBB0_9:
	leal	-1(%r12), %ecx
	movl	$1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	cmpl	%r13d, %eax
	jle	LBB0_11
## %bb.10:
	negl	%eax
	cmpl	%r13d, %eax
	jle	LBB0_12
LBB0_11:
	movq	_overflows@GOTPCREL(%rip), %rax
	incl	(%rax)
LBB0_12:
	movl	%r12d, %r15d
	negl	%r15d
	cmovsl	%r12d, %r15d
	cmpq	$0, 32(%r14)
	je	LBB0_20
## %bb.13:
	cmpl	$32, %r15d
	je	LBB0_18
## %bb.14:
	cmpl	$16, %r15d
	je	LBB0_17
## %bb.15:
	cmpl	$8, %r15d
	jne	LBB0_19
## %bb.16:
	movq	8(%r14), %rax
	movq	16(%r14), %rcx
	movl	%r13d, (%rcx,%rax,4)
	incq	%rax
	movq	%rax, 8(%r14)
	addl	$8, 24(%r14)
	jmp	LBB0_28
LBB0_20:
	movl	%r15d, %ecx
	negb	%cl
	shll	%cl, %r13d
	shrl	%cl, %r13d
	movl	%r15d, %ebx
	andl	$7, %ebx
	je	LBB0_24
## %bb.21:
	leaq	24(%r14), %r12
	.p2align	4, 0x90
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movl	%r13d, %edi
	andl	$1, %edi
	movq	16(%r14), %rsi
	movq	%r12, %rdx
	callq	_Huff_putBit
	sarl	%r13d
	decl	%ebx
	jne	LBB0_22
## %bb.23:
	andl	$2147483640, %r15d              ## imm = 0x7FFFFFF8
LBB0_24:
	testl	%r15d, %r15d
	je	LBB0_27
## %bb.25:
	leaq	24(%r14), %r12
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_26:                                ## =>This Inner Loop Header: Depth=1
	movzbl	%r13b, %esi
	movq	16(%r14), %rdx
	movq	_msgHuff@GOTPCREL(%rip), %rdi
	movq	%r12, %rcx
	callq	_Huff_offsetTransmit
	sarl	$8, %r13d
	addl	$8, %ebx
	cmpl	%r15d, %ebx
	jb	LBB0_26
LBB0_27:
	movl	24(%r14), %eax
	sarl	$3, %eax
	incl	%eax
	cltq
	movq	%rax, 8(%r14)
	jmp	LBB0_28
LBB0_18:
	movq	8(%r14), %r15
	movq	16(%r14), %rbx
	movl	%r13d, %edi
	callq	_LittleLong
	movl	%eax, (%rbx,%r15,4)
	addq	$4, 8(%r14)
	addl	$8, 24(%r14)
	jmp	LBB0_28
LBB0_17:
	movq	8(%r14), %r15
	movq	16(%r14), %rbx
	movl	%r13d, %edi
	callq	_LittleShort
	movw	%ax, (%rbx,%r15,4)
	addq	$2, 8(%r14)
	addl	$16, 24(%r14)
LBB0_28:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	movq	_ERR_DROP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_Com_Error                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_oldsize,4,2                    ## @oldsize
	.comm	_qtrue,4,2                      ## @qtrue
	.comm	_ERR_DROP,4,2                   ## @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MSG_WriteBits: bad bits %i"

	.comm	_overflows,4,2                  ## @overflows
L_.str.1:                               ## @.str.1
	.asciz	"can't read %d bits\n"

	.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:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _oldsize@GOTPAGE
Lloh1:
	ldr	x8, [x8, _oldsize@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, w2
	str	w9, [x8]
	ldrsw	x8, [x0]
	ldr	x9, [x0, #8]
	sub	x8, x8, x9
	cmp	x8, #3
	b.hi	LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _qtrue@GOTPAGE
Lloh3:
	ldr	x8, [x8, _qtrue@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	str	w8, [x19, #40]
	b	LBB0_40
LBB0_2:
	mov	x20, x2
	mov	x21, x1
	cbz	w2, LBB0_8
; %bb.3:
	sub	w8, w20, #33
	cmn	w8, #65
	b.ls	LBB0_8
; %bb.4:
	cmp	w20, #32
	b.eq	LBB0_12
; %bb.5:
	subs	w8, w20, #1
	b.lt	LBB0_9
LBB0_6:
	tbnz	w21, #31, LBB0_11
; %bb.7:
	mov	w8, #-1
	lsl	w8, w8, w20
	mvn	w8, w8
	cmp	w8, w21
	b.ge	LBB0_12
	b	LBB0_11
LBB0_8:
Lloh5:
	adrp	x8, _ERR_DROP@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ERR_DROP@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_Com_Error
	subs	w8, w20, #1
	b.ge	LBB0_6
LBB0_9:
	mov	w9, #1
	lsl	w8, w9, w8
	cmp	w8, w21
	b.le	LBB0_11
; %bb.10:
	neg	w8, w8
	cmp	w8, w21
	b.le	LBB0_12
LBB0_11:
Lloh10:
	adrp	x8, _overflows@GOTPAGE
Lloh11:
	ldr	x8, [x8, _overflows@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
LBB0_12:
	cmp	w20, #0
	cneg	w20, w20, mi
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_17
; %bb.13:
	cmp	w20, #32
	b.eq	LBB0_20
; %bb.14:
	cmp	w20, #16
	b.eq	LBB0_22
; %bb.15:
	cmp	w20, #8
	b.ne	LBB0_23
; %bb.16:
	ldp	x9, x8, [x19, #8]
	str	w21, [x8, x9, lsl #2]
	add	x8, x9, #1
	b	LBB0_21
LBB0_17:
	neg	w8, w20
	mov	w9, #-1
	lsr	w8, w9, w8
	and	w23, w8, w21
	ands	w22, w20, #0x7
	b.eq	LBB0_36
; %bb.18:
	add	x21, x19, #24
	and	w0, w23, #0x1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #1
	b.ne	LBB0_24
; %bb.19:
	asr	w23, w23, #1
	b	LBB0_35
LBB0_20:
	ldp	x22, x20, [x19, #8]
	mov	x0, x21
	bl	_LittleLong
	str	w0, [x20, x22, lsl #2]
	ldr	x8, [x19, #8]
	add	x8, x8, #4
LBB0_21:
	str	x8, [x19, #8]
	ldr	w8, [x19, #24]
	add	w8, w8, #8
	str	w8, [x19, #24]
	b	LBB0_40
LBB0_22:
	ldp	x8, x20, [x19, #8]
	lsl	x22, x8, #2
	mov	x0, x21
	bl	_LittleShort
	strh	w0, [x20, x22]
	ldr	x8, [x19, #8]
	add	x8, x8, #2
	str	x8, [x19, #8]
	ldr	w8, [x19, #24]
	add	w8, w8, #16
	str	w8, [x19, #24]
	b	LBB0_40
LBB0_23:
Lloh12:
	adrp	x8, _ERR_DROP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ERR_DROP@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_Com_Error
LBB0_24:
	ubfx	w0, w23, #1, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #2
	b.ne	LBB0_26
; %bb.25:
	asr	w23, w23, #2
	b	LBB0_35
LBB0_26:
	ubfx	w0, w23, #2, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #3
	b.ne	LBB0_28
; %bb.27:
	asr	w23, w23, #3
	b	LBB0_35
LBB0_28:
	ubfx	w0, w23, #3, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #4
	b.ne	LBB0_30
; %bb.29:
	asr	w23, w23, #4
	b	LBB0_35
LBB0_30:
	ubfx	w0, w23, #4, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #5
	b.ne	LBB0_32
; %bb.31:
	asr	w23, w23, #5
	b	LBB0_35
LBB0_32:
	ubfx	w0, w23, #5, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	cmp	w22, #6
	b.ne	LBB0_34
; %bb.33:
	asr	w23, w23, #6
	b	LBB0_35
LBB0_34:
	ubfx	w0, w23, #6, #1
	ldr	x1, [x19, #16]
	mov	x2, x21
	bl	_Huff_putBit
	asr	w23, w23, #7
LBB0_35:
	and	w20, w20, #0x7ffffff8
LBB0_36:
	cbz	w20, LBB0_39
; %bb.37:
	mov	w24, #0
	add	x21, x19, #24
Lloh17:
	adrp	x22, _msgHuff@GOTPAGE
Lloh18:
	ldr	x22, [x22, _msgHuff@GOTPAGEOFF]
LBB0_38:                                ; =>This Inner Loop Header: Depth=1
	and	w1, w23, #0xff
	ldr	x2, [x19, #16]
	mov	x0, x22
	mov	x3, x21
	bl	_Huff_offsetTransmit
	asr	w23, w23, #8
	add	w24, w24, #8
	cmp	w24, w20
	b.lo	LBB0_38
LBB0_39:
	ldr	w8, [x19, #24]
	asr	w8, w8, #3
	add	w8, w8, #1
	sxtw	x8, w8
	str	x8, [x19, #8]
LBB0_40:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_oldsize,4,2                    ; @oldsize
	.comm	_qtrue,4,2                      ; @qtrue
	.comm	_ERR_DROP,4,2                   ; @ERR_DROP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MSG_WriteBits: bad bits %i"

	.comm	_overflows,4,2                  ; @overflows
l_.str.1:                               ; @.str.1
	.asciz	"can't read %d bits\n"

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