	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bmp_read_1bit
_bmp_read_1bit:                         ## @bmp_read_1bit
	.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
	movq	%rcx, %r13
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movq	(%rdx), %rax
	movq	_BMP_BI_RGB@GOTPCREL(%rip), %rcx
	movl	$1, %r15d
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.1:
	movq	%rdx, %r12
	movl	%esi, %r14d
	movl	8(%rdx), %edx
	testl	%edx, %edx
	je	LBB0_3
## %bb.2:
	cmpl	$2, %edx
	jbe	LBB0_4
	jmp	LBB0_5
LBB0_3:
	movl	$2, 8(%r12)
	movl	$2, %edx
LBB0_4:
	movq	16(%r12), %rax
	movq	_BMP_PALETTE_4@GOTPCREL(%rip), %rsi
	xorl	%ecx, %ecx
	cmpq	(%rsi), %rax
	sete	%cl
	movq	%rdi, %rbx
	movl	%r14d, %esi
	callq	_bmp_read_palette
	testq	%rax, %rax
	je	LBB0_6
LBB0_5:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	8(%r12), %eax
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movl	%eax, (%rbx)
	movl	%r14d, %edi
	callq	_gdTell
	movq	(%r13), %rsi
	cmpq	%rsi, %rax
	je	LBB0_8
## %bb.7:
	movl	%r14d, %edi
	callq	_gdSeek
	testl	%eax, %eax
	je	LBB0_5
LBB0_8:
	movl	24(%r12), %eax
	movl	28(%r12), %ecx
	leal	7(%rax), %edx
	leal	14(%rax), %esi
	testl	%edx, %edx
	cmovnsl	%edx, %esi
	sarl	$3, %esi
	leal	3(%rsi), %edx
	testl	%esi, %esi
	cmovnsl	%esi, %edx
	testl	%ecx, %ecx
	jle	LBB0_24
## %bb.9:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	andl	$-4, %edx
	subl	%edx, %esi
	movl	$5, %edx
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	subl	%esi, %edx
	movl	%edx, -56(%rbp)                 ## 4-byte Spill
	xorl	%edx, %edx
LBB0_10:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
                                        ##       Child Loop BB0_15 Depth 3
                                        ##     Child Loop BB0_20 Depth 2
	movl	%edx, %r13d
	notl	%r13d
	addl	%ecx, %r13d
	movq	%r12, %rbx
	cmpq	$0, 32(%r12)
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	cmovnel	%edx, %r13d
	testl	%eax, %eax
	jle	LBB0_19
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	xorl	%r12d, %r12d
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_13 Depth=2
	addl	$8, %r12d
	cmpl	%eax, %r12d
	jge	LBB0_19
LBB0_13:                                ##   Parent Loop BB0_10 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_15 Depth 3
	leaq	-48(%rbp), %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_25
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=2
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_15:                                ##   Parent Loop BB0_10 Depth=1
                                        ##     Parent Loop BB0_13 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	-48(%rbp), %eax
	movl	%r14d, %ecx
	shll	%cl, %eax
	movzbl	%al, %ecx
	shrl	$7, %ecx
	movl	%ecx, -52(%rbp)
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	8(%rdi), %rax
	cmpq	$0, (%rax,%rcx,8)
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=3
	movq	$0, (%rax,%rcx,8)
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=3
	leal	(%r12,%r14), %r15d
	movl	%r15d, %esi
	movl	%r13d, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_gdImageSetPixel
	movl	24(%rbx), %eax
	cmpl	%eax, %r15d
	jge	LBB0_12
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=3
	leal	1(%r14), %ecx
	cmpl	$7, %r14d
	movl	%ecx, %r14d
	jb	LBB0_15
	jmp	LBB0_12
LBB0_19:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	-56(%rbp), %r14d                ## 4-byte Reload
	cmpl	$0, -72(%rbp)                   ## 4-byte Folded Reload
	movl	$1, %r15d
	movq	%rbx, %r12
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	leaq	-52(%rbp), %r13
	je	LBB0_22
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_10 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_5
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=2
	decl	%r14d
	cmpl	$2, %r14d
	jge	LBB0_20
LBB0_22:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	incl	%edx
	movl	28(%r12), %ecx
	cmpl	%edx, %ecx
	jle	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	24(%r12), %eax
	jmp	LBB0_10
LBB0_24:
	xorl	%r15d, %r15d
	jmp	LBB0_5
LBB0_25:
	movl	$1, %r15d
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_BMP_BI_RGB,8,3                 ## @BMP_BI_RGB
	.comm	_BMP_PALETTE_4,8,3              ## @BMP_PALETTE_4
	.no_dead_strip	_bmp_read_1bit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bmp_read_1bit
_bmp_read_1bit:                         ; @bmp_read_1bit
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [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 w27, -88
	.cfi_offset w28, -96
	str	xzr, [sp, #8]
	ldr	x8, [x2]
Lloh0:
	adrp	x9, _BMP_BI_RGB@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BMP_BI_RGB@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.1:
	mov	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w2, [x2, #8]
	cbz	w2, LBB0_3
; %bb.2:
	cmp	w2, #2
	b.ls	LBB0_4
	b	LBB0_5
LBB0_3:
	mov	w2, #2
	str	w2, [x19, #8]
LBB0_4:
	ldr	x8, [x19, #16]
Lloh3:
	adrp	x9, _BMP_PALETTE_4@GOTPAGE
Lloh4:
	ldr	x9, [x9, _BMP_PALETTE_4@GOTPAGEOFF]
Lloh5:
	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	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_7:
	ldr	w8, [x19, #8]
	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:
	ldp	w8, w9, [x19, #24]
	add	w10, w8, #7
	add	w11, w8, #14
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #3
	and	w11, w10, #0x3
	negs	w10, w10
	and	w10, w10, #0x3
	csneg	w24, w11, w10, mi
	cmp	w9, #1
	b.lt	LBB0_35
; %bb.10:
	mov	w25, #0
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
                                        ;       Child Loop BB0_17 Depth 3
	ldr	x10, [x19, #32]
	mvn	w11, w25
	add	w9, w9, w11
	cmp	x10, #0
	csel	w22, w9, w25, eq
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w26, #0
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=2
	add	w26, w26, #8
	cmp	w26, w8
	b.ge	LBB0_19
LBB0_14:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_17 Depth 3
	add	x0, sp, #8
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	mov	w27, #0
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=3
	add	w23, w26, w27
	mov	x0, x21
	mov	x1, x23
	mov	x2, x22
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_gdImageSetPixel
	ldr	w8, [x19, #24]
	cmp	w23, w8
	ccmp	w27, #7, #2, lt
	add	w27, w27, #1
	b.hs	LBB0_13
LBB0_17:                                ;   Parent Loop BB0_11 Depth=1
                                        ;     Parent Loop BB0_14 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	w8, [sp, #8]
	lsl	w8, w8, w27
	ubfx	w3, w8, #7, #1
	str	w3, [sp, #12]
	ldr	x8, [x21, #8]
	ldr	x9, [x8, w3, uxtw #3]
	cbz	x9, LBB0_16
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=3
	str	xzr, [x8, x3, lsl #3]
	b	LBB0_16
LBB0_19:                                ;   in Loop: Header=BB0_11 Depth=1
	cbz	w24, LBB0_33
; %bb.20:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.21:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w24, #2
	b.gt	LBB0_33
; %bb.22:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.23:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w24, #1
	b.gt	LBB0_33
; %bb.24:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.25:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w24, #0
	b.gt	LBB0_33
; %bb.26:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.27:                               ;   in Loop: Header=BB0_11 Depth=1
	tbz	w24, #31, LBB0_33
; %bb.28:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.29:                               ;   in Loop: Header=BB0_11 Depth=1
	cmn	w24, #2
	b.gt	LBB0_33
; %bb.30:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
; %bb.31:                               ;   in Loop: Header=BB0_11 Depth=1
	cmn	w24, #3
	b.gt	LBB0_33
; %bb.32:                               ;   in Loop: Header=BB0_11 Depth=1
	add	x0, sp, #12
	mov	x1, x20
	bl	_gdGetByte
	cbz	w0, LBB0_5
LBB0_33:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w25, w25, #1
	ldr	w9, [x19, #28]
	cmp	w9, w25
	b.le	LBB0_35
; %bb.34:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w8, [x19, #24]
	b	LBB0_11
LBB0_35:
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_BMP_BI_RGB,8,3                 ; @BMP_BI_RGB
	.comm	_BMP_PALETTE_4,8,3              ; @BMP_PALETTE_4
	.no_dead_strip	_bmp_read_1bit
.subsections_via_symbols
