	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_HPDF_MemStream_Rewrite         ## -- Begin function HPDF_MemStream_Rewrite
	.p2align	4, 0x90
_HPDF_MemStream_Rewrite:                ## @HPDF_MemStream_Rewrite
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r13
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movslq	(%rdi), %r15
	leaq	L_.str(%rip), %rdi
	callq	_HPDF_PTRACE
	testq	%r14, %r14
	jg	LBB0_1
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	leaq	(%r13,%rbx,4), %r13
	movq	%r12, %r14
	testq	%r12, %r12
	jle	LBB0_8
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	40(%r15), %rax
	movq	(%rax), %rax
	cmpq	(%r15), %rax
	jle	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	24(%r15), %rbx
	subq	8(%r15), %rbx
	movq	%r14, %r12
	movl	32(%r15), %edi
	subq	%rbx, %r12
	jle	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_HPDF_MemCpy
	movq	(%r15), %rsi
	movq	40(%r15), %rax
	incq	%rsi
	movq	%rsi, (%r15)
	cmpq	%rsi, (%rax)
	jle	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	$0, 8(%r15)
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	leaq	-56(%rbp), %rdx
	callq	_HPDF_MemStream_GetBufPtr
	movl	%eax, 32(%r15)
	jmp	LBB0_7
LBB0_2:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_HPDF_MemStream_WriteFunc
	movq	16(%r15), %rcx
	movq	40(%r15), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, (%r15)
	movq	%rcx, 8(%r15)
	movl	48(%r15), %ecx
	movl	%ecx, 32(%r15)
	jmp	LBB0_9
LBB0_4:
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_HPDF_MemCpy
	addq	%r14, 8(%r15)
	addl	%r14d, 32(%r15)
LBB0_8:
	movq	_HPDF_OK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_9:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" HPDF_MemStream_Rewrite\n"

	.comm	_HPDF_OK,4,2                    ## @HPDF_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_HPDF_MemStream_Rewrite         ; -- Begin function HPDF_MemStream_Rewrite
	.p2align	2
_HPDF_MemStream_Rewrite:                ; @HPDF_MemStream_Rewrite
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	ldrsw	x23, [x0]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_HPDF_PTRACE
	cmp	x21, #1
	b.ge	LBB0_2
	b	LBB0_8
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	x19, x19, x22, lsl #2
	mov	x21, x24
	cmp	x24, #0
	b.le	LBB0_8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23, #40]
	ldr	x8, [x8]
	ldr	x9, [x23]
	cmp	x8, x9
	b.le	LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x23, #24]
	ldr	x9, [x23, #8]
	ldr	w0, [x23, #32]
	sub	x22, x8, x9
	subs	x24, x21, x22
	b.le	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x1, x19
	mov	x2, x22
	bl	_HPDF_MemCpy
	ldr	x8, [x23]
	add	x1, x8, #1
	str	x1, [x23]
	ldr	x8, [x23, #40]
	ldr	x8, [x8]
	cmp	x8, x1
	b.le	LBB0_1
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	str	xzr, [x23, #8]
	add	x2, sp, #8
	mov	x0, x20
	bl	_HPDF_MemStream_GetBufPtr
	str	w0, [x23, #32]
	b	LBB0_1
LBB0_6:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	bl	_HPDF_MemStream_WriteFunc
	ldr	x8, [x23, #40]
	ldr	x8, [x8]
	ldr	x9, [x23, #16]
	stp	x8, x9, [x23]
	ldr	w8, [x23, #48]
	str	w8, [x23, #32]
	b	LBB0_9
LBB0_7:
	mov	x1, x19
	mov	x2, x21
	bl	_HPDF_MemCpy
	ldr	x8, [x23, #8]
	add	x8, x8, x21
	str	x8, [x23, #8]
	ldr	w8, [x23, #32]
	add	w8, w8, w21
	str	w8, [x23, #32]
LBB0_8:
Lloh2:
	adrp	x8, _HPDF_OK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _HPDF_OK@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
LBB0_9:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" HPDF_MemStream_Rewrite\n"

	.comm	_HPDF_OK,4,2                    ; @HPDF_OK
.subsections_via_symbols
