// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/transform/squeeze.h
// Function: default_squeeze_parameters(std::vector<int, std::allocator<int>>&, Image const&)
void default_squeeze_parameters(std::vector<int> &parameters, const Image &image) {
    int nb_channels = image.nb_channels;
    // maybe other transforms have been applied before, but let's assume the first nb_channels channels
    // still contain the 'main' data

    parameters.clear();
    int w = image.channel[image.nb_meta_channels].w;
    int h = image.channel[image.nb_meta_channels].h;
    v_printf(7,"\nDefault squeeze parameters for %ix%i image: ",w,h);

    bool wide = (w>h);  // do horizontal first on wide images; vertical first on tall images
    if (nb_channels>2 && image.channel[image.nb_meta_channels+1].w == w && image.channel[image.nb_meta_channels+1].h == h) {
        // assume channels 1 and 2 are chroma, and can be squeezed first for 4:2:0 previews
        v_printf(7,"(4:2:0 chroma), ",w,h);
//        if (!wide) {
//        parameters.push_back(0+2); // vertical chroma squeeze
//        parameters.push_back(image.nb_meta_channels+1);
//        parameters.push_back(image.nb_meta_channels+2);
//        }
        parameters.push_back(1+2); // horizontal chroma squeeze
        parameters.push_back(image.nb_meta_channels+1);
        parameters.push_back(image.nb_meta_channels+2);
//        if (wide) {
        parameters.push_back(0+2); // vertical chroma squeeze
        parameters.push_back(image.nb_meta_channels+1);
        parameters.push_back(image.nb_meta_channels+2);
//        }
    }

    if (!wide) {
            if (h > MAX_FIRST_PREVIEW_SIZE) {
                parameters.push_back(0); // vertical squeeze
                parameters.push_back(image.nb_meta_channels);
                parameters.push_back(image.nb_meta_channels+nb_channels-1);
                h = (h+1)/2;
                v_printf(7,"Vertical (%ix%i), ",w,h);
            }
    }
    while ( w > MAX_FIRST_PREVIEW_SIZE || h > MAX_FIRST_PREVIEW_SIZE ) {
            if (w > MAX_FIRST_PREVIEW_SIZE) {
                parameters.push_back(1); // horizontal squeeze
                parameters.push_back(image.nb_meta_channels);
                parameters.push_back(image.nb_meta_channels+nb_channels-1);
                w = (w+1)/2;
                v_printf(7,"Horizontal (%ix%i), ",w,h);
            }
            if (h > MAX_FIRST_PREVIEW_SIZE) {
                parameters.push_back(0); // vertical squeeze
                parameters.push_back(image.nb_meta_channels);
                parameters.push_back(image.nb_meta_channels+nb_channels-1);
                h = (h+1)/2;
                v_printf(7,"Vertical (%ix%i), ",w,h);
            }
    }
    v_printf(7,"that's it\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %rbx
movl 0x64(%rsi), %r13d
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0xab03
movq %rax, 0x8(%rbx)
leaq 0x6c(%r12), %r14
movslq 0x6c(%r12), %rax
movq (%r12), %rcx
shlq $0x6, %rax
movl 0x18(%rcx,%rax), %ebp
movl 0x1c(%rcx,%rax), %r15d
leaq 0x1b1f4(%rip), %rsi     # 0x25d19
movl $0x7, %edi
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1d0d6
cmpl $0x3, %r13d
jl 0xac8c
movslq 0x6c(%r12), %rcx
movq (%r12), %rax
shlq $0x6, %rcx
cmpl %ebp, 0x58(%rax,%rcx)
jne 0xac8c
addq %rcx, %rax
cmpl %r15d, 0x5c(%rax)
jne 0xac8c
leaq 0x1b1dc(%rip), %rsi     # 0x25d47
movl $0x7, %edi
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1d0d6
movl $0x3, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xab9e
movl $0x3, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xabab
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movl (%r14), %eax
incl %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xabca
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xabd7
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movl (%r14), %eax
addl $0x2, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xabf7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xac04
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movl $0x2, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xac26
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xac33
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movl (%r14), %eax
incl %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xac52
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xac5f
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movl (%r14), %eax
addl $0x2, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xac7f
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xac8c
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
cmpl %r15d, %ebp
setg %al
cmpl $0x9, %r15d
setl %cl
orb %al, %cl
jne 0xad41
movl $0x0, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xacc3
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xacd0
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xace9
movl (%r14), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xacf4
movq %rbx, %rdi
movq %r14, %rdx
callq 0xfa3c
movl (%r14), %eax
addl %r13d, %eax
decl %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xad16
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xad23
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xf6da
incl %r15d
shrl %r15d
leaq 0x1b028(%rip), %rsi     # 0x25d58
movl $0x7, %edi
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1d0d6
cmpl $0x9, %ebp
setge %al
cmpl $0x9, %r15d
setge %r12b
cmpl $0x8, %ebp
jg 0xad5e
cmpl $0x9, %r15d
jl 0xaece
decl %r13d
testb $0x1, %al
je 0xae05
movl $0x1, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xad8b
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xad98
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xf6da
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xadb1
movl (%r14), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xadbc
movq %rbx, %rdi
movq %r14, %rdx
callq 0xfa3c
movl (%r14), %eax
addl %r13d, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xaddc
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xade9
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xf6da
incl %ebp
shrl %ebp
movl $0x7, %edi
leaq 0x1af72(%rip), %rsi     # 0x25d6b
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1d0d6
testb $0x1, %r12b
je 0xaead
movl $0x0, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xae31
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xae3e
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xf6da
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xae57
movl (%r14), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xae62
movq %rbx, %rdi
movq %r14, %rdx
callq 0xfa3c
movl (%r14), %eax
addl %r13d, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xae82
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xae8f
movq %rbx, %rdi
leaq 0x4(%rsp), %rdx
callq 0xf6da
incl %r15d
shrl %r15d
movl $0x7, %edi
leaq 0x1aeb7(%rip), %rsi     # 0x25d58
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x1d0d6
cmpl $0x9, %ebp
setge %al
cmpl $0x9, %r15d
setge %r12b
cmpl $0x8, %ebp
jg 0xad61
cmpl $0x8, %r15d
jg 0xad61
leaq 0x1aeab(%rip), %rsi     # 0x25d80
movl $0x7, %edi
xorl %eax, %eax
callq 0x1d0d6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq