// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/transform/permute.h
// Function: inv_permute(Image&, std::vector<int, std::allocator<int>> const&)
bool inv_permute(Image &input, const std::vector<int> &parameters) {
    Image tmp=input;
    bool use_channel = (parameters.size()==0);
    int perm_length;
    if (use_channel) perm_length = input.channel[0].w;
    else perm_length = parameters.size();

    v_printf(5,"Permutation: ");
    for (int i=0; i<perm_length; i++) {
        int c;
        if (use_channel) c = input.channel[0].value(0,i);
        else c = parameters[i];
        // permutation sanity is already checked in meta-step, so no need to double check
        input.channel[input.nb_meta_channels+i] = tmp.channel[tmp.nb_meta_channels+c];
        v_printf(5,"[%i <- %i] ",i,c);
    }
    if (use_channel) {
     input.nb_meta_channels--;
     input.channel.erase(input.channel.begin(),input.channel.begin()+1);
     assert(input.channel[0].w == input.channel.size() - input.nb_meta_channels);
    }
    v_printf(5,"\n");
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, (%rsp)
movq %rdi, %r14
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xe0fe
leaq 0x30(%rsp), %r15
leaq 0x18(%r14), %rsi
movq %r15, %rdi
callq 0xe6be
movups 0x30(%r14), %xmm0
leaq 0x58(%rsp), %rdi
movups %xmm0, -0x10(%rdi)
leaq 0x40(%r14), %rsi
callq 0x63d8
movups 0x58(%r14), %xmm0
movups 0x64(%r14), %xmm1
leaq 0x90(%rsp), %rdi
movups %xmm1, -0x14(%rdi)
movups %xmm0, -0x20(%rdi)
leaq 0x78(%r14), %rsi
callq 0xe748
movups 0x90(%r14), %xmm0
movups 0x99(%r14), %xmm1
movups %xmm1, 0xb1(%rsp)
movups %xmm0, 0xa8(%rsp)
movq (%rsp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rbx
movq %rbx, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
subq %rcx, %rbx
je 0xcb5e
shrq $0x2, %rbx
jmp 0xcb64
movq (%r14), %rax
movl 0x18(%rax), %ebx
leaq 0x1944d(%rip), %rsi     # 0x25fb8
movl $0x5, %edi
xorl %eax, %eax
callq 0x1cede
testl %ebx, %ebx
jle 0xcc34
movl %ebx, %r12d
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0xcba1
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%r13,4), %ebp
movq (%r14), %rax
jmp 0xcbc3
movq (%r14), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq %rdx
leaq 0x24(%rax), %rsi
cmpq %r13, %rdx
leaq (%rcx,%r13,2), %rcx
cmovbeq %rsi, %rcx
movswl (%rcx), %ebp
movslq 0x84(%rsp), %rcx
movslq %ebp, %rbx
addq %rcx, %rbx
shlq $0x6, %rbx
addq 0x18(%rsp), %rbx
movslq 0x6c(%r14), %rcx
movslq %r13d, %r15
addq %rcx, %r15
shlq $0x6, %r15
addq %rax, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xe5dc
movq 0x38(%rbx), %rax
movq %rax, 0x38(%r15)
movups 0x18(%rbx), %xmm0
movups 0x28(%rbx), %xmm1
movups %xmm1, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movl $0x5, %edi
leaq 0x193aa(%rip), %rsi     # 0x25fc6
movl %r13d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1cede
incq %r13
cmpq %r12, %r13
jne 0xcb85
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0xcc53
decl 0x6c(%r14)
movq (%r14), %rsi
leaq 0x40(%rsi), %rdx
movq %r14, %rdi
callq 0xfcc2
leaq 0x1ad2c(%rip), %rsi     # 0x27986
movl $0x5, %edi
xorl %eax, %eax
callq 0x1cede
leaq 0x30(%rsp), %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0xcc88
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xcc9f
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0xe794
leaq 0x18(%rsp), %rdi
callq 0xe188
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcd01
movq %rax, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xcce6
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
jmp 0xcce6
movq %rax, %r14
movq %r15, %rdi
callq 0xe794
jmp 0xccf3
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xe188
jmp 0xcd0e
jmp 0xcd01
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xde46
movq %r14, %rdi
callq 0x3590