	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gif_write_packet
_gif_write_packet:                      ## @gif_write_packet
	.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	%rsi, %rbx
	movq	8(%rdi), %r12
	movq	16(%r12), %r14
	testq	%r14, %r14
	je	LBB0_1
## %bb.6:
	movq	%rdi, %r13
	movq	(%rdi), %r15
	movq	%r15, %rdi
	callq	_avio_tell
	movl	%eax, 24(%r12)
	movl	(%r14), %edx
	testl	%edx, %edx
	jle	LBB0_8
## %bb.7:
	movq	8(%r14), %rcx
	leal	-1(%rdx), %esi
	movl	(%rcx,%rsi,4), %ecx
	movq	_GIF_TRAILER@GOTPCREL(%rip), %rsi
	xorl	%edi, %edi
	cmpl	(%rsi), %ecx
	sete	%dil
	movl	%edi, (%r12)
LBB0_8:
	testl	%eax, %eax
	je	LBB0_9
## %bb.22:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rsi
	movq	%r13, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_gif_parse_packet
	movl	(%r14), %edx
	movq	8(%r14), %rsi
	testl	%eax, %eax
	jle	LBB0_25
## %bb.23:
	movl	%eax, %ebx
	leal	-2(%rdx), %eax
	cmpl	%eax, %ebx
	jge	LBB0_25
## %bb.24:
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_avio_write
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdx
	callq	_gif_get_delay
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_avio_wl16
	movq	8(%r14), %rax
	movl	%ebx, %ecx
	leaq	(%rax,%rcx,4), %rsi
	addq	$8, %rsi
	movl	(%r14), %edx
	subl	%ebx, %edx
	movq	%r13, %rbx
	addl	$-2, %edx
LBB0_21:
	movq	%r15, %rdi
	callq	_avio_write
	jmp	LBB0_26
LBB0_1:
	xorl	%eax, %eax
	callq	_av_packet_alloc
	movq	%rax, 16(%r12)
	testq	%rax, %rax
	je	LBB0_2
## %bb.4:
	movq	%rax, %rdi
	jmp	LBB0_5
LBB0_9:
	cmpl	$12, %edx
	jle	LBB0_10
## %bb.11:
	movq	8(%r14), %rsi
	movl	40(%rsi), %eax
	movl	%eax, %ecx
	andb	$7, %cl
	movl	$2, %edi
	shll	%cl, %edi
	testb	$-128, %al
	leal	13(%rdi,%rdi,2), %eax
	movl	$13, %ecx
	cmovnel	%eax, %ecx
	leal	2(%rcx), %eax
	cmpl	%eax, %edx
	jb	LBB0_10
## %bb.12:
	movq	%r15, %rdi
	movl	%ecx, %edx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	callq	_avio_write
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%r14), %rdi
	movl	%eax, %ecx
	movq	_GIF_EXTENSION_INTRODUCER@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	cmpl	%esi, (%rdi,%rcx,4)
	jne	LBB0_14
## %bb.13:
	leal	19(%rax), %edx
	cmpl	$255, 4(%rdi,%rcx,4)
	cmovnel	%eax, %edx
	movl	%edx, %eax
LBB0_14:
	movl	(%r14), %edx
	cmpl	%eax, %edx
	jle	LBB0_10
## %bb.15:
	cmpq	$0, 8(%r12)
	js	LBB0_17
## %bb.16:
	movq	%r15, %rdi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	callq	_avio_w8
	movq	_GIF_APP_EXT_LABEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_avio_w8
	movq	%r15, %rdi
	movl	$11, %esi
	callq	_avio_w8
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	$11, %edx
	callq	_avio_write
	movq	%r15, %rdi
	movl	$3, %esi
	callq	_avio_w8
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_avio_w8
	movl	8(%r12), %esi
	movq	%r15, %rdi
	callq	_avio_wl16
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_avio_w8
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%r14), %rdi
	movl	(%r14), %edx
LBB0_17:
	movl	%eax, %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rdi,%rcx,4), %rsi
	subl	%eax, %edx
	movq	%r13, %rdi
	movq	%rax, %r13
	callq	_gif_parse_packet
	movq	%r13, %rcx
	movl	(%r14), %edx
	testl	%eax, %eax
	jle	LBB0_20
## %bb.18:
	movl	%eax, %r13d
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	$-2, %eax
	cmpl	%eax, %r13d
	jge	LBB0_20
## %bb.19:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	shlq	$2, %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rsi
	addq	%rax, %rsi
	movq	%r15, %rdi
	movl	%r13d, %edx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	callq	_avio_write
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_gif_get_delay
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_avio_wl16
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	addq	8(%r14), %rcx
	movl	%r13d, %eax
	leaq	(%rcx,%rax,4), %rsi
	addq	$8, %rsi
	movl	(%r14), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%r13d, %ecx
	negl	%ecx
	leal	(%rax,%rcx), %edx
	addl	$-2, %edx
	jmp	LBB0_21
LBB0_10:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_25:
	movq	%r15, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_avio_write
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_26:
	movq	16(%r12), %rdi
	callq	_av_packet_unref
	testq	%rbx, %rbx
	je	LBB0_28
## %bb.27:
	movq	16(%r12), %rdi
LBB0_5:
	movq	%rbx, %rsi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_av_packet_ref                  ## TAILCALL
LBB0_28:
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %edi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_20:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	shlq	$2, %rsi
	addq	8(%r14), %rsi
	subl	%ecx, %edx
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GIF_TRAILER,4,2                ## @GIF_TRAILER
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GIF_EXTENSION_INTRODUCER,4,2   ## @GIF_EXTENSION_INTRODUCER
	.comm	_GIF_APP_EXT_LABEL,4,2          ## @GIF_APP_EXT_LABEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"NETSCAPE2.0"

	.no_dead_strip	_gif_write_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gif_write_packet
_gif_write_packet:                      ; @gif_write_packet
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	ldr	x20, [x0, #8]
	ldr	x22, [x20, #16]
	cbz	x22, LBB0_9
; %bb.1:
	mov	x23, x0
	ldr	x21, [x0]
	mov	x0, x21
	bl	_avio_tell
	str	w0, [x20, #24]
	ldr	w2, [x22]
	subs	w8, w2, #1
	b.lt	LBB0_3
; %bb.2:
	ldr	x9, [x22, #8]
	ldr	w8, [x9, w8, uxtw #2]
Lloh0:
	adrp	x9, _GIF_TRAILER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _GIF_TRAILER@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	cset	w8, eq
	str	w8, [x20]
LBB0_3:
	cbz	w0, LBB0_11
; %bb.4:
	ldr	x1, [x22, #8]
	mov	x0, x23
	bl	_gif_parse_packet
	ldr	w2, [x22]
	sub	w8, w2, #2
	ldr	x1, [x22, #8]
	cmp	w0, #1
	ccmp	w0, w8, #0, ge
	b.ge	LBB0_7
; %bb.5:
	mov	x23, x0
	mov	x0, x21
	mov	x2, x23
	bl	_avio_write
	mov	x0, x20
	mov	x1, x22
	mov	x2, x19
	bl	_gif_get_delay
	mov	x1, x0
	mov	x0, x21
	bl	_avio_wl16
	ldr	x8, [x22, #8]
	add	x8, x8, w23, uxtw #2
	add	x1, x8, #8
	ldr	w8, [x22]
	sub	w8, w8, w23
LBB0_6:
	sub	w2, w8, #2
LBB0_7:
	mov	x0, x21
	bl	_avio_write
	ldr	x0, [x20, #16]
	bl	_av_packet_unref
	cbz	x19, LBB0_22
; %bb.8:
	ldr	x0, [x20, #16]
	b	LBB0_10
LBB0_9:
	bl	_av_packet_alloc
	str	x0, [x20, #16]
	cbz	x0, LBB0_23
LBB0_10:
	mov	x1, x19
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_av_packet_ref
LBB0_11:
	cmp	w2, #12
	b.le	LBB0_21
; %bb.12:
	ldr	x1, [x22, #8]
	ldr	w8, [x1, #40]
	and	x9, x8, #0x7
	mov	w10, #2
	lsl	w9, w10, w9
	add	w9, w9, w9, lsl #1
	add	w9, w9, #13
	tst	w8, #0x80
	mov	w8, #13
	csel	w24, w8, w9, eq
	add	w8, w24, #2
	cmp	w2, w8
	b.lo	LBB0_21
; %bb.13:
	mov	x0, x21
	mov	x2, x24
	bl	_avio_write
	ldr	x8, [x22, #8]
	ldr	w9, [x8, w24, uxtw #2]
Lloh3:
	adrp	x10, _GIF_EXTENSION_INTRODUCER@GOTPAGE
Lloh4:
	ldr	x10, [x10, _GIF_EXTENSION_INTRODUCER@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x10]
	cmp	w9, w1
	b.ne	LBB0_15
; %bb.14:
	add	w9, w24, #1
	ldr	w9, [x8, w9, uxtw #2]
	add	w10, w24, #19
	cmp	w9, #255
	csel	w24, w10, w24, eq
LBB0_15:
	ldr	w9, [x22]
	cmp	w9, w24
	b.le	LBB0_21
; %bb.16:
	ldr	x10, [x20, #8]
	tbnz	x10, #63, LBB0_18
; %bb.17:
	mov	x0, x21
	bl	_avio_w8
Lloh6:
	adrp	x8, _GIF_APP_EXT_LABEL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GIF_APP_EXT_LABEL@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_avio_w8
	mov	x0, x21
	mov	w1, #11
	bl	_avio_w8
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	w2, #11
	bl	_avio_write
	mov	x0, x21
	mov	w1, #3
	bl	_avio_w8
	mov	x0, x21
	mov	w1, #1
	bl	_avio_w8
	ldr	w1, [x20, #8]
	mov	x0, x21
	bl	_avio_wl16
	mov	x0, x21
	mov	w1, #0
	bl	_avio_w8
	ldr	x8, [x22, #8]
	ldr	w9, [x22]
LBB0_18:
	mov	w25, w24
	sub	w2, w9, w24
	add	x1, x8, w24, uxtw #2
	mov	x0, x23
	bl	_gif_parse_packet
	ldr	w8, [x22]
	cmp	w0, #1
	b.lt	LBB0_25
; %bb.19:
	mov	x23, x0
	sub	w9, w8, w24
	sub	w9, w9, #2
	cmp	w0, w9
	b.ge	LBB0_25
; %bb.20:
	ldr	x8, [x22, #8]
	lsl	x25, x25, #2
	add	x1, x8, x25
	mov	x0, x21
	mov	x2, x23
	bl	_avio_write
	mov	x0, x20
	mov	x1, x22
	mov	x2, x19
	bl	_gif_get_delay
	mov	x1, x0
	mov	x0, x21
	bl	_avio_wl16
	ldr	x8, [x22, #8]
	add	x8, x8, x25
	add	x8, x8, w23, uxtw #2
	add	x1, x8, #8
	ldr	w8, [x22]
	add	w9, w24, w23
	sub	w8, w8, w9
	b	LBB0_6
LBB0_21:
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_24
LBB0_22:
	mov	w0, #0
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_23:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_24:
	ldr	w0, [x8]
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_AVERROR
LBB0_25:
	ldr	x9, [x22, #8]
	add	x1, x9, x25, lsl #2
	sub	w2, w8, w24
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GIF_TRAILER,4,2                ; @GIF_TRAILER
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GIF_EXTENSION_INTRODUCER,4,2   ; @GIF_EXTENSION_INTRODUCER
	.comm	_GIF_APP_EXT_LABEL,4,2          ; @GIF_APP_EXT_LABEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"NETSCAPE2.0"

	.no_dead_strip	_gif_write_packet
.subsections_via_symbols
