	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gen_mjpeghdr_to_package
_gen_mjpeghdr_to_package:               ## @gen_mjpeghdr_to_package
	.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, %r14d
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4096, %edi                     ## imm = 0x1000
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_17
## %bb.1:
	movq	%rax, %r15
	movl	$1, %ebx
	movq	%rax, %r13
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	callq	_mjpeg_frame_header
	incl	%ebx
	addq	$320, %r13                      ## imm = 0x140
	cmpl	$32, %ebx
	jne	LBB0_2
## %bb.3:
	leaq	9920(%r15), %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	$1, %edx
	callq	_mjpeg_frame_header
	movl	%eax, %ebx
	leaq	10240(%r15), %rsi
	leal	-80(%rbx), %edx
	movq	%r13, %rdi
	callq	_memmove
	addl	$2400, %ebx                     ## imm = 0x960
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	testl	%ebx, %ebx
	jle	LBB0_4
## %bb.5:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movslq	%r14d, %rbx
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	16(%rax), %r14
	movl	$15872, -44(%rbp)               ## 4-byte Folded Spill
                                        ## imm = 0x3E00
	movl	$25, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	xorl	%r15d, %r15d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_6 Depth=1
	addl	$28, -44(%rbp)                  ## 4-byte Folded Spill
	movl	$4124, %edi                     ## imm = 0x101C
	callq	___cpu_to_le16
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx,%r13,8)
	xorl	%eax, %eax
LBB0_13:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rax, 248(%rcx,%r13,8)
	movslq	%r15d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
	leal	(%r12,%r12), %edx
	movq	%r14, %rdi
	callq	_memcpy
	addq	$32, %r13
	leal	(%r15,%r12,2), %r15d
	addq	$256, %r14                      ## imm = 0x100
	addq	$-32, %rbx
	cmpl	%r15d, -72(%rbp)                ## 4-byte Folded Reload
	jle	LBB0_14
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$32, %rbx
	jl	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edi
	orl	$32768, %edi                    ## imm = 0x8000
	callq	___cpu_to_le16
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, 8(%rcx,%r13,8)
	movl	$16384, %r12d                   ## imm = 0x4000
	subl	%r14d, %r12d
	cmpl	$16357, %r14d                   ## imm = 0x3FE5
	movl	$28, %eax
	cmovll	%eax, %r12d
	leal	(%r15,%r12,2), %eax
	cmpl	-72(%rbp), %eax                 ## 4-byte Folded Reload
	jle	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	subl	%r15d, %eax
	movl	%eax, %r12d
	shrl	$31, %r12d
	addl	%eax, %r12d
	sarl	%r12d
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpl	$27, %r12d
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	jg	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	%r12d, %edi
	orl	$16384, %edi                    ## imm = 0x4000
	callq	___cpu_to_le16
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx,%r13,8)
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	leal	1(%rdi), %ebx
                                        ## kill: def $edi killed $edi killed $rdi
	callq	___cpu_to_le16
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	$15872, -44(%rbp)               ## 4-byte Folded Spill
                                        ## imm = 0x3E00
	movl	%ebx, %edx
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_13
LBB0_17:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_16
LBB0_4:
	xorl	%r13d, %r13d
	jmp	LBB0_15
LBB0_7:
	movl	$-1, %r13d
LBB0_14:
	movq	-64(%rbp), %r15                 ## 8-byte Reload
LBB0_15:
	movq	%r15, %rdi
	callq	_kfree
LBB0_16:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_gen_mjpeghdr_to_package
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gen_mjpeghdr_to_package
_gen_mjpeghdr_to_package:               ; @gen_mjpeghdr_to_package
	.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
	mov	x21, x2
	mov	x20, x1
	mov	x22, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #4096
	bl	_kzalloc
	cbz	x0, LBB0_10
; %bb.1:
	mov	x19, x0
	mov	w23, #1
	mov	x24, x0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	mov	x1, x24
	mov	x2, x23
	bl	_mjpeg_frame_header
	add	w23, w23, #1
	add	x24, x24, #320
	cmp	w23, #32
	b.ne	LBB0_2
; %bb.3:
	mov	w8, #9920
	add	x23, x19, x8
	mov	x0, x22
	mov	x1, x23
	mov	w2, #1
	bl	_mjpeg_frame_header
	mov	x22, x0
	mov	w8, #10240
	add	x1, x19, x8
	sub	w2, w0, #80
	mov	x0, x23
	bl	_memmove
	add	w23, w22, #2400
	cmp	w23, #1
	b.lt	LBB0_11
; %bb.4:
	mov	x24, #0
	mov	w25, #0
	sxtw	x26, w21
	mov	w28, #15872
	mov	w27, #25
	mov	w21, #16384
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	w28, w28, #28
	mov	w0, #4124
	bl	___cpu_to_le16
	mov	x8, x0
	mov	x0, #0
	str	x8, [x20]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	str	x0, [x20, #248]
	add	x0, x20, #16
	lsl	w22, w22, #1
	add	x1, x19, w25, sxtw #2
	mov	x2, x22
	bl	_memcpy
	add	x20, x20, #256
	sub	x24, x24, #32
	add	w25, w22, w25
	cmp	w23, w25
	b.le	LBB0_12
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x8, x26, x24
	cmp	x8, #32
	b.lt	LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	orr	w0, w28, #0x8000
	bl	___cpu_to_le16
	str	x0, [x20, #8]
	sub	w8, w21, w28
	mov	w9, #16356
	cmp	w28, w9
	mov	w9, #28
	csel	w8, w8, w9, gt
	add	w9, w25, w8, lsl #1
	sub	w10, w23, w25
	cmp	w10, #0
	cinc	w10, w10, lt
	asr	w10, w10, #1
	cmp	w9, w23
	csel	w22, w8, w10, le
	cmp	w22, #27
	b.gt	LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	orr	w0, w22, #0x4000
	bl	___cpu_to_le16
	str	x0, [x20]
	add	w21, w27, #1
	mov	x0, x27
	bl	___cpu_to_le16
	mov	w28, #15872
	mov	x27, x21
	mov	w21, #16384
	b	LBB0_6
LBB0_10:
Lloh3:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_15
LBB0_11:
	mov	w20, #0
	b	LBB0_14
LBB0_12:
	neg	w20, w24
	b	LBB0_14
LBB0_13:
	mov	w20, #-1
LBB0_14:
	mov	x0, x19
	bl	_kfree
LBB0_15:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_gen_mjpeghdr_to_package
.subsections_via_symbols
