// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/polymosttexcompress.cc
// Function: ptcompress_compress
int ptcompress_compress(void * bgra, int width, int height, unsigned char * output, int format)
{
	switch (format) {
		case PTCOMPRESS_DXT1:
		case PTCOMPRESS_DXT5:
			squish::CompressImage( (squish::u8 const *) bgra, width, height, output, getsquishflags(format));
			return 0;
		case PTCOMPRESS_ETC1:
			compressetc1((uint8_t *)bgra, width, height, output);
			return 0;
	}
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %rbx
movl %edx, 0x8(%rsp)
movl %esi, %r14d
movq %rdi, %r15
leal -0x1(%r8), %eax
cmpl $0x2, %eax
jae 0x672f3
leaq 0x5926c4(%rip), %rax    # 0x5f9988
movl (%rax), %eax
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
shll $0x5, %ecx
addl $0x220, %ecx            # imm = 0x220
cmpl $0x2, %eax
movl $0x300, %eax            # imm = 0x300
cmovnel %ecx, %eax
cmpl $0x2, %r8d
je 0x67342
cmpl $0x1, %r8d
jne 0x67345
orl $0x1, %eax
jmp 0x67345
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x3, %r8d
jne 0x6751f
movl $0x2, 0x10(%rsp)
movb $0x0, 0x14(%rsp)
cmpb $0x0, 0x65ce99(%rip)    # 0x6c41b0
jne 0x67325
callq 0x695ec
movb $0x1, 0x65ce8b(%rip)    # 0x6c41b0
leaq 0x59265c(%rip), %rax    # 0x5f9988
movl (%rax), %eax
cmpl $0x1, %eax
je 0x67365
cmpl $0x2, %eax
jne 0x6736f
movl $0x2, 0x10(%rsp)
jmp 0x67377
orl $0x4, %eax
xorl %r12d, %r12d
movq %r15, %rdi
movl %r14d, %esi
movl 0x8(%rsp), %edx
movq %rbx, %rcx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x6b2c8
jmp 0x6751f
movl $0x1, 0x10(%rsp)
jmp 0x67377
movl $0x0, 0x10(%rsp)
cmpl $0x0, 0x8(%rsp)
jle 0x6751c
movl 0x8(%rsp), %eax
movl %eax, %ecx
movq %rcx, 0x38(%rsp)
movl %r14d, %ecx
shll $0x4, %ecx
movl %ecx, 0x24(%rsp)
leal (,%r14,4), %r12d
xorl %ecx, %ecx
movq $0x0, 0x18(%rsp)
cmpl $0x4, %eax
movl $0x4, %ebp
movl %eax, 0x28(%rsp)
cmovll %eax, %ebp
cmpl $0x2, %ebp
movl $0x1, %eax
cmovll %eax, %ebp
testl %r14d, %r14d
movq %rcx, 0x30(%rsp)
jle 0x674f4
xorl %r13d, %r13d
movl %ecx, 0xc(%rsp)
movl %r14d, %ecx
cmpl $0x4, %ecx
movl $0x4, %eax
movl %ecx, 0x2c(%rsp)
cmovll %ecx, %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
movl $0x0, %ecx
movq 0x18(%rsp), %rdx
cmpq 0x38(%rsp), %rdx
jae 0x674a6
leaq 0x40(%rsp), %rdx
movl 0xc(%rsp), %esi
leaq 0x43(%rsp), %rdi
xorl %ecx, %ecx
leaq 0x3c(%rsp), %r11
xorl %r8d, %r8d
cmpl %r14d, %r13d
jge 0x6746b
movl %esi, %r9d
xorl %r8d, %r8d
leal 0x2(%r9), %r10d
movslq %r10d, %r10
movb (%r15,%r10), %r10b
movb %r10b, -0x3(%rdi,%r8,4)
leal 0x1(%r9), %r10d
movslq %r10d, %r10
movb (%r15,%r10), %r10b
movb %r10b, -0x2(%rdi,%r8,4)
movslq %r9d, %r9
movb (%r15,%r9), %r10b
movb %r10b, -0x1(%rdi,%r8,4)
movb $-0x1, (%rdi,%r8,4)
incq %r8
addl $0x4, %r9d
cmpq %r8, %rax
jne 0x6742e
cmpl $0x3, %r8d
ja 0x6748f
movq %rcx, %r9
shlq $0x4, %r9
addq %r11, %r9
movl %r8d, %r8d
movl (%r9,%r8,4), %r9d
movl %r9d, (%rdx,%r8,4)
incq %r8
cmpq $0x4, %r8
jne 0x67482
incq %rcx
addq $0x10, %rdi
addl %r12d, %esi
addq $0x10, %rdx
cmpq %rbp, %rcx
jne 0x67420
cmpl $0x3, %ecx
ja 0x674c5
movl %ecx, %eax
shlq $0x4, %rax
movaps 0x30(%rsp,%rax), %xmm0
movaps %xmm0, 0x40(%rsp,%rax)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x674b1
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x697ec
addq $0x8, %rbx
addl $0x4, %r13d
movl 0x2c(%rsp), %ecx
addl $-0x4, %ecx
addl $0x10, 0xc(%rsp)
cmpl %r14d, %r13d
jl 0x673dc
movq 0x18(%rsp), %rdx
addq $0x4, %rdx
movl 0x28(%rsp), %eax
addl $-0x4, %eax
movq 0x30(%rsp), %rcx
addl 0x24(%rsp), %ecx
movq %rdx, 0x18(%rsp)
cmpl 0x8(%rsp), %edx
jl 0x673aa
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq