	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_read_header_tga                ## -- Begin function read_header_tga
	.p2align	4, 0x90
_read_header_tga:                       ## @read_header_tga
	.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	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	leaq	-64(%rbp), %rdi
	movl	$18, %esi
	movq	%r14, %rdx
	callq	_gdGetBuf
	cmpl	$17, %eax
	jg	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_gd_error
	jmp	LBB0_10
LBB0_2:
	movzbl	-64(%rbp), %edi
	movb	%dil, (%rbx)
	movb	-63(%rbp), %al
	movb	%al, 1(%rbx)
	movb	-62(%rbp), %al
	movb	%al, 2(%rbx)
	movb	-61(%rbp), %al
	movb	%al, 3(%rbx)
	movb	-59(%rbp), %al
	movb	%al, 4(%rbx)
	movb	-57(%rbp), %al
	movb	%al, 5(%rbx)
	movb	-56(%rbp), %al
	movb	%al, 6(%rbx)
	movb	-54(%rbp), %al
	movb	%al, 7(%rbx)
	movb	-52(%rbp), %al
	movb	%al, 8(%rbx)
	movb	-50(%rbp), %al
	movb	%al, 9(%rbx)
	movzbl	-48(%rbp), %edx
	movb	%dl, 10(%rbx)
	movzbl	-47(%rbp), %eax
	movl	%eax, %ecx
	andl	$15, %ecx
	movb	%cl, 11(%rbx)
	movl	%eax, %esi
	shrl	$4, %esi
	andl	$1, %esi
	movl	%esi, 12(%rbx)
	xorl	%esi, %esi
	testb	$32, %al
	sete	%sil
	movl	%esi, 16(%rbx)
	movq	_TGA_BPP_24@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jne	LBB0_4
## %bb.3:
	testb	%cl, %cl
	je	LBB0_6
LBB0_4:
	movq	_TGA_BPP_32@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jne	LBB0_9
## %bb.5:
	cmpb	$8, %cl
	jne	LBB0_9
LBB0_6:
	movq	$0, 24(%rbx)
	movl	$1, %r15d
	testl	%edi, %edi
	je	LBB0_11
## %bb.7:
	callq	_gdMalloc
	movq	%rax, 24(%rbx)
	testq	%rax, %rax
	je	LBB0_10
## %bb.8:
	movzbl	(%rbx), %esi
	movq	%rax, %rdi
	movq	%r14, %rdx
	callq	_gdGetBuf
	jmp	LBB0_11
LBB0_9:
	movq	_GD_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_gd_error_ex
LBB0_10:
	movl	$-1, %r15d
LBB0_11:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_13
## %bb.12:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fail to read header"

	.comm	_TGA_BPP_24,4,2                 ## @TGA_BPP_24
	.comm	_TGA_BPP_32,4,2                 ## @TGA_BPP_32
	.comm	_GD_WARNING,4,2                 ## @GD_WARNING
L_.str.1:                               ## @.str.1
	.asciz	"gd-tga: %u bits per pixel with %u alpha bits not supported\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_read_header_tga                ; -- Begin function read_header_tga
	.p2align	2
_read_header_tga:                       ; @read_header_tga
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	add	x0, sp, #6
	mov	w1, #18
	mov	x2, x19
	bl	_gdGetBuf
	cmp	w0, #17
	b.gt	LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gd_error
	b	LBB0_11
LBB0_2:
	ldrb	w0, [sp, #6]
	strb	w0, [x20]
	ldrb	w8, [sp, #7]
	strb	w8, [x20, #1]
	ldrh	w8, [sp, #8]
	strh	w8, [x20, #2]
	ldrb	w8, [sp, #11]
	strb	w8, [x20, #4]
	ldurh	w8, [sp, #13]
	sturh	w8, [x20, #5]
	ldrb	w8, [sp, #16]
	strb	w8, [x20, #7]
	ldrb	w8, [sp, #18]
	strb	w8, [x20, #8]
	ldrb	w8, [sp, #20]
	strb	w8, [x20, #9]
	ldrb	w2, [sp, #22]
	strb	w2, [x20, #10]
	ldrb	w8, [sp, #23]
	and	w3, w8, #0xf
	strb	w3, [x20, #11]
	mov	w9, #1
	bic	w9, w9, w8, lsr #5
	ubfx	w8, w8, #4, #1
	stp	w8, w9, [x20, #12]
Lloh5:
	adrp	x8, _TGA_BPP_24@GOTPAGE
Lloh6:
	ldr	x8, [x8, _TGA_BPP_24@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, w2
	b.ne	LBB0_4
; %bb.3:
	cbz	w3, LBB0_6
LBB0_4:
Lloh8:
	adrp	x8, _TGA_BPP_32@GOTPAGE
Lloh9:
	ldr	x8, [x8, _TGA_BPP_32@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w8, w2
	b.ne	LBB0_10
; %bb.5:
	cmp	w3, #8
	b.ne	LBB0_10
LBB0_6:
	str	xzr, [x20, #24]
	cbz	w0, LBB0_9
; %bb.7:
	bl	_gdMalloc
	str	x0, [x20, #24]
	cbz	x0, LBB0_11
; %bb.8:
	ldrb	w1, [x20]
	mov	x2, x19
	bl	_gdGetBuf
LBB0_9:
	mov	w0, #1
	b	LBB0_12
LBB0_10:
Lloh11:
	adrp	x8, _GD_WARNING@GOTPAGE
Lloh12:
	ldr	x8, [x8, _GD_WARNING@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_gd_error_ex
LBB0_11:
	mov	w0, #-1
LBB0_12:
	ldr	x8, [sp, #24]
Lloh16:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh17:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fail to read header"

	.comm	_TGA_BPP_24,4,2                 ; @TGA_BPP_24
	.comm	_TGA_BPP_32,4,2                 ; @TGA_BPP_32
	.comm	_GD_WARNING,4,2                 ; @GD_WARNING
l_.str.1:                               ; @.str.1
	.asciz	"gd-tga: %u bits per pixel with %u alpha bits not supported\n"

.subsections_via_symbols
