	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_HPDF_Xref_WriteToStream        ## -- Begin function HPDF_Xref_WriteToStream
	.p2align	4, 0x90
_HPDF_Xref_WriteToStream:               ## @HPDF_Xref_WriteToStream
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_HPDF_SHORT_BUF_SIZ@GOTPCREL(%rip), %rax
	movslq	(%rax), %r12
	movl	%r12d, %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rbx
	leaq	L_.str(%rip), %rdi
	callq	_HPDF_PTRACE
	movq	%r14, %rdi
	testq	%r14, %r14
	je	LBB0_17
## %bb.1:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rbx,%r12), %rax
	decq	%rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%rbx), %rbx
	testq	%rbx, %rbx
	je	LBB0_4
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	xorl	%r14d, %r14d
	cmpq	$0, (%rbx)
	sete	%r14b
	movq	24(%rbx), %rdi
	cmpl	%r14d, (%rdi)
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	jle	LBB0_3
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r14d, %esi
	callq	_HPDF_List_ItemAt
	movslq	%eax, %r12
	movq	%r15, %rax
	movl	(%rbx), %r15d
	addl	%r14d, %r15d
	movl	(%r12), %ebx
	movl	(%rax), %eax
	movl	%eax, 4(%r12)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %esi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdx
	callq	_HPDF_IToA
	movb	$32, (%rax)
	leaq	1(%rax), %rdi
	movl	%ebx, %esi
	movq	%r13, %rdx
	callq	_HPDF_IToA
	movq	%rax, %rdi
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdx
	movq	_HPDF_OK@GOTPCREL(%rip), %r13
	callq	_HPDF_StrCpy
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_HPDF_Stream_WriteStr
	cmpq	(%r13), %rax
	jne	LBB0_18
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	%eax, %edi
	movl	%r15d, %esi
	movl	%ebx, %edx
	callq	_HPDF_Encrypt_InitKey
	movl	-60(%rbp), %eax                 ## 4-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=2
	movl	12(%r12), %edi
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_HPDF_Obj_WriteValue
	cmpq	(%r13), %rax
	jne	LBB0_18
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	%r15, %rdi
	leaq	L_.str.2(%rip), %rsi
	callq	_HPDF_Stream_WriteStr
	cmpq	(%r13), %rax
	jne	LBB0_18
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=2
	incl	%r14d
	movq	-96(%rbp), %rbx                 ## 8-byte Reload
	movq	24(%rbx), %rdi
	cmpl	(%rdi), %r14d
	jl	LBB0_9
	jmp	LBB0_3
LBB0_4:
	leaq	L_.str.3(%rip), %rsi
	leaq	L_.str.4(%rip), %r12
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_5
LBB0_16:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	16(%r14), %r14
	testq	%r14, %r14
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	leaq	L_.str.3(%rip), %rsi
	leaq	L_.str.4(%rip), %r12
	je	LBB0_17
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	movl	(%r15), %eax
	movl	%eax, 8(%r14)
	movq	%r13, %rdi
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_HPDF_StrCpy
	movl	(%r14), %esi
	movq	%rax, %rdi
	movq	%rbx, %rdx
	callq	_HPDF_IToA
	movb	$32, (%rax)
	leaq	1(%rax), %rdi
	movq	24(%r14), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdx
	callq	_HPDF_IToA
	movq	%rax, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	callq	_HPDF_StrCpy
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_HPDF_Stream_WriteStr
	movq	_HPDF_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	24(%r14), %rax
	cmpl	$0, (%rax)
	movq	_HPDF_BYTE_OFFSET_LEN@GOTPCREL(%rip), %r12
	jle	LBB0_16
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_15:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_HPDF_Xref_GetEntry
	movq	%rax, %r15
	movl	4(%rax), %esi
	movq	(%r12), %rdx
	incq	%rdx
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	callq	_HPDF_IToA2
	movb	$32, (%rax)
	leaq	1(%rax), %rdi
	movl	(%r15), %esi
	movq	_HPDF_GEN_NO_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	incq	%rdx
	callq	_HPDF_IToA2
	movb	$32, (%rax)
	movzbl	8(%r15), %ecx
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movb	%cl, 1(%rax)
	leaq	2(%rax), %rdi
	leaq	L_.str.5(%rip), %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	callq	_HPDF_StrCpy
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_HPDF_Stream_WriteStr
	movq	_HPDF_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_15 Depth=2
	incl	%ebx
	movq	24(%r14), %rax
	cmpl	(%rax), %ebx
	jl	LBB0_15
	jmp	LBB0_16
LBB0_17:
	movq	%r15, %rsi
	callq	_WriteTrailer
LBB0_18:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_20
## %bb.19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HPDF_SHORT_BUF_SIZ,4,2         ## @HPDF_SHORT_BUF_SIZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" HPDF_Xref_WriteToStream\n"

L_.str.1:                               ## @.str.1
	.asciz	" obj\n"

	.comm	_HPDF_OK,8,3                    ## @HPDF_OK
L_.str.2:                               ## @.str.2
	.asciz	"\nendobj\n"

L_.str.3:                               ## @.str.3
	.asciz	"xref\n"

L_.str.4:                               ## @.str.4
	.asciz	"\n"

	.comm	_HPDF_BYTE_OFFSET_LEN,8,3       ## @HPDF_BYTE_OFFSET_LEN
	.comm	_HPDF_GEN_NO_LEN,8,3            ## @HPDF_GEN_NO_LEN
L_.str.5:                               ## @.str.5
	.asciz	"\r\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_HPDF_Xref_WriteToStream        ; -- Begin function HPDF_Xref_WriteToStream
	.p2align	2
_HPDF_Xref_WriteToStream:               ; @HPDF_Xref_WriteToStream
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #16
	mov	x23, x2
	mov	x19, x1
	mov	x27, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x8, _HPDF_SHORT_BUF_SIZ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HPDF_SHORT_BUF_SIZ@GOTPAGEOFF]
Lloh5:
	ldrsw	x20, [x8]
	and	x8, x20, #0xffffffff
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x21, x9, x8
	mov	sp, x21
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_HPDF_PTRACE
	cbz	x27, LBB0_17
; %bb.1:
	add	x8, x21, x20
	sub	x22, x8, #1
Lloh10:
	adrp	x20, _HPDF_OK@GOTPAGE
Lloh11:
	ldr	x20, [x20, _HPDF_OK@GOTPAGEOFF]
	stur	x27, [x29, #-96]                ; 8-byte Folded Spill
	mov	x25, x27
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x25, [x25, #16]
	cbz	x25, LBB0_10
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	ldr	x8, [x25]
	cmp	x8, #0
	cset	w26, eq
	ldr	x0, [x25, #24]
	ldr	w8, [x0]
	cmp	w8, w26
	b.le	LBB0_2
LBB0_4:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x1, x26
	bl	_HPDF_List_ItemAt
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x24, w0
	ldr	w8, [x25]
	add	w27, w26, w8
	ldr	w28, [x24]
	ldr	w8, [x19]
	str	w8, [x24, #4]
	mov	x0, x21
	mov	x1, x27
	mov	x2, x22
	bl	_HPDF_IToA
	mov	w8, #32
	strb	w8, [x0], #1
	mov	x1, x28
	mov	x2, x22
	bl	_HPDF_IToA
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x22
	bl	_HPDF_StrCpy
	mov	x0, x19
	mov	x1, x21
	bl	_HPDF_Stream_WriteStr
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=2
	cbz	w23, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=2
	mov	x0, x23
	mov	x1, x27
	mov	x2, x28
	bl	_HPDF_Encrypt_InitKey
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=2
	ldr	w0, [x24, #12]
	mov	x1, x19
	mov	x2, x23
	bl	_HPDF_Obj_WriteValue
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=2
	mov	x0, x19
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_HPDF_Stream_WriteStr
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=2
	add	w26, w26, #1
	ldr	x0, [x25, #24]
	ldr	w8, [x0]
	cmp	w26, w8
	b.lt	LBB0_4
	b	LBB0_2
LBB0_10:
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
Lloh18:
	adrp	x28, l_.str.4@PAGE
Lloh19:
	add	x28, x28, l_.str.4@PAGEOFF
	mov	w24, #32
Lloh20:
	adrp	x23, _HPDF_GEN_NO_LEN@GOTPAGE
Lloh21:
	ldr	x23, [x23, _HPDF_GEN_NO_LEN@GOTPAGEOFF]
	ldur	x25, [x29, #-96]                ; 8-byte Folded Reload
Lloh22:
	adrp	x26, l_.str.5@PAGE
Lloh23:
	add	x26, x26, l_.str.5@PAGEOFF
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	ldr	x25, [x25, #16]
	ldur	x27, [x29, #-96]                ; 8-byte Folded Reload
Lloh24:
	adrp	x1, l_.str.3@PAGE
Lloh25:
	add	x1, x1, l_.str.3@PAGEOFF
Lloh26:
	adrp	x28, l_.str.4@PAGE
Lloh27:
	add	x28, x28, l_.str.4@PAGEOFF
	cbz	x25, LBB0_17
LBB0_12:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_15 Depth 2
	ldr	w8, [x19]
	str	w8, [x25, #8]
	mov	x0, x21
	mov	x2, x22
	bl	_HPDF_StrCpy
	ldr	w1, [x25]
	mov	x2, x22
	bl	_HPDF_IToA
	strb	w24, [x0], #1
	ldr	x8, [x25, #24]
	ldr	w1, [x8]
	mov	x2, x22
	bl	_HPDF_IToA
	mov	x1, x28
	mov	x2, x22
	bl	_HPDF_StrCpy
	mov	x0, x19
	mov	x1, x21
	bl	_HPDF_Stream_WriteStr
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [x25, #24]
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	w27, #0
LBB0_15:                                ;   Parent Loop BB0_12 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x25
	mov	x1, x27
	bl	_HPDF_Xref_GetEntry
	mov	x28, x0
	ldr	w1, [x0, #4]
Lloh28:
	adrp	x8, _HPDF_BYTE_OFFSET_LEN@GOTPAGE
Lloh29:
	ldr	x8, [x8, _HPDF_BYTE_OFFSET_LEN@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	add	x2, x8, #1
	mov	x0, x21
	bl	_HPDF_IToA2
	strb	w24, [x0], #1
	ldr	w1, [x28]
	ldr	x8, [x23]
	add	x2, x8, #1
	bl	_HPDF_IToA2
	strb	w24, [x0]
	ldr	w9, [x28, #8]
	add	x8, x0, #2
	strb	w9, [x0, #1]
	mov	x0, x8
	mov	x1, x26
	mov	x2, x22
	bl	_HPDF_StrCpy
	mov	x0, x19
	mov	x1, x21
	bl	_HPDF_Stream_WriteStr
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=2
	add	w27, w27, #1
	ldr	x8, [x25, #24]
	ldr	w8, [x8]
	cmp	w27, w8
	b.lt	LBB0_15
	b	LBB0_11
LBB0_17:
	mov	x0, x27
	mov	x1, x19
	bl	_WriteTrailer
LBB0_18:
	ldur	x8, [x29, #-88]
Lloh31:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh32:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.19:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_20:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_HPDF_SHORT_BUF_SIZ,4,2         ; @HPDF_SHORT_BUF_SIZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" HPDF_Xref_WriteToStream\n"

l_.str.1:                               ; @.str.1
	.asciz	" obj\n"

	.comm	_HPDF_OK,8,3                    ; @HPDF_OK
l_.str.2:                               ; @.str.2
	.asciz	"\nendobj\n"

l_.str.3:                               ; @.str.3
	.asciz	"xref\n"

l_.str.4:                               ; @.str.4
	.asciz	"\n"

	.comm	_HPDF_BYTE_OFFSET_LEN,8,3       ; @HPDF_BYTE_OFFSET_LEN
	.comm	_HPDF_GEN_NO_LEN,8,3            ; @HPDF_GEN_NO_LEN
l_.str.5:                               ; @.str.5
	.asciz	"\r\n"

.subsections_via_symbols
