	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_RE_SaveJPGToBuffer             ## -- Begin function RE_SaveJPGToBuffer
	.p2align	4, 0x90
_RE_SaveJPGToBuffer:                    ## @RE_SaveJPGToBuffer
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r12
	movl	%r8d, -60(%rbp)                 ## 4-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %r15d
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-116(%rbp), %rdi
	callq	_jpeg_std_error
	movq	%rax, -72(%rbp)
	movq	_R_JPGErrorExit@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 4(%rax)
	movq	_R_JPGOutputMessage@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rax)
	movl	-120(%rbp), %edi
	callq	_setjmp
	leaq	-112(%rbp), %rdi
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	callq	_jpeg_destroy_compress
	movq	_ri@GOTPCREL(%rip), %rax
	movq	_PRINT_ALL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str(%rip), %rsi
	callq	*(%rax)
	xorl	%eax, %eax
                                        ## kill: def $rax killed $eax
	jmp	LBB0_8
LBB0_2:
	callq	_jpeg_create_compress
	leaq	-112(%rbp), %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	callq	_jpegDest
	movl	%ebx, -112(%rbp)
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -108(%rbp)
	movl	$3, -104(%rbp)
	movq	_JCS_RGB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-112(%rbp), %rdi
	callq	_jpeg_set_defaults
	movq	_TRUE@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	leaq	-112(%rbp), %rdi
	movl	%r15d, %esi
	callq	_jpeg_set_quality
	cmpl	$85, %r15d
	jl	LBB0_4
## %bb.3:
	movq	-88(%rbp), %rax
	movabsq	$4294967297, %rcx               ## imm = 0x100000001
	movq	%rcx, (%rax)
LBB0_4:
	movl	(%r14), %esi
	leaq	-112(%rbp), %rdi
	callq	_jpeg_start_compress
	movl	-108(%rbp), %ecx
	movl	-100(%rbp), %eax
	cmpl	%ecx, %eax
	jge	LBB0_7
## %bb.5:
	imull	-104(%rbp), %ebx
	addl	16(%rbp), %ebx
	leaq	-112(%rbp), %r14
	leaq	-56(%rbp), %r15
	movl	$1, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	notl	%eax
	addl	%ecx, %eax
	imull	%ebx, %eax
	cltq
	leaq	(%r12,%rax,4), %rax
	movq	%rax, -56(%rbp)
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%r13d, %edx
	callq	_jpeg_write_scanlines
	movl	-108(%rbp), %edx
	movl	-100(%rbp), %esi
	movl	%edx, %ecx
	movl	%esi, %eax
	cmpl	%edx, %esi
	jl	LBB0_6
LBB0_7:
	leaq	-112(%rbp), %r14
	movq	%r14, %rdi
	callq	_jpeg_finish_compress
	movq	-96(%rbp), %rax
	movq	(%rax), %rbx
	subq	8(%rax), %rbx
	movq	%r14, %rdi
	callq	_jpeg_destroy_compress
	movq	%rbx, %rax
LBB0_8:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_10
## %bb.9:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_R_JPGErrorExit,4,2             ## @R_JPGErrorExit
	.comm	_R_JPGOutputMessage,4,2         ## @R_JPGOutputMessage
	.comm	_ri,8,3                         ## @ri
	.comm	_PRINT_ALL,4,2                  ## @PRINT_ALL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\n"

	.comm	_JCS_RGB,4,2                    ## @JCS_RGB
	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_RE_SaveJPGToBuffer             ; -- Begin function RE_SaveJPGToBuffer
	.p2align	2
_RE_SaveJPGToBuffer:                    ; @RE_SaveJPGToBuffer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	mov	x20, x6
	mov	x19, x5
	mov	x23, x4
	mov	x21, x3
	mov	x22, x2
	mov	x24, x1
	mov	x25, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #72]
	add	x8, sp, #8
	orr	x0, x8, #0x4
	bl	_jpeg_std_error
	str	x0, [sp, #56]
Lloh3:
	adrp	x8, _R_JPGErrorExit@GOTPAGE
Lloh4:
	ldr	x8, [x8, _R_JPGErrorExit@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _R_JPGOutputMessage@GOTPAGE
Lloh7:
	ldr	x9, [x9, _R_JPGOutputMessage@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	stp	w9, w8, [x0]
	ldr	w0, [sp, #8]
	bl	_setjmp
	cbz	x0, LBB0_2
; %bb.1:
	add	x0, sp, #16
	bl	_jpeg_destroy_compress
Lloh9:
	adrp	x8, _ri@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ri@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
Lloh12:
	adrp	x9, _PRINT_ALL@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PRINT_ALL@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x9]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	blr	x8
	mov	x0, #0
	b	LBB0_8
LBB0_2:
	add	x26, sp, #16
	mov	x0, x26
	bl	_jpeg_create_compress
	mov	x0, x26
	mov	x1, x25
	mov	x2, x24
	bl	_jpegDest
	stp	w21, w23, [sp, #16]
	mov	w8, #3
Lloh17:
	adrp	x9, _JCS_RGB@GOTPAGE
Lloh18:
	ldr	x9, [x9, _JCS_RGB@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	str	w8, [sp, #24]
	str	w9, [sp, #48]
	mov	x0, x26
	bl	_jpeg_set_defaults
Lloh20:
	adrp	x23, _TRUE@GOTPAGE
Lloh21:
	ldr	x23, [x23, _TRUE@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	x0, x26
	mov	x1, x22
	bl	_jpeg_set_quality
	cmp	w22, #85
	b.lt	LBB0_4
; %bb.3:
	ldr	x8, [sp, #40]
	movi.2s	v0, #1
	str	d0, [x8]
LBB0_4:
	ldr	w1, [x23]
	add	x0, sp, #16
	bl	_jpeg_start_compress
	ldr	w8, [sp, #28]
	ldr	w9, [sp, #20]
	cmp	w8, w9
	b.ge	LBB0_7
; %bb.5:
	ldr	w10, [sp, #24]
	madd	w23, w10, w21, w20
	mov	x0, x8
	add	x20, sp, #16
	add	x21, sp, #64
	mov	w22, #1
	mov	x8, x9
	mov	x9, x0
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mvn	w9, w9
	add	w8, w8, w9
	mul	w8, w8, w23
	add	x8, x19, w8, sxtw #2
	str	x8, [sp, #64]
	mov	x0, x20
	mov	x1, x21
	mov	x2, x22
	bl	_jpeg_write_scanlines
	ldr	w10, [sp, #28]
	ldr	w11, [sp, #20]
	mov	x9, x10
	mov	x8, x11
	cmp	w10, w11
	b.lt	LBB0_6
LBB0_7:
	add	x19, sp, #16
	mov	x0, x19
	bl	_jpeg_finish_compress
	ldr	x8, [sp, #32]
	ldp	x9, x8, [x8]
	sub	x20, x9, x8
	mov	x0, x19
	bl	_jpeg_destroy_compress
	mov	x0, x20
LBB0_8:
	ldr	x8, [sp, #72]
Lloh22:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh23:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_10
; %bb.9:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_10:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_R_JPGErrorExit,4,2             ; @R_JPGErrorExit
	.comm	_R_JPGOutputMessage,4,2         ; @R_JPGOutputMessage
	.comm	_ri,8,3                         ; @ri
	.comm	_PRINT_ALL,4,2                  ; @PRINT_ALL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\n"

	.comm	_JCS_RGB,4,2                    ; @JCS_RGB
	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
