LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/encoding/../maniac/symbol.h
// Function: int reader<15, SimpleSymbolBitCoder<SimpleBitChance, RacInput24<FileIO>, 15>>(SimpleSymbolBitCoder<SimpleBitChance, RacInput24<FileIO>, 15>&, int, int)
int reader(SymbolCoder& coder, int min, int max) {
    assert(min<=max);
    if (min == max) return min;

    bool sign;
    assert(min <= 0 && max >= 0); // should always be the case, because guess should always be in valid range

      if (coder.read(BIT_ZERO)) return 0;
      if (min < 0) {
        if (max > 0) {
          sign = coder.read(BIT_SIGN);
        } else {sign = false; }
      } else {sign = true; }

    const int amax = (sign? max : -min);
    const int emax = maniac::util::ilog2(amax);

    int e = 0;
    for (; e < emax; e++) {
        if (coder.read(BIT_EXP,e)) break;
    }

    int have = (1 << e);

    for (int pos = e; pos>0;) {
        pos--;
        int minabs1 = have | (1<<pos);
        if (minabs1 > amax) continue; // 1-bit is impossible
        if (coder.read(BIT_MANT,pos)) have = minabs1;
    }
    return (sign ? have : -have);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
cmpl %edx, %esi
jne 0x4971
movl %r15d, %r13d
jmp 0x4a31
movl %edx, %ebp
movq %rdi, %rbx
xorl %r13d, %r13d
xorl %esi, %esi
xorl %edx, %edx
callq 0x15fee
testb %al, %al
jne 0x4a31
movb $0x1, %r14b
testl %r15d, %r15d
jns 0x49ba
testl %ebp, %ebp
jle 0x49b1
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x15fee
movl %eax, %r14d
negl %r15d
testb %al, %al
cmovel %r15d, %ebp
jmp 0x49ba
negl %r15d
xorl %r14d, %r14d
movl %r15d, %ebp
bsrl %ebp, %r13d
xorl %r15d, %r15d
pushq $0x2
popq %r12
testl %ebp, %ebp
je 0x49e5
cmpl %r15d, %r13d
jbe 0x49e5
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x15fee
testb %al, %al
jne 0x49e5
incl %r15d
jmp 0x49c5
movl %r14d, 0x4(%rsp)
pushq $0x1
popq %r12
movl %r15d, %ecx
shll %cl, %r12d
pushq $0x3
popq %r14
testl %r15d, %r15d
jle 0x4a22
decl %r15d
movl %r12d, %r13d
btsl %r15d, %r13d
cmpl %ebp, %r13d
jg 0x49f8
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x15fee
testb %al, %al
cmovnel %r13d, %r12d
jmp 0x49f8
movl %r12d, %r13d
negl %r13d
cmpb $0x0, 0x4(%rsp)
cmovnel %r12d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/image/image.cpp
// Function: colormodel_name(int, int)
const char * colormodel_name(int colormodel, int nb_channels) {
    if (nb_channels == 1) return "Grayscale";
    else if (nb_channels == 2) return "Grayscale+alpha";

    switch (colormodel>>4) {
        case 7: return "Custom other";
        case 6: return "Custom CIE";
        case 5: return "Custom CMYK";
        case 4: return "Custom RGB";
        case 3: return "[RESERVED]";
        case 2:
            if (nb_channels == 3) {
                if (colormodel & 1) return "CIEXYZ";
                else return "CIELAB";
            } else if (nb_channels == 4) {
                if (colormodel & 1) return "CIEXYZ+alpha";
                else return "CIELAB+alpha";
            }
        case 1:
            if (nb_channels == 3) return "CMY";
            else if (nb_channels == 4) return "CMYK";
            else if (nb_channels == 5) return "CMYK+alpha";
            else return "CMYK+";

        case 0:
        default:
            if (nb_channels == 3) return "RGB";
            else if (nb_channels == 4) return "RGBA";
            else return "RGB+";
    }
}

// Assembly:
cmpl $0x1, %esi
je 0x4efe
cmpl $0x2, %esi
jne 0x4f06
leaq 0x18149(%rip), %rax     # 0x1d046
retq
leaq 0x18137(%rip), %rax     # 0x1d03c
retq
movl %edi, %eax
sarl $0x4, %eax
decl %eax
cmpl $0x6, %eax
ja 0x4f57
leaq 0x180eb(%rip), %rcx     # 0x1d004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addl $-0x3, %esi
cmpl $0x3, %esi
jae 0x4fae
movl %esi, %eax
leaq 0x180e9(%rip), %rcx     # 0x1d020
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
retq
leaq 0x18128(%rip), %rax     # 0x1d06e
retq
leaq 0x18137(%rip), %rax     # 0x1d085
retq
leaq 0x18124(%rip), %rax     # 0x1d07a
retq
cmpl $0x4, %esi
leaq 0x1816c(%rip), %rax     # 0x1d0cd
leaq 0x1816a(%rip), %rcx     # 0x1d0d2
cmoveq %rax, %rcx
cmpl $0x3, %esi
leaq 0x1810b(%rip), %rax     # 0x1d081
cmovneq %rcx, %rax
retq
cmpl $0x5, %esi
je 0x4fcd
cmpl $0x4, %esi
je 0x4fb6
cmpl $0x3, %esi
jne 0x4fae
testb $0x1, %dil
leaq 0x18102(%rip), %rcx     # 0x1d097
leaq 0x180f4(%rip), %rax     # 0x1d090
jmp 0x4fc8
leaq 0x180be(%rip), %rax     # 0x1d063
retq
leaq 0x180a9(%rip), %rax     # 0x1d056
retq
leaq 0x18112(%rip), %rax     # 0x1d0c7
retq
testb $0x1, %dil
leaq 0x180ea(%rip), %rcx     # 0x1d0ab
leaq 0x180d6(%rip), %rax     # 0x1d09e
cmoveq %rcx, %rax
retq
leaq 0x180e8(%rip), %rax     # 0x1d0bc
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/image/image.cpp
// Function: Channel::actual_minmax(short*, short*) const
void Channel::actual_minmax(pixel_type *min, pixel_type *max) const {
    pixel_type realmin=LARGEST_VAL;
    pixel_type realmax=SMALLEST_VAL;
    for (int i=0; i<data.size(); i++) {
        if (data[i] < realmin) realmin = data[i];
        if (data[i] > realmax) realmax = data[i];
    }
    *min = realmin;
    *max = realmax;
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
sarq %rcx
movw $0x8001, %r9w           # imm = 0x8001
movw $0x7fff, %di            # imm = 0x7FFF
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x503d
movzwl (%rax,%r8,2), %r10d
cmpw %di, %r10w
cmovll %r10d, %edi
cmpw %r9w, %r10w
cmovlel %r9d, %r10d
incq %r8
movl %r10d, %r9d
jmp 0x501b
movw %di, (%rsi)
movw %r9w, (%rdx)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/image/image.cpp
// Function: Image::undo_transforms(int)
void Image::undo_transforms(int keep) {
    while ( transform.size() > keep ) {
            Transform t = transform.back();
            v_printf(4,"Undoing transform %s\n",t.name());
            bool result = t.apply(*this, true);
            if (result == false) {
                e_printf("Error while undoing transform %s.\n",t.name());
                error = true;
                return;
            }
            v_printf(8,"Undoing transform %s: done\n",t.name());
            transform.pop_back();
    }
    if (!keep) { // clamp the values to the valid range (lossy compression can produce values outside the range)
        for (int i=0; i<channel.size(); i++) {
            for (int j=0; j<channel[i].data.size(); j++) {
                channel[i].data[j] = CLAMP(channel[i].data[j], minval, maxval);
            }
        }
    }
//    recompute_minmax();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movslq %esi, %rbp
leaq 0x18(%rsp), %r12
leaq 0x275c5(%rip), %r15     # 0x2c638
pushq $0x1
popq %r14
movq 0x20(%rbx), %rsi
movq %rsi, %rax
subq 0x18(%rbx), %rax
sarq $0x5, %rax
cmpq %rbp, %rax
jbe 0x512c
addq $-0x20, %rsi
movq %r12, %rdi
callq 0x52d0
movslq 0x18(%rsp), %rax
movq (%r15), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rdx
pushq $0x4
popq %rdi
leaq 0x1805e(%rip), %rsi     # 0x1d113
xorl %eax, %eax
callq 0x16c30
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0xa246
movl %eax, %r13d
movslq 0x18(%rsp), %rax
movq (%r15), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rdx
testb %r13b, %r13b
je 0x50ff
pushq $0x8
popq %rdi
leaq 0x18060(%rip), %rsi     # 0x1d14c
xorl %eax, %eax
callq 0x16c30
movq 0x10(%rsp), %rdi
callq 0x52e2
jmp 0x5117
leaq 0x18023(%rip), %rdi     # 0x1d129
movq %rdx, %rsi
xorl %eax, %eax
callq 0x16b80
movb $0x1, 0xa8(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x5374
testb %r13b, %r13b
jne 0x5077
jmp 0x5133
cmpl $0x0, 0xc(%rsp)
je 0x5142
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x6, %rcx
xorl %edx, %edx
cmpq %rcx, %rdx
je 0x5133
movq %rdx, %rdi
shlq $0x6, %rdi
movq (%rax,%rdi), %rsi
movq 0x8(%rax,%rdi), %rdi
subq %rsi, %rdi
sarq %rdi
movl 0x5c(%rbx), %r8d
xorl %r9d, %r9d
cmpq %r9, %rdi
je 0x519a
movswl (%rsi,%r9,2), %r10d
movl 0x60(%rbx), %r11d
cmpl %r10d, %r11d
cmovgel %r10d, %r11d
cmpl %r10d, %r8d
cmovgl %r8d, %r11d
movw %r11w, (%rsi,%r9,2)
incq %r9
jmp 0x5174
incq %rdx
jmp 0x5152
jmp 0x51a1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5374
movq %rbx, %rdi
callq 0x35d0
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/image/image.cpp
// Function: Image::do_transform(Transform const&)
bool Image::do_transform(const Transform &tr) {
    Transform t = tr;
    bool did_it = t.apply(*this, false);
    if (did_it) transform.push_back(t);
    return did_it;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x52d0
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xa246
movl %eax, %ebp
testb %al, %al
je 0x51ee
addq $0x18, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x52fa
leaq 0x8(%rsp), %rdi
callq 0x5374
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5374
movq %rbx, %rdi
callq 0x35d0
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/image/image.cpp
// Function: Image::recompute_downscales()
void Image::recompute_downscales() {
    downscales[0] = nb_meta_channels + nb_channels -1; // we have an LQIP when each component has had its first scan
    for (int s=1; s<6; s++) {
        downscales[s] = channel.size()-1;
        for (int k=downscales[s-1]; k<channel.size(); k++) {
            // has to be possible to decode downscaled image with a buffer the size of the final image, so once we need a larger buffer, we went too far
            if ((1<<channel[k].hcshift) < RESPONSIVE_SIZE(s) || (1<<channel[k].vcshift) < RESPONSIVE_SIZE(s)) break;

            // all channels should ideally be available in the required size (though chroma subsampling may cause this to be not true)
            if ((1<<channel[k].hcshift) == RESPONSIVE_SIZE(s) && (1<<channel[k].vcshift) == RESPONSIVE_SIZE(s)) downscales[s] = k;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x6c(%rdi), %eax
movl 0x64(%rdi), %ecx
leal -0x1(%rax,%rcx), %r8d
movl %r8d, 0x90(%rdi)
movq (%rdi), %rdx
movq 0x8(%rdi), %rsi
subq %rdx, %rsi
sarq $0x6, %rsi
leal -0x1(%rsi), %r9d
addq $0x38, %rdx
movabsq $0x1, %rax
movl $0x20, %r10d
movl $0x1, %r11d
cmpq $0x6, %rax
je 0x52c6
movl %r9d, 0x90(%rdi,%rax,4)
movl %r10d, %ebx
movl %eax, %ecx
shrl %cl, %ebx
movslq %r8d, %r14
movq %r14, %r15
shlq $0x6, %r15
addq %rdx, %r15
movl %r9d, %r8d
cmpq %r14, %rsi
jbe 0x52c1
movb -0x4(%r15), %cl
movl %r11d, %ebp
shll %cl, %ebp
cmpl %ebx, %ebp
jl 0x52c1
movb (%r15), %cl
movl %r11d, %r12d
shll %cl, %r12d
cmpl %ebx, %r12d
jl 0x52c1
xorl %ebx, %ebp
xorl %ebx, %r12d
orl %ebp, %r12d
jne 0x52b8
movl %r14d, 0x90(%rdi,%rax,4)
movl %r14d, %r8d
incq %r14
addq $0x40, %r15
jmp 0x5283
incq %rax
jmp 0x525e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/subsample.h
// Function: check_subsample_parameters(std::vector<int, std::allocator<int>>&)
void check_subsample_parameters(std::vector<int> &parameters) {
    if (parameters.size() == 1) {
        // special case: abbreviated parameters for some common cases
        switch (parameters[0]) {
            case 0:     // 4:2:0
                parameters[0] = 1;
                parameters.push_back(2);
                parameters.push_back(2);
                parameters.push_back(2);
                break;
            case 1:     // 4:2:2
                parameters[0] = 1;
                parameters.push_back(2);
                parameters.push_back(2);
                parameters.push_back(1);
                break;
            case 2:     // 4:4:0
                parameters[0] = 1;
                parameters.push_back(2);
                parameters.push_back(1);
                parameters.push_back(2);
                break;
            case 3:     // 4:1:1
                parameters[0] = 1;
                parameters.push_back(2);
                parameters.push_back(4);
                parameters.push_back(1);
                break;
            default:
                break;
        }
    }
    if (parameters.size() % 4) {
        e_printf("Error: invalid parameters for subsampling.\n");
        parameters.clear();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
jne 0x5992
movl (%rax), %ecx
cmpq $0x3, %rcx
ja 0x5992
leaq 0x17930(%rip), %rdx     # 0x1d200
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x1, (%rax)
pushq $0x2
popq %rbp
leaq 0x4(%rsp), %r14
movl %ebp, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl %ebp, (%r14)
jmp 0x5972
pushq $0x1
popq %rbp
movl %ebp, (%rax)
pushq $0x2
popq %r15
leaq 0x4(%rsp), %r14
movl %r15d, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl %ebp, (%r14)
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl %r15d, (%r14)
jmp 0x5985
pushq $0x1
popq %rbp
movl %ebp, (%rax)
leaq 0x4(%rsp), %r14
movl $0x2, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl $0x4, (%r14)
jmp 0x5972
pushq $0x1
popq %rbp
movl %ebp, (%rax)
pushq $0x2
popq %r15
leaq 0x4(%rsp), %r14
movl %r15d, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl %r15d, (%r14)
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl %ebp, (%r14)
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0xb266
movl 0x8(%rbx), %eax
subl (%rbx), %eax
testb $0xc, %al
je 0x59b6
leaq 0x17dec(%rip), %rdi     # 0x1d78e
xorl %eax, %eax
callq 0x16b80
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x59b6
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/subsample.h
// Function: meta_subsample(Image&, std::vector<int, std::allocator<int>>)
void meta_subsample(Image &input, std::vector<int> parameters) {
    check_subsample_parameters(parameters);
    if (parameters.size())
    for (int i=0; i<parameters.size(); i+=4) {
        int c1 = parameters[i+0];
        int c2 = parameters[i+1];
        int srh = parameters[i+2];
        int srv = parameters[i+3];
        assert (srh == 1 || srh == 2);
        assert (srv == 1 || srv == 2);
        int srhshift = (srh==1?0:1);
        int srvshift = (srv==1?0:1);
        for (int c=c1; c<=c2; c++) {
          input.channel[c].w += srh-1;
          input.channel[c].w /= srh;
          input.channel[c].h += srv-1;
          input.channel[c].h /= srv;
          input.channel[c].hshift += srhshift;
          input.channel[c].vshift += srvshift;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x589f
movq (%r14), %rcx
movq 0x8(%r14), %rsi
subq %rcx, %rsi
je 0x5f94
sarq $0x2, %rsi
xorl %edi, %edi
movdqa 0x1775c(%rip), %xmm0    # 0x1d670
cmpq %rdi, %rsi
jbe 0x5f94
movslq (%rcx,%rdi,4), %r8
movslq 0x4(%rcx,%rdi,4), %r9
movq 0x8(%rcx,%rdi,4), %r10
movq %r10, %xmm1
pcmpeqd %xmm0, %xmm1
pandn %xmm0, %xmm1
leal -0x1(%r10), %r11d
movq (%rbx), %rax
movq %r10, %r14
shrq $0x20, %r14
leal -0x1(%r14), %ebp
movq %r8, %rdx
shlq $0x6, %rdx
leaq (%rax,%rdx), %r15
addq $0x18, %r15
cmpq %r9, %r8
jg 0x5f8e
movl (%r15), %eax
addl %r11d, %eax
cltd
idivl %r10d
movl %eax, (%r15)
movl 0x4(%r15), %eax
addl %ebp, %eax
cltd
idivl %r14d
movl %eax, 0x4(%r15)
movq 0x14(%r15), %xmm2
paddd %xmm1, %xmm2
movq %xmm2, 0x14(%r15)
incq %r8
addq $0x40, %r15
jmp 0x5f55
addq $0x4, %rdi
jmp 0x5f14
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/dct.h
// Function: DCT1d(double const*, int, double*)
void DCT1d(const double* in, int stride, double* out) {
  for (int x = 0; x < 8; ++x) {
    out[x * stride] = 0.0;
    for (int u = 0; u < 8; ++u) {
      out[x * stride] += kDCTMatrix[8 * x + u] * in[u * stride];
    }
  }
}

// Assembly:
movslq %esi, %rax
leaq (,%rax,8), %rcx
leaq 0x17267(%rip), %rsi     # 0x1d270
xorl %r8d, %r8d
cmpq $0x8, %r8
je 0x6054
movq %r8, %r9
imulq %rax, %r9
andq $0x0, (%rdx,%r9,8)
xorpd %xmm0, %xmm0
movq %rdi, %r10
xorl %r11d, %r11d
cmpq $0x8, %r11
je 0x604b
movsd (%rsi,%r11,8), %xmm1
mulsd (%r10), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%r9,8)
incq %r11
addq %rcx, %r10
jmp 0x6028
incq %r8
addq $0x40, %rsi
jmp 0x600c
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/dct.h
// Function: IDCT1d(double const*, int, double*)
void IDCT1d(const double* in, int stride, double* out) {
  for (int x = 0; x < 8; ++x) {
    out[x * stride] = 0.0;
    for (int u = 0; u < 8; ++u) {
      out[x * stride] += kDCTMatrix[8 * u + x] * in[u * stride];
    }
  }
}

// Assembly:
movslq %esi, %rax
leaq (,%rax,8), %rcx
leaq 0x17209(%rip), %rsi     # 0x1d270
xorl %r8d, %r8d
cmpq $0x8, %r8
je 0x60b6
movq %r8, %r9
imulq %rax, %r9
andq $0x0, (%rdx,%r9,8)
xorpd %xmm0, %xmm0
movq %rdi, %r10
xorl %r11d, %r11d
cmpq $0x200, %r11            # imm = 0x200
je 0x60ad
movsd (%rsi,%r11), %xmm1
mulsd (%r10), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%r9,8)
addq $0x40, %r11
addq %rcx, %r10
jmp 0x6086
incq %r8
addq $0x8, %rsi
jmp 0x606a
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/dct.h
// Function: TransformBlock(double*, void (*)(double const*, int, double*))
void TransformBlock(double block[64], Transform1d f) {
  double tmp[64];
  for (int x = 0; x < 8; ++x) {
    f(&block[x], 8, &tmp[x]);
  }
  for (int y = 0; y < 8; ++y) {
    f(&tmp[8 * y], 1, &block[8 * y]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
pushq $0x8
popq %rbp
cmpq $0x40, %r15
je 0x60e8
leaq (%r14,%r15), %rdi
leaq (%rsp,%r15), %rdx
movl %ebp, %esi
callq *%rbx
addq $0x8, %r15
jmp 0x60d0
xorl %r15d, %r15d
pushq $0x1
popq %rbp
cmpq $0x200, %r15            # imm = 0x200
je 0x6109
leaq (%rsp,%r15), %rdi
leaq (%r14,%r15), %rdx
movl %ebp, %esi
callq *%rbx
addq $0x40, %r15
jmp 0x60ee
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/quantize.h
// Function: inv_quantize(Image&, std::vector<int, std::allocator<int>> const&)
bool inv_quantize(Image &input, const std::vector<int> &parameters) {
    for (int c=input.nb_meta_channels; c<input.channel.size(); c++) {
        Channel &ch = input.channel[c];
        if (ch.data.size() == 0) continue;
        int q = ch.q;
        if (q == 1) continue;
        v_printf(3,"De-quantizing channel %i with quantization constant %i\n",c,q);
        for (int y=0; y<ch.h; y++) {
          for (int x=0; x<ch.w; x++) {
            ch.value(y,x) *= q;
          }
        }
        ch.minval *= q;
        ch.maxval *= q;
        ch.q = 1;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x6c(%rdi), %r14
movq (%rbx), %r12
movq 0x8(%rbx), %rax
subq %r12, %rax
sarq $0x6, %rax
cmpq %r14, %rax
jbe 0x6ddf
movq %r14, %rax
shlq $0x6, %rax
movq 0x8(%r12,%rax), %rcx
cmpq (%r12,%rax), %rcx
je 0x6dd7
addq %rax, %r12
movl 0x28(%r12), %r13d
cmpl $0x1, %r13d
je 0x6dd7
xorl %r15d, %r15d
pushq $0x3
popq %rdi
leaq 0x16bd9(%rip), %rsi     # 0x1d94d
movl %r14d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x16c30
cmpl 0x1c(%r12), %r15d
jge 0x6db2
xorl %ebp, %ebp
cmpl 0x18(%r12), %ebp
jge 0x6dad
movq %r12, %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0xa44a
movzwl (%rax), %ecx
imulw %r13w, %cx
movw %cx, (%rax)
incl %ebp
jmp 0x6d8a
incl %r15d
jmp 0x6d81
movq 0x20(%r12), %xmm0
movd %r13d, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pmullw %xmm0, %xmm1
movd %xmm1, 0x20(%r12)
movl $0x1, 0x28(%r12)
incq %r14
jmp 0x6d30
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/quantize.h
// Function: fwd_quantize(Image&, std::vector<int, std::allocator<int>>&)
bool fwd_quantize(Image &input, std::vector<int> &parameters) {
    for (int c=input.nb_meta_channels; c<input.channel.size(); c++) {
        Channel &ch = input.channel[c];
        int q = (c < parameters.size() ? parameters[c] : parameters.back());
        v_printf(3,"Quantizing channel %i with quantization constant %i\n",c,q);
        for (int y=0; y<ch.h; y++) {
          for (int x=0; x<ch.w; x++) {
            ch.value(y,x) = rounded_div(ch.value(y,x),q);
          }
        }
        ch.minval /= q;
        ch.maxval /= q;
        ch.q = q;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movslq 0x6c(%rdi), %r15
movq 0x10(%rsp), %rax
movq (%rax), %r13
movq 0x8(%rax), %rax
subq %r13, %rax
sarq $0x6, %rax
cmpq %r15, %rax
jbe 0x6ed7
movq %r15, %rax
shlq $0x6, %rax
addq %rax, %r13
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
addq $-0x4, %rcx
cmpq %r15, %rdx
leaq (%rax,%r15,4), %rax
cmovbeq %rcx, %rax
movl (%rax), %r12d
xorl %ebp, %ebp
pushq $0x3
popq %rdi
leaq 0x16b1f(%rip), %rsi     # 0x1d985
movl %r15d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x16c30
cmpl 0x1c(%r13), %ebp
jge 0x6eaf
xorl %ebx, %ebx
cmpl 0x18(%r13), %ebx
jge 0x6eab
movq %r13, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xa44a
movswl (%rax), %eax
cltd
idivl %r12d
movl %eax, %r14d
movq %r13, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xa44a
movw %r14w, (%rax)
incl %ebx
jmp 0x6e7b
incl %ebp
jmp 0x6e73
movswl 0x20(%r13), %eax
cltd
idivl %r12d
movw %ax, 0x20(%r13)
movswl 0x22(%r13), %eax
cltd
idivl %r12d
movw %ax, 0x22(%r13)
movl %r12d, 0x28(%r13)
incq %r15
jmp 0x6e0c
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/ycocg.h
// Function: fwd_YCoCg(Image&)
bool fwd_YCoCg(Image &input) {
    int nb_channels = input.nb_channels;
    if (nb_channels < 3) {
        //e_printf("Invalid number of channels to apply YCoCg.\n");
        return false;
    }
    int m = input.nb_meta_channels;
    int w = input.channel[m+0].w;
    int h = input.channel[m+0].h;
    if (input.channel[m+1].w < w
     || input.channel[m+1].h < h
     || input.channel[m+2].w < w
     || input.channel[m+2].h < h) {
        e_printf("Invalid channel dimensions to apply YCoCg.\n");
        return false;
    }
    for (int y=0; y<h; y++) {
      for (int x=0; x<w; x++) {
        int R = input.channel[m+0].value(y,x);
        int G = input.channel[m+1].value(y,x);
        int B = input.channel[m+2].value(y,x);
        int Y = (((R + B)>>1) + G)>>1;
        int Co = R - B;
        int Cg = G - ((R + B)>>1);
        input.channel[m+0].value(y,x) = Y;
        input.channel[m+1].value(y,x) = Co;
        input.channel[m+2].value(y,x) = Cg;
      }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x3, 0x64(%rdi)
jge 0x6f18
xorl %ebx, %ebx
jmp 0x6f82
movq %rdi, %rbx
movslq 0x6c(%rdi), %rcx
movq (%rdi), %rax
movq %rcx, %rsi
shlq $0x6, %rsi
movl 0x18(%rax,%rsi), %r8d
leaq 0x1(%rcx), %r13
shlq $0x6, %r13
cmpl %r8d, 0x18(%rax,%r13)
jl 0x6f72
movq %rcx, %rdx
movl 0x1c(%rax,%rsi), %r9d
leaq (%rax,%r13), %rcx
cmpl %r9d, 0x1c(%rcx)
jl 0x6f72
movl %r8d, %edi
addq $0x2, %rdx
shlq $0x6, %rdx
movq %rdx, (%rsp)
cmpl %r8d, 0x18(%rax,%rdx)
jl 0x6f72
movl %r9d, %r8d
addq (%rsp), %rax
cmpl %r9d, 0x1c(%rax)
jge 0x6f93
leaq 0x16ac7(%rip), %rdi     # 0x1da40
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x16b80
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
testl %edi, %edi
cmovlel %ebp, %edi
movl %edi, 0x10(%rsp)
testl %r8d, %r8d
cmovlel %ebp, %r8d
movl %r8d, 0xc(%rsp)
movq %rsi, 0x18(%rsp)
movq %r13, 0x20(%rsp)
cmpl 0xc(%rsp), %ebp
je 0x7095
xorl %r14d, %r14d
cmpl %r14d, 0x10(%rsp)
je 0x708e
movq (%rbx), %rdi
addq 0x18(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0xa44a
movswl (%rax), %r15d
movq (%rbx), %rdi
addq %r13, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0xa44a
movswl (%rax), %r12d
movl %r12d, 0x14(%rsp)
movq (%rbx), %rdi
addq (%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0xa44a
movswl (%rax), %eax
movq %r15, %rcx
leal (%rax,%r15), %r13d
movl %ebp, %r15d
movq %rbx, %rbp
movl %r13d, %ebx
shrl %ebx
sarl %r13d
addl %r12d, %r13d
shrl %r13d
subl %eax, %ecx
movq %rcx, %r12
movq (%rbp), %rdi
addq 0x18(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0xa44a
movw %r13w, (%rax)
movq 0x20(%rsp), %r13
movq (%rbp), %rdi
addq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0xa44a
movw %r12w, (%rax)
movl 0x14(%rsp), %r12d
subl %ebx, %r12d
movq %rbp, %rbx
movl %r15d, %ebp
movq (%rbx), %rdi
addq (%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0xa44a
movw %r12w, (%rax)
incl %r14d
jmp 0x6fc1
incl %ebp
jmp 0x6fb4
movb $0x1, %bl
jmp 0x6f82
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/palette.h
// Function: meta_palette(Image&, std::vector<int, std::allocator<int>>)
void meta_palette(Image &input, std::vector<int> parameters) {
    if (parameters.size() != 3) {
        e_printf("Error: Palette transform with incorrect parameters.\n");
        input.error = true; return;
    }
    int begin_c = input.nb_meta_channels+parameters[0];
    int end_c = input.nb_meta_channels+parameters[1];
    if (begin_c > end_c || end_c >= input.channel.size()) {
        e_printf("Error: Palette transform with incorrect parameters.\n");
        input.error = true; return;
    }
    int nb = end_c - begin_c + 1;
    int &nb_colors = parameters[2];
    input.nb_meta_channels++;
    input.nb_channels -= nb-1;
    input.channel.erase(input.channel.begin()+begin_c+1,input.channel.begin()+end_c+1);
    Channel pch(nb_colors,nb, 0, 1);
    pch.hshift = -1;
    input.channel.insert(input.channel.begin(),pch);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %rax
subq %r14, %rax
cmpq $0xc, %rax
jne 0x73d7
movl (%r14), %eax
movl 0x4(%r14), %ecx
movl %ecx, %ebp
subl %eax, %ebp
jl 0x73d7
movl 0x6c(%rbx), %esi
addl %esi, %ecx
movslq %ecx, %rcx
movq (%rbx), %rdx
movq 0x8(%rbx), %rdi
subq %rdx, %rdi
sarq $0x6, %rdi
cmpq %rcx, %rdi
jbe 0x73d7
addl %esi, %eax
incl %esi
movl %esi, 0x6c(%rbx)
subl %ebp, 0x64(%rbx)
incl %ebp
cltq
shlq $0x6, %rax
leaq (%rdx,%rax), %rsi
addq $0x40, %rsi
shlq $0x6, %rcx
addq %rcx, %rdx
addq $0x40, %rdx
movq %rbx, %rdi
callq 0xa676
movl 0x8(%r14), %esi
andl $0x0, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x20(%rsp), %r14
pushq $0x1
popq %r8
movq %r14, %rdi
movl %ebp, %edx
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0xa470
orl $-0x1, 0x2c(%r14)
movq (%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xa7c8
leaq 0x20(%rsp), %rdi
callq 0xabc2
jmp 0x73ec
leaq 0x166b9(%rip), %rdi     # 0x1da97
xorl %eax, %eax
callq 0x16b80
movb $0x1, 0xa8(%rbx)
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xabc2
movq %rbx, %rdi
callq 0x35d0
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/2dmatch.h
// Function: compute_offset(int, int&, int&)
void compute_offset(int code, int &xoffset, int &yoffset) {
    int onion_layer = 0;
    int onion_layer_size = 4;
    int ocode=code;
    while (code > onion_layer_size) { code -= onion_layer_size; onion_layer++; onion_layer_size += 4; }
    if (onion_layer & 1) {
        // odd layer: going right to left
        if (code <= onion_layer) {
            xoffset = 1 + onion_layer;  yoffset = -code;   // right vertical bottom-to-top segment
        } else if (code <= 3+3*onion_layer) {
            xoffset = 2 +2*onion_layer - code;  yoffset = -1-onion_layer;   // horizontal right-to-left segment
        } else {
            xoffset = -1 - onion_layer;  yoffset = -4 -4*onion_layer + code;    // left vertical top-to-bottom segment
        }
    } else {
        // even layer: going left to right
        if (code <= 1+onion_layer) {
            xoffset = -1 - onion_layer;  yoffset = 1-code;   // left vertical bottom-to-top segment
        } else if (code <= 4+3*onion_layer) {
            xoffset = -3 -2*onion_layer + code;  yoffset = -1-onion_layer;   // horizontal left-to-right segment
        } else {
            xoffset = 1 + onion_layer;  yoffset = -5 -4*onion_layer + code;    // right vertical top-to-bottom segment
        }
    }
}

// Assembly:
xorl %ecx, %ecx
pushq $0x1
popq %rax
pushq $0x3
popq %r8
xorl %r9d, %r9d
movl %edi, %r10d
leal 0x4(%r9), %r11d
subl %r11d, %r10d
jle 0x85cd
addl $0x2, %ecx
incl %eax
addl $0x3, %r8d
movl %r11d, %r9d
movl %r10d, %edi
jmp 0x85b3
leal -0x1(%rax), %r10d
testb $0x1, %r10b
jne 0x85ed
cmpl %eax, %edi
jle 0x8603
incl %r8d
cmpl %r8d, %edi
jle 0x8616
movl %eax, (%rsi)
subl %r9d, %edi
addl $-0x5, %edi
jmp 0x862a
cmpl %r10d, %edi
jle 0x8610
cmpl %r8d, %edi
jle 0x861f
negl %eax
movl %eax, (%rsi)
subl %r9d, %edi
addl $-0x4, %edi
jmp 0x862a
negl %eax
movl %eax, (%rsi)
pushq $0x1
popq %rax
subl %edi, %eax
movl %eax, %edi
jmp 0x862a
negl %edi
movl %eax, (%rsi)
jmp 0x862a
subl %ecx, %edi
addl $-0x3, %edi
movl %edi, (%rsi)
jmp 0x8626
subl %edi, %ecx
addl $0x2, %ecx
movl %ecx, (%rsi)
negl %eax
movl %eax, %edi
movl %edi, (%rdx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/2dmatch.h
// Function: make_offsets_table(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&)
void make_offsets_table(offsets &t) {
    for (int i=1; i<t.size(); i++) {
        int xoffset, yoffset;
        compute_offset(i,xoffset,yoffset);
        t[i].first = xoffset;
        t[i].second = yoffset;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq (%rdi), %r12
movq 0x8(%rdi), %r13
subq %r12, %r13
sarq $0x3, %r13
pushq $0x1
popq %rbx
leaq 0xc(%rsp), %r14
leaq 0x8(%rsp), %r15
cmpq %rbx, %r13
jbe 0x867d
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x85a4
movl 0xc(%rsp), %eax
movl %eax, (%r12,%rbx,8)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%r12,%rbx,8)
incq %rbx
jmp 0x8655
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/2dmatch.h
// Function: default_match_parameters(std::vector<int, std::allocator<int>>&, Image const&)
void default_match_parameters(std::vector<int> &parameters, const Image &image) {
    parameters.clear();
    parameters.push_back(0); // first channel
    parameters.push_back(image.nb_channels - 1); // last channel
    parameters.push_back(0);  // 0 = only exact matches, 1 = soft match (difference gets encoded)
    parameters.push_back(1000000); // max distance (positive = search all, negative = look at corresponding positions in previous frames only)
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
cmpq %rax, 0x8(%rdi)
je 0x86a7
movq %rax, 0x8(%rbx)
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb266
movl 0x64(%r14), %eax
decl %eax
movl %eax, (%r15)
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
andl $0x0, (%r14)
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb266
movl $0xf4240, (%r14)        # imm = 0xF4240
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xb266
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/2dmatch.h
// Function: meta_match(Image&, std::vector<int, std::allocator<int>>&)
void meta_match(Image &input, std::vector<int> &parameters) {
    if (!parameters.size()) default_match_parameters(parameters,input);
    if (parameters.size() < 3) {
        e_printf("Error: match transform with incorrect parameters.\n");
        input.error = true; return;
    }
    int begin_c = input.nb_meta_channels+parameters[0];
    int end_c = input.nb_meta_channels+parameters[1];
    if (begin_c > end_c || end_c >= input.channel.size()) {
        e_printf("Error: match transform with incorrect parameters.\n");
        input.error = true; return;
    }
    input.nb_meta_channels++;
    Channel mch(input.channel[begin_c].w,input.channel[begin_c].h, 0, 1);
    input.channel.insert(input.channel.begin(),mch);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq (%rsi), %rcx
movq 0x8(%rsi), %rax
cmpq %rcx, %rax
jne 0x8b70
movq %rsi, %r14
movq %rsi, %rdi
movq %rbx, %rsi
callq 0x868b
movq (%r14), %rcx
movq 0x8(%r14), %rax
subq %rcx, %rax
cmpq $0x8, %rax
jbe 0x8bf5
movl (%rcx), %eax
movl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jg 0x8bf5
movl 0x6c(%rbx), %edx
addl %edx, %ecx
movslq %ecx, %rsi
movq (%rbx), %rcx
movq 0x8(%rbx), %rdi
subq %rcx, %rdi
sarq $0x6, %rdi
cmpq %rsi, %rdi
jbe 0x8bf5
addl %edx, %eax
incl %edx
movl %edx, 0x6c(%rbx)
cltq
shlq $0x6, %rax
movl 0x18(%rcx,%rax), %esi
movl 0x1c(%rcx,%rax), %edx
andl $0x0, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x28(%rsp), %r14
pushq $0x1
popq %r8
movq %r14, %rdi
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0xa470
movq (%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xa7c8
leaq 0x28(%rsp), %rdi
callq 0xabc2
jmp 0x8c0a
leaq 0x1517b(%rip), %rdi     # 0x1dd77
xorl %eax, %eax
callq 0x16b80
movb $0x1, 0xa8(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xabc2
movq %rbx, %rdi
callq 0x35d0
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/2dmatch.h
// Function: matches(Image&, int, int, int, int, int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, bool)
bool matches(Image &img, int c0, int cn, int x, int y, int z, offsets &ot, bool newmatch) {
    int x2 = x+ot[z].first;
    int y2 = y+ot[z].second;
    if (y2<0 || x2<0) return false;
    if (x2 >= img.channel[c0].w) return false;
    if (newmatch && img.channel[0].value(y,x)) return false;
    for (int c=c0; c<=cn; c++)
        if (img.channel[c].value(y,x) != img.channel[c].value(y2,x2)) return false;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq 0x60(%rsp), %rax
movslq %r9d, %rdx
movq (%rax), %rax
movl (%rax,%rdx,8), %r15d
movl %ecx, 0x4(%rsp)
addl %ecx, %r15d
movl 0x4(%rax,%rdx,8), %eax
movl %r8d, 0x8(%rsp)
addl %r8d, %eax
movl %eax, 0xc(%rsp)
orl %r15d, %eax
js 0x8c93
movq %rdi, %r14
movslq %esi, %rbp
movq (%rdi), %rdi
movq %rbp, %r13
shlq $0x6, %r13
cmpl 0x18(%rdi,%r13), %r15d
jge 0x8c93
cmpb $0x0, 0x68(%rsp)
je 0x8ca6
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
callq 0xa44a
cmpw $0x0, (%rax)
je 0x8ca6
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, 0x10(%rsp)
movslq %ebx, %rax
movq %rax, 0x18(%rsp)
decq %rbp
incq %rbp
cmpq 0x18(%rsp), %rbp
setg %bl
jg 0x8c95
leaq 0x40(%r13), %rax
movq %rax, 0x20(%rsp)
movl %r15d, %r14d
movq 0x10(%rsp), %r15
movq (%r15), %rdi
addq %r13, %rdi
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
callq 0xa44a
movzwl (%rax), %r12d
addq (%r15), %r13
movl %r14d, %r15d
movq %r13, %rdi
movl 0xc(%rsp), %esi
movl %r14d, %edx
callq 0xa44a
movq 0x20(%rsp), %r13
cmpw (%rax), %r12w
je 0x8cb6
jmp 0x8c95
// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xa67c
movq (%r15), %r14
movq %r15, (%rsp)
movq 0x8(%r15), %rbp
movq %rbp, %r15
subq %r14, %r15
je 0x990a
shrq $0x2, %r15
jmp 0x9911
movq (%rbx), %rax
movl 0x18(%rax), %r15d
leaq 0x14620(%rip), %rsi     # 0x1df38
xorl %r12d, %r12d
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x16c30
testl %r15d, %r15d
cmovlel %r12d, %r15d
xorl %r12d, %r12d
cmpq %r15, %r12
je 0x99b9
cmpq %r14, %rbp
je 0x994d
movq (%rsp), %rax
movq (%rax), %rax
movl (%rax,%r12,4), %r13d
movq (%rbx), %rax
jmp 0x9970
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq %rdx
leaq 0x24(%rax), %rsi
cmpq %r12, %rdx
leaq (%rcx,%r12,2), %rcx
cmovbeq %rsi, %rcx
movswl (%rcx), %r13d
movslq 0x74(%rsp), %rcx
movslq %r13d, %rsi
addq %rcx, %rsi
shlq $0x6, %rsi
addq 0x8(%rsp), %rsi
movslq 0x6c(%rbx), %rcx
movslq %r12d, %rdi
addq %rcx, %rdi
shlq $0x6, %rdi
addq %rax, %rdi
callq 0xa526
pushq $0x5
popq %rdi
leaq 0x145a2(%rip), %rsi     # 0x1df46
movl %r12d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x16c30
incq %r12
jmp 0x992f
cmpq %r14, %rbp
jne 0x99d0
decl 0x6c(%rbx)
movq (%rbx), %rsi
leaq 0x40(%rsi), %rdx
movq %rbx, %rdi
callq 0xa676
leaq 0x15f5f(%rip), %rsi     # 0x1f936
pushq $0x5
popq %rdi
xorl %eax, %eax
callq 0x16c30
leaq 0x8(%rsp), %rdi
callq 0xa776
movb $0x1, %al
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9a03
jmp 0x9a03
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xa776
movq %rbx, %rdi
callq 0x35d0
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/approximate.h
// Function: meta_approximate(Image&, std::vector<int, std::allocator<int>>&)
void meta_approximate(Image &image, std::vector<int> &parameters) {
    if (parameters.size() < 3) {
        e_printf("Incorrect number of parameters for Approximation transform.\n");
        image.error = true;
        return;
    }
    int nb = parameters[1] - parameters[0] + 1;
    if (nb < 1 || parameters[0] < 0 || parameters[1] >= image.channel.size()) {
        e_printf("Incorrect parameters for Approximation transform.\n");
        image.error = true;
        return;
    }
    for (int c = parameters[0]; c <= parameters[1]; c++) {
        int q = (c+2-parameters[0] < parameters.size() ? parameters[c+2-parameters[0]] : parameters.back());
        if (q) image.channel.push_back(image.channel[c]);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jae 0x9fe5
leaq 0x1416d(%rip), %rdi     # 0x1e14d
jmp 0xa070
movq %rsi, %r14
movl (%rax), %r15d
movl 0x4(%rax), %ecx
cmpl %r15d, %ecx
setl %dl
testl %r15d, %r15d
sets %sil
orb %dl, %sil
leaq 0x14185(%rip), %rdi     # 0x1e18a
jne 0xa070
movslq %ecx, %rdx
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x6, %rsi
cmpq %rdx, %rsi
jbe 0xa070
movq %r15, %r12
shlq $0x6, %r12
cmpl %r15d, %ecx
jl 0xa07e
movl %r15d, %edx
subl (%rax), %edx
addl $0x2, %edx
movslq %edx, %rdx
movq 0x8(%r14), %rsi
movq %rsi, %rdi
subq %rax, %rdi
sarq $0x2, %rdi
addq $-0x4, %rsi
cmpq %rdx, %rdi
leaq (%rax,%rdx,4), %rdx
cmovbeq %rsi, %rdx
cmpl $0x0, (%rdx)
je 0xa067
movq (%rbx), %rsi
addq %r12, %rsi
movq %rbx, %rdi
callq 0xa628
movq (%r14), %rax
movl 0x4(%rax), %ecx
incl %r15d
addq $0x40, %r12
jmp 0xa021
xorl %eax, %eax
callq 0x16b80
movb $0x1, 0xa8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/transform.cpp
// Function: Transform::apply(Image&, bool)
bool Transform::apply(Image &input, bool inverse) {
    switch(ID) {
        case TRANSFORM_YCbCr: return YCbCr(input, inverse);
        case TRANSFORM_ChromaSubsample: return subsample(input, inverse, parameters);
        case TRANSFORM_DCT: return DCT(input, inverse, parameters);
        case TRANSFORM_QUANTIZE: return quantize(input, inverse, parameters);
        case TRANSFORM_YCoCg: return YCoCg(input, inverse);
//        case TRANSFORM_XYB: return XYB(input, inverse);
        case TRANSFORM_SQUEEZE: return squeeze(input, inverse, parameters);
        case TRANSFORM_PALETTE: return palette(input, inverse, parameters);
        case TRANSFORM_2DMATCH: return match(input, inverse, parameters);
        case TRANSFORM_PERMUTE: return permute(input, inverse, parameters);
        case TRANSFORM_APPROXIMATE: return approximate(input, inverse, parameters);
        default: e_printf("Unknown transformation (ID=%i)\n",ID); return false;
    }
}

// Assembly:
pushq %rbx
movl (%rdi), %eax
cmpq $0xa, %rax
ja 0xa2cd
movl %edx, %ebx
movq %rdi, %rdx
leaq 0x12fb5(%rip), %rcx     # 0x1d210
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmpq *%rdi
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x5892
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
callq 0x5f9f
jmp 0xa319
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x785a
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x709c
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
callq 0x83aa
jmp 0xa317
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x986d
leaq 0x13f7a(%rip), %rdi     # 0x1e24e
xorl %ebx, %ebx
movl %eax, %esi
xorl %eax, %eax
callq 0x16b80
jmp 0xa319
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x6d05
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
callq 0x6ee8
jmp 0xa317
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
callq 0xa22a
movb $0x1, %bl
movl %ebx, %eax
popq %rbx
retq
addq $0x8, %rdx
movzbl %bl, %eax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x9dba
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/transform.cpp
// Function: Transform::meta_apply(Image&)
void Transform::meta_apply(Image &input) {
    switch(ID) {
        case TRANSFORM_YCbCr: return;
        case TRANSFORM_YCoCg: return;
//        case TRANSFORM_XYB: return;
        case TRANSFORM_ChromaSubsample: meta_subsample(input, parameters); return;
        case TRANSFORM_DCT: meta_DCT(input, parameters); return;
        case TRANSFORM_QUANTIZE: return;
        case TRANSFORM_SQUEEZE: meta_squeeze(input, parameters); return;
        case TRANSFORM_PALETTE: meta_palette(input, parameters); return;
        case TRANSFORM_2DMATCH: meta_match(input, parameters); return;
        case TRANSFORM_PERMUTE: meta_permute(input, parameters); return;
        case TRANSFORM_APPROXIMATE: meta_approximate(input, parameters); return;
        default: e_printf("Unknown transformation (ID=%i)\n",ID); return;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl (%rdi), %esi
cmpq $0xa, %rsi
ja 0xa3c0
movq %rdi, %rax
leaq 0x12ef0(%rip), %rcx     # 0x1d23c
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
addq $0x8, %rax
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x5326
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5ee1
leaq 0x20(%rsp), %rdi
jmp 0xa427
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x81e6
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x8b45
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x62fc
leaq 0x13e87(%rip), %rdi     # 0x1e24e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x16b80
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x9fbe
addq $0x8, %rax
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x9a18
addq $0x8, %rax
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x5326
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7311
leaq 0x8(%rsp), %rdi
callq 0x5374
addq $0x38, %rsp
popq %rbx
popq %r14
retq
jmp 0xa436
movq %rax, %rbx
movq %r14, %rdi
callq 0x5374
movq %rbx, %rdi
callq 0x35d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/cloudinary[P]fuif/transform/squeeze.h
// Function: smooth_tendency(short, short, short)
inline pixel_type smooth_tendency(pixel_type B, pixel_type a, pixel_type n) {
    pixel_type diff = 0;
    if (B >= a && a >= n) {
        diff = (4*B - 3*n - a + 6)/12;
//      2C = a<<1 + diff - diff&1 <= 2B  so diff - diff&1 <= 2B - 2a
//      2D = a<<1 - diff - diff&1 >= 2n  so diff + diff&1 <= 2a - 2n
        if (diff-(diff&1) > 2*(B-a)) diff = 2*(B-a)+1;
        if (diff+(diff&1) > 2*(a-n)) diff = 2*(a-n);
    } else if (B <= a && a <= n) {
        diff = (4*B - 3*n - a - 6)/12;
//      2C = a<<1 + diff + diff&1 >= 2B  so diff + diff&1 >= 2B - 2a
//      2D = a<<1 - diff + diff&1 <= 2n  so diff - diff&1 >= 2a - 2n
        if (diff+(diff&1) < 2*(B-a)) diff = 2*(B-a)-1;
        if (diff-(diff&1) < 2*(a-n)) diff = 2*(a-n);
    }
    return diff;
}

// Assembly:
cmpw %si, %di
setl %al
cmpw %dx, %si
setl %cl
orb %al, %cl
je 0xa925
cmpw %si, %di
setg %al
cmpw %dx, %si
setg %cl
orb %al, %cl
je 0xa970
xorl %esi, %esi
jmp 0xa9b9
movswl %dx, %ecx
leal (,%rdi,4), %eax
imull $-0x3, %ecx, %edx
subl %esi, %eax
addl %edx, %eax
addl $0x6, %eax
pushq $0xc
popq %r8
cltd
idivl %r8d
movswl %ax, %edx
movl %eax, %r8d
andl $0x1, %r8d
subl %r8d, %edx
subl %esi, %edi
leal (%rdi,%rdi), %r8d
cmpl %r8d, %edx
leal 0x1(%rdi,%rdi), %edx
cmovlel %eax, %edx
movswl %dx, %eax
movl %eax, %edi
andl $0x1, %edi
addl %eax, %edi
subl %ecx, %esi
addl %esi, %esi
cmpl %esi, %edi
jmp 0xa9b6
movswl %dx, %ecx
leal (,%rdi,4), %eax
imull $-0x3, %ecx, %edx
subl %esi, %eax
addl %edx, %eax
addl $-0x6, %eax
pushq $0xc
popq %r8
cltd
idivl %r8d
movswl %ax, %edx
movl %eax, %r8d
andl $0x1, %r8d
addl %edx, %r8d
subl %esi, %edi
leal (%rdi,%rdi), %edx
cmpl %edx, %r8d
leal -0x1(%rdi,%rdi), %edx
cmovgel %eax, %edx
movl %edx, %eax
andl $0xfffe, %eax           # imm = 0xFFFE
cwtl
subl %ecx, %esi
addl %esi, %esi
cmpl %eax, %esi
cmovlel %edx, %esi
movl %esi, %eax
retq