// File: /workspace/github_cpp_makefile_star2_O1/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 0x641c
movq 0x8(%r14), %rax
cmpq (%r14), %rax
jne 0xb0f5
movq %rsp, %rdi
movq %rbx, %rsi
callq 0xaae1
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
testb %bpl, %bpl
je 0xb201
shrq $0x2, %rcx
movl %ecx, %eax
leaq -0x3(%rax), %rcx
testl %ecx, %ecx
js 0xb2a9
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 0xb159
leaq 0x1ac3c(%rip), %rdi     # 0x25d8b
movl %r15d, %esi
xorl %eax, %eax
callq 0x3796
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 0xb1d4
movslq %r12d, %rax
movq (%rbx), %rdi
shlq $0x6, %rax
movq 0x8(%rdi,%rax), %rcx
cmpq (%rdi,%rax), %rcx
jne 0xb1a8
addq %rax, %rdi
movslq 0x18(%rdi), %rax
movslq 0x1c(%rdi), %rsi
imulq %rax, %rsi
leaq 0x24(%rdi), %rdx
callq 0xe944
testb $0x1, %r14b
jne 0xb1bd
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x4a56
jmp 0xb1ca
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x4445
incl %ebp
incl %r12d
cmpl %ebp, %r15d
jne 0xb17b
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 0xfd3a
movq 0x20(%rsp), %rax
jmp 0xb110
cmpq $0x9, %rcx
jb 0xb2a9
movl $0x2, %ecx
xorl %r13d, %r13d
movl (%rax,%r13,4), %r14d
movl 0x4(%rax,%r13,4), %ebp
movslq (%rax,%rcx,4), %r12
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x6, %rax
cmpq %r12, %rax
ja 0xb241
leaq 0x1ab54(%rip), %rdi     # 0x25d8b
movl %r12d, %esi
xorl %eax, %eax
callq 0x3796
cmpl %r12d, %ebp
jg 0xb285
movl 0x64(%rbx), %r15d
addl 0x6c(%rbx), %r15d
incl %r12d
testb $0x2, %r14b
cmovel %r12d, %r15d
testb $0x1, %r14b
jne 0xb26e
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0xa31e
jmp 0xb27b
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x9bc7
incl %ebp
incl %r15d
cmpl %ebp, %r12d
jne 0xb259
movq %r13, %rcx
addq $0x3, %r13
addq $0x5, %rcx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rcx, %rdx
ja 0xb213
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb2bf
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 0xb2da
jmp 0xb2da
jmp 0xb2da
jmp 0xb2da
jmp 0xb2da
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xb2f3
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x35a0