LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: spp::sparse_hashtable<std::pair<unsigned int const, unsigned int>, unsigned int, Hash32, spp::sparse_hash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::SelectKey, spp::sparse_hash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::SetKey, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::clear()
void clear()
    {
        if (!empty() || num_deleted != 0)
        {
            table.clear();
            table = Table(HT_DEFAULT_STARTING_BUCKETS, table.get_allocator());
        }
        settings.reset_thresholds(bucket_count());
        num_deleted = 0;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
orq 0x48(%rdi), %rax
je 0x2247
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x1766
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
movaps %xmm0, (%rsp)
movq $0x20, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x30, %edi
callq 0x10f0
movq %rax, (%rsp)
leaq 0x18(%rax), %rcx
movq $-0x1, 0x18(%rax)
movq %rcx, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movw $0x0, 0x10(%rax)
movq %r14, %rdi
callq 0x1766
leaq 0x40(%rbx), %rax
xorps %xmm2, %xmm2
movups %xmm2, (%rax)
movq %rsp, %rdi
movaps (%rdi), %xmm0
movups (%r14), %xmm1
movups %xmm0, (%r14)
movaps %xmm1, (%rdi)
movaps 0x10(%rdi), %xmm0
movups %xmm0, (%rax)
movaps %xmm2, 0x10(%rdi)
callq 0x1766
movq 0x40(%rbx), %rax
testq %rax, %rax
js 0x225a
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0x2272
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
movss 0x10(%rbx), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
movss 0xdb1(%rip), %xmm2      # 0x3040
subss %xmm2, %xmm1
cvttss2si %xmm1, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, (%rbx)
mulss 0x14(%rbx), %xmm0
cvttss2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subss %xmm2, %xmm0
cvttss2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x8(%rbx)
movb $0x0, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x22ee
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1766
movq %rbx, %rdi
callq 0x1150
movq %rax, %rdi
callq 0x17b0
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: spp::Two_d_destructive_iterator<std::pair<unsigned int const, unsigned int>, spp::sparsegroup<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>*, std::pair<unsigned int const, unsigned int>*, std::input_iterator_tag, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::advance_past_end()
void advance_past_end()
    {
        // used when col_current points to end()
        while (this->col_current == this->row_current->ne_end())
        {
            this->row_current->clear(_alloc, true);  // This is what differs from non-destructive iterators above

            // end of current row
            // ------------------
            ++this->row_current;                          // go to beginning of next
            if (!this->row_current->is_marked())          // col is irrelevant at end
                this->col_current = this->row_current->ne_begin();
            else
                break;                                    // don't go past row_end
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
movq (%r14), %rdi
movzbl 0x10(%r14), %eax
leaq (%rdi,%rax,8), %rax
cmpq %rax, 0x8(%rbx)
jne 0x2585
leaq 0x10(%r14), %r15
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x2546
callq 0x10d0
movq $0x0, (%r14)
movq $0x0, 0x8(%r14)
movb %bpl, (%r15)
movb %bpl, 0x11(%r14)
movq (%rbx), %rax
leaq 0x18(%rax), %rcx
movq %rcx, (%rbx)
movq 0x18(%rax), %rax
cmpq $-0x1, %rax
je 0x2585
movq %rax, 0x8(%rbx)
movq (%rbx), %r14
movq (%r14), %rdi
leaq 0x10(%r14), %r15
movzbl 0x10(%r14), %ecx
leaq (%rdi,%rcx,8), %rcx
cmpq %rcx, %rax
je 0x2535
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: void spp::sparsegroup<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::_set<std::pair<unsigned int const, unsigned int>>(spp::libc_allocator<std::pair<unsigned int const, unsigned int>>&, unsigned char, unsigned char, std::pair<unsigned int const, unsigned int>&)
void _set(allocator_type &alloc, size_type i, size_type offset, Val &val)
    {
        if (!_bmtest(i))
        {
            _set_aux(alloc, offset, val, check_alloc_type());
            _incr_num_items();
            _bmset(i);
        }
        else
            _set_val(&_group[offset], val);
    }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %ecx, %eax
movl %edx, %ecx
movq %rdi, %rbx
movl 0x8(%rdi), %edx
movl $0x1, %ebp
shll %cl, %ebp
btl %ecx, %edx
jae 0x25ff
movq (%rbx), %rcx
movzbl %al, %eax
movl (%r8), %edx
movl %edx, (%rcx,%rax,8)
movl 0x4(%r8), %edx
movl %edx, 0x4(%rcx,%rax,8)
jmp 0x2613
movzbl %al, %edx
movq %rbx, %rdi
movq %r8, %rcx
callq 0x261a
incb 0x10(%rbx)
orl %ebp, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: void spp::sparsegroup<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::_set_aux<std::pair<unsigned int const, unsigned int>>(spp::libc_allocator<std::pair<unsigned int const, unsigned int>>&, unsigned char, std::pair<unsigned int const, unsigned int>&, spp::integral_constant<bool, true>)
void _set_aux(allocator_type &alloc, size_type offset, Val &val, realloc_ok_type)
    {
        //static int x=0;  if (++x < 10) printf("x\n"); // check we are getting here

        uint32_t  num_items = _num_items();
        uint32_t  num_alloc = _sizing(num_items);

        if (num_items == num_alloc)
        {
            num_alloc = _sizing(num_items + 1);
            _group = alloc.reallocate(_group, num_alloc);
            _set_num_alloc(num_alloc);
        }

        for (uint32_t i = num_items; i > offset; --i)
            memcpy(_group + i, _group + i-1, sizeof(*_group));

        _init_val((mutable_pointer)(_group + offset), val);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
movzbl 0x10(%rdi), %r15d
movl %r15d, %edi
callq 0x2690
cmpl %r15d, %eax
jne 0x265d
leal 0x1(%r15), %edi
callq 0x2690
movl %eax, %r12d
movq (%r14), %rdi
movl %eax, %esi
shlq $0x3, %rsi
callq 0x1120
movq %rax, (%r14)
movb %r12b, 0x11(%r14)
movzbl %bpl, %eax
cmpb %al, %r15b
jbe 0x267c
movl %r15d, %ecx
movq (%r14), %rdx
movq -0x8(%rdx,%rcx,8), %rsi
movq %rsi, (%rdx,%rcx,8)
decq %rcx
cmpl %eax, %ecx
ja 0x2669
movq (%r14), %rcx
movq (%rbx), %rdx
movq %rdx, (%rcx,%rax,8)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: spp::sparsegroup<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::_sizing(unsigned int)::alloc_batch_size::alloc_batch_size()
SPP_CXX14_CONSTEXPR alloc_batch_size()
                : data()
            {
                uint8_t group_sz          = SPP_GROUP_SIZE / 4;
                uint8_t group_start_alloc = SPP_GROUP_SIZE / 8; //4;
                uint8_t alloc_sz          = group_start_alloc;
                for (int i=0; i<4; ++i)
                {
                    for (int j=0; j<group_sz; ++j)
                    {
                        if (j && j % group_start_alloc == 0)
                            alloc_sz += group_start_alloc;
                        data[i * group_sz + j] = alloc_sz;
                    }
                    if (group_start_alloc > 2)
                        group_start_alloc /= 2;
                    alloc_sz += group_start_alloc;
                }
            }

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movb $0x4, %al
xorl %edx, %edx
xorl %esi, %esi
movb $0x4, %r8b
movzbl %r8b, %ecx
leal -0x1(%rcx), %r9d
xorl %r10d, %r10d
testl %r10d, %r9d
movl $0x0, %r11d
cmovel %ecx, %r11d
testq %r10, %r10
cmovel %edx, %r11d
addb %r11b, %al
movb %al, (%rdi,%r10)
incq %r10
cmpq $0x8, %r10
jne 0x26da
cmpb $0x3, %r8b
setae %cl
shrb %cl, %r8b
addb %r8b, %al
incq %rsi
addq $0x8, %rdi
cmpq $0x4, %rsi
jne 0x26cf
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: std::pair<unsigned int const, unsigned int>& spp::sparse_hashtable<std::pair<unsigned int const, unsigned int>, unsigned int, Hash32, spp::sparse_hash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::SelectKey, spp::sparse_hash_map<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::SetKey, std::equal_to<unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::_insert_at<std::pair<unsigned int const, unsigned int>>(std::pair<unsigned int const, unsigned int>&, unsigned long, bool)
reference _insert_at(T& obj, size_type pos, bool erased)
    {
        if (size() >= max_size())
        {
            throw_exception(std::length_error("insert overflow"));
        }
        if (erased)
        {
            assert(num_deleted);
            --num_deleted;
        }
        return table.set(pos, obj);
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movabsq $0x1fffffffffffffff, %rsi # imm = 0x1FFFFFFFFFFFFFFF
cmpq %rsi, 0x48(%rdi)
jae 0x2874
testb %cl, %cl
je 0x285e
movq 0x28(%rdi), %rcx
testq %rcx, %rcx
je 0x28c4
decq %rcx
movq %rcx, 0x28(%rdi)
addq $0x30, %rdi
movq %rdx, %rsi
movq %rax, %rdx
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x2984
leaq 0x12ee(%rip), %rsi      # 0x3b69
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x10c0
movl $0x10, %edi
callq 0x1070
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1130
movq 0x3729(%rip), %rax      # 0x5fd0
addq $0x10, %rax
movq %rax, (%r14)
movq 0x372b(%rip), %rsi      # 0x5fe0
movq 0x370c(%rip), %rdx      # 0x5fc8
movq %r14, %rdi
callq 0x1140
leaq 0x12ae(%rip), %rdi      # 0x3b79
leaq 0x7f9(%rip), %rsi       # 0x30cb
leaq 0x12ac(%rip), %rcx      # 0x3b85
movl $0xc67, %edx            # imm = 0xC67
callq 0x10a0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1178
movq %rbx, %rdi
callq 0x1150
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/sparsepp/./sparsepp/spp.h
// Function: std::pair<unsigned int const, unsigned int>& spp::sparsetable<std::pair<unsigned int const, unsigned int>, spp::libc_allocator<std::pair<unsigned int const, unsigned int>>>::set<std::pair<unsigned int const, unsigned int>>(unsigned long, std::pair<unsigned int const, unsigned int>&)
reference set(size_type i, Val &val)
    {
        assert(i < _table_size);
        group_type &group = which_group(i);
        typename group_type::size_type old_numbuckets = group.num_nonempty();
        pointer p(group.set(_alloc, pos_in_group(i), val));
        _num_buckets += group.num_nonempty() - old_numbuckets;
        return *p;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq %rsi, 0x10(%rdi)
jbe 0x2a38
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rbx
movq (%rdi), %rax
movq %rsi, %rdx
shrq $0x5, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %r14
movzbl 0x10(%r14), %r12d
leaq 0x21(%rdi), %rsi
movl %ecx, %edx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
roll %cl, %eax
andl %eax, 0xc(%r14)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
andl $0x1f, %edx
notl %eax
andl 0x8(%r14), %eax
movl %eax, %ecx
shrl %ecx
andl $0x15555555, %ecx       # imm = 0x15555555
subl %ecx, %eax
movl $0x33333333, %ecx       # imm = 0x33333333
movl %eax, %edi
andl %ecx, %edi
shrl $0x2, %eax
andl %ecx, %eax
addl %edi, %eax
movl %eax, %ecx
shrl $0x4, %ecx
addl %eax, %ecx
andl $0xf0f0f0f, %ecx        # imm = 0xF0F0F0F
imull $0x1010101, %ecx, %r15d # imm = 0x1010101
shrl $0x18, %r15d
movq %r14, %rdi
movl %r15d, %ecx
callq 0x25d0
shll $0x3, %r15d
addq (%r14), %r15
movzbl 0x10(%r14), %eax
subq %r12, %rax
addq %rax, 0x18(%rbx)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xd22(%rip), %rdi       # 0x3761
leaq 0x685(%rip), %rsi       # 0x30cb
leaq 0x143f(%rip), %rcx      # 0x3e8c
movl $0x8be, %edx            # imm = 0x8BE
callq 0x10a0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/mshinfo/mshinfo.cpp
// Function: NumBoundaryEdges(gaps::R3Mesh*)
int NumBoundaryEdges(R3Mesh *mesh)
{
  // Count number of boundary edges
  int count = 0;
  for (int i = 0; i < mesh->NEdges(); i++) {
    R3MeshEdge *edge = mesh->Edge(i);
    R3MeshFace *face0 = mesh->FaceOnEdge(edge, 0);
    R3MeshFace *face1 = mesh->FaceOnEdge(edge, 1);
    if (!face0 || !face1) count++;
  }
  return count;
}

// Assembly:
movslq 0x24(%rdi), %rcx
testq %rcx, %rcx
jle 0xe6d5
movq 0x18(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movq (%rdx,%rsi,8), %rdi
cmpq $0x0, 0x18(%rdi)
sete %r8b
cmpq $0x0, 0x20(%rdi)
sete %dil
orb %r8b, %dil
movzbl %dil, %edi
addl %edi, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0xe6ad
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/fglut/freeglut_main.c
// Function: fgWarning
void fgWarning( const char *fmt, ... )
{
    va_list ap;

    va_start( ap, fmt );

    fprintf( stderr, "freeglut ");
    if( fgState.ProgramName )
        fprintf( stderr, "(%s): ", fgState.ProgramName );
    VFPRINTF( stderr, fmt, ap );
    fprintf( stderr, "\n" );

    va_end( ap );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x22b0c
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 %rdi, 0x10(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsp)
movq 0x11c475(%rip), %r14    # 0x13efa8
movq (%r14), %rcx
leaq 0xd9a6f(%rip), %rdi     # 0xfc5ac
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x222a0
leaq 0x121671(%rip), %rax    # 0x1441c0
movq 0xa8(%rax), %rdx
testq %rdx, %rdx
je 0x22b6c
movq (%r14), %rdi
leaq 0xd9a51(%rip), %rsi     # 0xfc5b6
xorl %eax, %eax
callq 0x21d90
movq (%r14), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
callq 0x21c80
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x21bc0
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: DrawBBoxes(gaps::R3Scene*, gaps::R3SceneNode*)
static void 
DrawBBoxes(R3Scene *scene, R3SceneNode *node)
{
  // Draw node bounding box
  node->BBox().Outline();

  // Push transformation
  node->Transformation().Push();

  // Draw children bboxes
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    DrawBBoxes(scene, child);
  }

  // Pop transformation
  node->Transformation().Pop();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x3c988
movq (%rax), %rcx
movl $0x1, %esi
movq %rax, %rdi
callq *0xb0(%rcx)
leaq 0x58(%rbx), %r14
movq 0x58(%rbx), %rax
movq %r14, %rdi
callq *0xb0(%rax)
cmpl $0x0, 0x2c(%rbx)
jle 0x263d6
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x26385
incq %r15
movslq 0x2c(%rbx), %rax
cmpq %rax, %r15
jl 0x263bd
movq (%r14), %rax
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *0xb8(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTResize(int, int)
void GLUTResize(int w, int h)
{
  // Resize window
  glViewport(0, 0, w, h);

  // Resize viewer viewport
  viewer->ResizeViewport(0, 0, w, h);

  // Resize scene viewport
  scene->SetViewport(viewer->Viewport());

  // Remember window size 
  GLUTwindow_width = w;
  GLUTwindow_height = h;

  // Redraw
  glutPostRedisplay();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
xorl %edi, %edi
xorl %esi, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x21200
movq 0x11e4e6(%rip), %rdi    # 0x1448e8
xorl %esi, %esi
xorl %edx, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x3e714
movq 0x11e4c1(%rip), %rdi    # 0x1448d8
movl $0x98, %esi
addq 0x11e4c5(%rip), %rsi    # 0x1448e8
callq 0x28a8c
movl %ebp, 0x119586(%rip)    # 0x13f9b4
movl %ebx, 0x119584(%rip)    # 0x13f9b8
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xcf414
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTSpecial(int, int, int)
void GLUTSpecial(int key, int x, int y)
{
  // Invert y coordinate
  y = GLUTwindow_height - y;

  // Process keyboard button event
  switch (key) {
  case GLUT_KEY_LEFT:
    viewer->TranslateCamera(0.1*viewer->Camera().Left());
    break;
  case GLUT_KEY_RIGHT:
    viewer->TranslateCamera(0.1*viewer->Camera().Right());
    break;
  case GLUT_KEY_DOWN:
    viewer->TranslateCamera(0.1*viewer->Camera().Down());
    break;
  case GLUT_KEY_UP:
    viewer->TranslateCamera(0.1*viewer->Camera().Up());
    break;
  }    

  // Remember mouse position 
  GLUTmouse[0] = x;
  GLUTmouse[1] = y;

  // Remember modifiers 
  GLUTmodifiers = glutGetModifiers();

  // Redraw
  glutPostRedisplay();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movl %esi, %ebx
movl 0x118e30(%rip), %r13d   # 0x13f9b8
addl $-0x64, %edi
cmpl $0x3, %edi
ja 0x26c31
leaq 0xb54f5(%rip), %rax     # 0xdc090
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x11dd3d(%rip), %rsi    # 0x1448e8
leaq 0x8(%rsi), %r14
addq $0x20, %rsi
jmp 0x26bd5
movq 0x11dd2c(%rip), %rsi    # 0x1448e8
leaq 0x8(%rsi), %r14
addq $0x20, %rsi
jmp 0x26c11
movq 0x11dd1b(%rip), %rsi    # 0x1448e8
leaq 0x8(%rsi), %r14
addq $0x38, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x779e8
leaq 0x8(%rsp), %r12
movsd 0xb5449(%rip), %xmm0    # 0xdc038
movq %r12, %rdi
movq %r15, %rsi
callq 0x77722
movq %r14, %rdi
movq %r12, %rsi
jmp 0x26c2c
movq 0x11dcdf(%rip), %rsi    # 0x1448e8
leaq 0x8(%rsi), %r14
addq $0x38, %rsi
leaq 0x8(%rsp), %r15
movsd 0xb541a(%rip), %xmm0    # 0xdc038
movq %r15, %rdi
callq 0x77722
movq %r14, %rdi
movq %r15, %rsi
callq 0x408a0
subl %ebp, %r13d
movl %ebx, 0x11dd4e(%rip)    # 0x144988
movl %r13d, 0x11dd4b(%rip)   # 0x14498c
callq 0xd435c
movl %eax, 0x11dd48(%rip)    # 0x144994
callq 0xcf414
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTInit(int*, char**)
void GLUTInit(int *argc, char **argv)
{
  // Open window 
  glutInit(argc, argv);
  glutInitWindowPosition(100, 100);
  glutInitWindowSize(GLUTwindow_width, GLUTwindow_height);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA);
  GLUTwindow = glutCreateWindow("Scene Viewer");
  
  // Initialize grfx (after create context because calls glewInit)
  RNInitGrfx();

  // Initialize depth testing
  glEnable(GL_DEPTH_TEST);

  // Initialize lighting
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  static GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
  glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
  glEnable(GL_NORMALIZE);
  glEnable(GL_LIGHTING); 

  // Initialize color settings
  glEnable(GL_COLOR_MATERIAL);
  glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

  // Initialize GLUT callback functions 
  glutDisplayFunc(GLUTRedraw);
  glutReshapeFunc(GLUTResize);
  glutKeyboardFunc(GLUTKeyboard);
  glutSpecialFunc(GLUTSpecial);
  glutMouseFunc(GLUTMouse);
  glutMotionFunc(GLUTMotion);
}

// Assembly:
pushq %rax
callq 0xd00bb
movl $0x64, %edi
movl $0x64, %esi
callq 0xd0608
movl 0x11899c(%rip), %edi    # 0x13f9b4
movl 0x11899a(%rip), %esi    # 0x13f9b8
callq 0xd061e
movl $0x1a, %edi
callq 0xd063d
leaq 0xb519f(%rip), %rdi     # 0xdc1d3
callq 0xd5608
movl %eax, 0x11d891(%rip)    # 0x1448d0
callq 0x88208
movl $0xb71, %edi            # imm = 0xB71
callq 0x21810
movl $0x1700, %edi           # imm = 0x1700
callq 0x21cc0
callq 0x21c50
leaq 0x11895c(%rip), %rsi    # 0x13f9c0
movl $0xb53, %edi            # imm = 0xB53
callq 0x22210
movl $0xb51, %edi            # imm = 0xB51
movl $0x1, %esi
callq 0x21150
movl $0xb52, %edi            # imm = 0xB52
movl $0x1, %esi
callq 0x21150
movl $0xba1, %edi            # imm = 0xBA1
callq 0x21810
movl $0xb50, %edi            # imm = 0xB50
callq 0x21810
movl $0xb57, %edi            # imm = 0xB57
callq 0x21810
movl $0x404, %edi            # imm = 0x404
movl $0x1602, %esi           # imm = 0x1602
callq 0x21590
leaq -0x1c71(%rip), %rdi     # 0x2544f
callq 0xceb10
leaq -0xce5(%rip), %rdi      # 0x263e7
callq 0xceb65
leaq -0x478(%rip), %rdi      # 0x26c60
callq 0xceba7
leaq -0x575(%rip), %rdi      # 0x26b6f
callq 0xcebef
leaq -0xa66(%rip), %rdi      # 0x2668a
callq 0xcef38
leaq -0xcbd(%rip), %rdi      # 0x2643f
popq %rax
jmp 0xcefc8
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/scnview/scnview.cpp
// Function: GLUTMainLoop()
void GLUTMainLoop(void)
{
  // Just checking
  if (!viewer || !scene) return;
  
  // Initialize viewing center
  center = scene->BBox().Centroid();

  // Define headlight
  if (headlight) {
    static GLfloat light0_diffuse[] = { 0.5, 0.5, 0.5, 1.0 };
    static GLfloat light0_position[] = { 0.0, 0.0, 1.0, 0.0 };
    glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
    glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
    glEnable(GL_LIGHT0);
  }
  
  // Run main loop -- never returns 
  glutMainLoop();
}

// Assembly:
cmpq $0x0, 0x11d7de(%rip)    # 0x1448e8
setne %cl
movq 0x11d7c4(%rip), %rax    # 0x1448d8
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x27197
pushq %rbx
subq $0x20, %rsp
movq (%rax), %rdi
callq 0x3c988
movq (%rax), %rcx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq *0x68(%rcx)
leaq 0x11d772(%rip), %rdi    # 0x1448b8
movq %rbx, %rsi
callq 0x76628
cmpb $0x1, 0x11d7fb(%rip)    # 0x144950
jne 0x2718d
leaq 0x118872(%rip), %rdx    # 0x13f9d0
movl $0x4000, %edi           # imm = 0x4000
movl $0x1201, %esi           # imm = 0x1201
callq 0x220b0
leaq 0x11886c(%rip), %rdx    # 0x13f9e0
movl $0x4000, %edi           # imm = 0x4000
movl $0x1203, %esi           # imm = 0x1203
callq 0x220b0
movl $0x4000, %edi           # imm = 0x4000
callq 0x21810
callq 0xd26d3
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::R3Scene()
R3Scene::
R3Scene(void)
  : nodes(),
    lights(),
    materials(),
    brdfs(),
    textures(),
    referenced_scenes(),
    info(),
    viewer(),
    ambient(0.2, 0.2, 0.2),
    background(0, 0, 0),
    filename(NULL),
    name(NULL),
    data(NULL)
{
  // Create root node
  root = new R3SceneNode(this);

  // Initialize viewer
  viewer.SetCamera(R3default_camera);
  viewer.SetViewport(R2default_viewport);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r13
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x886bc
leaq 0x18(%r13), %r14
movq %r14, %rdi
movq %rbx, 0x20(%rsp)
callq 0x886bc
leaq 0x28(%r13), %r15
movq %r15, %rdi
movq %r14, 0x18(%rsp)
callq 0x886bc
movq %r15, 0x10(%rsp)
leaq 0x38(%r13), %r12
movq %r12, %rdi
callq 0x886bc
leaq 0x48(%r13), %rbp
movq %rbp, %rdi
callq 0x886bc
leaq 0x58(%r13), %rbx
movq %rbx, %rdi
callq 0x886bc
movl $0x30, %edi
callq 0x218c0
movq %rax, %rcx
addq $0x8, %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq $0x0, 0x28(%rax)
movq %rax, 0x68(%r13)
leaq 0x70(%r13), %r14
movq %r14, %rdi
callq 0x3e534
leaq 0x118(%r13), %rdi
movsd 0xb414a(%rip), %xmm0    # 0xdc4a0
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x88530
leaq 0x130(%r13), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x88530
xorps %xmm0, %xmm0
movups %xmm0, 0x148(%r13)
movq $0x0, 0x158(%r13)
movl $0x1b0, %edi            # imm = 0x1B0
callq 0x218c0
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
callq 0x3bab8
movq %r15, (%r13)
leaq 0x11c6d1(%rip), %rsi    # 0x144a80
movq %r14, %rdi
callq 0x3e614
leaq 0x11763a(%rip), %rsi    # 0x13f9f8
movq %r14, %rdi
callq 0x3e66e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, 0x8(%rsp)
movl $0x1b0, %esi            # imm = 0x1B0
movq %r15, %rdi
callq 0x218e0
jmp 0x2841f
movq %rax, 0x8(%rsp)
jmp 0x28427
movq %rax, 0x8(%rsp)
jmp 0x28433
movq %rax, 0x8(%rsp)
jmp 0x2843b
movq %rax, 0x8(%rsp)
jmp 0x28443
movq %rax, 0x8(%rsp)
jmp 0x2844b
movq %rax, 0x8(%rsp)
jmp 0x28455
movq %rax, 0x8(%rsp)
jmp 0x2845f
movq %rax, 0x8(%rsp)
movq %r14, %rdi
callq 0x3e608
addq $0x68, %r13
movq %r13, %rdi
callq 0x372a2
movq %rbx, %rdi
callq 0x88726
movq %rbp, %rdi
callq 0x88726
movq %r12, %rdi
callq 0x88726
movq 0x10(%rsp), %rdi
callq 0x88726
movq 0x18(%rsp), %rdi
callq 0x88726
movq 0x20(%rsp), %rdi
callq 0x88726
movq 0x8(%rsp), %rdi
callq 0x220d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Node(char const*) const
R3SceneNode *R3Scene::
Node(const char *name) const
{
  // Search nodes for matching name
  for (int i = 0; i < NNodes(); i++) {
    R3SceneNode *node = Node(i);
    if (!node->Name()) continue;
    if (!strcmp(node->Name(), name)) return node;
  }

  // Node not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x14(%rdi), %r15
testq %r15, %r15
jle 0x2853b
movq %rsi, %rbx
movq 0x8(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x1a0(%rbp), %rdi
testq %rdi, %rdi
je 0x28529
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x2852e
movl $0x4, %ecx
testb $0x3, %cl
jne 0x2853e
incq %r13
cmpq %r13, %r15
jne 0x28504
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Material(char const*) const
R3Material *R3Scene::
Material(const char *name) const
{
  // Search materials for matching name
  for (int i = 0; i < NMaterials(); i++) {
    R3Material *material = Material(i);
    if (!material->Name()) continue;
    if (!strcmp(material->Name(), name)) return material;
  }

  // Material not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x34(%rdi), %r15
testq %r15, %r15
jle 0x285a2
movq %rsi, %rbx
movq 0x28(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x10(%rbp), %rdi
testq %rdi, %rdi
je 0x28590
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x28595
movl $0x4, %ecx
testb $0x3, %cl
jne 0x285a5
incq %r13
cmpq %r13, %r15
jne 0x2856e
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Light(char const*) const
R3Light *R3Scene::
Light(const char *name) const
{
  // Search lights for matching name
  for (int i = 0; i < NLights(); i++) {
    R3Light *light = Light(i);
    if (!light->Name()) continue;
    if (!strcmp(light->Name(), name)) return light;
  }

  // Light not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x24(%rdi), %r15
testq %r15, %r15
jle 0x2860a
movq %rsi, %rbx
movq 0x18(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x18(%rbp), %rdi
testq %rdi, %rdi
je 0x285f8
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x285fd
movl $0x4, %ecx
testb $0x3, %cl
jne 0x2860d
incq %r13
cmpq %r13, %r15
jne 0x285d6
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Brdf(char const*) const
R3Brdf *R3Scene::
Brdf(const char *name) const
{
  // Search brdfs for matching name
  for (int i = 0; i < NBrdfs(); i++) {
    R3Brdf *brdf = Brdf(i);
    if (!brdf->Name()) continue;
    if (!strcmp(brdf->Name(), name)) return brdf;
  }

  // Brdf not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x44(%rdi), %r15
testq %r15, %r15
jle 0x28672
movq %rsi, %rbx
movq 0x38(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x18(%rbp), %rdi
testq %rdi, %rdi
je 0x28660
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x28665
movl $0x4, %ecx
testb $0x3, %cl
jne 0x28675
incq %r13
cmpq %r13, %r15
jne 0x2863e
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::Texture(char const*) const
R2Texture *R3Scene::
Texture(const char *name) const
{
  // Search textures for matching name
  for (int i = 0; i < NTextures(); i++) {
    R2Texture *texture = Texture(i);
    if (!texture->Name()) continue;
    if (!strcmp(texture->Name(), name)) return texture;
  }

  // Texture not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x54(%rdi), %r15
testq %r15, %r15
jle 0x286da
movq %rsi, %rbx
movq 0x48(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x10(%rbp), %rdi
testq %rdi, %rdi
je 0x286c8
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x286cd
movl $0x4, %ecx
testb $0x3, %cl
jne 0x286dd
incq %r13
cmpq %r13, %r15
jne 0x286a6
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::ReferencedScene(char const*) const
R3Scene *R3Scene::
ReferencedScene(const char *name) const
{
  // Search textures for matching name
  for (int i = 0; i < NReferencedScenes(); i++) {
    R3Scene *referenced_scene = ReferencedScene(i);
    if (!referenced_scene->Name()) continue;
    if (!strcmp(referenced_scene->Name(), name)) return referenced_scene;
  }

  // Referenced scene not found
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x64(%rdi), %r15
testq %r15, %r15
jle 0x28745
movq %rsi, %rbx
movq 0x58(%rdi), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
movq 0x150(%rbp), %rdi
testq %rdi, %rdi
je 0x28733
movq %rbx, %rsi
callq 0x21d10
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %rbp, %r14
jmp 0x28738
movl $0x4, %ecx
testb $0x3, %cl
jne 0x28748
incq %r13
cmpq %r13, %r15
jne 0x2870e
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveNode(gaps::R3SceneNode*)
void R3Scene::
RemoveNode(R3SceneNode *node) 
{
  // Remove node
  assert(node->scene == this);
  assert(node->scene_index >= 0);
  RNArrayEntry *entry = nodes.KthEntry(node->scene_index);
  assert(nodes.EntryContents(entry) == node);
  R3SceneNode *tail = nodes.Tail();
  nodes.EntryContents(entry) = tail;
  tail->scene_index = node->scene_index;
  nodes.RemoveTail();
  node->scene_index = -1;
  node->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x8(%rdi), %rax
movslq 0x8(%rsi), %rcx
movq 0x8(%rdi), %rdx
movslq 0x14(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x8(%rdi)
decl %esi
movq %rax, %rdi
callq 0x888c6
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveLight(gaps::R3Light*)
void R3Scene::
RemoveLight(R3Light *light) 
{
  // Remove light
  assert(light->scene == this);
  assert(light->scene_index >= 0);
  RNArrayEntry *entry = lights.KthEntry(light->scene_index);
  assert(lights.EntryContents(entry) == light);
  R3Light *tail = lights.Tail();
  lights.EntryContents(entry) = tail;
  tail->scene_index = light->scene_index;
  lights.RemoveTail();
  light->scene_index = -1;
  light->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x18(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x18(%rdi), %rdx
movslq 0x24(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x10(%rdi)
decl %esi
movq %rax, %rdi
callq 0x888c6
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveMaterial(gaps::R3Material*)
void R3Scene::
RemoveMaterial(R3Material *material) 
{
  // Remove material
  assert(material->scene == this);
  assert(material->scene_index >= 0);
  RNArrayEntry *entry = materials.KthEntry(material->scene_index);
  assert(materials.EntryContents(entry) == material);
  R3Material *tail = materials.Tail();
  materials.EntryContents(entry) = tail;
  tail->scene_index = material->scene_index;
  materials.RemoveTail();
  material->scene_index = -1;
  material->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x28(%rdi), %rax
movslq 0x8(%rsi), %rcx
movq 0x28(%rdi), %rdx
movslq 0x34(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x8(%rdi)
decl %esi
movq %rax, %rdi
callq 0x888c6
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveBrdf(gaps::R3Brdf*)
void R3Scene::
RemoveBrdf(R3Brdf *brdf) 
{
  // Remove brdf
  assert(brdf->scene == this);
  assert(brdf->scene_index >= 0);
  RNArrayEntry *entry = brdfs.KthEntry(brdf->scene_index);
  assert(brdfs.EntryContents(entry) == brdf);
  R3Brdf *tail = brdfs.Tail();
  brdfs.EntryContents(entry) = tail;
  tail->scene_index = brdf->scene_index;
  brdfs.RemoveTail();
  brdf->scene_index = -1;
  brdf->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x38(%rdi), %rax
movslq 0x10(%rsi), %rcx
movq 0x38(%rdi), %rdx
movslq 0x44(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x10(%rdi)
decl %esi
movq %rax, %rdi
callq 0x888c6
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveTexture(gaps::R2Texture*)
void R3Scene::
RemoveTexture(R2Texture *texture) 
{
  // Remove texture
  assert(texture->scene == this);
  assert(texture->scene_index >= 0);
  RNArrayEntry *entry = textures.KthEntry(texture->scene_index);
  assert(textures.EntryContents(entry) == texture);
  R2Texture *tail = textures.Tail();
  textures.EntryContents(entry) = tail;
  tail->scene_index = texture->scene_index;
  textures.RemoveTail();
  texture->scene_index = -1;
  texture->scene = NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x48(%rdi), %rax
movslq 0x8(%rsi), %rcx
movq 0x48(%rdi), %rdx
movslq 0x54(%rdi), %rsi
movq -0x8(%rdx,%rsi,8), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %ecx, 0x8(%rdi)
decl %esi
movq %rax, %rdi
callq 0x888c6
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq $0x0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3Scene::RemoveReferences()
void R3Scene::
RemoveReferences(void)
{
  // Replace all references with copies of referenced scenes
  R3SceneRemoveReferences(this, root);

  // Remove/delete referenced scenes
  while (NReferencedScenes() > 0) {
    R3Scene *referenced_scene = ReferencedScene(0);
    RemoveReferencedScene(referenced_scene);
    delete referenced_scene;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rsi
callq 0x28b6a
cmpl $0x0, 0x64(%rbx)
jle 0x28b64
leaq 0x58(%rbx), %r14
movq (%r14), %rax
movq (%rax), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x88734
subq (%r14), %rax
shrq $0x3, %rax
movq %r14, %rdi
movl %eax, %esi
callq 0x888c6
testq %r15, %r15
je 0x28b5e
movq %r15, %rdi
callq 0x28474
movl $0x160, %esi            # imm = 0x160
movq %r15, %rdi
callq 0x218e0
cmpl $0x0, 0x64(%rbx)
jg 0x28b22
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveReferences(gaps::R3Scene*, gaps::R3SceneNode*)
static void
R3SceneRemoveReferences(R3Scene *scene, R3SceneNode *node)
{
  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveReferences(scene, child);
  }

  // Insert copy of all referenced scenes
  for (int i = 0; i < node->NReferences(); i++) {
    R3SceneReference *reference = node->Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    CopyScene(referenced_scene, scene, node, &(reference->Materials()));
  }

  // Remove references
  while (node->NReferences() > 0) {
    R3SceneReference *reference = node->Reference(0);
    node->RemoveReference(reference);
    delete reference;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x0, 0x2c(%rsi)
jle 0x28b9a
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x28b6a
incq %r15
movslq 0x2c(%rbx), %rax
cmpq %rax, %r15
jl 0x28b7e
cmpl $0x0, 0x4c(%rbx)
jle 0x28bf7
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rcx
movq (%rcx), %rdi
addq $0x8, %rcx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x36cf1
incq %r15
movslq 0x4c(%rbx), %rax
cmpq %rax, %r15
jl 0x28ba3
jmp 0x28bf7
movq 0x40(%rbx), %rax
movq (%rax), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3bf06
testq %r14, %r14
je 0x28bf7
movq %r14, %rdi
callq 0x3e2a0
movl $0x30, %esi
movq %r14, %rdi
callq 0x218e0
cmpl $0x0, 0x4c(%rbx)
jg 0x28bcb
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveHierarchy(gaps::R3Scene*, gaps::R3SceneNode*, gaps::R3Affine const&)
static void
R3SceneRemoveHierarchy(R3Scene *scene, R3SceneNode *node, const R3Affine& parent_transformation)
{
  // Compute transformation
  R3Affine transformation = R3identity_affine;
  transformation.Transform(parent_transformation);
  transformation.Transform(node->Transformation());

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveHierarchy(scene, child, transformation);
  }

  // Check if should move node to root
  R3SceneNode *root = scene->Root();
  if (node != root) {
    R3SceneNode *parent = node->Parent();
    if (parent && (parent != root)) {
      // Assign transformation
      node->SetTransformation(transformation);

      // Move node to be child of root
      parent->RemoveChild(node);
      root->InsertChild(node);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1124fb(%rip), %rax    # 0x13b148
addq $0x10, %rax
leaq 0x10(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11ea1f(%rip), %r12    # 0x147680
leaq 0x8(%r12), %rsi
callq 0x72bb6
movl $0x88, %esi
leaq 0x8(%rsp), %rdi
addq %rsi, %rdi
addq 0x116359(%rip), %rsi    # 0x13efd8
callq 0x72bb6
movq 0x108(%r12), %rax
leaq 0x8(%rsp), %rdi
movq %rax, 0x108(%rdi)
movq %r15, %rsi
callq 0x709e6
leaq 0x58(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x709e6
cmpl $0x0, 0x2c(%rbx)
jle 0x28cdb
xorl %r12d, %r12d
leaq 0x8(%rsp), %r15
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x28c2f
incq %r12
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
jl 0x28cbc
movq (%r14), %r14
cmpq %rbx, %r14
je 0x28d1a
movq 0x10(%rbx), %r15
testq %r15, %r15
sete %al
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x28d1a
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x3d06c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3bf3a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ce8e
leaq 0x8(%rsp), %rdi
callq 0x70878
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x28d46
jmp 0x28d46
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x70f00
jmp 0x28d53
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x70878
movq %rbx, %rdi
callq 0x220d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneRemoveTransformations(gaps::R3Scene*, gaps::R3SceneNode*, gaps::R3Affine const&)
static void
R3SceneRemoveTransformations(R3Scene *scene, R3SceneNode *node, const R3Affine& parent_transformation)
{
  // Compute transformation
  R3Affine transformation = R3identity_affine;
  transformation.Transform(parent_transformation);
  transformation.Transform(node->Transformation());

  // Check if node has references
  if (node->NReferences() > 0) {
    node->SetTransformation(transformation);
    return;
  }

  // Transform elements
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *element = node->Element(i);
    element->Transform(transformation);
  }

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneRemoveTransformations(scene, child, transformation);
  }

  // Remove transformation
  node->SetTransformation(R3identity_affine);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1123c5(%rip), %rax    # 0x13b148
addq $0x10, %rax
leaq 0x10(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11e8e9(%rip), %r15    # 0x147680
leaq 0x8(%r15), %rsi
callq 0x72bb6
movl $0x88, %esi
leaq 0x8(%rsp), %rdi
addq %rsi, %rdi
addq 0x116224(%rip), %rsi    # 0x13efd8
callq 0x72bb6
movq 0x108(%r15), %rax
leaq 0x8(%rsp), %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x709e6
leaq 0x58(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x709e6
cmpl $0x0, 0x4c(%rbx)
jg 0x28e42
cmpl $0x0, 0x3c(%rbx)
jle 0x28e15
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
callq 0x3dd02
incq %r12
movslq 0x3c(%rbx), %rax
cmpq %rax, %r12
jl 0x28df9
cmpl $0x0, 0x2c(%rbx)
jle 0x28e3f
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
movq 0x20(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq %r14, %rsi
callq 0x28d68
incq %r12
movslq 0x2c(%rbx), %rax
cmpq %rax, %r12
jl 0x28e23
movq %r15, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d06c
leaq 0x8(%rsp), %rdi
callq 0x70878
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x70f00
jmp 0x28e86
jmp 0x28e79
jmp 0x28e79
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x70878
movq %rbx, %rdi
callq 0x220d0
// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::R3SceneSubdivideTriangles(gaps::R3Scene*, gaps::R3SceneNode*, double)
static void
R3SceneSubdivideTriangles(R3Scene *scene, R3SceneNode *node, RNLength max_edge_length)
{
  // Check max edge length
  if (RNIsNegativeOrZero(max_edge_length)) return;

  // Transform max_edge_length
  RNScalar scale = node->Transformation().ScaleFactor();
  if (RNIsNotZero(scale)) max_edge_length /= scale;

  // Subdivide triangles in elements
  for (int i = 0; i < node->NElements(); i++) {
    R3SceneElement *element = node->Element(i);
    for (int j = 0; j < element->NShapes(); j++) {
      R3Shape *shape = element->Shape(j);
      if (shape->ClassID() == R3TriangleArray::CLASS_ID()) {
        R3TriangleArray *triangles = (R3TriangleArray *) shape;
        triangles->Subdivide(max_edge_length);
      }
    }
  }

  // Subdivide triangles in references
  for (int i = 0; i < node->NReferences(); i++) {
    R3SceneReference *reference = node->Reference(i);
    R3Scene *referenced_scene = reference->ReferencedScene();
    R3SceneSubdivideTriangles(referenced_scene, referenced_scene->Root(), max_edge_length);
  }

  // Recurse to children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    R3SceneSubdivideTriangles(scene, child, max_edge_length);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x117230(%rip), %r14    # 0x1400d8
movsd (%r14), %xmm1
ucomisd %xmm0, %xmm1
jae 0x28fd4
movq %rdi, %rbx
addq $0x58, %rdi
movq 0x58(%rbx), %rax
movapd %xmm0, (%rsp)
callq *0xc0(%rax)
movapd %xmm0, %xmm3
movsd (%r14), %xmm0
movapd 0xb3652(%rip), %xmm1    # 0xdc530
xorpd %xmm0, %xmm1
movapd (%rsp), %xmm4
movapd %xmm4, %xmm2
divsd %xmm3, %xmm2
cmpnltsd %xmm3, %xmm0
cmpnltsd %xmm1, %xmm3
movapd %xmm3, %xmm1
andnpd %xmm2, %xmm1
andpd %xmm4, %xmm3
orpd %xmm1, %xmm3
andpd %xmm0, %xmm3
andnpd %xmm2, %xmm0
orpd %xmm0, %xmm3
movapd %xmm3, (%rsp)
cmpl $0x0, 0x3c(%rbx)
jle 0x28f80
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %r12
cmpl $0x0, 0x1c(%r12)
jle 0x28f74
xorl %r13d, %r13d
movq 0x10(%r12), %rax
movq (%rax,%r13,8), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0xb8(%rax)
movl %eax, %ebp
callq 0x6867c
cmpl %eax, %ebp
jne 0x28f67
movq (%r14), %rax
movq %r14, %rdi
movapd (%rsp), %xmm0
callq *0x228(%rax)
incq %r13
movslq 0x1c(%r12), %rax
cmpq %rax, %r13
jl 0x28f36
incq %r15
movslq 0x3c(%rbx), %rax
cmpq %rax, %r15
jl 0x28f23
cmpl $0x0, 0x4c(%rbx)
jle 0x28fad
xorl %r14d, %r14d
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rax
movq (%rax), %rdi
movapd (%rsp), %xmm0
callq 0x28e93
incq %r14
movslq 0x4c(%rbx), %rax
cmpq %rax, %r14
jl 0x28f89
cmpl $0x0, 0x2c(%rbx)
jle 0x28fd4
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
movapd (%rsp), %xmm0
callq 0x28e93
incq %r14
movslq 0x2c(%rbx), %rax
cmpq %rax, %r14
jl 0x28fb6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop