// File: cloudinary[P]fuif/encoding/encoding.cpp
// Function: inv_permute_meta(Image&)
void inv_permute_meta(Image &input) {
    v_printf(5,"Permutation (Meta): ");
    std::vector<Channel> inchannel = input.channel;
    for (int i=0; i<input.channel[0].w; i++) {
        int c = input.channel[0].value(0,i);
        if (c < 0 || c >= input.channel[0].w) {
            e_printf("Invalid permutation: %i is not a channel number\n",c);
            input.error=true;
            return;
        }
        for (int j=0; j<i; j++) if (input.channel[0].value(0,i) == input.channel[0].value(0,j)) {
            e_printf("Invalid permutation: both %i and %i map from channel number %i\n",i,j,input.channel[0].value(0,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);
    }
    v_printf(5,"\n");
    return;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movl $0x5, %edi
leaq 0x284f1(%rip), %rsi     # 0x4745c
movb $0x0, %al
callq 0x3a770
movq 0x90(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0x13580
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
movl %eax, 0x58(%rsp)
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4ba0
movq %rax, %rcx
movl 0x58(%rsp), %eax
cmpl 0x18(%rcx), %eax
jge 0x1f1f4
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x4c(%rsp)
movl %eax, %esi
callq 0x4ba0
movl 0x4c(%rsp), %esi
movq %rax, %rdi
movl 0x74(%rsp), %edx
callq 0x12110
movq %rax, 0x50(%rsp)
jmp 0x1efe1
movq 0x50(%rsp), %rax
movswl (%rax), %eax
movl %eax, 0x70(%rsp)
cmpl $0x0, 0x70(%rsp)
jl 0x1f019
movl 0x70(%rsp), %eax
movl %eax, 0x48(%rsp)
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4ba0
movq %rax, %rcx
movl 0x48(%rsp), %eax
cmpl 0x18(%rcx), %eax
jl 0x1f066
movl 0x70(%rsp), %esi
leaq 0x27ff9(%rip), %rdi     # 0x4701d
xorl %eax, %eax
callq 0x3a670
jmp 0x1f02d
movq 0x90(%rsp), %rax
movb $0x1, 0xa8(%rax)
movl $0x1, 0x60(%rsp)
jmp 0x1f211
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x13680
jmp 0x1f223
movl $0x0, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
cmpl 0x74(%rsp), %eax
jge 0x1f17a
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x3c(%rsp)
movl %eax, %esi
callq 0x4ba0
movl 0x3c(%rsp), %esi
movq %rax, %rdi
movl 0x74(%rsp), %edx
callq 0x12110
movq %rax, 0x40(%rsp)
jmp 0x1f0a8
movq 0x40(%rsp), %rax
movswl (%rax), %eax
movl %eax, 0x28(%rsp)
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x2c(%rsp)
movl %eax, %esi
callq 0x4ba0
movl 0x2c(%rsp), %esi
movq %rax, %rdi
movl 0x5c(%rsp), %edx
callq 0x12110
movq %rax, 0x30(%rsp)
jmp 0x1f0e0
movl 0x28(%rsp), %eax
movq 0x30(%rsp), %rcx
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x1f168
movl 0x74(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, 0x1c(%rsp)
movl %eax, %esi
callq 0x4ba0
movl 0x1c(%rsp), %esi
movq %rax, %rdi
movl 0x74(%rsp), %edx
callq 0x12110
movq %rax, 0x20(%rsp)
jmp 0x1f12c
movl 0x18(%rsp), %edx
movl 0x14(%rsp), %esi
movq 0x20(%rsp), %rax
movswl (%rax), %ecx
leaq 0x27de8(%rip), %rdi     # 0x46f2b
xorl %eax, %eax
callq 0x3a670
jmp 0x1f14c
movq 0x90(%rsp), %rax
movb $0x1, 0xa8(%rax)
movl $0x1, 0x60(%rsp)
jmp 0x1f211
jmp 0x1f16a
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x1f06e
movq 0x90(%rsp), %rax
movl 0x6c(%rax), %eax
movl 0x74(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x78(%rsp), %rdi
callq 0x4ba0
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rdi
movl 0x6c(%rdi), %eax
movl 0x70(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x4ba0
movq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x12390
jmp 0x1f1c5
movl 0x74(%rsp), %edx
movl 0x70(%rsp), %ecx
leaq 0x27d97(%rip), %rsi     # 0x46f6b
xorl %eax, %eax
movl $0x5, %edi
callq 0x3a770
jmp 0x1f1e2
jmp 0x1f1e4
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x1ef8c
leaq 0x296b2(%rip), %rsi     # 0x488ad
xorl %eax, %eax
movl $0x5, %edi
callq 0x3a770
jmp 0x1f209
movl $0x1, 0x60(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x13680
addq $0x98, %rsp
retq
movq 0x68(%rsp), %rdi
callq 0x36a0
nopl (%rax)