	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageCreateFromTgaCtx        ## -- Begin function gdImageCreateFromTgaCtx
	.p2align	4, 0x90
_gdImageCreateFromTgaCtx:               ## @gdImageCreateFromTgaCtx
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	$0, -48(%rbp)
	movl	$56, %edi
	callq	_gdMalloc
	testq	%rax, %rax
	je	LBB0_20
## %bb.1:
	movq	%rax, %r15
	movq	$0, (%rax)
	movq	$0, 48(%rax)
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_read_header_tga
	testq	%rax, %rax
	js	LBB0_19
## %bb.2:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_read_image_tga
	testq	%rax, %rax
	js	LBB0_19
## %bb.3:
	movl	8(%r15), %edi
	movl	12(%r15), %esi
	callq	_gdImageCreateTrueColor
	movq	%rax, -48(%rbp)
	cmpq	$0, -48(%rbp)
	je	LBB0_19
## %bb.4:
	cmpq	$0, 40(%r15)
	je	LBB0_6
## %bb.5:
	movq	-48(%rbp), %rdi
	xorl	%esi, %esi
	callq	_gdImageAlphaBlending
	movq	-48(%rbp), %rdi
	movl	$1, %esi
	callq	_gdImageSaveAlpha
LBB0_6:
	movl	12(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_21
## %bb.7:
	movl	8(%r15), %eax
	xorl	%esi, %esi
	movq	_TGA_BPP_24@GOTPCREL(%rip), %rbx
	xorl	%r13d, %r13d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_10 Depth=1
	movl	12(%r15), %ecx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
LBB0_9:                                 ##   in Loop: Header=BB0_10 Depth=1
	incq	%rsi
	movslq	%ecx, %rdx
	cmpq	%rdx, %rsi
	jge	LBB0_21
LBB0_10:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	movq	-48(%rbp), %rdx
	testl	%eax, %eax
	jle	LBB0_9
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	(%rdx), %rax
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	(%rax,%rsi,8), %r12
	xorl	%r14d, %r14d
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_15 Depth=2
	movq	(%r15), %rax
	movslq	%r13d, %rcx
	movl	8(%rax,%rcx,4), %edi
	movl	(%rax,%rcx,4), %edx
	movl	4(%rax,%rcx,4), %esi
	callq	_gdTrueColor
	movl	$3, %ecx
LBB0_13:                                ##   in Loop: Header=BB0_15 Depth=2
	movl	%eax, (%r12,%r14,4)
	addl	%ecx, %r13d
LBB0_14:                                ##   in Loop: Header=BB0_15 Depth=2
	movl	8(%r15), %eax
	incq	%r14
	cmpl	%eax, %r14d
	jge	LBB0_8
LBB0_15:                                ##   Parent Loop BB0_10 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	16(%r15), %rax
	cmpq	(%rbx), %rax
	je	LBB0_12
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	movq	_TGA_BPP_32@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=2
	cmpq	$0, 40(%r15)
	je	LBB0_14
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=2
	movq	(%r15), %rax
	movslq	%r13d, %rcx
	movq	%rbx, %r8
	movl	12(%rax,%rcx,4), %ebx
	movl	8(%rax,%rcx,4), %edi
	movl	(%rax,%rcx,4), %edx
	movl	4(%rax,%rcx,4), %esi
	movq	_gdAlphaMax@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	sarl	%ebx
	movslq	%ebx, %rax
	movq	%r8, %rbx
	subq	%rax, %rcx
	callq	_gdTrueColorAlpha
	movl	$4, %ecx
	jmp	LBB0_13
LBB0_19:
	movq	%r15, %rdi
	callq	_free_tga
LBB0_20:
	xorl	%eax, %eax
LBB0_28:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	cmpq	$0, 32(%r15)
	movq	24(%r15), %rax
	je	LBB0_24
## %bb.22:
	movq	-48(%rbp), %rdi
	testq	%rax, %rax
	je	LBB0_26
## %bb.23:
	callq	_gdImageFlipBoth
	jmp	LBB0_27
LBB0_24:
	testq	%rax, %rax
	je	LBB0_27
## %bb.25:
	movq	-48(%rbp), %rdi
	callq	_gdImageFlipHorizontal
	jmp	LBB0_27
LBB0_26:
	callq	_gdImageFlipVertical
LBB0_27:
	movq	%r15, %rdi
	callq	_free_tga
	movq	-48(%rbp), %rax
	jmp	LBB0_28
	.cfi_endproc
                                        ## -- End function
	.comm	_TGA_BPP_24,8,3                 ## @TGA_BPP_24
	.comm	_TGA_BPP_32,8,3                 ## @TGA_BPP_32
	.comm	_gdAlphaMax,8,3                 ## @gdAlphaMax
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageCreateFromTgaCtx        ; -- Begin function gdImageCreateFromTgaCtx
	.p2align	2
_gdImageCreateFromTgaCtx:               ; @gdImageCreateFromTgaCtx
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x0
	str	xzr, [sp, #8]
	mov	w0, #56
	bl	_gdMalloc
	cbz	x0, LBB0_27
; %bb.1:
	mov	x19, x0
	str	xzr, [x0]
	str	xzr, [x0, #48]
	mov	x0, x20
	mov	x1, x19
	bl	_read_header_tga
	tbnz	x0, #63, LBB0_19
; %bb.2:
	mov	x0, x20
	mov	x1, x19
	bl	_read_image_tga
	tbnz	x0, #63, LBB0_19
; %bb.3:
	ldp	w0, w1, [x19, #8]
	bl	_gdImageCreateTrueColor
	str	x0, [sp, #8]
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_19
; %bb.4:
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_6
; %bb.5:
	ldr	x0, [sp, #8]
	mov	w1, #0
	bl	_gdImageAlphaBlending
	ldr	x0, [sp, #8]
	mov	w1, #1
	bl	_gdImageSaveAlpha
LBB0_6:
	ldr	w9, [x19, #12]
	cmp	w9, #1
	b.lt	LBB0_20
; %bb.7:
	mov	x20, #0
	mov	w21, #0
	ldr	w8, [x19, #8]
Lloh0:
	adrp	x22, _TGA_BPP_24@GOTPAGE
Lloh1:
	ldr	x22, [x22, _TGA_BPP_24@GOTPAGEOFF]
Lloh2:
	adrp	x23, _TGA_BPP_32@GOTPAGE
Lloh3:
	ldr	x23, [x23, _TGA_BPP_32@GOTPAGEOFF]
Lloh4:
	adrp	x24, _gdAlphaMax@GOTPAGE
Lloh5:
	ldr	x24, [x24, _gdAlphaMax@GOTPAGEOFF]
	b	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldr	w9, [x19, #12]
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x20, x20, #1
	cmp	x20, w9, sxtw
	b.ge	LBB0_20
LBB0_10:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_15 Depth 2
	ldr	x10, [sp, #8]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x25, #0
	ldr	x8, [x10]
	ldr	x26, [x8, x20, lsl #3]
	b	LBB0_15
LBB0_12:                                ;   in Loop: Header=BB0_15 Depth=2
	ldr	x8, [x19]
	add	x8, x8, w21, sxtw #2
	ldp	w1, w0, [x8, #4]
	ldr	w2, [x8]
	bl	_gdTrueColor
	mov	w8, #3
LBB0_13:                                ;   in Loop: Header=BB0_15 Depth=2
	str	w0, [x26, x25, lsl #2]
	add	w21, w21, w8
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=2
	ldr	w8, [x19, #8]
	add	x25, x25, #1
	cmp	w25, w8
	b.ge	LBB0_8
LBB0_15:                                ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x19, #16]
	ldr	x9, [x22]
	cmp	x8, x9
	b.eq	LBB0_12
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=2
	ldr	x9, [x23]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=2
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_14
; %bb.18:                               ;   in Loop: Header=BB0_15 Depth=2
	ldr	x8, [x19]
	add	x8, x8, w21, sxtw #2
	ldp	w0, w9, [x8, #8]
	ldp	w2, w1, [x8]
	ldr	x8, [x24]
	asr	w9, w9, #1
	sub	x3, x8, w9, sxtw
	bl	_gdTrueColorAlpha
	mov	w8, #4
	b	LBB0_13
LBB0_19:
	mov	x0, x19
	bl	_free_tga
	mov	x0, #0
	b	LBB0_27
LBB0_20:
	ldp	x8, x9, [x19, #24]
	cbz	x9, LBB0_23
; %bb.21:
	ldr	x0, [sp, #8]
	cbz	x8, LBB0_25
; %bb.22:
	bl	_gdImageFlipBoth
	b	LBB0_26
LBB0_23:
	cbz	x8, LBB0_26
; %bb.24:
	ldr	x0, [sp, #8]
	bl	_gdImageFlipHorizontal
	b	LBB0_26
LBB0_25:
	bl	_gdImageFlipVertical
LBB0_26:
	mov	x0, x19
	bl	_free_tga
	ldr	x0, [sp, #8]
LBB0_27:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_TGA_BPP_24,8,3                 ; @TGA_BPP_24
	.comm	_TGA_BPP_32,8,3                 ; @TGA_BPP_32
	.comm	_gdAlphaMax,8,3                 ; @gdAlphaMax
.subsections_via_symbols
