LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: PropertySymbolCoder<SimpleBitChance, RacDummy<DummyIO>, 15>::write_int(std::vector<int, std::allocator<int>>&, int, int, int)
void write_int(Properties &properties, int min, int max, int val) {
//        CompoundSymbolChances<BitChance,bits> &chances = find_leaf(properties);
//        set_selection_and_update_property_sums(properties,chances);
        CompoundSymbolChances<BitChance,bits> &chances2 = find_leaf(properties);
        coder.write_int(chances2, selection, min, max, val);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movq %rdi, %r15
callq 0x19a00
cmpl %ebp, %r14d
je 0x18aa0
leaq 0x4058(%r15), %rcx
movq 0x8(%r15), %rdx
addq $0x10, %r15
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
movq %rdx, 0x8(%rdi)
movq %rax, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x1aa9f
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: CompoundSymbolChances<SimpleBitChance, 15>::resetCounters()
void resetCounters() {
        best_property = -1;
        realSize = 0;
        count = 0;
        virtPropSum.assign(virtPropSum.size(),0);
        virtSize.assign(virtSize.size(),0);
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movw $0xffff, 0x94(%rdi)     # imm = 0xFFFF
xorl %r15d, %r15d
movq %r15, 0x58(%rdi)
movl $0x0, 0x90(%rdi)
movq 0x80(%rdi), %rsi
subq 0x78(%rdi), %rsi
addq $0x78, %rdi
sarq $0x3, %rsi
leaq 0x8(%rsp), %r14
movq %r15, (%r14)
movq %r14, %rdx
callq 0x1a070
leaq 0x60(%rbx), %rdi
movq 0x68(%rbx), %rsi
subq 0x60(%rbx), %rsi
sarq $0x3, %rsi
movq %r15, (%r14)
leaq 0x8(%rsp), %rdx
callq 0x1a434
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: PropertySymbolCoder<SimpleBitChance, RacDummy<DummyIO>, 15>::kill_children(int)
void kill_children(int pos) {
        PropertyDecisionNode &n = inner_node[pos];
        if (n.property == -1) n.property = 0;
        else kill_children(n.childID);
        PropertyDecisionNode &n1 = inner_node[pos+1];
        if (n1.property == -1) n1.property = 0;
        else kill_children(n1.childID);
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4050(%rdi), %rax
movq (%rax), %rax
movslq %esi, %r14
cmpw $-0x1, (%rax,%r14,8)
je 0x1b2a0
movzwl 0x2(%rax,%r14,8), %esi
movq %rbx, %rdi
callq 0x1b26a
movq 0x4050(%rbx), %rax
movq (%rax), %rax
jmp 0x1b2a7
movw $0x0, (%rax,%r14,8)
cmpw $-0x1, 0x8(%rax,%r14,8)
je 0x1b2b8
movzwl 0xa(%rax,%r14,8), %esi
jmp 0x1b27b
movw $0x0, 0x8(%rax,%r14,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<BlobIO>, 15>::estimate_int(std::vector<int, std::allocator<int>> const&, int, int, int)
int FinalPropertySymbolCoder<BitChance,RAC,bits>::estimate_int(const Properties &properties, int min, int max, int val) {
        if (min == max) { assert(val==min); return 0; }
        assert(properties.size() == nb_properties);
        FinalCompoundSymbolChances<BitChance,bits> &chances = find_leaf_readonly(properties);
        return coder.estimate_int(chances, min, max, val);
    }

// Assembly:
xorl %eax, %eax
cmpl %ecx, %edx
je 0x1b5d7
subq $0x18, %rsp
movq 0x4030(%rdi), %rax
movq (%rax), %rax
movzwl (%rax), %r10d
cmpw $-0x1, %r10w
je 0x1b596
movq (%rsi), %rsi
movq %rax, %r9
movswq %r10w, %r10
movl (%rsi,%r10,4), %r10d
xorl %r11d, %r11d
cmpl 0x4(%r9), %r10d
setle %r11b
movzwl 0x2(%r9), %r9d
leaq (%rax,%r9,8), %r9
leaq (%r9,%r11,8), %r9
movzwl (%r9), %r10d
cmpw $-0x1, %r10w
jne 0x1b569
jmp 0x1b599
movq %rax, %r9
movzwl 0x2(%r9), %esi
leaq (%rsi,%rsi), %rax
shll $0x6, %esi
subq %rax, %rsi
addq 0x4018(%rdi), %rsi
movq (%rdi), %r9
addq $0x8, %rdi
movq %rsp, %rax
movq %rdi, (%rax)
movq %r9, 0x8(%rax)
movq %rsi, 0x10(%rax)
movq %rax, %rdi
movl %edx, %esi
movl %ecx, %edx
movl %r8d, %ecx
callq 0x1baa0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<BlobIO>, 15>::write_int(std::vector<int, std::allocator<int>> const&, int, int, int)
void FinalPropertySymbolCoder<BitChance,RAC,bits>::write_int(const Properties &properties, int min, int max, int val) {
        if (min == max) { assert(val==min); return; }
        assert(properties.size() == nb_properties);
        FinalCompoundSymbolChances<BitChance,bits> &chances = find_leaf(properties);
        coder.write_int(chances, min, max, val);
    }

// Assembly:
cmpl %ecx, %edx
je 0x1b66d
subq $0x18, %rsp
movq 0x4030(%rdi), %rax
movq (%rax), %rax
movzwl (%rax), %r10d
cmpw $-0x1, %r10w
je 0x1b62c
movq (%rsi), %rsi
movq %rax, %r9
movswq %r10w, %r10
movl (%rsi,%r10,4), %r10d
xorl %r11d, %r11d
cmpl 0x4(%r9), %r10d
setle %r11b
movzwl 0x2(%r9), %r9d
leaq (%rax,%r9,8), %r9
leaq (%r9,%r11,8), %r9
movzwl (%r9), %r10d
cmpw $-0x1, %r10w
jne 0x1b5ff
jmp 0x1b62f
movq %rax, %r9
movzwl 0x2(%r9), %esi
leaq (%rsi,%rsi), %rax
shll $0x6, %esi
subq %rax, %rsi
addq 0x4018(%rdi), %rsi
movq (%rdi), %r9
addq $0x8, %rdi
movq %rsp, %rax
movq %rdi, (%rax)
movq %r9, 0x8(%rax)
movq %rsi, 0x10(%rax)
movq %rax, %rdi
movl %edx, %esi
movl %ecx, %edx
movl %r8d, %ecx
callq 0x1bbda
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound_enc.h
// Function: MetaPropertySymbolCoder<SimpleBitChance, RacOutput24<BlobIO>>::write_subtree(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, Tree const&)
void MetaPropertySymbolCoder<BitChance,RAC>::write_subtree(int pos, Ranges &subrange, const Tree &tree) {
        const PropertyDecisionNode &n = tree[pos];
        int p = n.property;
        coder[0].write_int2(0,nb_properties,p+1);
        if (p != -1) {
//            coder[1].write_int2(CONTEXT_TREE_MIN_COUNT, CONTEXT_TREE_MAX_COUNT, n.count);
//            printf("From properties 0..%i, split node at PROPERTY %i\n",nb_properties-1,p);
            int oldmin = subrange[p].first;
            int oldmax = subrange[p].second;
            assert(oldmin < oldmax);
            coder[2].write_int2(oldmin, oldmax-1, n.splitval);
//            e_printf( "Pos %i: prop %i splitval %i in [%i..%i]\n", pos, n.property, n.splitval, oldmin, oldmax-1);
            // > splitval
            subrange[p].first = n.splitval+1;
            write_subtree(n.childID, subrange, tree);

            // <= splitval
            subrange[p].first = oldmin;
            subrange[p].second = n.splitval;
            write_subtree(n.childID+1, subrange, tree);

            subrange[p].second = oldmax;
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rdi, %r15
movslq %esi, %r12
movq (%rcx), %r13
movswl (%r13,%r12,8), %ebp
movq (%rdi), %rdi
movl 0x30(%r15), %edx
leal 0x1(%rbp), %ecx
xorl %esi, %esi
callq 0x1b73c
cmpl $-0x1, %ebp
je 0x1b72c
movslq %ebp, %rbp
movq (%rbx), %rax
movl (%rax,%rbp,8), %esi
movl %esi, 0xc(%rsp)
movl 0x4(%rax,%rbp,8), %eax
movq %rax, 0x10(%rsp)
movl $0x80a0, %edi           # imm = 0x80A0
addq (%r15), %rdi
leal -0x1(%rax), %edx
movl 0x4(%r13,%r12,8), %ecx
callq 0x1b73c
movl 0x4(%r13,%r12,8), %eax
incl %eax
movq (%rbx), %rcx
movl %eax, (%rcx,%rbp,8)
movzwl 0x2(%r13,%r12,8), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1b66e
movq (%rbx), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax,%rbp,8)
movl 0x4(%r13,%r12,8), %ecx
movl %ecx, 0x4(%rax,%rbp,8)
movzwl 0x2(%r13,%r12,8), %esi
incl %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1b66e
movq (%rbx), %rax
movq 0x10(%rsp), %rcx
movl %ecx, 0x4(%rax,%rbp,8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/encoding.cpp
// Function: bool corrupt_or_truncated<FileIO>(FileIO&, Channel&, unsigned long)
bool corrupt_or_truncated(IO& io, Channel &channel, size_t bytes_to_load) {
    if (io.isEOF() || (bytes_to_load && io.ftell() >= bytes_to_load)) {
        v_printf(3,"Premature end-of-file detected.\n");
        channel.data = std::vector<pixel_type>(channel.w * channel.h, 0);
        return true;
    } else {
        v_printf(3,"Corruption detected.\n");
        return false;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x3470
testl %eax, %eax
je 0x1befc
leaq 0xafab(%rip), %rsi      # 0x26e26
movl $0x3, %edi
xorl %eax, %eax
callq 0x1cede
movslq 0x18(%rbx), %rax
movslq 0x1c(%rbx), %rsi
imulq %rax, %rsi
leaq 0xe(%rsp), %rdx
movw $0x0, (%rdx)
leaq 0x10(%rsp), %r14
leaq 0xd(%rsp), %rcx
movq %r14, %rdi
callq 0xe282
movq (%rbx), %rdi
movq 0x10(%rbx), %rsi
movaps (%r14), %xmm0
movups %xmm0, (%rbx)
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
testq %rdi, %rdi
je 0x1bef8
subq %rdi, %rsi
callq 0x32c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1bef8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movb $0x1, %bl
jmp 0x1bf27
testq %r14, %r14
je 0x1bf12
movq (%r15), %rdi
callq 0x3030
cmpq %r14, %rax
jae 0x1be74
leaq 0xaf2e(%rip), %rsi      # 0x26e47
xorl %ebx, %ebx
movl $0x3, %edi
xorl %eax, %eax
callq 0x1cede
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/symbol.h
// Function: UniformSymbolCoder<RacInput24<FileIO>>::read_int(int, int)
int read_int(int min, int len) {
        assert(len >= 0);
        if (len == 0) return min;

        // split in [0..med] [med+1..len]
        int med = len/2;
        bool bit = rac.read_bit();
        if (bit) {
            return read_int(min+med+1, len-(med+1));
        } else {
            return read_int(min, med);
        }
    }

// Assembly:
movl %esi, %eax
testl %edx, %edx
je 0x1c080
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %r14
movq %rax, (%rsp)
movl %ebp, %r15d
movl %r15d, %ebp
shrl $0x1f, %r15d
addl %ebp, %r15d
sarl %r15d
movq (%r14), %r12
movq 0x8(%r12), %rcx
movq 0x10(%r12), %r13
movq %rcx, %rax
shrq %rax
movq %rcx, %rbx
subq %rax, %rbx
movq %r13, %rdx
subq %rbx, %rdx
jae 0x1bfd5
movq %rbx, 0x8(%r12)
cmpq $0x10000, %rbx          # imm = 0x10000
ja 0x1c04a
movq %r13, %rax
shlq $0x8, %rax
movq %rax, 0x10(%r12)
movq %rbx, %rax
shlq $0x8, %rax
movq %rax, 0x8(%r12)
movq (%r12), %rax
movq (%rax), %rdi
callq 0x34b0
cltq
orq 0x10(%r12), %rax
movq %rax, 0x10(%r12)
movq 0x8(%r12), %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
jbe 0x1c020
jmp 0x1c04a
movq %rdx, 0x10(%r12)
movq %rax, 0x8(%r12)
cmpq $0x20001, %rcx          # imm = 0x20001
ja 0x1c057
shlq $0x8, %rdx
movq %rdx, 0x10(%r12)
shlq $0x8, %rax
movq %rax, 0x8(%r12)
movq (%r12), %rax
movq (%rax), %rdi
callq 0x34b0
cltq
orq 0x10(%r12), %rax
movq %rax, 0x10(%r12)
movq 0x8(%r12), %rcx
cmpq $0x10001, %rcx          # imm = 0x10001
jae 0x1c057
shlq $0x8, %rax
movq %rax, 0x10(%r12)
shlq $0x8, %rcx
movq %rcx, 0x8(%r12)
movq (%r12), %rax
movq (%rax), %rdi
callq 0x34b0
cltq
orq %rax, 0x10(%r12)
cmpq %rbx, %r13
jae 0x1c057
incl %ebp
cmpl $0x2, %ebp
ja 0x1bf55
jmp 0x1c06e
movq (%rsp), %rax
addl %r15d, %eax
incl %eax
notl %r15d
addl %r15d, %ebp
jne 0x1bf4e
jmp 0x1c072
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/compound.h
// Function: MetaPropertySymbolCoder<SimpleBitChance, RacInput24<FileIO>>::read_tree(Tree&)
bool read_tree(Tree &tree) {
          Ranges rootrange(range);
          tree.clear();
          tree.push_back(PropertyDecisionNode());
          int depth=0;
          if (read_subtree(0, rootrange, tree, depth, 0)) {
            int neededdepth = maniac::util::ilog2(tree.size())+1;
            v_printf(8,"Read MANIAC tree with %u nodes and depth %i (with better balance, depth %i might have been enough).\n",(unsigned int) tree.size(),depth,neededdepth);
            return true;
          } else return false;
          //return read_subtree(0, rootrange, tree);
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %rsi
leaq 0x10(%rsp), %rdi
callq 0x18aee
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x1c1a8
movq %rax, 0x8(%r14)
leaq 0x8(%rsp), %rsi
movq $0xffff, (%rsi)         # imm = 0xFFFF
movq %r14, %rdi
callq 0x1c4f0
leaq 0x8(%rsp), %r8
movl $0x0, (%r8)
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rcx
xorl %r9d, %r9d
callq 0x1c368
movl %eax, %ebx
testb %al, %al
je 0x1c21a
movq 0x8(%r14), %rdx
subq (%r14), %rdx
shrq $0x3, %rdx
bsrl %edx, %eax
xorl $-0x20, %eax
addl $0x21, %eax
testl %edx, %edx
movl $0x1, %r8d
cmovnel %eax, %r8d
movl 0x8(%rsp), %ecx
leaq 0xac4f(%rip), %rsi      # 0x26e5d
movl $0x8, %edi
xorl %eax, %eax
callq 0x1cede
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1c231
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x1c23f
jmp 0x1c23f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1c259
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3590
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/encoding/../maniac/rac.h
// Function: RacInput<RacConfig24, BlobReader>::get(unsigned long)
bool inline get(rac_t chance) {
        assert(chance >= 0);
        assert(chance < range);
        if (low >= range-chance) {
            low -= range-chance;
            range = chance;
            input();
            return true;
        } else {
            range -= chance;
            input();
            return false;
        }
    }

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
subq %rsi, %rax
movq %rcx, %rdx
subq %rax, %rdx
jb 0x1cabb
movq %rdx, 0x10(%rdi)
movq %rsi, 0x8(%rdi)
cmpq $0x10000, %rsi          # imm = 0x10000
ja 0x1cb97
shlq $0x8, %rdx
movq %rdx, 0x10(%rdi)
movq %rsi, %r8
shlq $0x8, %r8
movq %r8, 0x8(%rdi)
movq (%rdi), %r8
movq 0x8(%r8), %r10
movq 0x10(%r8), %r9
cmpq %r10, %r9
jae 0x1cb06
movq (%r8), %r11
leaq 0x1(%r9), %rbx
movq %rbx, 0x10(%r8)
movzbl (%r11,%r9), %r11d
movq %rbx, %r9
jmp 0x1cb0a
movq %rax, 0x8(%rdi)
cmpq $0x10000, %rax          # imm = 0x10000
ja 0x1cb97
movq %rcx, %rdx
shlq $0x8, %rdx
movq %rdx, 0x10(%rdi)
movq %rax, %rsi
shlq $0x8, %rsi
movq %rsi, 0x8(%rdi)
movq (%rdi), %rsi
movq 0x8(%rsi), %r9
movq 0x10(%rsi), %r8
cmpq %r9, %r8
jae 0x1cb44
movq (%rsi), %r10
leaq 0x1(%r8), %r11
movq %r11, 0x10(%rsi)
movzbl (%r10,%r8), %r10d
movq %r11, %r8
jmp 0x1cb48
movl 0x18(%r8), %r11d
movslq %r11d, %r11
orq %r11, %rdx
movq %rdx, 0x10(%rdi)
cmpq $0x100, %rsi            # imm = 0x100
ja 0x1cb97
shlq $0x8, %rdx
movq %rdx, 0x10(%rdi)
shlq $0x10, %rsi
movq %rsi, 0x8(%rdi)
cmpq %r10, %r9
jae 0x1cb84
movq (%r8), %rsi
leaq 0x1(%r9), %r10
movq %r10, 0x10(%r8)
movzbl (%rsi,%r9), %esi
jmp 0x1cb8d
movl 0x18(%rsi), %r10d
movslq %r10d, %r10
orq %r10, %rdx
movq %rdx, 0x10(%rdi)
cmpq $0x100, %rax            # imm = 0x100
ja 0x1cb97
shlq $0x8, %rdx
movq %rdx, 0x10(%rdi)
movq %rax, %r10
shlq $0x10, %r10
movq %r10, 0x8(%rdi)
cmpq %r9, %r8
jae 0x1cb8a
movq (%rsi), %r9
leaq 0x1(%r8), %r10
movq %r10, 0x10(%rsi)
movzbl (%r9,%r8), %esi
jmp 0x1cb8d
movl 0x18(%r8), %esi
jmp 0x1cb8d
movl 0x18(%rsi), %esi
movslq %esi, %rsi
orq %rdx, %rsi
movq %rsi, 0x10(%rdi)
cmpq %rax, %rcx
setae %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/io.cpp
// Function: v_printf(int, char const*, ...)
void v_printf(const int v, const char *format, ...) {
    if (verbosity < v) return;
    va_list args;
    va_start(args, format);
    vfprintf(my_stdout, format, args);
    fflush(my_stdout);
    va_end(args);
}

// Assembly:
subq $0xd8, %rsp
testb %al, %al
je 0x1cf20
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl %edi, 0x133de(%rip)     # 0x30318
jl 0x1cf79
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x157c0(%rip), %rdi     # 0x32728
callq 0x33d0
movq 0x157b4(%rip), %rdi     # 0x32728
callq 0x3360
addq $0xd8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/io.cpp
// Function: v_printf_tty(int, char const*, ...)
void v_printf_tty(const int v, const char *format, ...) {
    if (verbosity < v) return;
#ifdef _WIN32
    if(!_isatty(_fileno(my_stdout))) return;
#else
    if(!isatty(fileno(my_stdout))) return;
#endif
    va_list args;
    va_start(args, format);
    vfprintf(my_stdout, format, args);
    fflush(my_stdout);
    va_end(args);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
testb %al, %al
je 0x1cfc4
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl %edi, 0x1333a(%rip)     # 0x30318
jl 0x1d03a
movq %rsi, %rbx
movq 0x1573e(%rip), %rdi     # 0x32728
callq 0x32f0
movl %eax, %edi
callq 0x3570
testl %eax, %eax
je 0x1d03a
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x15702(%rip), %rdi     # 0x32728
movq %rbx, %rsi
callq 0x33d0
movq 0x156f3(%rip), %rdi     # 0x32728
callq 0x3360
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/./import/read_gif.h
// Function: render_frame_rect(gd_GIF*, unsigned char*)
static void
render_frame_rect(gd_GIF *gif, uint8_t *buffer)
{
    int i, j, k;
    uint8_t index, *color;
    i = gif->fy * gif->width + gif->fx;
    for (j = 0; j < gif->fh; j++) {
        for (k = 0; k < gif->fw; k++) {
            index = gif->frame[(gif->fy + j) * gif->width + gif->fx + k];
            color = &gif->palette->colors[index*3];
            if (!gif->gce.transparency || index != gif->gce.tindex) {
                memcpy(&buffer[(i+k)*4], color, 3);
                buffer[(i+k)*4+3] = 255; // opaque
            }
        }
        i += gif->width;
    }
}

// Assembly:
movzwl 0x656(%rdi), %r9d
testw %r9w, %r9w
je 0x1e19a
pushq %r14
pushq %rbx
movzwl 0x10(%rdi), %r10d
movzwl 0x652(%rdi), %ecx
imull %r10d, %ecx
movzwl 0x650(%rdi), %eax
addl %ecx, %eax
movzwl 0x654(%rdi), %edx
xorl %ecx, %ecx
movl %edx, %r11d
xorl %r8d, %r8d
testw %r11w, %r11w
je 0x1e17b
movl %eax, %r9d
leaq (%rsi,%r9,4), %r9
xorl %r10d, %r10d
movzwl 0x652(%rdi), %r11d
movzwl 0x10(%rdi), %ebx
movzwl 0x650(%rdi), %r14d
addq %rcx, %r11
imulq %rbx, %r11
addq %r14, %r11
addq 0x668(%rdi), %r11
movzbl (%r10,%r11), %r11d
movq 0x28(%rdi), %rbx
cmpl $0x0, 0x20(%rdi)
je 0x1e134
cmpb 0x1a(%rdi), %r11b
je 0x1e15d
leaq (%r11,%r11,2), %rdx
addq %rbx, %rdx
addq $0x4, %rdx
movb 0x2(%rdx), %r11b
movb %r11b, 0x2(%r9,%r10,4)
movzwl (%rdx), %edx
movw %dx, (%r9,%r10,4)
movb $-0x1, 0x3(%r9,%r10,4)
movzwl 0x654(%rdi), %edx
incq %r10
movzwl %dx, %r11d
cmpq %r11, %r10
jb 0x1e0fa
movzwl 0x10(%rdi), %r10d
movzwl 0x656(%rdi), %r9d
movl %edx, %r11d
jmp 0x1e17e
xorl %r11d, %r11d
movzwl %r10w, %ebx
addl %ebx, %eax
incl %r8d
movzwl %r9w, %ebx
incq %rcx
cmpl %ebx, %r8d
jb 0x1e0e6
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/./import/read_pam.h
// Function: read_pnm_int(_IO_FILE*, char*, char**)
unsigned int read_pnm_int(FILE *fp, char* buf, char** t) {
    long result = strtol(*t,t,10);
    if (result == 0) {
        // no valid int found here, try next line
        do {
          *t = fgets(buf, PPMREADBUFLEN, fp);
          if ( *t == NULL ) {return false;}
        } while ( strncmp(buf, "#", 1) == 0 || strncmp(buf, "\n", 1) == 0);
        result = strtol(*t,t,10);
        if (result == 0) { e_printf("Invalid PNM file.\n"); fclose(fp); }
    }
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq (%rdx), %rdi
movq %rdx, %rsi
movl $0xa, %edx
callq 0x33e0
testq %rax, %rax
je 0x1f135
movq %rax, %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x34d0
movq %rax, (%r15)
xorl %r14d, %r14d
testq %rax, %rax
je 0x1f126
movzbl (%r12), %ecx
cmpl $0x23, %ecx
je 0x1f15f
cmpl $0xa, %ecx
jne 0x1f174
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x34d0
movq %rax, (%r15)
jmp 0x1f14b
movq %rax, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x33e0
testq %rax, %rax
jne 0x1f123
leaq 0x8060(%rip), %rdi      # 0x271f0
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x379e
movq %rbx, %rdi
callq 0x32a0
jmp 0x1f126
// File: /workspace/github_cpp_makefile_star2_O3/cloudinary[P]fuif/fuif.cpp
// Function: file_exists(char const*)
bool file_exists(const char * filename){
        FILE * file = fopen(filename, "rb");
        if (!file) return false;
        fclose(file);
        return true;
}

// Assembly:
pushq %rbx
leaq 0x5837(%rip), %rsi      # 0x26a6f
callq 0x3370
movq %rax, %rbx
testq %rax, %rax
je 0x2124d
movq %rbx, %rdi
callq 0x32a0
testq %rbx, %rbx
setne %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::finish(void*, unsigned long)
size_t APDigest::finish(void* digest, size_t size)
{
    SHA512_Final(m_Digest, &m_Ctx);
    if (size > DIGEST_SIZE) 
        size = DIGEST_SIZE;

    memcpy(digest, &m_Digest[0], size);
    return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
leaq 0xd8(%rdi), %r15
movq %r15, %rdi
callq 0x408304
cmpq $0x40, %rbx
movl $0x40, %r12d
cmovbq %rbx, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x401110
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::hmac(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned char*, unsigned long)
size_t APDigest::hmac(
    const uint8_t* key, size_t key_size, 
    const uint8_t* msg, size_t msg_size,
    uint8_t* mac, size_t mac_size)
{
    uint32_t i;
    uint8_t i_pad[BLOCK_SIZE], o_pad[BLOCK_SIZE];
    if (key_size > BLOCK_SIZE)
    {
        APDigest h((void*)key, key_size);
        for (i = 0; i < DIGEST_SIZE; i++)
        {
            o_pad[i] = h.m_Digest[i] ^ 0x5c;
            i_pad[i] = h.m_Digest[i] ^ 0x36;
        }
    }
    else
    {
        for (i = 0; i < key_size; i++)
        {
            o_pad[i] = key[i] ^ 0x5c;
            i_pad[i] = key[i] ^ 0x36;
        }
    }

    while (i < BLOCK_SIZE)
    {
        o_pad[i] = 0x5c;
        i_pad[i] = 0x36;
        i++;
    }

    APDigest inner_hash;
    inner_hash.update((void*)&i_pad[0], sizeof(i_pad));
    inner_hash.update((void*)msg, msg_size);
    inner_hash.finish();

    APDigest outer_hash;
    outer_hash.update((void*)&o_pad[0], sizeof(o_pad));
    outer_hash.update((void*)&inner_hash.m_Digest[0], sizeof(inner_hash.m_Digest));
    return outer_hash.finish((void*)mac, mac_size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rdx
movq %rdi, %rsi
cmpq $0x80, %rdx
jbe 0x405ab3
leaq 0x108(%rsp), %rdi
callq 0x405998
xorl %eax, %eax
movaps 0x174cc2(%rip), %xmm0   # 0x57a740
movaps 0x174ccb(%rip), %xmm1   # 0x57a750
movups 0x1e0(%rsp,%rax), %xmm2
movaps %xmm2, %xmm3
xorps %xmm0, %xmm3
movaps %xmm3, (%rsp,%rax)
xorps %xmm1, %xmm2
movaps %xmm2, 0x80(%rsp,%rax)
addq $0x10, %rax
cmpq $0x40, %rax
jne 0x405a85
movl $0x40, %edx
jmp 0x405ae6
testq %rdx, %rdx
je 0x405ae4
xorl %eax, %eax
movb (%rsi,%rax), %cl
movl %ecx, %edi
xorb $0x5c, %dil
movb %dil, (%rsp,%rax)
xorb $0x36, %cl
movb %cl, 0x80(%rsp,%rax)
incq %rax
cmpq %rax, %rdx
jne 0x405aba
cmpq $0x80, %rdx
jne 0x405ae6
jmp 0x405b1a
xorl %edx, %edx
movl %edx, %ebp
leaq (%rsp,%rbp), %rdi
movl $0x80, %r13d
subl %edx, %r13d
movl $0x5c, %esi
movq %r13, %rdx
callq 0x401060
leaq (%rsp,%rbp), %rdi
addq $0x80, %rdi
movl $0x36, %esi
movq %r13, %rdx
callq 0x401060
leaq 0x108(%rsp), %r13
movq %r13, %rdi
callq 0x40827c
leaq 0x80(%rsp), %rsi
movl $0x80, %edx
movq %r13, %rdi
callq 0x409a57
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x409a57
movl $0xd8, %r15d
leaq (%r15,%r13), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x408304
leaq 0x220(%rsp), %r13
movq %r13, %rdi
callq 0x40827c
movq %rsp, %rsi
movl $0x80, %edx
movq %r13, %rdi
callq 0x409a57
movl $0x40, %ebp
movl $0x40, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x409a57
addq %r13, %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x408304
cmpq $0x40, %r14
cmovbq %r14, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x401110
movq %rbp, %rax
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::kdf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned char*, unsigned long)
void APDigest::kdf(
    const std::string& userid,
    const std::string& password,
    const std::string& domain,
    uint8_t* dk, size_t dkLen)
{
#ifdef USE_PASSWORD_HASH
    // Replace password with its hash to be able to convert hashed
    // passwords automatically

    // Here we are assuming passwords are haded with sha512
    APDigest passwordHash(password.c_str(), password.length());

    // Use combination of userid & domain as salt

    APDigest saltHash;
    saltHash.update(userid.c_str(), userid.length());
    saltHash.update(&kdf_separator, 1);
    saltHash.update(domain.c_str(), domain.length());
    saltHash.finish();

    APDigest::pbkdf2(
        passwordHash.digest(), APDigest::DIGEST_SIZE, 
        saltHash.digest(), APDigest::DIGEST_SIZE,
        APDigest::KDF_ITERATIONS,
        dk, dkLen);
#else
    std::string salt = userid + AP_KDF_SEP + domain;
    APDigest::pbkdf2(
        password.c_str(), password.length(), 
        salt.c_str(), salt.length(),
        APDigest::KDF_ITERATIONS,
        dk, dkLen);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x40585e
movq 0x8(%r13), %rsi
movl $0x1, %ecx
movq %r13, %rdi
xorl %edx, %edx
movl $0x26, %r8d
callq 0x4783f0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
leaq 0x28(%rsp), %rdi
callq 0x479120
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rsi
addq $0x10, %rsi
cmpq %rsi, %rdx
je 0x405c5e
movq %rdx, 0x8(%rsp)
movq (%rsi), %rcx
movq %rcx, 0x18(%rsp)
jmp 0x405c69
movups (%rsi), %xmm0
movups %xmm0, (%r12)
movq %r12, %rdx
movq 0x8(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq %rsi, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x405ca2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movq %r14, (%rsp)
movl $0x64, %r8d
movq %rbx, %r9
callq 0x405d1a
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x405cd2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x405d11
movq 0x18(%rsp), %rsi
jmp 0x405d09
jmp 0x405cf7
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x405d11
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq %rbx, %rdi
callq 0x4a9bd0
nop
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::pbkdf2(void const*, unsigned long, void const*, unsigned long, unsigned int, unsigned char*, unsigned long)
void APDigest::pbkdf2(
    const void *password, size_t passwordLen,
    const void *salt,     size_t saltLen,
    uint32_t iterations,
    uint8_t* dk,          size_t dkLen)
{
    uint8_t *saltBlock = new uint8_t[saltLen + 4];
    uint32_t blockNumber = 1;
    memcpy (saltBlock, salt, saltLen);
    while (dkLen >= DIGEST_SIZE)
    {
        PRF((const uint8_t*)password, passwordLen, 
            saltBlock, saltLen,
            iterations, blockNumber++, dk, DIGEST_SIZE);
        dk += DIGEST_SIZE;
        dkLen -= DIGEST_SIZE;
    }

    if (dkLen > 0)
    {
        PRF((const uint8_t*)password, passwordLen, 
            saltBlock, saltLen,
            iterations, blockNumber, dk, dkLen);
    }
    delete [] saltBlock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movl %r8d, 0xc(%rsp)
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movq 0x60(%rsp), %r12
leaq 0x4(%rcx), %rdi
callq 0x40bb70
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rsi
movq %r13, 0x18(%rsp)
movq %r13, %rdx
callq 0x401110
movl $0x1, %ebp
cmpq $0x40, %r12
movq %r14, 0x20(%rsp)
jb 0x405db8
movl $0x1, %r9d
movq 0x18(%rsp), %r13
movq 0x10(%rsp), %r14
leal 0x1(%r9), %ebp
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq %r13, %rcx
movl 0xc(%rsp), %r8d
pushq $0x40
pushq %rbx
callq 0x405dff
addq $0x10, %rsp
addq $0x40, %rbx
addq $-0x40, %r12
movl %ebp, %r9d
cmpq $0x3f, %r12
ja 0x405d82
jmp 0x405dc2
movq 0x18(%rsp), %r13
movq 0x10(%rsp), %r14
testq %r12, %r12
movl 0xc(%rsp), %r8d
movq 0x20(%rsp), %rsi
je 0x405de9
movq %r14, %rdi
movq %r15, %rdx
movq %r13, %rcx
movl %ebp, %r9d
pushq %r12
pushq %rbx
callq 0x405dff
addq $0x10, %rsp
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40ac90
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: PRF(unsigned char const*, unsigned long, unsigned char*, unsigned long, unsigned int, unsigned int, unsigned char*, unsigned long)
static void PRF(
   const uint8_t *password, size_t passwordLen,
   uint8_t *saltBlock, size_t saltLen,
   uint32_t iterations,
   uint32_t blockNumber,
   uint8_t *dk, size_t dkLen)   // dkLen <= APDigest::DIGEST_SIZE
{
    uint8_t mac[APDigest::DIGEST_SIZE];
    /* saltBlock = [ Salt || INT (blockNumber)]. */
    saltBlock[saltLen + 0] = (uint8_t)(blockNumber >> 24);
    saltBlock[saltLen + 1] = (uint8_t)(blockNumber >> 16);
    saltBlock[saltLen + 2] = (uint8_t)(blockNumber >> 8);
    saltBlock[saltLen + 3] = (uint8_t)(blockNumber);

    APDigest::hmac (
        password, passwordLen, 
        saltBlock, saltLen + 4, 
        mac, sizeof(mac));
    memcpy (dk, mac, dkLen);

    while (--iterations > 0)
    {
        APDigest::hmac (
            password, passwordLen, 
            mac, APDigest::DIGEST_SIZE, 
            mac, APDigest::DIGEST_SIZE);
        for (uint32_t i = 0; i < dkLen; i++) dk[i] ^= mac[i];
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x88(%rsp), %r12
movq 0x80(%rsp), %r13
bswapl %r9d
movl %r9d, (%rdx,%rcx)
addq $0x4, %rcx
movq %rsp, %rbp
movl $0x40, %r9d
movq %rbp, %r8
callq 0x405a3c
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x401110
decl %ebx
je 0x405e90
movq %rsp, %rbp
movl $0x40, %ecx
movl $0x40, %r9d
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbp, %r8
callq 0x405a3c
testq %r12, %r12
je 0x405e8c
xorl %eax, %eax
movb (%rsp,%rax), %cl
xorb %cl, (%r13,%rax)
incq %rax
movl %eax, %ecx
cmpq %r12, %rcx
jb 0x405e7a
decl %ebx
jne 0x405e57
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::createToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
const std::string APUser::createToken(
    const std::string& tag, 
    const std::string& payload)
{
    std::ostringstream s;
    s << tag << AP_SEP << std::hex << uint64_t(time(0)) << AP_SEP << payload << AP_SEP;

    std::string p = s.str();
    return p + m_private_key.signMessage(p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x46fdd0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x467680
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467680
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r12,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r12,%rax)
xorl %edi, %edi
callq 0x52da20
movq %r12, %rdi
movq %rax, %rsi
callq 0x467f80
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467680
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rax, %rdi
callq 0x467680
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467680
leaq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x46d7c0
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r14, %rsi
callq 0x40671a
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x478aa0
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x405fbb
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x405fc1
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x405ff3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40600e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470680
leaq 0xb8(%rsp), %rdi
callq 0x44ae50
movq %rbx, %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406063
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
jmp 0x406063
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406085
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
jmp 0x406085
jmp 0x406082
movq %rax, %rbx
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470680
leaq 0xb8(%rsp), %rdi
callq 0x44ae50
movq %rbx, %rdi
callq 0x4a9bd0
nop
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::registerNewUser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
const std::string APUser::registerNewUser(
    const std::string& pw_reset_info)
{
    std::ostringstream payload;
    payload << AP_DEFAULT_ALGO << AP_SEP << getPublicKey();
    if (!pw_reset_info.empty())
        payload << AP_SEP << B64Encode(
            pw_reset_info.c_str(), pw_reset_info.length());
    return createToken(AP_TAG_NEW_USER, payload.str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x46fdd0
leaq 0x174679(%rip), %rsi    # 0x57a760
movl $0x5, %edx
movq %r12, %rdi
callq 0x467680
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
leaq 0x48(%rsp), %rdi
movl $0x1, %edx
callq 0x467680
movq %rax, %r12
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x406702
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x467680
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x406148
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
cmpq $0x0, 0x8(%r15)
je 0x4061a3
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
leaq 0x48(%rsp), %rdi
movl $0x1, %edx
callq 0x467680
movq %rax, %r12
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0x8(%rsp), %rdi
callq 0x409b38
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x467680
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4061a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x19b915(%rip), %rsi    # 0x5a1ac7
leaq 0x19b910(%rip), %rdx    # 0x5a1ac9
callq 0x40549e
leaq 0x50(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x46d7c0
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x405eac
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4061fd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x406214
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470680
leaq 0xb8(%rsp), %rdi
callq 0x44ae50
movq %rbx, %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x40626a
jmp 0x40629d
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40626d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
jmp 0x40626d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x40628c
jmp 0x4062a0
jmp 0x40629d
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4062a0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
jmp 0x4062a0
jmp 0x40629d
movq %rax, %rbx
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470680
leaq 0xb8(%rsp), %rdi
callq 0x44ae50
movq %rbx, %rdi
callq 0x4a9bd0
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::changePassword[abi:cxx11](APUser const&)
const std::string APUser::changePassword(
    const APUser& new_key)
{
    std::string payload = new_key.getPublicKey();
    std::string token = createToken(AP_TAG_CHANGE_PASSWORD, payload);
    m_private_key = new_key.m_private_key;
    return token;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0x406702
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1742d9(%rip), %rsi    # 0x57a769
leaq 0x1742d4(%rip), %rdx    # 0x57a76b
leaq 0x8(%rsp), %rdi
callq 0x40549e
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x405eac
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4064cd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq %r15, %rdi
movq %r14, %rsi
callq 0x406758
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4064f3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x406535
movq (%rbx), %rsi
jmp 0x406528
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x406535
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ac80
jmp 0x406535
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406550
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ac80
movq %r14, %rdi
callq 0x4a9bd0
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/client/APPrivateKey.cpp
// Function: APPrivateKey::signMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string APPrivateKey::signMessage(const std::string& msg)
{
    unsigned char sig[SignatureSize];
    ed25519_SignMessage (sig, m_Key, &edp_signature_blinding,
        (const unsigned char*)msg.c_str(), msg.length());

    return B64Encode(sig, sizeof(sig));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq (%rdx), %rcx
movq 0x8(%rdx), %r8
leaq 0x1e4ae6(%rip), %rdx    # 0x5eb218
movq %rsp, %r14
movq %r14, %rdi
callq 0x40771f
movl $0x40, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x409b38
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: hex_string_to_u64(char const*, unsigned long&)
const char* hex_string_to_u64(const char* p, uint64_t& val)
{
    val = 0;
    do
    {
        int d = get_hex_digit(*p);
        if (d < 0) break;

        p++;
        val = (val << 4) + d;
    } while(1);
    return p;
}

// Assembly:
movq %rdi, %rax
xorl %ecx, %ecx
movq %rcx, (%rsi)
movsbl (%rax), %edx
leal -0x30(%rdx), %edi
cmpb $0x9, %dil
ja 0x40684c
addl $-0x30, %edx
jmp 0x406866
leal -0x41(%rdx), %edi
cmpb $0x5, %dil
ja 0x40685a
addl $-0x37, %edx
jmp 0x406866
leal -0x61(%rdx), %edi
cmpb $0x5, %dil
ja 0x406878
addl $-0x57, %edx
testl %edx, %edx
js 0x406878
incq %rax
shlq $0x4, %rcx
movl %edx, %edx
addq %rdx, %rcx
jmp 0x406838
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::ValidateToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
int APVerifier::ValidateToken(
    const std::string& token,
    size_t key_index)
{
    unsigned char sig[64];

    do
    {
        m_error = SplitToken(token);
        if (m_error != AP_SUCCESS) break;

        size_t nItems = m_items.size();

        // Last item is the signature in base64 format
        std::string& signature = m_items[nItems-1];
        if (B64Decode(signature, sig, sizeof(sig)) != sizeof(sig))
        {
            m_error = AP_E_B64_ITEM;
            break;
        }

        // If self-sined, key_index points to the public key
        if (key_index > 0)
        {
            if (key_index < 2 || key_index >= (nItems - 1))
            {
                m_error = AP_E_PARAMETER;
                break;
            }
            if (setKey(m_items[key_index]) != AP_SUCCESS) break;
        }

        m_error = m_public_key.verifySignature(
            (const unsigned char*)token.c_str(), 
            token.length() - signature.length(), 
            &sig[0]) ? 
            AP_SUCCESS : AP_E_SIGNATURE;

    } while(0);
    return m_error;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x40687a
movl %eax, 0x20(%rbx)
testl %eax, %eax
jne 0x406abe
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %r13
subq %rax, %r13
sarq $0x5, %r13
decq %r13
movq %r13, %r12
shlq $0x5, %r12
addq %rax, %r12
movq %rsp, %rsi
movl $0x40, %edx
movq %r12, %rdi
callq 0x409c72
cmpq $0x40, %rax
jne 0x406a7e
testq %r15, %r15
je 0x406a9a
cmpq $0x1, %r15
je 0x406a8c
cmpq %r15, %r13
jbe 0x406a8c
shlq $0x5, %r15
addq 0x38(%rbx), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4067d2
testl %eax, %eax
je 0x406a9a
movl 0x20(%rbx), %eax
jmp 0x406abe
movl $0xfffffff6, 0x20(%rbx) # imm = 0xFFFFFFF6
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
jmp 0x406abe
movl $0xffffffff, 0x20(%rbx) # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x406abe
movq (%r14), %rsi
movq 0x8(%r14), %rdx
subq 0x8(%r12), %rdx
movq %rsp, %rcx
movq %rbx, %rdi
callq 0x406fca
movzbl %al, %eax
leal -0x8(,%rax,8), %eax
movl %eax, 0x20(%rbx)
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::parseUserRegistrationToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool APVerifier::parseUserRegistrationToken(
    const std::string& token)
{
    m_error = SplitToken(token);
    if (m_error == AP_SUCCESS)
    {
        if (m_items.size() < 4)
            m_error = AP_E_FORMAT;
        else if (m_tag != AP_NEW_USER)
            m_error = AP_E_TOKEN;
        else if (m_items[2] != AP_DEFAULT_ALGO)
            m_error = AP_E_ALGO;
        else
            setKey(m_items[3]);
    }
    m_token_expiration_time = 0;
    return isValid();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x40687a
movl %eax, 0x20(%rbx)
testl %eax, %eax
jne 0x406b8d
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq %rdi, %rax
cmpq $0x7f, %rax
ja 0x406b41
movl $0xfffffffe, 0x20(%rbx) # imm = 0xFFFFFFFE
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x406b8d
cmpl $0x6e75, 0x24(%rbx)     # imm = 0x6E75
jne 0x406b6c
addq $0x40, %rdi
leaq 0x173c0b(%rip), %rsi    # 0x57a760
callq 0x479cc0
testl %eax, %eax
je 0x406b7a
movl $0xfffffffd, 0x20(%rbx) # imm = 0xFFFFFFFD
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jmp 0x406b8d
movl $0xfffffffc, 0x20(%rbx) # imm = 0xFFFFFFFC
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
jmp 0x406b8d
movq 0x38(%rbx), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
callq 0x4067d2
movl 0x20(%rbx), %eax
movq $0x0, 0x30(%rbx)
testl %eax, %eax
setns %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::parseUserLoginToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool APVerifier::parseUserLoginToken(const std::string& token)
{
    do
    {
        if (ValidateToken(token) != AP_SUCCESS) break;

        if (m_tag != AP_USER_LOGIN)
        {
            m_error = AP_E_TOKEN;
            break;
        }

        // item(2) is token duration (in hex)
        uint64_t duration = 0;
        const char* p = hex_string_to_u64(m_items[2].c_str(), duration);
        if (*p != '\0' || duration > APV_MAX_LOGIN_DURATION)
        {
            m_error = AP_E_TIMESTAMP;
            break;
        }

        m_token_expiration_time = (uint64_t)time(NULL) + duration;

    } while(0);
    return isValid();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %edx, %edx
callq 0x4069fa
testl %eax, %eax
jne 0x406c29
cmpl $0x6c69, 0x24(%rbx)     # imm = 0x6C69
jne 0x406bfc
movq 0x38(%rbx), %rax
movq 0x40(%rax), %rax
xorl %r14d, %r14d
movsbl (%rax), %ecx
leal -0x30(%rcx), %edx
cmpb $0x9, %dl
ja 0x406bd2
addl $-0x30, %ecx
jmp 0x406bea
leal -0x41(%rcx), %edx
cmpb $0x5, %dl
ja 0x406bdf
addl $-0x37, %ecx
jmp 0x406bea
leal -0x61(%rcx), %edx
cmpb $0x5, %dl
ja 0x406c05
addl $-0x57, %ecx
testl %ecx, %ecx
js 0x406c22
incq %rax
shlq $0x4, %r14
movl %ecx, %ecx
addq %rcx, %r14
jmp 0x406bc2
movl $0xfffffffc, 0x20(%rbx) # imm = 0xFFFFFFFC
jmp 0x406c29
testb %cl, %cl
jne 0x406c22
cmpq $0xe11, %r14            # imm = 0xE11
jae 0x406c22
xorl %edi, %edi
callq 0x52da20
addq %r14, %rax
movq %rax, 0x30(%rbx)
jmp 0x406c29
movl $0xfffffffb, 0x20(%rbx) # imm = 0xFFFFFFFB
cmpl $0x0, 0x20(%rbx)
setns %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq