// File: /workspace/github_c_makefile_star2_O3/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, %r13
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
leal -0x1(%r8), %eax
cmpl $0x2, %eax
jae 0x69006
leaq 0x5919ce(%rip), %rax    # 0x5fa988
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
xorl %ecx, %ecx
cmpl $0x1, %r8d
setne %cl
leal (%rcx,%rcx,2), %ecx
leal (%rax,%rcx), %r8d
incl %r8d
xorl %r12d, %r12d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movq %r13, %rcx
xorl %r9d, %r9d
callq 0x6d014
jmp 0x69221
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x3, %r8d
jne 0x69221
movb $0x0, 0xc(%rsp)
cmpb $0x0, 0x65c17e(%rip)    # 0x6c51a0
jne 0x69030
callq 0x6b384
movb $0x1, 0x65c170(%rip)    # 0x6c51a0
leaq 0x591951(%rip), %rax    # 0x5fa988
movl (%rax), %eax
cmpl $0x1, %eax
je 0x6904d
cmpl $0x2, %eax
jne 0x69057
movl $0x2, 0x8(%rsp)
jmp 0x6905f
movl $0x1, 0x8(%rsp)
jmp 0x6905f
movl $0x0, 0x8(%rsp)
testl %ebp, %ebp
jle 0x6921e
movl %ebp, %eax
movq %rax, 0x38(%rsp)
movl %r14d, %eax
shll $0x4, %eax
movl %eax, 0x1c(%rsp)
leal (,%r14,4), %r12d
xorl %eax, %eax
movl %ebp, %ecx
movq $0x0, 0x10(%rsp)
movl %ebp, 0x20(%rsp)
cmpl $0x4, %ecx
movl $0x4, %ebp
movl %ecx, 0x24(%rsp)
cmovll %ecx, %ebp
cmpl $0x2, %ebp
movl $0x1, %ecx
cmovll %ecx, %ebp
testl %r14d, %r14d
movq %rax, 0x30(%rsp)
jle 0x691f4
xorl %ebx, %ebx
movl %eax, %esi
movl %r14d, %ecx
cmpl $0x4, %ecx
movl $0x4, %eax
movl %ecx, 0x28(%rsp)
cmovll %ecx, %eax
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
movq 0x10(%rsp), %rcx
cmpq 0x38(%rsp), %rcx
movl %esi, 0x2c(%rsp)
jae 0x691aa
movq %rax, %rcx
negq %rcx
leaq 0x40(%rsp), %rdx
leaq 0x43(%rsp), %rdi
xorl %r9d, %r9d
movq %r9, %r8
cmpl %r14d, %ebx
jge 0x69164
movq $-0x1, %r9
movl %esi, %r10d
leal 0x2(%r10), %r11d
movslq %r11d, %r11
movb (%r15,%r11), %r11b
movb %r11b, 0x1(%rdi,%r9,4)
leal 0x1(%r10), %r11d
movslq %r11d, %r11
movb (%r15,%r11), %r11b
movb %r11b, 0x2(%rdi,%r9,4)
movslq %r10d, %r10
movb (%r15,%r10), %r11b
movb %r11b, 0x3(%rdi,%r9,4)
movb $-0x1, 0x4(%rdi,%r9,4)
leaq (%rcx,%r9), %r11
incq %r11
incq %r9
addl $0x4, %r10d
cmpq $-0x1, %r11
jne 0x69113
movq %rax, %r10
cmpq $0x2, %r9
jbe 0x69167
jmp 0x69187
xorl %r10d, %r10d
movq %r8, %r9
shlq $0x4, %r9
leaq 0x3c(%rsp), %r11
addq %r11, %r9
movl (%r9,%r10,4), %r9d
movl %r9d, (%rdx,%r10,4)
incq %r10
cmpq $0x4, %r10
jne 0x6917a
leaq 0x1(%r8), %r9
addq $0x10, %rdi
addl %r12d, %esi
addq $0x10, %rdx
cmpq %rbp, %r9
jne 0x69101
movq %rbp, %rax
cmpq $0x3, %r8
jb 0x691ac
jmp 0x691c4
xorl %eax, %eax
shlq $0x4, %rax
movaps 0x30(%rsp,%rax), %xmm0
movaps %xmm0, 0x40(%rsp,%rax)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x691b0
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x6b5b7
addq $0x8, %r13
addl $0x4, %ebx
movl 0x28(%rsp), %ecx
addl $-0x4, %ecx
movl 0x2c(%rsp), %esi
addl $0x10, %esi
cmpl %r14d, %ebx
jl 0x690c0
movq 0x10(%rsp), %rdx
addq $0x4, %rdx
movl 0x24(%rsp), %ecx
addl $-0x4, %ecx
movq 0x30(%rsp), %rax
addl 0x1c(%rsp), %eax
movl 0x20(%rsp), %ebp
movq %rdx, 0x10(%rsp)
cmpl %ebp, %edx
jl 0x69091
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop