	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fits_encode_frame
_fits_encode_frame:                     ## @fits_encode_frame
	.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	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rdx, -144(%rbp)                ## 8-byte Spill
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movaps	L___const.fits_encode_frame.map(%rip), %xmm0
	movaps	%xmm0, -64(%rbp)
	movl	(%rdi), %eax
	leal	-128(%rax), %ecx
	cmpl	$5, %ecx
	ja	LBB0_5
## %bb.1:
	movq	%rsi, %r13
	movl	$3, %edx
	btl	%ecx, %edx
	jb	LBB0_7
## %bb.2:
	movl	$20, %edx
	btl	%ecx, %edx
	jae	LBB0_3
## %bb.4:
	xorl	%ecx, %ecx
	cmpl	$130, %eax
	sete	%cl
	movl	$4, %r15d
	subl	%ecx, %r15d
	movl	$2, %edx
	movb	$1, %al
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	jmp	LBB0_8
LBB0_7:
	movl	$0, -64(%rbp)
	xorl	%ecx, %ecx
	cmpl	$128, %eax
	setne	%al
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	sete	%cl
	movl	$2, %edx
	subl	%ecx, %edx
	movl	$1, %r15d
	jmp	LBB0_8
LBB0_3:
	xorl	%ecx, %ecx
	cmpl	$131, %eax
	sete	%cl
	movl	$4, %r15d
	subl	%ecx, %r15d
	movl	$1, %edx
	movl	$0, -68(%rbp)                   ## 4-byte Folded Spill
LBB0_8:
	imull	%r15d, %edx
	imull	4(%rbx), %edx
	imull	8(%rbx), %edx
	leal	2879(%rdx), %eax
	cltq
	imulq	$-1240768329, %rax, %rax        ## imm = 0xB60B60B7
	shrq	$32, %rax
	movq	%rdx, -120(%rbp)                ## 8-byte Spill
	addl	%edx, %eax
	addl	$2879, %eax                     ## imm = 0xB3F
	movl	%eax, %ecx
	shrl	$31, %ecx
	sarl	$11, %eax
	addl	%ecx, %eax
	imull	$2880, %eax, %edx               ## imm = 0xB40
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	%rdx, -112(%rbp)                ## 8-byte Spill
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%ecx, %ecx
	callq	_ff_alloc_packet2
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:
	movq	%r12, -104(%rbp)                ## 8-byte Spill
	movq	%r13, -96(%rbp)                 ## 8-byte Spill
	movq	8(%r13), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%rax, -80(%rbp)
	movl	%r15d, %eax
	movq	%rax, -128(%rbp)                ## 8-byte Spill
	movl	4(%rbx), %eax
	xorl	%ecx, %ecx
	leaq	-80(%rbp), %r14
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_11 Depth=1
	movq	-136(%rbp), %rcx                ## 8-byte Reload
	incq	%rcx
	cmpq	-128(%rbp), %rcx                ## 8-byte Folded Reload
	je	LBB0_20
LBB0_11:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
                                        ##       Child Loop BB0_16 Depth 3
	testl	%eax, %eax
	movq	%rcx, -136(%rbp)                ## 8-byte Spill
	jle	LBB0_19
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movslq	-64(%rbp,%rcx,4), %rcx
	movq	%rcx, -152(%rbp)                ## 8-byte Spill
	xorl	%r12d, %r12d
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_13 Depth=2
	movq	-80(%rbp), %rdi
	movl	8(%rbx), %edx
	movq	%r15, %rsi
	callq	_memcpy
	movslq	8(%rbx), %rax
	shlq	$2, %rax
	addq	%rax, -80(%rbp)
LBB0_18:                                ##   in Loop: Header=BB0_13 Depth=2
	incl	%r12d
	movl	4(%rbx), %eax
	cmpl	%r12d, %eax
	jle	LBB0_19
LBB0_13:                                ##   Parent Loop BB0_11 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_16 Depth 3
	movq	-144(%rbp), %rdx                ## 8-byte Reload
	movq	(%rdx), %rcx
	movq	8(%rdx), %rdx
	movl	%r12d, %esi
	notl	%esi
	addl	%eax, %esi
	movq	-152(%rbp), %rdi                ## 8-byte Reload
	movslq	(%rcx,%rdi,4), %rax
	movslq	%esi, %r15
	imulq	%rax, %r15
	shlq	$2, %r15
	addq	(%rdx,%rdi,8), %r15
	cmpb	$0, -68(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=2
	cmpl	$0, 8(%rbx)
	jle	LBB0_18
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=2
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_11 Depth=1
                                        ##     Parent Loop BB0_13 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	%r15, %rdi
	callq	_AV_RB16
	xorl	$32768, %eax                    ## imm = 0x8000
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_bytestream_put_be16
	addq	$8, %r15
	incl	%r13d
	cmpl	8(%rbx), %r13d
	jl	LBB0_16
	jmp	LBB0_18
LBB0_20:
	movq	-112(%rbp), %rbx                ## 8-byte Reload
	subl	-120(%rbp), %ebx                ## 4-byte Folded Reload
	movq	-80(%rbp), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_memset
	shlq	$2, %rbx
	addq	-80(%rbp), %rbx
	subq	-88(%rbp), %rbx                 ## 8-byte Folded Reload
	shrq	$2, %rbx
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	movl	%ebx, (%rcx)
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%rcx)
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movl	$1, (%rax)
	jmp	LBB0_21
LBB0_9:
	movl	%eax, %r14d
LBB0_21:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_23
## %bb.22:
	movl	%r14d, %eax
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_av_log
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_23
## %bb.6:
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_23:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## @__const.fits_encode_frame.map
L___const.fits_encode_frame.map:
	.long	2                               ## 0x2
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	3                               ## 0x3

	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unsupported pixel format\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AV_PKT_FLAG_KEY,4,2            ## @AV_PKT_FLAG_KEY
	.no_dead_strip	_fits_encode_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fits_encode_frame
_fits_encode_frame:                     ; @fits_encode_frame
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	adrp	x9, l___const.fits_encode_frame.map@PAGE
	add	x9, x9, l___const.fits_encode_frame.map@PAGEOFF
	str	x8, [sp, #72]
	ldr	q0, [x9]
	str	q0, [sp, #48]
	ldr	w8, [x0]
	sub	w9, w8, #128
	cmp	w9, #5
	b.hi	LBB0_18
; %bb.1:
	mov	x20, x3
	mov	x22, x2
	mov	x23, x1
	mov	w19, #1
	lsl	w9, w19, w9
	tst	w9, #0x3
	b.ne	LBB0_3
; %bb.2:
	mov	w10, #20
	cmp	w8, #130
	mov	w11, #3
	cinc	w12, w11, ne
	mov	w13, #2
	mov	w14, #1
	cmp	w8, #131
	cinc	w11, w11, ne
	mov	w8, #1
	tst	w9, w10
	csel	w25, w14, wzr, ne
	csel	w8, w13, w8, ne
	csel	w19, w12, w11, ne
	b	LBB0_4
LBB0_3:
	str	wzr, [sp, #48]
	cmp	w8, #128
	cset	w25, ne
	cinc	w8, w19, ne
LBB0_4:
	ldp	w9, w10, [x21, #4]
	mul	w8, w19, w8
	mul	w8, w8, w9
	mul	w24, w8, w10
	add	w8, w24, #2879
	mov	w9, #24759
	movk	w9, #46603, lsl #16
	smull	x9, w8, w9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #11
	add	w8, w9, w8, lsr #31
	mov	w9, #2880
	mul	w26, w8, w9
	mov	x0, x21
	mov	x1, x23
	mov	x2, x26
	mov	w3, #0
	bl	_ff_alloc_packet2
	tbnz	w0, #31, LBB0_16
; %bb.5:
	stp	w26, w24, [sp, #16]             ; 8-byte Folded Spill
	stp	x23, x20, [sp, #24]             ; 16-byte Folded Spill
	mov	x28, #0
	ldr	x8, [x23, #8]
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	str	x8, [sp, #40]
	mov	w19, w19
	ldr	w8, [x21, #4]
	add	x27, sp, #48
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x28, x28, #1
	cmp	x28, x19
	b.eq	LBB0_15
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
                                        ;       Child Loop BB0_14 Depth 3
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w26, #0
	ldrsw	x23, [x27, x28, lsl #2]
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=2
	ldr	x0, [sp, #40]
	ldr	w2, [x21, #8]
	mov	x1, x24
	bl	_memcpy
	ldrsw	x8, [x21, #8]
	ldr	x9, [sp, #40]
	add	x8, x9, x8, lsl #2
	str	x8, [sp, #40]
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	add	w26, w26, #1
	ldr	w8, [x21, #4]
	cmp	w8, w26
	b.le	LBB0_6
LBB0_11:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_14 Depth 3
	ldp	x10, x9, [x22]
	ldr	x9, [x9, x23, lsl #3]
	mvn	w11, w26
	add	w8, w8, w11
	ldr	w10, [x10, x23, lsl #2]
	mul	w8, w10, w8
	add	x24, x9, w8, sxtw #2
	cbz	w25, LBB0_9
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	ldr	w8, [x21, #8]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	w20, #0
LBB0_14:                                ;   Parent Loop BB0_7 Depth=1
                                        ;     Parent Loop BB0_11 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	mov	x0, x24
	bl	_AV_RB16
	eor	w1, w0, #0x8000
	add	x0, sp, #40
	bl	_bytestream_put_be16
	add	x24, x24, #8
	add	w20, w20, #1
	ldr	w8, [x21, #8]
	cmp	w20, w8
	b.lt	LBB0_14
	b	LBB0_10
LBB0_15:
	ldp	w9, w8, [sp, #16]               ; 8-byte Folded Reload
	sub	w21, w9, w8
	ldr	x0, [sp, #40]
	mov	w1, #0
	mov	x2, x21
	bl	_memset
	mov	w0, #0
	ldr	x8, [sp, #40]
	add	x8, x8, w21, uxtw #2
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	sub	x8, x8, x9
	lsr	x8, x8, #2
	ldr	x10, [sp, #24]                  ; 8-byte Folded Reload
	str	w8, [x10]
Lloh3:
	adrp	x8, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x10, #4]
	orr	w8, w9, w8
	str	w8, [x10, #4]
	mov	w8, #1
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	str	w8, [x9]
LBB0_16:
	ldr	x8, [sp, #72]
Lloh6:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh7:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.17:
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_18:
Lloh9:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x2, l_.str@PAGE
Lloh13:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x21
	bl	_av_log
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	ldr	x8, [sp, #72]
Lloh17:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh18:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.19:
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	b	_AVERROR
LBB0_20:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ; @__const.fits_encode_frame.map
l___const.fits_encode_frame.map:
	.long	2                               ; 0x2
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	3                               ; 0x3

	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unsupported pixel format\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AV_PKT_FLAG_KEY,4,2            ; @AV_PKT_FLAG_KEY
	.no_dead_strip	_fits_encode_frame
.subsections_via_symbols
