// File: /workspace/github_cpp_makefile_star2_O1/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 0xe196
leaq 0x30(%rsp), %r15
leaq 0x18(%r14), %rsi
movq %r15, %rdi
callq 0xe732
movups 0x30(%r14), %xmm0
leaq 0x58(%rsp), %rdi
movups %xmm0, -0x10(%rdi)
leaq 0x40(%r14), %rsi
callq 0x641c
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 0xe7bc
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 0xcc37
shrq $0x2, %rbx
jmp 0xcc3d
movq (%r14), %rax
movl 0x18(%rax), %ebx
leaq 0x19374(%rip), %rsi     # 0x25fb8
movl $0x5, %edi
xorl %eax, %eax
callq 0x1d0d6
testl %ebx, %ebx
jle 0xcd0a
movl %ebx, %r12d
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0xcc77
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%r13,4), %ebp
jmp 0xcc99
movq (%r14), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq %rdx
addq $0x24, %rax
cmpq %r13, %rdx
leaq (%rcx,%r13,2), %rcx
cmovbeq %rax, %rcx
movswl (%rcx), %ebp
movslq 0x84(%rsp), %rax
movslq %ebp, %rbx
addq %rax, %rbx
shlq $0x6, %rbx
addq 0x18(%rsp), %rbx
movslq 0x6c(%r14), %rax
movslq %r13d, %r15
addq %rax, %r15
shlq $0x6, %r15
addq (%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xe65e
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 0x192d4(%rip), %rsi     # 0x25fc6
movl %r13d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1d0d6
incq %r13
cmpq %r12, %r13
jne 0xcc5e
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0xcd29
decl 0x6c(%r14)
movq (%r14), %rsi
leaq 0x40(%rsi), %rdx
movq %r14, %rdi
callq 0xfd3a
leaq 0x1ac56(%rip), %rsi     # 0x27986
movl $0x5, %edi
xorl %eax, %eax
callq 0x1d0d6
leaq 0x30(%rsp), %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0xcd5e
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xcd75
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0xe808
leaq 0x18(%rsp), %rdi
callq 0xe220
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcdd7
movq %rax, %r14
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0xcdbc
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
jmp 0xcdbc
movq %rax, %r14
movq %r15, %rdi
callq 0xe808
jmp 0xcdc9
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xe220
jmp 0xcde4
jmp 0xcdd7
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xded8
movq %r14, %rdi
callq 0x35a0