// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]oblivious-avl-tree/src/OAVLTreeDeterministicEviction.cpp
// Function: OAVLTreeDeterministicEviction::insert(int, int)
void OAVLTreeDeterministicEviction::insert(int key, int val) {
    Block to_insert;
    to_insert.leaf_id = rand_gen->getRandomLeaf();
    to_insert.id = id_gen->getNextId();
    to_insert.data[0] = key;
    to_insert.data[1] = val;
    to_insert.data[2] = 0;
    to_insert.data[3] = 0;
    if (root.id == -1) {
        stash.push_back(to_insert);
        root.leaf_id = to_insert.leaf_id;
        root.id = to_insert.id;
        performDummyFinds(num_levels);
        evictTwoPaths();
        performDummyEvictions(num_levels - 1);
        return;
    }
    moveToLocal(root.leaf_id, root.id);
    int b = 0;
    while (true) {
        if (local[b].data[0] < key) {
            if (local[b].rightChildId != -1) {
                moveToLocal(local[b].rightChildPos, local[b].rightChildId);
            } else {
                local[b].rightChildId = to_insert.id;
                local[b].rightChildPos = to_insert.leaf_id;
                local.push_back(to_insert);
                break;
            }
        } else {
            if (local[b].leftChildId != -1) {
                moveToLocal(local[b].leftChildPos, local[b].leftChildId);
            } else {
                local[b].leftChildId = to_insert.id;
                local[b].leftChildPos = to_insert.leaf_id;
                local.push_back(to_insert);
                break;
            }
        }
        b = (int)local.size() - 1;
    }
    for (int i = (int)local.size() - 2; i >= 0; i--) {
        local[i].leaf_id = rand_gen->getRandomLeaf();
        if (local[i].leftChildId == local[i + 1].id) {
            local[i].leftChildPos = local[i + 1].leaf_id;
        } else local[i].rightChildPos = local[i + 1].leaf_id;
    }
    updateHeight();
    root.id = local[0].id;
    root.leaf_id = local[0].leaf_id;

    for (int i = (int)local.size() - 3; i > 0; i--) {
        if (local[i].getBalance() > 1) {
            if (local[i+1].getBalance() >= 0) {
                bool isLeftChild = false;
                if (local[i-1].leftChildId == local[i].id) isLeftChild = true;
                local[i].leftChildId = local[i+1].rightChildId;
                local[i].leftChildPos = local[i+1].rightChildPos;
                local[i+1].rightChildId = local[i].id;
                local[i+1].rightChildPos = local[i].leaf_id;
                if (isLeftChild) {
                    local[i-1].leftChildId = local[i+1].id;
                    local[i-1].leftChildPos = local[i+1].leaf_id;
                } else {
                    local[i-1].rightChildId = local[i+1].id;
                    local[i-1].rightChildPos = local[i+1].leaf_id;
                }
                local[i].data[2] = local[i+1].data[3];
                local[i+1].data[3] = 1+ max(local[i].data[2],local[i].data[3]);
                if (isLeftChild) local[i-1].data[2] = 1+ max(local[i+1].data[2],local[i+1].data[3]);
                else local[i-1].data[3] = 1+ max(local[i+1].data[2],local[i+1].data[3]);
                for (int j = i-2; j >= 0; j--) {
                    if (local[j].leftChildId == local[j+1].id) {
                        local[j].data[2] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                    } else local[j].data[3] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                }
                root.id = local[0].id;
                root.leaf_id = local[0].leaf_id;
            } else { //double rotation
               bool isLeftChild = false;
               if (local[i-1].leftChildId == local[i].id) isLeftChild = true;
               local[i].leftChildId = local[i+2].rightChildId;
               local[i].leftChildPos = local[i+2].rightChildPos;
               local[i].data[2] = local[i+2].data[3];
               local[i+1].rightChildId = local[i+2].leftChildId;
               local[i+1].rightChildPos = local[i+2].leftChildPos;
               local[i+1].data[3] = local[i+2].data[2];
               local[i+2].rightChildId = local[i].id;
               local[i+2].rightChildPos = local[i].leaf_id;
               local[i+2].data[3] = 1 + max(local[i].data[2], local[i].data[3]);
               local[i+2].leftChildId = local[i+1].id;
               local[i+2].leftChildPos = local[i+1].leaf_id;
               local[i+2].data[2] = 1 + max(local[i+1].data[2], local[i+1].data[3]);
               if (isLeftChild) {
                   local[i-1].leftChildId = local[i+2].id;
                   local[i-1].leftChildPos = local[i+2].leaf_id;
                   local[i-1].data[2] = 1+ max(local[i+2].data[2],local[i+2].data[3]);
               } else {
                   local[i-1].rightChildId = local[i+2].id;
                   local[i-1].rightChildPos = local[i+2].leaf_id;
                   local[i-1].data[3] = 1+ max(local[i+2].data[2],local[i+2].data[3]);
               }
               for (int j = i-2; j >= 0; j--) {
                   if (local[j].leftChildId == local[j+1].id) {
                       local[j].data[2] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                   } else local[j].data[3] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
               }
               root.id = local[0].id;
               root.leaf_id = local[0].leaf_id;
           }
        }
        
        
        if (local[i].getBalance() < -1) {
            if (local[i+1].getBalance() <= 0) {
                bool isLeftChild = false;
                if (local[i-1].leftChildId == local[i].id) isLeftChild = true;
                local[i].rightChildId = local[i+1].leftChildId;
                local[i].rightChildPos = local[i+1].leftChildPos;
                local[i+1].leftChildId = local[i].id;
                local[i+1].leftChildPos = local[i].leaf_id;
                if (isLeftChild) {
                    local[i-1].leftChildId = local[i+1].id;
                    local[i-1].leftChildPos = local[i+1].leaf_id;
                } else {
                    local[i-1].rightChildId = local[i+1].id;
                    local[i-1].rightChildPos = local[i+1].leaf_id;
                }
                local[i].data[3] = local[i+1].data[2];
                local[i+1].data[2] = 1+ max(local[i].data[2],local[i].data[3]);
                if (isLeftChild) local[i-1].data[2] = 1+ max(local[i+1].data[2],local[i+1].data[3]);
                else local[i-1].data[3] = 1+ max(local[i+1].data[2],local[i+1].data[3]);
                for (int j = i-2; j >= 0; j--) {
                    if (local[j].leftChildId == local[j+1].id) {
                        local[j].data[2] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                    } else local[j].data[3] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                }
                root.id = local[0].id;
                root.leaf_id = local[0].leaf_id;
            } else { //double rotation
                bool isLeftChild = false;
                if (local[i-1].leftChildId == local[i].id) isLeftChild = true;
                local[i].rightChildId = local[i+2].leftChildId;
                local[i].rightChildPos = local[i+2].leftChildPos;
                local[i].data[3] = local[i+2].data[2];
                local[i+1].leftChildId = local[i+2].rightChildId;
                local[i+1].leftChildPos = local[i+2].rightChildPos;
                local[i+1].data[2] = local[i+2].data[3];
                local[i+2].leftChildId = local[i].id;
                local[i+2].leftChildPos = local[i].leaf_id;
                local[i+2].data[2] = 1 + max(local[i].data[2], local[i].data[3]);
                local[i+2].rightChildId = local[i+1].id;
                local[i+2].rightChildPos = local[i+1].leaf_id;
                local[i+2].data[3] = 1 + max(local[i+1].data[2], local[i+1].data[3]);
                if (isLeftChild) {
                    local[i-1].leftChildId = local[i+2].id;
                    local[i-1].leftChildPos = local[i+2].leaf_id;
                    local[i-1].data[2] = 1+ max(local[i+2].data[2],local[i+2].data[3]);
                } else {
                    local[i-1].rightChildId = local[i+2].id;
                    local[i-1].rightChildPos = local[i+2].leaf_id;
                    local[i-1].data[3] = 1+ max(local[i+2].data[2],local[i+2].data[3]);
                }
                for (int j = i-2; j >= 0; j--) {
                    if (local[j].leftChildId == local[j+1].id) {
                        local[j].data[2] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                    } else local[j].data[3] = 1 + max(local[j+1].data[2], local[j+1].data[3]);
                }
                root.id = local[0].id;
                root.leaf_id = local[0].leaf_id;
            }
        }
    }

    //rotate root
    if (local[0].getBalance() > 1) {
        if (local[1].getBalance() >= 0) {
            local[0].leftChildId = local[1].rightChildId;
            local[0].leftChildPos = local[1].rightChildPos;
            local[1].rightChildId = local[0].id;
            local[1].rightChildPos = local[0].leaf_id;
            local[0].data[2] = local[1].data[3];
            local[1].data[3] = 1+ max(local[0].data[2],local[0].data[3]);
            root.id = local[1].id;
            root.leaf_id = local[1].leaf_id;
        } else { //double rotation
            local[0].leftChildId = local[2].rightChildId;
            local[0].leftChildPos = local[2].rightChildPos;
            local[0].data[2] = local[2].data[3];
            local[1].rightChildId = local[2].leftChildId;
            local[1].rightChildPos = local[2].leftChildPos;
            local[1].data[3] = local[2].data[2];
            local[2].rightChildId = local[0].id;
            local[2].rightChildPos = local[0].leaf_id;
            local[2].data[3] = 1 + max(local[0].data[2], local[0].data[3]);
            local[2].leftChildId = local[1].id;
            local[2].leftChildPos = local[1].leaf_id;
            local[2].data[2] = 1 + max(local[1].data[2], local[1].data[3]);
            root.id = local[2].id;
            root.leaf_id = local[2].leaf_id;
        }
    }
    if (local[0].getBalance() < -1) {
        if (local[1].getBalance() <= 0) {
            local[0].rightChildId = local[1].leftChildId;
            local[0].rightChildPos = local[1].leftChildPos;
            local[1].leftChildId = local[0].id;
            local[1].leftChildPos = local[0].leaf_id;
            local[0].data[3] = local[1].data[2];
            local[1].data[2] = 1+ max(local[0].data[2],local[0].data[3]);
            root.id = local[1].id;
            root.leaf_id = local[1].leaf_id;
        } else { //double rotation
            local[0].rightChildId = local[2].leftChildId;
            local[0].rightChildPos = local[2].leftChildPos;
            local[0].data[3] = local[2].data[2];
            local[1].leftChildId = local[2].rightChildId;
            local[1].leftChildPos = local[2].rightChildPos;
            local[1].data[2] = local[2].data[3];
            local[2].leftChildId = local[0].id;
            local[2].leftChildPos = local[0].leaf_id;
            local[2].data[2] = 1 + max(local[0].data[2], local[0].data[3]);
            local[2].rightChildId = local[1].id;
            local[2].rightChildPos = local[1].leaf_id;
            local[2].data[3] = 1 + max(local[1].data[2], local[1].data[3]);
            root.id = local[2].id;
            root.leaf_id = local[2].leaf_id;
        }
    }
    int l = local.size();
    performDummyFinds(num_levels - l);
    while (!local.empty())
    {
        stash.push_back(local[local.size()-1]);
        local.pop_back();
        evictTwoPaths();
    }
    performDummyEvictions(num_levels - l);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x18(%rsp), %rdi
callq 0x261c
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *(%rax)
movl %eax, 0x20(%rsp)
movq 0x60(%rbx), %rax
movl (%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movl %ecx, 0x24(%rsp)
movl %ebp, 0x28(%rsp)
movl %r14d, 0x2c(%rsp)
movq $0x0, 0x30(%rsp)
movl 0x68(%rbx), %edx
cmpl $-0x1, %edx
je 0x4836
movl 0x6c(%rbx), %esi
movq %rbx, %rdi
callq 0x4548
leaq 0x48(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rbx), %rcx
xorl %eax, %eax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
cltq
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
cmpl %ebp, 0x10(%rcx,%rdx)
jge 0x4806
movl 0x2c(%rax), %edx
movl $0x28, %ecx
cmpl $-0x1, %edx
jne 0x4813
jmp 0x4886
movl 0x24(%rax), %edx
movl $0x20, %ecx
cmpl $-0x1, %edx
je 0x488d
movl (%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x4548
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rax
subq %rcx, %rax
sarq $0x4, %rax
imulq %r15, %rax
decq %rax
jmp 0x47e0
leaq 0x30(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0x30ce
movq 0x20(%rsp), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x68(%rbx)
movl 0x20(%rbx), %esi
movq %rbx, %rdi
callq 0x4fa4
movq %rbx, %rdi
callq 0x50fc
movl 0x20(%rbx), %ebp
cmpl $0x2, %ebp
jl 0x4f66
decl %ebp
movq %rbx, %rdi
callq 0x50fc
decl %ebp
jne 0x4875
jmp 0x4f66
movl $0x2c, %edx
jmp 0x4892
movl $0x24, %edx
leaq 0x18(%rsp), %rsi
movl 0xc(%rsi), %edi
movl %edi, (%rax,%rdx)
movl 0x8(%rsi), %edx
movl %edx, (%rax,%rcx)
movq 0x8(%rsp), %rdi
callq 0x30ce
movq 0x50(%rbx), %rax
subq 0x48(%rbx), %rax
sarq $0x4, %rax
imulq %r15, %rax
cmpl $0x2, %eax
jl 0x490d
addl $-0x2, %eax
leaq 0x1(%rax), %r14
shlq $0x4, %rax
leaq (%rax,%rax,2), %r12
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *(%rax)
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rcx,%r12), %rdx
movl %eax, 0x8(%rcx,%r12)
movl 0x24(%rcx,%r12), %eax
movl 0x38(%rcx,%r12), %esi
xorl %edi, %edi
cmpl 0x3c(%rcx,%r12), %eax
setne %dil
movl %esi, 0x20(%rdx,%rdi,8)
addq $-0x30, %r12
decq %r14
jg 0x48d1
movq %rbx, %rdi
callq 0x51a8
movq 0x48(%rbx), %rdi
movq 0x50(%rbx), %rax
movq 0x8(%rdi), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x68(%rbx)
subq %rdi, %rax
sarq $0x4, %rax
imulq %r15, %rax
cmpl $0x4, %eax
jl 0x4d78
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
movl %eax, %r15d
addl %ecx, %r15d
leal -0x5(%rax), %ebp
leal -0x4(%rax), %r12d
leaq (%r15,%r15,2), %r13
shlq $0x4, %r13
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq %r13, %rdi
callq 0x2a1e
movl %ebp, %ecx
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rcx
movq %rcx, 0x10(%rsp)
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
cmpl $0x2, %eax
jl 0x4b66
leaq 0x1(%r15), %rax
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
addq %r14, %rdi
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
leaq (%rdi,%r13), %rcx
movl -0xc(%rdi,%r13), %edx
movl 0xc(%rdi,%r13), %esi
testl %eax, %eax
js 0x4a30
xorl %eax, %eax
cmpl %esi, %edx
setne %al
movq 0x28(%rdi,%r14), %r8
movq %r8, 0x20(%rcx)
movl %esi, 0x2c(%rdi,%r14)
movl 0x8(%rcx), %r8d
movl %r8d, 0x28(%rdi,%r14)
movl 0xc(%rdi,%r14), %r8d
shll $0x3, %eax
movq %rax, %r9
orq $-0xc, %r9
orq $-0x10, %rax
movl %r8d, (%rcx,%r9)
movl 0x8(%rdi,%r14), %r8d
movl %r8d, (%rcx,%rax)
movl 0x1c(%rdi,%r14), %eax
movl %eax, 0x18(%rcx)
movl 0x1c(%rcx), %r8d
cmpl %r8d, %eax
cmovgl %eax, %r8d
leal 0x1(%r8), %r9d
movl 0x18(%rdi,%r14), %eax
cmpl %r8d, %eax
cmovlel %r9d, %eax
incl %eax
movl %r9d, 0x1c(%rdi,%r14)
cmpl %esi, %edx
jne 0x4ac0
movl %eax, -0x18(%rcx)
jmp 0x4ac3
movq 0x88(%rcx), %rax
movq %rax, 0x20(%rcx)
movl 0x7c(%rcx), %r9d
movl %r9d, 0x18(%rcx)
movq 0x80(%rcx), %rax
movq %rax, 0x28(%rdi,%r14)
movl 0x78(%rcx), %eax
movl %eax, 0x1c(%rdi,%r14)
movl %esi, 0x8c(%rcx)
movl 0x8(%rcx), %r10d
movl 0x1c(%rcx), %r8d
movl %r10d, 0x88(%rcx)
cmpl %r8d, %r9d
cmovgl %r9d, %r8d
leal 0x1(%r8), %r9d
movl %r9d, 0x7c(%rcx)
movq 0x8(%rdi,%r14), %r10
movq %r10, 0x80(%rcx)
movl 0x18(%rdi,%r14), %r10d
cmpl %eax, %r10d
cmovgl %r10d, %eax
leal 0x1(%rax), %r10d
movl %r10d, 0x78(%rcx)
movl 0x6c(%rcx), %r11d
cmpl %esi, %edx
jne 0x4b04
movl %r11d, -0xc(%rcx)
movl 0x68(%rcx), %edx
movl %edx, -0x10(%rcx)
xorl %edx, %edx
cmpl %r8d, %eax
setl %dl
movl 0x78(%rcx,%rdx,4), %eax
incl %eax
movl %eax, -0x18(%rcx)
jmp 0x4b1c
movl %eax, -0x14(%rcx)
cmpq $0x2, %r15
jl 0x4b57
movq 0x10(%rsp), %rax
addq %rdi, %rax
addq $0x4c, %rax
movl %r12d, %ecx
movl -0x4(%rax), %esi
movl (%rax), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
movl -0x28(%rax), %esi
incl %edx
cmpl -0x10(%rax), %esi
jne 0x4af5
movl %edx, -0x34(%rax)
jmp 0x4af8
movl %edx, -0x30(%rax)
decl %ecx
addq $-0x30, %rax
testl %ecx, %ecx
jg 0x4adc
jmp 0x4b57
movl %r11d, -0x4(%rcx)
movl 0x68(%rcx), %eax
movl %eax, -0x8(%rcx)
cmpl %r9d, %r10d
cmovgl %r10d, %r9d
incl %r9d
movl %r9d, -0x14(%rcx)
cmpq $0x2, %r15
jb 0x4b57
movq 0x10(%rsp), %rax
addq %rdi, %rax
addq $0x4c, %rax
movl %r12d, %ecx
movl -0x4(%rax), %esi
movl (%rax), %edx
cmpl %edx, %esi
cmovgl %esi, %edx
movl -0x28(%rax), %esi
incl %edx
cmpl -0x10(%rax), %esi
jne 0x4b4a
movl %edx, -0x34(%rax)
jmp 0x4b4d
movl %edx, -0x30(%rax)
decl %ecx
addq $-0x30, %rax
testl %ecx, %ecx
jg 0x4b31
movq 0x8(%rdi), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x68(%rbx)
addq %r13, %rdi
callq 0x2a1e
cmpl $-0x2, %eax
jg 0x4d5a
leaq 0x1(%r15), %rax
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rcx,%r13), %rdx
movl -0xc(%rcx,%r13), %esi
movl 0xc(%rcx,%r13), %edi
testl %eax, %eax
jle 0x4c48
movq 0x80(%rdx), %rax
movq %rax, 0x28(%rdx)
movl 0x78(%rdx), %eax
movl %eax, 0x1c(%rdx)
movq 0x88(%rdx), %r8
movq %r8, 0x20(%rcx,%r14)
movl 0x7c(%rdx), %r10d
movl %r10d, 0x18(%rcx,%r14)
movl %edi, 0x84(%rdx)
movl 0x8(%rdx), %r8d
movl 0x18(%rdx), %r9d
movl %r8d, 0x80(%rdx)
cmpl %eax, %r9d
cmovgl %r9d, %eax
leal 0x1(%rax), %r8d
movl %r8d, 0x78(%rdx)
movq 0x8(%rcx,%r14), %r9
movq %r9, 0x88(%rdx)
movl 0x1c(%rcx,%r14), %r9d
cmpl %r9d, %r10d
cmovgl %r10d, %r9d
leal 0x1(%r9), %r10d
movl %r10d, 0x7c(%rdx)
movl 0x6c(%rdx), %r11d
cmpl %edi, %esi
jne 0x4cb8
movl %r11d, -0xc(%rdx)
movl 0x68(%rdx), %esi
movl %esi, -0x10(%rdx)
xorl %esi, %esi
cmpl %r9d, %eax
setl %sil
movl 0x78(%rdx,%rsi,4), %eax
incl %eax
movl %eax, -0x18(%rdx)
jmp 0x4cd0
xorl %eax, %eax
cmpl %edi, %esi
setne %al
movq 0x20(%rcx,%r14), %r8
movq %r8, 0x28(%rdx)
movl %edi, 0x24(%rcx,%r14)
movl 0x8(%rdx), %r8d
movl %r8d, 0x20(%rcx,%r14)
movl 0xc(%rcx,%r14), %r8d
shll $0x3, %eax
movq %rax, %r9
orq $-0xc, %r9
orq $-0x10, %rax
movl %r8d, (%rdx,%r9)
movl 0x8(%rcx,%r14), %r8d
movl %r8d, (%rdx,%rax)
movl 0x18(%rcx,%r14), %r8d
movl %r8d, 0x1c(%rdx)
movl 0x18(%rdx), %eax
cmpl %r8d, %eax
cmovgl %eax, %r8d
incl %r8d
movl 0x1c(%rcx,%r14), %eax
cmpl %eax, %r8d
cmovgl %r8d, %eax
incl %eax
movl %r8d, 0x18(%rcx,%r14)
cmpl %edi, %esi
jne 0x4d0d
movl %eax, -0x18(%rdx)
jmp 0x4d10
movl %r11d, -0x4(%rdx)
movl 0x68(%rdx), %eax
movl %eax, -0x8(%rdx)
cmpl %r10d, %r8d
cmovgl %r8d, %r10d
incl %r10d
movl %r10d, -0x14(%rdx)
cmpq $0x2, %r15
jl 0x4d4b
movq 0x10(%rsp), %rax
addq %rcx, %rax
addq $0x4c, %rax
movl %r12d, %edx
movl -0x4(%rax), %edi
movl (%rax), %esi
cmpl %esi, %edi
cmovgl %edi, %esi
movl -0x28(%rax), %edi
incl %esi
cmpl -0x10(%rax), %edi
jne 0x4cfe
movl %esi, -0x34(%rax)
jmp 0x4d01
movl %esi, -0x30(%rax)
decl %edx
addq $-0x30, %rax
testl %edx, %edx
jg 0x4ce5
jmp 0x4d4b
movl %eax, -0x14(%rdx)
cmpq $0x2, %r15
jl 0x4d4b
movq 0x10(%rsp), %rax
addq %rcx, %rax
addq $0x4c, %rax
movl %r12d, %edx
movl -0x4(%rax), %edi
movl (%rax), %esi
cmpl %esi, %edi
cmovgl %edi, %esi
movl -0x28(%rax), %edi
incl %esi
cmpl -0x10(%rax), %edi
jne 0x4d3e
movl %esi, -0x34(%rax)
jmp 0x4d41
movl %esi, -0x30(%rax)
decl %edx
addq $-0x30, %rax
testl %edx, %edx
jg 0x4d25
movq 0x8(%rcx), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x68(%rbx)
leaq -0x1(%r15), %rax
decl %ebp
decl %r12d
cmpq $0x1, %r15
movq %rax, %r15
jg 0x4952
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
cmpl $0x2, %eax
jl 0x4e3a
addq $0x30, %rdi
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
testl %eax, %eax
js 0x4dd2
movq 0x58(%rdi), %rax
movq %rax, 0x20(%rdi)
movq 0x8(%rdi), %rax
movq %rax, 0x58(%rdi)
movl 0x4c(%rdi), %eax
movl %eax, 0x18(%rdi)
movl 0x1c(%rdi), %ecx
cmpl %ecx, %eax
cmovgl %eax, %ecx
incl %ecx
movl %ecx, 0x4c(%rdi)
movl $0x38, %eax
movl $0x3c, %ecx
jmp 0x4e2e
movq 0x88(%rdi), %rax
movq %rax, 0x20(%rdi)
movl 0x7c(%rdi), %eax
movl %eax, 0x18(%rdi)
movq 0x80(%rdi), %rcx
movq %rcx, 0x58(%rdi)
movl 0x78(%rdi), %ecx
movl %ecx, 0x4c(%rdi)
movl 0x1c(%rdi), %edx
movl 0x48(%rdi), %esi
cmpl %edx, %eax
cmovgl %eax, %edx
incl %edx
movl %edx, 0x7c(%rdi)
movq 0x8(%rdi), %xmm0
movq 0x38(%rdi), %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqu %xmm1, 0x80(%rdi)
cmpl %ecx, %esi
cmovgl %esi, %ecx
incl %ecx
movl %ecx, 0x78(%rdi)
movl $0x68, %eax
movl $0x6c, %ecx
movl (%rdi,%rcx), %ecx
movl %ecx, 0x68(%rbx)
movl (%rdi,%rax), %eax
movl %eax, 0x6c(%rbx)
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
cmpl $-0x2, %eax
jg 0x4efc
addq $0x30, %rdi
callq 0x2a1e
movq 0x8(%rsp), %rcx
movq (%rcx), %rdi
testl %eax, %eax
jle 0x4ec3
movq 0x80(%rdi), %rax
movq %rax, 0x28(%rdi)
movl 0x78(%rdi), %eax
movl %eax, 0x1c(%rdi)
movq 0x88(%rdi), %rcx
movq %rcx, 0x50(%rdi)
movl 0x7c(%rdi), %ecx
movl %ecx, 0x48(%rdi)
movl 0x18(%rdi), %edx
movl 0x4c(%rdi), %esi
cmpl %eax, %edx
cmovgl %edx, %eax
incl %eax
movl %eax, 0x78(%rdi)
movq 0x38(%rdi), %xmm0
movq 0x8(%rdi), %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqu %xmm1, 0x80(%rdi)
cmpl %esi, %ecx
cmovgl %ecx, %esi
incl %esi
movl %esi, 0x7c(%rdi)
movl $0x68, %eax
movl $0x6c, %ecx
jmp 0x4ef0
movq 0x50(%rdi), %rax
movq %rax, 0x28(%rdi)
movq 0x8(%rdi), %rax
movq %rax, 0x50(%rdi)
movl 0x48(%rdi), %eax
movl %eax, 0x1c(%rdi)
movl 0x18(%rdi), %ecx
cmpl %eax, %ecx
cmovgl %ecx, %eax
incl %eax
movl %eax, 0x48(%rdi)
movl $0x38, %eax
movl $0x3c, %ecx
movl (%rdi,%rcx), %ecx
movl %ecx, 0x68(%rbx)
movl (%rdi,%rax), %eax
movl %eax, 0x6c(%rbx)
movq 0x50(%rbx), %rax
subq %rdi, %rax
shrq $0x4, %rax
imull $0xaaaaaaab, %eax, %ebp # imm = 0xAAAAAAAB
movl 0x20(%rbx), %esi
subl %ebp, %esi
movq %rbx, %rdi
callq 0x4fa4
leaq 0x30(%rbx), %r14
movq 0x50(%rbx), %rsi
cmpq %rsi, 0x48(%rbx)
je 0x4f50
addq $-0x30, %rsi
movq %r14, %rdi
callq 0x30ce
movq 0x50(%rbx), %rax
leaq -0x30(%rax), %rdi
movq %rdi, 0x50(%rbx)
movq -0x30(%rax), %rax
callq *(%rax)
movq %rbx, %rdi
callq 0x50fc
jmp 0x4f1e
movl 0x20(%rbx), %r14d
subl %ebp, %r14d
jle 0x4f66
movq %rbx, %rdi
callq 0x50fc
decl %r14d
jne 0x4f59
leaq 0x18(%rsp), %rdi
callq 0x2638
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
jmp 0x4f8f
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2638
movq %rbx, %rdi
callq 0x22a0