// File: cloudinary[P]fuif/transform/squeeze.h
// Function: meta_squeeze(Image&, std::vector<int, std::allocator<int>>&)
void meta_squeeze(Image &image, std::vector<int> &parameters) {
    if (!parameters.size()) default_squeeze_parameters(parameters,image);

    for (int i=0; i+2<parameters.size(); i+=3) {
        bool horizontal = parameters[i] & 1; // 0=vertical, 1=horizontal
        bool in_place = !(parameters[i] & 2);
        int beginc = parameters[i+1];
        int endc = parameters[i+2];
        int offset;
        if (in_place) offset = endc+1; else offset = image.nb_meta_channels + image.nb_channels;
        int nb_chans = endc-beginc+1;
        for (int c=beginc; c<=endc; c++) {
            Channel dummy;
            dummy.hcshift = image.channel[c].hcshift;
            dummy.vcshift = image.channel[c].vcshift;
            dummy.component = image.channel[c].component;
            if (horizontal) {
                int w = image.channel[c].w;
                image.channel[c].w = (w+1)/2;
                image.channel[c].hshift++;
                image.channel[c].hcshift++;
                dummy.w = w-(w+1)/2;
                dummy.h = image.channel[c].h;
            } else {
                int h = image.channel[c].h;
                image.channel[c].h = (h+1)/2;
                image.channel[c].vshift++;
                image.channel[c].vcshift++;
                dummy.h = h-(h+1)/2;
                dummy.w = image.channel[c].w;
            }
            dummy.hshift = image.channel[c].hshift;
            dummy.vshift = image.channel[c].vshift;

            image.channel.insert(image.channel.begin()+offset+c-beginc, dummy);
        }
    }
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x4d50
cmpq $0x0, %rax
jne 0xd61f
movq 0xd8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0xd270
movl $0x0, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
addl $0x2, %eax
cltq
movq %rax, 0x28(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x4d50
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0xda99
movq 0xd8(%rsp), %rdi
movslq 0xd4(%rsp), %rsi
callq 0x12190
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0xd3(%rsp)
movq 0xd8(%rsp), %rdi
movslq 0xd4(%rsp), %rsi
callq 0x12190
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0xd2(%rsp)
movq 0xd8(%rsp), %rdi
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x12190
movl (%rax), %eax
movl %eax, 0xcc(%rsp)
movq 0xd8(%rsp), %rdi
movl 0xd4(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0x12190
movl (%rax), %eax
movl %eax, 0xc8(%rsp)
testb $0x1, 0xd2(%rsp)
je 0xd710
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0xd72d
movq 0xe0(%rsp), %rax
movl 0x6c(%rax), %eax
movq 0xe0(%rsp), %rcx
addl 0x64(%rcx), %eax
movl %eax, 0xc4(%rsp)
movl 0xc8(%rsp), %eax
subl 0xcc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc0(%rsp)
movl 0xcc(%rsp), %eax
movl %eax, 0xbc(%rsp)
movl 0xbc(%rsp), %eax
cmpl 0xc8(%rsp), %eax
jg 0xda81
leaq 0x78(%rsp), %rdi
callq 0x125f0
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x34(%rax), %eax
movl %eax, 0xac(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x38(%rax), %eax
movl %eax, 0xb0(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x3c(%rax), %eax
movl %eax, 0xb4(%rsp)
testb $0x1, 0xd3(%rsp)
je 0xd8ad
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x18(%rax), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x20(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x20(%rsp), %ecx
movl %ecx, 0x18(%rax)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x34(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x34(%rax)
movl 0x74(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x24(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x90(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x1c(%rax), %eax
movl %eax, 0x94(%rsp)
jmp 0xd979
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x1c(%rax), %eax
movl %eax, 0x70(%rsp)
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, 0x18(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x18(%rsp), %ecx
movl %ecx, 0x1c(%rax)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x38(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rax)
movl 0x70(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x70(%rsp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x1c(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x94(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x18(%rax), %eax
movl %eax, 0x90(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x2c(%rax), %eax
movl %eax, 0xa4(%rsp)
movq 0xe0(%rsp), %rdi
movslq 0xbc(%rsp), %rsi
callq 0x4ba0
movl 0x30(%rax), %eax
movl %eax, 0xa8(%rsp)
movq 0xe0(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x127d0
movq %rax, 0x48(%rsp)
movslq 0xc4(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x12800
movq %rax, 0x50(%rsp)
movslq 0xbc(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x12800
movq %rax, 0x58(%rsp)
movslq 0xcc(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x133b0
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x12840
movq 0x8(%rsp), %rdi
movq 0x68(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x12c20
movq %rax, 0x10(%rsp)
jmp 0xda3d
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x12380
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0xd753
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x12380
jmp 0xdaa1
jmp 0xda83
movl 0xd4(%rsp), %eax
addl $0x3, %eax
movl %eax, 0xd4(%rsp)
jmp 0xd62a
addq $0xe8, %rsp
retq
movq 0x40(%rsp), %rdi
callq 0x36a0
nopl (%rax,%rax)