// File: cloudinary[P]fuif/encoding/../maniac/compound.h
// Function: MetaPropertySymbolCoder<SimpleBitChance, RacInput24<FileIO>>::read_subtree(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, Tree&, int&, int)
bool read_subtree(int pos, Ranges &subrange, Tree &tree, int &maxdepth, int depth) {
        PropertyDecisionNode &n = tree[pos];
        int p = n.property = coder[0].read_int2(0,nb_properties)-1;
        depth++;
        if (depth>maxdepth) maxdepth=depth;
        if (p != -1) {
            int oldmin = subrange[p].first;
            int oldmax = subrange[p].second;
            if (oldmin >= oldmax) {
              e_printf( "Invalid tree. Aborting tree decoding.\n");
              return false;
            }
//            n.count = coder[1].read_int2(CONTEXT_TREE_MIN_COUNT, CONTEXT_TREE_MAX_COUNT);
            assert(oldmin < oldmax);
            int splitval = n.splitval = coder[2].read_int2(oldmin, oldmax-1);
            int childID = n.childID = tree.size();
//            e_printf( "Pos %i: prop %i splitval %i in [%i..%i]\n", pos, n.property, splitval, oldmin, oldmax-1);
            tree.push_back(PropertyDecisionNode());
            tree.push_back(PropertyDecisionNode());
            // > splitval
            subrange[p].first = splitval+1;
            if (!read_subtree(childID, subrange, tree, maxdepth, depth)) return false;

            // <= splitval
            subrange[p].first = oldmin;
            subrange[p].second = splitval;
            if (!read_subtree(childID+1, subrange, tree, maxdepth, depth)) return false;

            subrange[p].second = oldmax;
        }
        return true;
    }

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movl %esi, 0x84(%rsp)
movq %rdx, 0x78(%rsp)
movq %rcx, 0x70(%rsp)
movq %r8, 0x68(%rsp)
movl %r9d, 0x64(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x70(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0x30990
movq 0x28(%rsp), %rdi
movq %rax, 0x58(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0x37b20
movq %rax, %rdi
movq 0x28(%rsp), %rax
movl 0x30(%rax), %edx
xorl %esi, %esi
callq 0x37b40
subl $0x1, %eax
movq 0x58(%rsp), %rcx
movw %ax, (%rcx)
cwtl
movl %eax, 0x54(%rsp)
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl (%rcx), %eax
jle 0x375b1
movl 0x64(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, (%rax)
cmpl $-0x1, 0x54(%rsp)
je 0x3778b
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl (%rax), %eax
movl %eax, 0x50(%rsp)
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl 0x4(%rax), %eax
movl %eax, 0x4c(%rsp)
movl 0x50(%rsp), %eax
cmpl 0x4c(%rsp), %eax
jl 0x3760c
leaq 0x107c8(%rip), %rdi     # 0x47dc0
movb $0x0, %al
callq 0x3a670
movb $0x0, 0x97(%rsp)
jmp 0x37793
movq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x37b20
movq %rax, %rdi
movl 0x50(%rsp), %esi
movl 0x4c(%rsp), %edx
subl $0x1, %edx
callq 0x37b40
movq 0x58(%rsp), %rcx
movl %eax, 0x4(%rcx)
movl %eax, 0x48(%rsp)
movq 0x70(%rsp), %rdi
callq 0x30b30
movq 0x58(%rsp), %rcx
movw %ax, 0x2(%rcx)
movzwl %ax, %eax
movl %eax, 0x44(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x3c(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x29fc0
movq 0x10(%rsp), %rdi
leaq 0x3c(%rsp), %rsi
callq 0x374e0
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x34(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x29fc0
movq 0x18(%rsp), %rdi
leaq 0x34(%rsp), %rsi
callq 0x374e0
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl 0x24(%rsp), %ecx
movq 0x28(%rsp), %rdi
movl %ecx, (%rax)
movl 0x44(%rsp), %esi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %r8
movl 0x64(%rsp), %r9d
callq 0x37510
testb $0x1, %al
jne 0x376ff
movb $0x0, 0x97(%rsp)
jmp 0x37793
movl 0x50(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
movl 0x48(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl 0xc(%rsp), %ecx
movq 0x28(%rsp), %rdi
movl %ecx, 0x4(%rax)
movl 0x44(%rsp), %esi
addl $0x1, %esi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
movq 0x68(%rsp), %r8
movl 0x64(%rsp), %r9d
callq 0x37510
testb $0x1, %al
jne 0x3776d
movb $0x0, 0x97(%rsp)
jmp 0x37793
movl 0x4c(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x78(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x13420
movl 0x4(%rsp), %ecx
movl %ecx, 0x4(%rax)
movb $0x1, 0x97(%rsp)
movb 0x97(%rsp), %al
andb $0x1, %al
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)
nop