// File: ticky[P]ps2iconsys/src/obj_to_ps2icon.cpp
// Function: LoadTexture()
GhulbusUtil::gbImageLoader* LoadTexture()
{
	GhulbusUtil::gbImageLoader* ret = NULL;
	if(IsBMP(texture_input_file)) {
		try {
			ret = new GhulbusUtil::gbImageLoader( texture_input_file, GhulbusUtil::gbImageType_BMP() );
		} catch( Ghulbus::gbException e ) {
			std::cout << "\"" << texture_input_file << "\" is no valid BMP file." << std::endl;
			exit(1);
		}
	} else {
		try {
			ret = new GhulbusUtil::gbImageLoader( texture_input_file, GhulbusUtil::gbImageType_TGA() );
		} catch( Ghulbus::gbException e ) {
			std::cout << "\"" << texture_input_file << "\" is no valid TGA file." << std::endl;
			exit(1);
		}
	}
	if( (ret->GetWidth() != 128) || (ret->GetHeight() != 128) ) {
		std::cout << "Only Textures of size 128x128 allowed! \"" << texture_input_file << "\" has "
			<< ret->GetWidth() << "x" << ret->GetHeight() << std::endl;
		exit(1);
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq $0x0, -0x8(%rbp)
movq 0x8266(%rip), %rdi      # 0x18290
callq 0xfe80
testb $0x1, %al
jne 0x10038
jmp 0x1015f
movl $0x20, %edi
callq 0x21d0
movq %rax, -0x50(%rbp)
jmp 0x10048
movq 0x8241(%rip), %rax      # 0x18290
movq %rax, -0x60(%rbp)
callq 0xe2d0
movq %rax, -0x58(%rbp)
jmp 0x1005e
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0xd070
jmp 0x10071
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1015a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x100a6
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x20, %esi
callq 0x21e0
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x10379
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x2240
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0xf100
movq -0x70(%rbp), %rdi
callq 0x20c0
movq 0x7ef9(%rip), %rdi      # 0x17fd8
leaq 0x1c1e(%rip), %rsi      # 0x11d04
callq 0x21c0
movq %rax, -0x68(%rbp)
jmp 0x100f1
movq -0x68(%rbp), %rdi
movq 0x8194(%rip), %rsi      # 0x18290
callq 0x21c0
movq %rax, -0x78(%rbp)
jmp 0x10107
movq -0x78(%rbp), %rdi
leaq 0x1b9b(%rip), %rsi      # 0x11cad
callq 0x21c0
movq %rax, -0x80(%rbp)
jmp 0x1011d
movq -0x80(%rbp), %rdi
movq 0x7e98(%rip), %rsi      # 0x17fc0
callq 0x21f0
jmp 0x1012f
movl $0x1, %edi
callq 0x2220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xf150
callq 0x2330
jmp 0x10155
jmp 0x10379
jmp 0x102b3
movl $0x20, %edi
callq 0x21d0
movq %rax, -0x88(%rbp)
jmp 0x10172
movq 0x8117(%rip), %rax      # 0x18290
movq %rax, -0x98(%rbp)
callq 0xddb0
movq %rax, -0x90(%rbp)
jmp 0x1018e
movq -0x90(%rbp), %rdx
movq -0x98(%rbp), %rsi
movq -0x88(%rbp), %rdi
callq 0xd070
jmp 0x101aa
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x102b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x101e5
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x20, %esi
callq 0x21e0
movl -0x14(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x10379
movq -0x10(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x2240
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0xf100
movq -0xa8(%rbp), %rdi
callq 0x20c0
movq 0x7db4(%rip), %rdi      # 0x17fd8
leaq 0x1ad9(%rip), %rsi      # 0x11d04
callq 0x21c0
movq %rax, -0xa0(%rbp)
jmp 0x10239
movq -0xa0(%rbp), %rdi
movq 0x8049(%rip), %rsi      # 0x18290
callq 0x21c0
movq %rax, -0xb0(%rbp)
jmp 0x10255
movq -0xb0(%rbp), %rdi
leaq 0x1a62(%rip), %rsi      # 0x11cc5
callq 0x21c0
movq %rax, -0xb8(%rbp)
jmp 0x10271
movq -0xb8(%rbp), %rdi
movq 0x7d41(%rip), %rsi      # 0x17fc0
callq 0x21f0
jmp 0x10286
movl $0x1, %edi
callq 0x2220
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xf150
callq 0x2330
jmp 0x102ac
jmp 0x10379
jmp 0x102b3
movq -0x8(%rbp), %rdi
callq 0xd2c0
cmpl $0x80, %eax
jne 0x102d7
movq -0x8(%rbp), %rdi
callq 0xd2e0
cmpl $0x80, %eax
je 0x1036c
movq 0x7cfa(%rip), %rdi      # 0x17fd8
leaq 0x19f8(%rip), %rsi      # 0x11cdd
callq 0x21c0
movq %rax, %rdi
movq 0x7f9c(%rip), %rsi      # 0x18290
callq 0x21c0
movq %rax, %rdi
leaq 0x1a03(%rip), %rsi      # 0x11d06
callq 0x21c0
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd2c0
movq -0xc8(%rbp), %rdi
movl %eax, %esi
callq 0x2350
movq %rax, %rdi
leaq 0x1881(%rip), %rsi      # 0x11bb1
callq 0x21c0
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd2e0
movq -0xc0(%rbp), %rdi
movl %eax, %esi
callq 0x2350
movq %rax, %rdi
movq 0x7c63(%rip), %rsi      # 0x17fc0
callq 0x21f0
movl $0x1, %edi
callq 0x2220
movq -0x8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x2370
movq %rax, %rdi
callq 0x5470
nopw (%rax,%rax)