// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, %r13d
movq %r8, %r15
movq %rdx, %rbx
movq %rdi, %r12
movslq %esi, %rbp
movq %rcx, 0x38(%rsp)
movq (%rcx), %r14
movq (%rdi), %rdi
movl 0x30(%r12), %edx
xorl %esi, %esi
callq 0x1c60e
movl %eax, %ecx
decl %ecx
movw %cx, (%r14,%rbp,8)
leal 0x1(%r13), %r8d
cmpl %r13d, (%r15)
jg 0x1c3b1
movl %r8d, (%r15)
movb $0x1, %r13b
testw %ax, %ax
je 0x1c4dd
movswq %cx, %rcx
movq (%rbx), %rax
movl (%rax,%rcx,8), %esi
movq %rcx, 0x30(%rsp)
movl 0x4(%rax,%rcx,8), %eax
cmpl %eax, %esi
jge 0x1c4c7
movq %rbx, %r13
movl $0x80a0, %edi           # imm = 0x80A0
addq (%r12), %rdi
movq %rax, 0x20(%rsp)
leal -0x1(%rax), %edx
movl %esi, 0x14(%rsp)
movq %r15, 0x18(%rsp)
movl %r8d, 0x10(%rsp)
callq 0x1c60e
movl %eax, %ebx
movl %eax, 0x4(%r14,%rbp,8)
movq 0x38(%rsp), %r15
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x3, %rax
movw %ax, 0x2(%r14,%rbp,8)
movzwl %ax, %eax
movl %eax, 0xc(%rsp)
movl $0xffff, %ebp           # imm = 0xFFFF
leaq 0x40(%rsp), %r14
movq %rbp, (%r14)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1c4f0
movq %rbp, (%r14)
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x1c4f0
movq %rbx, 0x28(%rsp)
leal 0x1(%rbx), %eax
movq (%r13), %rcx
movq 0x30(%rsp), %rbx
movl %eax, (%rcx,%rbx,8)
movq %r12, %rdi
movl 0xc(%rsp), %esi
movq %r13, %rdx
movq %r15, %rcx
movq 0x18(%rsp), %r8
movl 0x10(%rsp), %r9d
callq 0x1c368
testb %al, %al
je 0x1c4da
movq (%r13), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%rax,%rbx,8)
movq 0x28(%rsp), %rcx
movl %ecx, 0x4(%rax,%rbx,8)
movl 0xc(%rsp), %esi
incl %esi
movq %r12, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq 0x18(%rsp), %r8
movl 0x10(%rsp), %r9d
callq 0x1c368
testb %al, %al
je 0x1c4da
movq (%r13), %rax
movq 0x20(%rsp), %rcx
movl %ecx, 0x4(%rax,%rbx,8)
movb $0x1, %r13b
jmp 0x1c4dd
leaq 0xa9f4(%rip), %rdi      # 0x26ec2
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x379e
jmp 0x1c4dd
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop