	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function rgb32tobgr16_c
LCPI0_0:
	.long	63488                           ## 0xf800
	.long	63488                           ## 0xf800
	.long	63488                           ## 0xf800
	.long	63488                           ## 0xf800
LCPI0_1:
	.long	2016                            ## 0x7e0
	.long	2016                            ## 0x7e0
	.long	2016                            ## 0x7e0
	.long	2016                            ## 0x7e0
LCPI0_2:
	.long	31                              ## 0x1f
	.long	31                              ## 0x1f
	.long	31                              ## 0x1f
	.long	31                              ## 0x1f
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_rgb32tobgr16_c:                        ## @rgb32tobgr16_c
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	testl	%edx, %edx
	jle	LBB0_8
## %bb.1:
	movslq	%edx, %rax
	leaq	(%rdi,%rax,4), %r11
	leaq	16(%rdi), %rcx
	cmpq	%rcx, %r11
	movq	%rcx, %r10
	cmovaq	%r11, %r10
	movq	%rdi, %r8
	notq	%r8
	addq	%r8, %r10
	cmpq	$64, %r10
	jb	LBB0_7
## %bb.2:
	cmpq	%rcx, %r11
	cmovaq	%r11, %rcx
	addq	%r8, %rcx
	shrq	$4, %rcx
	movq	%rcx, %rdx
	shlq	$4, %rdx
	addq	%rdi, %rdx
	addq	$4, %rdx
	cmpq	%rsi, %rdx
	jbe	LBB0_4
## %bb.3:
	leaq	(%rsi,%rcx,4), %rcx
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	ja	LBB0_7
LBB0_4:
	shrq	$4, %r10
	incq	%r10
	movl	%r10d, %ecx
	andl	$3, %ecx
	testq	%rcx, %rcx
	movl	$4, %edx
	cmovneq	%rcx, %rdx
	subq	%rdx, %r10
	leaq	(%rsi,%r10,4), %r8
	movq	%r10, %r9
	shlq	$4, %r9
	addq	%rdi, %r9
	xorl	%edx, %edx
	movdqa	LCPI0_0(%rip), %xmm0            ## xmm0 = [63488,63488,63488,63488]
	movdqa	LCPI0_1(%rip), %xmm1            ## xmm1 = [2016,2016,2016,2016]
	movdqa	LCPI0_2(%rip), %xmm2            ## xmm2 = [31,31,31,31]
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	(%rdi), %xmm3
	movdqu	16(%rdi), %xmm4
	punpckldq	%xmm4, %xmm3            ## xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
	movdqu	32(%rdi), %xmm4
	movdqu	48(%rdi), %xmm5
	punpckldq	%xmm5, %xmm4            ## xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
	punpcklqdq	%xmm4, %xmm3            ## xmm3 = xmm3[0],xmm4[0]
	movdqa	%xmm3, %xmm4
	pslld	$8, %xmm4
	pand	%xmm0, %xmm4
	movdqa	%xmm3, %xmm5
	psrld	$5, %xmm5
	pand	%xmm1, %xmm5
	por	%xmm4, %xmm5
	psrld	$19, %xmm3
	pand	%xmm2, %xmm3
	por	%xmm5, %xmm3
	movdqu	%xmm3, (%rsi,%rdx,4)
	addq	$4, %rdx
	addq	$64, %rdi
	cmpq	%rdx, %r10
	jne	LBB0_5
## %bb.6:
	movq	%r8, %rsi
	movq	%r9, %rdi
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdi), %ecx
	addq	$16, %rdi
	movl	%ecx, %edx
	shll	$8, %edx
	andl	$63488, %edx                    ## imm = 0xF800
	movl	%ecx, %eax
	shrl	$5, %eax
	andl	$2016, %eax                     ## imm = 0x7E0
	orl	%edx, %eax
	shrl	$19, %ecx
	andl	$31, %ecx
	orl	%eax, %ecx
	movl	%ecx, (%rsi)
	addq	$4, %rsi
	cmpq	%r11, %rdi
	jb	LBB0_7
LBB0_8:
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_rgb32tobgr16_c
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rgb32tobgr16_c
_rgb32tobgr16_c:                        ; @rgb32tobgr16_c
	.cfi_startproc
; %bb.0:
	stp	d11, d10, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	.cfi_offset b8, -8
	.cfi_offset b9, -16
	.cfi_offset b10, -24
	.cfi_offset b11, -32
                                        ; kill: def $w2 killed $w2 def $x2
	cmp	w2, #1
	b.lt	LBB0_9
; %bb.1:
	sxtw	x8, w2
	add	x9, x0, x8, lsl #2
	add	x10, x0, #16
	cmp	x9, x10
	csel	x8, x9, x10, hi
	mvn	x11, x0
	add	x8, x8, x11
	cmp	x8, #256
	b.lo	LBB0_6
; %bb.2:
	cmp	x9, x10
	csel	x9, x9, x10, hi
	add	x9, x9, x11
	lsr	x9, x9, #4
	add	x10, x1, x9, lsl #2
	add	x10, x10, #4
	add	x9, x0, x9, lsl #4
	add	x9, x9, #4
	cmp	x9, x1
	ccmp	x10, x0, #0, hi
	b.hi	LBB0_6
; %bb.3:
	lsr	x10, x8, #4
	add	x8, x10, #1
	ands	x9, x8, #0xf
	mov	w11, #16
	csel	x11, x11, x9, eq
	sub	x8, x8, x11
	add	x9, x1, x8, lsl #2
	add	x8, x0, x8, lsl #4
	mvn	x10, x10
	add	x10, x10, x11
	add	x11, x1, #32
	add	x12, x0, #128
	movi.4s	v0, #248, lsl #8
	mov	w13, #2016
	dup.4s	v1, w13
	movi.4s	v2, #31
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	sub	x13, x12, #128
	sub	x14, x12, #64
	ld4.4s	{ v3, v4, v5, v6 }, [x13]
	ld4.4s	{ v16, v17, v18, v19 }, [x14]
	mov	x13, x12
	ld4.4s	{ v20, v21, v22, v23 }, [x13], #64
	ld4.4s	{ v24, v25, v26, v27 }, [x13]
	shl.4s	v7, v3, #8
	shl.4s	v28, v16, #8
	shl.4s	v29, v20, #8
	shl.4s	v30, v24, #8
	and.16b	v7, v7, v0
	and.16b	v28, v28, v0
	and.16b	v29, v29, v0
	and.16b	v30, v30, v0
	ushr.4s	v31, v3, #5
	ushr.4s	v8, v16, #5
	ushr.4s	v9, v20, #5
	ushr.4s	v10, v24, #5
	and.16b	v31, v31, v1
	and.16b	v8, v8, v1
	and.16b	v9, v9, v1
	and.16b	v10, v10, v1
	orr.16b	v7, v7, v31
	orr.16b	v28, v28, v8
	orr.16b	v29, v29, v9
	orr.16b	v30, v30, v10
	ushr.4s	v3, v3, #19
	ushr.4s	v4, v16, #19
	ushr.4s	v5, v20, #19
	ushr.4s	v6, v24, #19
	and.16b	v3, v3, v2
	and.16b	v4, v4, v2
	and.16b	v5, v5, v2
	and.16b	v6, v6, v2
	orr.16b	v3, v7, v3
	orr.16b	v4, v28, v4
	orr.16b	v5, v29, v5
	stp	q3, q4, [x11, #-32]
	orr.16b	v3, v30, v6
	stp	q5, q3, [x11], #64
	add	x12, x12, #256
	adds	x10, x10, #16
	b.ne	LBB0_4
; %bb.5:
	mov	x1, x9
	b	LBB0_7
LBB0_6:
	mov	x8, x0
LBB0_7:
	add	x9, x0, w2, sxtw #2
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8], #16
	lsl	w11, w10, #8
	and	w11, w11, #0xf800
	bfxil	w11, w10, #5, #11
	bfxil	w11, w10, #19, #5
	str	w11, [x1], #4
	cmp	x8, x9
	b.lo	LBB0_8
LBB0_9:
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	ldp	d11, d10, [sp], #32             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_rgb32tobgr16_c
.subsections_via_symbols
