// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/transform/permute.h
// Function: meta_permute(Image&, std::vector<int, std::allocator<int>>&, bool)
void meta_permute(Image &input, std::vector<int> &parameters, bool use_channel=false) {
    int nb = input.channel.size() - input.nb_meta_channels;
    if (parameters.size() == 0 || use_channel) {
      input.nb_meta_channels++;
      Channel pch(nb, 1, 0, nb-1);
      pch.hshift = -1;
      input.channel.insert(input.channel.begin(),pch);
    } else if (parameters.size() <= nb) {
      std::vector<Channel> inchannel = input.channel;
      for (int i=0; i<parameters.size(); i++) {
        int c = parameters[i];
        if (c < 0 || c >= parameters.size()) {
            e_printf("Invalid permutation: channel %i is lost\n",c);
            input.error=true;
            return;
        }
        for (int j=0; j<i; j++) if (parameters[i] == parameters[j]) {
            e_printf("Invalid permutation: both %i and %i map from channel number %i\n",i,j,parameters[i]);
            input.error=true;
            return;
        }
        input.channel[input.nb_meta_channels+c] = inchannel[input.nb_meta_channels+i];
        v_printf(5,"[%i -> %i] ",i,c);
      }
    } else {
        e_printf("Incorrect number of parameters in Permute transform.\n");
        input.error=true;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorb $0x1, %dl
movq 0x8(%rdi), %rsi
subq (%rdi), %rsi
shrq $0x6, %rsi
movl 0x6c(%rdi), %eax
subl %eax, %esi
movq 0x8(%r14), %rcx
subq (%r14), %rcx
setne %dil
testb %dl, %dil
jne 0xce8e
incl %eax
movl %eax, 0x6c(%rbx)
leal -0x1(%rsi), %eax
xorl %r10d, %r10d
movswl %ax, %r8d
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
movl $0x1, %r9d
pushq %r10
pushq %r10
pushq %r10
pushq %r10
callq 0xdc18
addq $0x20, %rsp
movl $0xffffffff, 0x2c(%r14) # imm = 0xFFFFFFFF
movq (%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xdf1c
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcfa9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
jmp 0xcfa9
sarq $0x2, %rcx
movslq %esi, %rax
cmpq %rax, %rcx
jbe 0xceb4
leaq 0x191a6(%rip), %rdi     # 0x26047
xorl %eax, %eax
callq 0x3796
movb $0x1, 0xa8(%rbx)
jmp 0xcfa9
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xe196
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
je 0xcf82
sarq $0x2, %rcx
xorl %r15d, %r15d
movslq (%rax,%r15,4), %r13
testq %r13, %r13
js 0xcfb8
cmpq %r13, %rcx
jbe 0xcfb8
testq %r15, %r15
je 0xcf07
xorl %edx, %edx
cmpl (%rax,%rdx,4), %r13d
je 0xcf84
incq %rdx
cmpq %rdx, %r15
jne 0xcef5
movl 0x6c(%rbx), %eax
leal (%r15,%rax), %ecx
movslq %ecx, %rbp
shlq $0x6, %rbp
addq 0x8(%rsp), %rbp
addl %r13d, %eax
movslq %eax, %r12
shlq $0x6, %r12
addq (%rbx), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0xe65e
movq 0x38(%rbp), %rax
movq %rax, 0x38(%r12)
movups 0x18(%rbp), %xmm0
movups 0x28(%rbp), %xmm1
movups %xmm1, 0x28(%r12)
movups %xmm0, 0x18(%r12)
movl $0x5, %edi
leaq 0x190e0(%rip), %rsi     # 0x2603b
movl %r15d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x1d0d6
incq %r15
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0xced8
jmp 0xcf9f
leaq 0x19070(%rip), %rdi     # 0x25ffb
movl %r15d, %esi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x3796
movb $0x1, 0xa8(%rbx)
leaq 0x8(%rsp), %rdi
callq 0xe220
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19013(%rip), %rdi     # 0x25fd2
movl %r13d, %esi
xorl %eax, %eax
callq 0x3796
jmp 0xcf98
jmp 0xcfeb
jmp 0xcfeb
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcff8
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
jmp 0xcff8
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xe220
movq %rbx, %rdi
callq 0x35a0