	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dds_luminance_to_d3dformat
_dds_luminance_to_d3dformat:            ## @dds_luminance_to_d3dformat
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movl	(%rdi), %esi
	cmpl	$8, %esi
	je	LBB0_4
## %bb.1:
	cmpl	$16, %esi
	jne	LBB0_2
## %bb.10:
	movl	4(%rdi), %edx
	cmpl	$65535, %edx                    ## imm = 0xFFFF
	jne	LBB0_12
## %bb.11:
	movq	_D3DFMT_L16@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_4:
	movl	4(%rdi), %edx
	cmpl	$255, %edx
	jne	LBB0_6
## %bb.5:
	movq	_D3DFMT_L8@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_2:
	movl	4(%rdi), %edx
LBB0_3:
	movl	12(%rdi), %ecx
	leaq	L_.str(%rip), %rdi
	callq	_WARN
	movq	_D3DFMT_UNKNOWN@GOTPCREL(%rip), %rax
LBB0_16:
	movl	(%rax), %eax
	popq	%rbp
	retq
LBB0_12:
	movq	_DDS_PF_ALPHA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rdi)
	je	LBB0_3
## %bb.13:
	cmpl	$255, %edx
	jne	LBB0_3
## %bb.14:
	movl	$255, %edx
	cmpl	$65280, 12(%rdi)                ## imm = 0xFF00
	jne	LBB0_3
## %bb.15:
	movq	_D3DFMT_A8L8@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_6:
	movq	_DDS_PF_ALPHA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rdi)
	je	LBB0_3
## %bb.7:
	cmpl	$15, %edx
	jne	LBB0_3
## %bb.8:
	movl	$15, %edx
	cmpl	$240, 12(%rdi)
	jne	LBB0_3
## %bb.9:
	movq	_D3DFMT_A4L4@GOTPCREL(%rip), %rax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_D3DFMT_L8,4,2                  ## @D3DFMT_L8
	.comm	_DDS_PF_ALPHA,4,2               ## @DDS_PF_ALPHA
	.comm	_D3DFMT_A4L4,4,2                ## @D3DFMT_A4L4
	.comm	_D3DFMT_L16,4,2                 ## @D3DFMT_L16
	.comm	_D3DFMT_A8L8,4,2                ## @D3DFMT_A8L8
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unknown luminance pixel format (bpp %u, l %#x, a %#x)\n"

	.comm	_D3DFMT_UNKNOWN,4,2             ## @D3DFMT_UNKNOWN
	.no_dead_strip	_dds_luminance_to_d3dformat
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dds_luminance_to_d3dformat
_dds_luminance_to_d3dformat:            ; @dds_luminance_to_d3dformat
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	ldr	w1, [x0]
	cmp	w1, #8
	b.eq	LBB0_4
; %bb.1:
	cmp	w1, #16
	b.ne	LBB0_6
; %bb.2:
	ldr	w2, [x0, #4]
	mov	w8, #65535
	cmp	w2, w8
	b.ne	LBB0_7
; %bb.3:
Lloh0:
	adrp	x8, _D3DFMT_L16@GOTPAGE
Lloh1:
	ldr	x8, [x8, _D3DFMT_L16@GOTPAGEOFF]
	b	LBB0_17
LBB0_4:
	ldr	w2, [x0, #4]
	cmp	w2, #255
	b.ne	LBB0_11
; %bb.5:
Lloh2:
	adrp	x8, _D3DFMT_L8@GOTPAGE
Lloh3:
	ldr	x8, [x8, _D3DFMT_L8@GOTPAGEOFF]
	b	LBB0_17
LBB0_6:
	ldr	w2, [x0, #4]
	b	LBB0_16
LBB0_7:
	ldr	w8, [x0, #8]
Lloh4:
	adrp	x9, _DDS_PF_ALPHA@GOTPAGE
Lloh5:
	ldr	x9, [x9, _DDS_PF_ALPHA@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.8:
	cmp	w2, #255
	b.ne	LBB0_16
; %bb.9:
	ldr	w8, [x0, #12]
	mov	w9, #65280
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.10:
Lloh7:
	adrp	x8, _D3DFMT_A8L8@GOTPAGE
Lloh8:
	ldr	x8, [x8, _D3DFMT_A8L8@GOTPAGEOFF]
	b	LBB0_17
LBB0_11:
	ldr	w8, [x0, #8]
Lloh9:
	adrp	x9, _DDS_PF_ALPHA@GOTPAGE
Lloh10:
	ldr	x9, [x9, _DDS_PF_ALPHA@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	and	w8, w9, w8
	cmp	w8, #0
	ccmp	w2, #15, #0, ne
	b.ne	LBB0_16
; %bb.12:
	ldr	w8, [x0, #12]
	cmp	w8, #240
	b.ne	LBB0_15
; %bb.13:
Lloh12:
	adrp	x8, _D3DFMT_A4L4@GOTPAGE
Lloh13:
	ldr	x8, [x8, _D3DFMT_A4L4@GOTPAGEOFF]
	b	LBB0_17
LBB0_14:
	mov	w2, #255
	b	LBB0_16
LBB0_15:
	mov	w2, #15
LBB0_16:
	ldr	w3, [x0, #12]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WARN
Lloh16:
	adrp	x8, _D3DFMT_UNKNOWN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _D3DFMT_UNKNOWN@GOTPAGEOFF]
LBB0_17:
	ldr	w0, [x8]
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_D3DFMT_L8,4,2                  ; @D3DFMT_L8
	.comm	_DDS_PF_ALPHA,4,2               ; @DDS_PF_ALPHA
	.comm	_D3DFMT_A4L4,4,2                ; @D3DFMT_A4L4
	.comm	_D3DFMT_L16,4,2                 ; @D3DFMT_L16
	.comm	_D3DFMT_A8L8,4,2                ; @D3DFMT_A8L8
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unknown luminance pixel format (bpp %u, l %#x, a %#x)\n"

	.comm	_D3DFMT_UNKNOWN,4,2             ; @D3DFMT_UNKNOWN
	.no_dead_strip	_dds_luminance_to_d3dformat
.subsections_via_symbols
