	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function bmp_read_4bit
LCPI0_0:
	.quad	0x3fe0000000000000              ## double 0.5
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_bmp_read_4bit:                         ## @bmp_read_4bit
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	movl	(%rdx), %eax
	andl	$-2, %eax
	movl	$1, %ebx
	cmpl	$128, %eax
	jne	LBB0_5
## %bb.1:
	movq	%rcx, %r14
	movq	%rdx, %r13
	movl	%esi, %r15d
	movq	%rdi, %r12
	movl	4(%rdx), %edx
	testl	%edx, %edx
	je	LBB0_3
## %bb.2:
	cmpl	$16, %edx
	jbe	LBB0_4
	jmp	LBB0_5
LBB0_3:
	movl	$16, 4(%r13)
	movl	$16, %edx
LBB0_4:
	movq	8(%r13), %rax
	movq	_BMP_PALETTE_4@GOTPCREL(%rip), %rsi
	xorl	%ecx, %ecx
	cmpq	(%rsi), %rax
	sete	%cl
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_bmp_read_palette
	testq	%rax, %rax
	je	LBB0_6
LBB0_5:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	4(%r13), %eax
	movl	%eax, (%r12)
	movl	%r15d, %edi
	callq	_gdTell
	movq	(%r14), %rsi
	cmpq	%rsi, %rax
	je	LBB0_8
## %bb.7:
	movl	%r15d, %edi
	callq	_gdSeek
	testl	%eax, %eax
	je	LBB0_5
LBB0_8:
	movsd	16(%r13), %xmm0                 ## xmm0 = mem[0],zero
	mulsd	LCPI0_0(%rip), %xmm0
	callq	_ceil
	movq	%rax, %r14
	leal	3(%rax), %ecx
	testl	%r14d, %r14d
	cmovnsl	%r14d, %ecx
	movl	(%r13), %eax
	cmpl	$128, %eax
	je	LBB0_12
## %bb.9:
	cmpl	$129, %eax
	jne	LBB0_5
## %bb.10:
	movl	24(%r13), %eax
	testl	%eax, %eax
	jle	LBB0_13
## %bb.11:
	andl	$-4, %ecx
	subl	%ecx, %r14d
	movl	$5, %ecx
	subl	%r14d, %ecx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	xorl	%ecx, %ecx
	xorpd	%xmm1, %xmm1
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_15
LBB0_12:
	movq	%r12, %rdi
	movl	%r15d, %esi
	movq	%r13, %rdx
	callq	_bmp_read_rle
	testl	%eax, %eax
	jne	LBB0_5
LBB0_13:
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_14:                                ##   in Loop: Header=BB0_15 Depth=1
	movl	-56(%rbp), %ecx                 ## 4-byte Reload
	incl	%ecx
	movl	24(%r13), %eax
	cmpl	%ecx, %eax
	xorpd	%xmm1, %xmm1
	jle	LBB0_13
LBB0_15:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_18 Depth 2
                                        ##     Child Loop BB0_25 Depth 2
	movl	%ecx, %ebx
	notl	%ebx
	addl	%eax, %ebx
	cmpl	$0, 28(%r13)
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	cmovnel	%ecx, %ebx
	movsd	16(%r13), %xmm0                 ## xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jbe	LBB0_24
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	xorl	%r14d, %r14d
	xorpd	%xmm1, %xmm1
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_18 Depth=2
	leal	1(%r14), %esi
	movq	%r12, %rdi
	movl	%ebx, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_gdImageSetPixel
	addl	$2, %r14d
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r14d, %xmm1
	movsd	16(%r13), %xmm0                 ## xmm0 = mem[0],zero
	ucomisd	%xmm1, %xmm0
	jbe	LBB0_24
LBB0_18:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsd	%xmm1, -72(%rbp)                ## 8-byte Spill
	leaq	-48(%rbp), %rdi
	movl	%r15d, %esi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_28
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=2
	movl	-48(%rbp), %ecx
	shrl	$4, %ecx
	andl	$15, %ecx
	movl	%ecx, -44(%rbp)
	movq	8(%r12), %rax
	cmpl	$0, (%rax,%rcx,4)
	je	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_18 Depth=2
	movl	$0, (%rax,%rcx,4)
	movl	-44(%rbp), %ecx
LBB0_21:                                ##   in Loop: Header=BB0_18 Depth=2
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%ebx, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_gdImageSetPixel
	movsd	-72(%rbp), %xmm0                ## 8-byte Reload
                                        ## xmm0 = mem[0],zero
	ucomisd	16(%r13), %xmm0
	jae	LBB0_24
## %bb.22:                              ##   in Loop: Header=BB0_18 Depth=2
	movl	-48(%rbp), %ecx
	andl	$15, %ecx
	movl	%ecx, -44(%rbp)
	movq	8(%r12), %rax
	cmpl	$0, (%rax,%rcx,4)
	je	LBB0_17
## %bb.23:                              ##   in Loop: Header=BB0_18 Depth=2
	movl	$0, (%rax,%rcx,4)
	movl	-44(%rbp), %ecx
	jmp	LBB0_17
LBB0_24:                                ##   in Loop: Header=BB0_15 Depth=1
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	testl	%r14d, %r14d
	je	LBB0_14
	.p2align	4, 0x90
LBB0_25:                                ##   Parent Loop BB0_15 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leaq	-44(%rbp), %rdi
	movl	%r15d, %esi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_28
## %bb.26:                              ##   in Loop: Header=BB0_25 Depth=2
	decl	%ebx
	cmpl	$2, %ebx
	jge	LBB0_25
	jmp	LBB0_14
LBB0_28:
	movl	$1, %ebx
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_BMP_PALETTE_4,8,3              ## @BMP_PALETTE_4
	.no_dead_strip	_bmp_read_4bit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bmp_read_4bit
_bmp_read_4bit:                         ; @bmp_read_4bit
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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 b8, -88
	.cfi_offset b9, -96
	str	xzr, [sp, #8]
	ldr	w8, [x2]
	and	w8, w8, #0xfffffffe
	cmp	w8, #128
	b.ne	LBB0_5
; %bb.1:
	mov	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w2, [x2, #4]
	cbz	w2, LBB0_3
; %bb.2:
	cmp	w2, #16
	b.ls	LBB0_4
	b	LBB0_5
LBB0_3:
	mov	w2, #16
	str	w2, [x19, #4]
LBB0_4:
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x9, _BMP_PALETTE_4@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BMP_PALETTE_4@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w3, eq
	mov	x0, x21
	mov	x1, x20
	bl	_bmp_read_palette
	cbz	x0, LBB0_7
LBB0_5:
	mov	w0, #1
LBB0_6:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_7:
	ldr	w8, [x19, #4]
	str	w8, [x21]
	mov	x0, x20
	bl	_gdTell
	ldr	x1, [x22]
	cmp	x0, x1
	b.eq	LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_gdSeek
	cbz	w0, LBB0_5
LBB0_9:
	ldr	d0, [x19, #16]
	fmov	d1, #0.50000000
	fmul	d0, d0, d1
	bl	_ceil
	and	w8, w0, #0x3
	negs	w9, w0
	and	w9, w9, #0x3
	csneg	w24, w8, w9, mi
	ldr	w8, [x19]
	cmp	w8, #128
	b.eq	LBB0_37
; %bb.10:
	cmp	w8, #129
	b.ne	LBB0_5
; %bb.11:
	ldr	w8, [x19, #24]
	cmp	w8, #1
	b.lt	LBB0_38
; %bb.12:
	mov	w25, #0
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	w25, w25, #1
	ldr	w8, [x19, #24]
	cmp	w8, w25
	b.le	LBB0_38
LBB0_14:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
	ldr	w9, [x19, #28]
	mvn	w10, w25
	add	w8, w8, w10
	cmp	w9, #0
	csel	w22, w8, w25, eq
	ldr	d0, [x19, #16]
	fcmp	d0, #0.0
	b.le	LBB0_23
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	w23, #0
	movi	d8, #0000000000000000
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=2
	add	w1, w23, #1
	mov	x0, x21
	mov	x2, x22
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_gdImageSetPixel
	add	w23, w23, #2
	scvtf	d8, w23
	ldr	d0, [x19, #16]
	fcmp	d0, d8
	b.le	LBB0_23
LBB0_17:                                ;   Parent Loop BB0_14 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x0, sp, #8
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=2
	ldr	w8, [sp, #8]
	ubfx	x3, x8, #4, #4
	str	w3, [sp, #12]
	ldr	x8, [x21, #8]
	ldr	w9, [x8, x3, lsl #2]
	cbz	w9, LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_17 Depth=2
	str	wzr, [x8, x3, lsl #2]
	ldr	w3, [sp, #12]
LBB0_20:                                ;   in Loop: Header=BB0_17 Depth=2
	mov	x0, x21
	mov	x1, x23
	mov	x2, x22
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_gdImageSetPixel
	ldr	d0, [x19, #16]
	fcmp	d0, d8
	b.ls	LBB0_23
; %bb.21:                               ;   in Loop: Header=BB0_17 Depth=2
	ldr	w8, [sp, #8]
	and	x3, x8, #0xf
	str	w3, [sp, #12]
	ldr	x8, [x21, #8]
	ldr	w9, [x8, x3, lsl #2]
	cbz	w9, LBB0_16
; %bb.22:                               ;   in Loop: Header=BB0_17 Depth=2
	str	wzr, [x8, x3, lsl #2]
	ldr	w3, [sp, #12]
	b	LBB0_16
LBB0_23:                                ;   in Loop: Header=BB0_14 Depth=1
	cbz	w24, LBB0_13
; %bb.24:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.25:                               ;   in Loop: Header=BB0_14 Depth=1
	cmp	w24, #2
	b.gt	LBB0_13
; %bb.26:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.27:                               ;   in Loop: Header=BB0_14 Depth=1
	cmp	w24, #1
	b.gt	LBB0_13
; %bb.28:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.29:                               ;   in Loop: Header=BB0_14 Depth=1
	cmp	w24, #0
	b.gt	LBB0_13
; %bb.30:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.31:                               ;   in Loop: Header=BB0_14 Depth=1
	tbz	w24, #31, LBB0_13
; %bb.32:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.33:                               ;   in Loop: Header=BB0_14 Depth=1
	cmn	w24, #2
	b.gt	LBB0_13
; %bb.34:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.35:                               ;   in Loop: Header=BB0_14 Depth=1
	cmn	w24, #3
	b.gt	LBB0_13
; %bb.36:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbnz	w0, LBB0_13
	b	LBB0_5
LBB0_37:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_bmp_read_rle
	cbnz	w0, LBB0_5
LBB0_38:
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_BMP_PALETTE_4,8,3              ; @BMP_PALETTE_4
	.no_dead_strip	_bmp_read_4bit
.subsections_via_symbols
