// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/transform/squeeze.h
// Function: squeeze(Image&, bool, std::vector<int, std::allocator<int>>&)
bool squeeze(Image &input, bool inverse, std::vector<int> &parameters) {
    std::vector<int> adj_params = parameters; // use a copy so empty (default) parameters remain empty
    if (!adj_params.size()) default_squeeze_parameters(adj_params,input);

    if (inverse) {
      for (int i=adj_params.size()-3; i>=0; i-=3) {
        bool horizontal = adj_params[i]&1; // 0=vertical, 1=horizontal
        bool in_place = !(adj_params[i] & 2);
        int beginc = adj_params[i+1];
        int endc = adj_params[i+2];
        if (endc >= input.channel.size()) {
            e_printf("Invalid parameters for squeeze transform: channel %i does not exist\n",endc);
        }
        int offset;
        if (in_place) offset = endc+1; else offset = input.nb_meta_channels + input.nb_channels;
        for (int c=beginc; c<=endc; c++) {
            if (input.channel[offset+c-beginc].data.size() == 0) {
                // stop unsqueezing luma; keep unsqueezing chroma channels
//                if (input.channel[beginc].w == input.channel[c].w && input.channel[beginc].h == input.channel[c].h) continue;
                input.channel[offset+c-beginc].resize();
            }
            if (horizontal) inv_hsqueeze(input, c, offset+c-beginc);
            else inv_vsqueeze(input, c, offset+c-beginc);
        }
        input.channel.erase(input.channel.begin()+offset,input.channel.begin()+offset+(endc-beginc+1));
      }
    } else {
      for (int i=0; i+2<adj_params.size(); i+=3) {
        bool horizontal = adj_params[i]&1; // 0=vertical, 1=horizontal
        bool in_place = !(adj_params[i] & 2);
        int beginc = adj_params[i+1];
        int endc = adj_params[i+2];
        if (endc >= input.channel.size()) {
            e_printf("Invalid parameters for squeeze transform: channel %i does not exist\n",endc);
        }
        int offset;
        if (in_place) offset = endc+1; else offset = input.nb_meta_channels + input.nb_channels;
        int nb_chans = endc-beginc+1;
        for (int c=beginc; c<=endc; c++) {
            if (horizontal) fwd_hsqueeze(input, c, offset+c-beginc);
            else fwd_vsqueeze(input, c, offset+c-beginc);
        }
      }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x63d8
movq 0x8(%r14), %rax
cmpq (%r14), %rax
jne 0xaff6
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xa985
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
subq %rdi, %rax
testb %bpl, %bpl
je 0xb102
shrq $0x2, %rax
movl %eax, %eax
leaq -0x3(%rax), %rcx
testl %ecx, %ecx
js 0xb1ac
movq %rcx, 0x20(%rsp)
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq (%rsp), %rdx
movl (%rdx,%rcx,4), %r14d
movl -0x8(%rdx,%rax,4), %ebp
movslq -0x4(%rdx,%rax,4), %r15
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x6, %rax
cmpq %r15, %rax
ja 0xb05a
leaq 0x1ad3b(%rip), %rdi     # 0x25d8b
movl %r15d, %esi
xorl %eax, %eax
callq 0x379e
movq %r15, %rax
incl %r15d
movl 0x64(%rbx), %r13d
addl 0x6c(%rbx), %r13d
testb $0x2, %r14b
cmovel %r15d, %r13d
movl %r13d, %r12d
subl %ebp, %eax
movq %rax, 0x18(%rsp)
jl 0xb0d5
movslq %r12d, %rax
movq (%rbx), %rdi
shlq $0x6, %rax
movq 0x8(%rdi,%rax), %rcx
cmpq (%rdi,%rax), %rcx
jne 0xb0a9
addq %rax, %rdi
movslq 0x18(%rdi), %rax
movslq 0x1c(%rdi), %rsi
imulq %rax, %rsi
leaq 0x24(%rdi), %rdx
callq 0xe8d6
testb $0x1, %r14b
jne 0xb0be
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x49ec
jmp 0xb0cb
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x4444
incl %ebp
incl %r12d
cmpl %ebp, %r15d
jne 0xb07c
movslq %r13d, %rsi
shlq $0x6, %rsi
addq (%rbx), %rsi
movslq 0x18(%rsp), %rax
shlq $0x6, %rax
leaq (%rax,%rsi), %rdx
addq $0x40, %rdx
movq %rbx, %rdi
callq 0xfcc2
movq 0x20(%rsp), %rax
jmp 0xb011
cmpq $0x9, %rax
jb 0xb1b0
movl $0x2, %eax
xorl %r13d, %r13d
movl (%rdi,%r13,4), %r14d
movl 0x4(%rdi,%r13,4), %ebp
movslq (%rdi,%rax,4), %r12
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x6, %rax
cmpq %r12, %rax
ja 0xb142
leaq 0x1ac53(%rip), %rdi     # 0x25d8b
movl %r12d, %esi
xorl %eax, %eax
callq 0x379e
cmpl %r12d, %ebp
jg 0xb186
movl 0x64(%rbx), %r15d
addl 0x6c(%rbx), %r15d
incl %r12d
testb $0x2, %r14b
cmovel %r12d, %r15d
testb $0x1, %r14b
jne 0xb16f
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0xa2e2
jmp 0xb17c
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x9b31
incl %ebp
incl %r15d
cmpl %ebp, %r12d
jne 0xb15a
movq %r13, %rax
addq $0x3, %r13
addq $0x5, %rax
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
ja 0xb114
jmp 0xb1b0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb1c2
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb1dd
jmp 0xb1dd
jmp 0xb1dd
jmp 0xb1dd
jmp 0xb1dd
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb1f6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3590