	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ico_write_packet
_ico_write_packet:                      ## @ico_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	16(%rdi), %rax
	movq	(%rax), %rbx
	cmpq	8(%rax), %rbx
	jge	LBB0_1
## %bb.2:
	movq	(%r12), %rcx
	movq	8(%r12), %r15
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	(%rsi), %rdx
	movq	(%rcx,%rdx,8), %rcx
	movq	(%rcx), %r13
	movq	16(%rax), %r14
	leaq	1(%rbx), %rcx
	movq	%rcx, (%rax)
	movq	%r15, %rdi
	callq	_avio_tell
	leaq	(%rbx,%rbx,4), %rbx
	movl	%eax, 16(%r14,%rbx,4)
	movl	(%r13), %eax
	xorl	%ecx, %ecx
	cmpl	$256, %eax                      ## imm = 0x100
	cmovel	%ecx, %eax
	movl	%eax, (%r14,%rbx,4)
	movl	4(%r13), %eax
	cmpl	$256, %eax                      ## imm = 0x100
	cmovel	%ecx, %eax
	movl	%eax, 4(%r14,%rbx,4)
	movq	8(%r13), %rax
	movq	_AV_CODEC_ID_PNG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	movl	16(%r13), %eax
	movl	%eax, 12(%r14,%rbx,4)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edx
	movl	%edx, 8(%r14,%rbx,4)
	movq	16(%rax), %rsi
	movq	%r15, %rdi
	callq	_avio_write
LBB0_10:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r12, %rdi
	movq	%rbx, %rcx
	xorl	%eax, %eax
	callq	_av_log
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_6:
	movl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_4:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	16(%rax), %rdi
	addq	$14, %rdi
	callq	_AV_RL32
	cmpl	$40, %eax
	jne	LBB0_5
## %bb.7:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movq	16(%r12), %rdi
	addq	$28, %rdi
	callq	_AV_RL16
	movl	%eax, 12(%r14,%rbx,4)
	movl	8(%r12), %eax
	movl	(%r13), %ecx
	addl	$7, %ecx
	imull	4(%r13), %ecx
	leal	7(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$3, %edx
	addl	%edx, %eax
	addl	$-14, %eax
	movl	%eax, 8(%r14,%rbx,4)
	movq	16(%r12), %rsi
	addq	$14, %rsi
	movq	%r15, %rdi
	movl	$8, %edx
	callq	_avio_write
	movq	16(%r12), %rdi
	addq	$22, %rdi
	callq	_AV_RL32
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rax,%rax), %esi
	movq	%r15, %rdi
	callq	_avio_wl32
	movq	16(%r12), %rsi
	addq	$26, %rsi
	movl	8(%r12), %edx
	addl	$-26, %edx
	movq	%r15, %rdi
	callq	_avio_write
	movl	(%r13), %eax
	addl	$7, %eax
	imull	4(%r13), %eax
	cmpl	$8, %eax
	jl	LBB0_10
## %bb.8:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_avio_w8
	incl	%ebx
	movl	(%r13), %eax
	addl	$7, %eax
	imull	4(%r13), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	cmpl	%ecx, %ebx
	jl	LBB0_9
	jmp	LBB0_10
LBB0_5:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_av_log
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ICO already contains %d images\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_AV_CODEC_ID_PNG,8,3            ## @AV_CODEC_ID_PNG
L_.str.1:                               ## @.str.1
	.asciz	"Invalid BMP\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_ico_write_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ico_write_packet
_ico_write_packet:                      ; @ico_write_packet
	.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, x0
	ldr	x8, [x0, #16]
	ldp	x23, x9, [x8]
	cmp	x23, x9
	b.ge	LBB0_4
; %bb.1:
	mov	x20, x1
	ldp	x9, x19, [x21]
	ldr	x10, [x1]
	ldr	x9, [x9, x10, lsl #3]
	ldr	x22, [x9]
	ldr	x24, [x8, #16]
	add	x9, x23, #1
	str	x9, [x8]
	mov	x0, x19
	bl	_avio_tell
	mov	w8, #20
	madd	x8, x23, x8, x24
	str	w0, [x8, #16]
	ldr	d0, [x22]
	movi.2s	v1, #1, lsl #8
	cmeq.2s	v1, v0, v1
	bic.8b	v0, v0, v1
	str	d0, [x8]
	ldr	x8, [x22, #8]
Lloh0:
	adrp	x9, _AV_CODEC_ID_PNG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AV_CODEC_ID_PNG@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.2:
	ldr	w8, [x22, #16]
	mov	w9, #20
	madd	x9, x23, x9, x24
	ldr	w2, [x20, #8]
	stp	w2, w8, [x9, #8]
	ldr	x1, [x20, #16]
	mov	x0, x19
	bl	_avio_write
LBB0_3:
	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
	add	sp, sp, #80
	ret
LBB0_4:
Lloh3:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	str	x23, [sp]
Lloh6:
	adrp	x2, l_.str@PAGE
Lloh7:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x21
	bl	_av_log
Lloh8:
	adrp	x8, _EIO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_5:
	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
	add	sp, sp, #80
	b	_AVERROR
LBB0_6:
	ldr	x8, [x20, #16]
	add	x0, x8, #14
	bl	_AV_RL32
	cmp	w0, #40
	b.ne	LBB0_10
; %bb.7:
	ldr	x8, [x20, #16]
	add	x0, x8, #28
	bl	_AV_RL16
	mov	w8, #20
	madd	x8, x23, x8, x24
	ldp	w10, w9, [x22]
	add	w10, w10, #7
	mul	w9, w10, w9
	add	w10, w9, #7
	cmp	w9, #0
	csel	w9, w10, w9, lt
	ldr	w10, [x20, #8]
	add	w9, w10, w9, asr #3
	sub	w9, w9, #14
	stp	w9, w0, [x8, #8]
	ldr	x8, [x20, #16]
	add	x1, x8, #14
	mov	x0, x19
	mov	w2, #8
	bl	_avio_write
	ldr	x8, [x20, #16]
	add	x0, x8, #22
	bl	_AV_RL32
	lsl	w1, w0, #1
	mov	x0, x19
	bl	_avio_wl32
	ldr	x8, [x20, #16]
	add	x1, x8, #26
	ldr	w8, [x20, #8]
	sub	w2, w8, #26
	mov	x0, x19
	bl	_avio_write
	ldp	w9, w8, [x22]
	add	w9, w9, #7
	mul	w8, w9, w8
	cmp	w8, #8
	b.lt	LBB0_3
; %bb.8:
	mov	w20, #0
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	w1, #0
	bl	_avio_w8
	add	w20, w20, #1
	ldp	w9, w8, [x22]
	add	w9, w9, #7
	mul	w8, w9, w8
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	cmp	w20, w8, asr #3
	b.lt	LBB0_9
	b	LBB0_3
LBB0_10:
Lloh10:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
Lloh13:
	adrp	x2, l_.str.1@PAGE
Lloh14:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_av_log
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ICO already contains %d images\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_AV_CODEC_ID_PNG,8,3            ; @AV_CODEC_ID_PNG
l_.str.1:                               ; @.str.1
	.asciz	"Invalid BMP\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_ico_write_packet
.subsections_via_symbols
