// File: tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Scene.cpp
// Function: gaps::CopyScene(gaps::R3Scene*, gaps::R3Scene*, gaps::R3SceneNode*, gaps::RNArray<gaps::R3Material*> const*)
static void
CopyScene(R3Scene *src_scene, R3Scene *dst_scene,
  R3SceneNode *dst_root_node = NULL, const RNArray<R3Material *> *materials = NULL)
{
  // Get/check inputs
  if (!src_scene || !dst_scene) return;
  if (!dst_root_node) dst_root_node = dst_scene->Root();
  
  // Copy lights
  RNArray<R3Light *> dst_lights;
  for (int i = 0; i < src_scene->NLights(); i++) {
    R3Light *src_light = src_scene->Light(i);
    R3Light *dst_light = src_light->Copy();
    dst_scene->InsertLight(dst_light);
    dst_lights.Insert(dst_light);
  }

  // Copy textures
  RNArray<R2Texture *> dst_textures;
  for (int i = 0; i < src_scene->NTextures(); i++) {
    R2Texture *src_texture = src_scene->Texture(i);
    R2Texture *dst_texture = new R2Texture(*src_texture);
    dst_textures.Insert(dst_texture);
    dst_scene->InsertTexture(dst_texture);
  }

  // Copy brdfs
  RNArray<R3Brdf *> dst_brdfs;
  for (int i = 0; i < src_scene->NBrdfs(); i++) {
    R3Brdf *src_brdf = src_scene->Brdf(i);
    R3Brdf *dst_brdf = new R3Brdf(*src_brdf);
    dst_brdfs.Insert(dst_brdf);
    dst_scene->InsertBrdf(dst_brdf);
  }

  // Copy materials
  RNArray<R3Material *> dst_materials;
  for (int i = 0; i < src_scene->NMaterials(); i++) {
    R3Material *dst_material = (i < materials->NEntries()) ? materials->Kth(i) : NULL;
    if (!dst_material) {
      R3Material *src_material = src_scene->Material(i);
      R3Brdf *dst_brdf = (src_material->Brdf()) ? dst_brdfs[src_material->Brdf()->SceneIndex()] : NULL;
      R2Texture *dst_texture = (src_material->Texture()) ? dst_textures[src_material->Texture()->SceneIndex()] : NULL;
      dst_material = new R3Material(dst_brdf, dst_texture, src_material->Name());
      dst_scene->InsertMaterial(dst_material);
    }
    dst_materials.Insert(dst_material);
  }

  // Copy nodes 
  RNArray<R3SceneNode *> dst_nodes;
  for (int i = 0; i < src_scene->NNodes(); i++) {
    R3SceneNode *src_node = src_scene->Node(i);
    R3SceneNode *dst_node = new R3SceneNode(*src_node);
    dst_scene->InsertNode(dst_node);
    dst_nodes.Insert(dst_node);

    // Copy elements
    for (int i = 0; i < src_node->NElements(); i++) {
      R3SceneElement *src_element = src_node->Element(i);
      R3Material *src_material = src_element->Material();
      R3Material *dst_material = (src_material) ? dst_materials[src_material->SceneIndex()] : NULL;
      R3SceneElement *dst_element = new R3SceneElement(dst_material);
      dst_node->InsertElement(dst_element);
      for (int j = 0; j < src_element->NShapes(); j++) {
        R3Shape *src_shape = src_element->Shape(j);
        R3Shape *dst_shape = src_shape->Copy();
        dst_element->InsertShape(dst_shape);
      }
    }

    // Copy references
    for (int i = 0; i < src_node->NReferences(); i++) {
      R3SceneReference *src_reference = src_node->Reference(i);
      R3Scene *src_referenced_scene = src_reference->ReferencedScene();
      RNArray<R3Material *> dst_reference_materials;
      for (int j = 0; j < src_reference->NMaterials(); j++) {
        R3Material *src_material = src_reference->Material(j);
        R3Material *dst_material = dst_materials[src_material->SceneIndex()];
        dst_scene->InsertMaterial(dst_material);
      }
      CopyScene(src_referenced_scene, dst_scene, dst_node, &dst_reference_materials);
    }
  }
  
  // Copy node hierarchy
  for (int i = 0; i < src_scene->NNodes(); i++) {
    R3SceneNode *src_node = src_scene->Node(i);
    R3SceneNode *dst_node = dst_nodes.Kth(i);
    R3SceneNode *src_parent = src_node->Parent();
    R3SceneNode *dst_parent = (src_parent) ? dst_nodes[src_parent->SceneIndex()] : dst_root_node;
    dst_parent->InsertChild(dst_node);
  }
}

// Assembly:
subq $0x368, %rsp            # imm = 0x368
movq %rdi, 0x360(%rsp)
movq %rsi, 0x358(%rsp)
movq %rdx, 0x350(%rsp)
movq %rcx, 0x348(%rsp)
cmpq $0x0, 0x360(%rsp)
je 0x42d0d
cmpq $0x0, 0x358(%rsp)
jne 0x42d12
jmp 0x43b09
cmpq $0x0, 0x350(%rsp)
jne 0x42d32
movq 0x358(%rsp), %rdi
callq 0x2b510
movq %rax, 0x350(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x48150
movl $0x0, 0x334(%rsp)
movl 0x334(%rsp), %eax
movl %eax, 0x1b0(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2b9f0
movl %eax, 0x1b4(%rsp)
jmp 0x42d6e
movl 0x1b0(%rsp), %eax
movl 0x1b4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x42e38
movq 0x360(%rsp), %rdi
movl 0x334(%rsp), %esi
callq 0x2ba10
movq %rax, 0x1a8(%rsp)
jmp 0x42da2
movq 0x1a8(%rsp), %rax
movq %rax, 0x318(%rsp)
movq 0x318(%rsp), %rdi
callq 0x63000
movq %rax, 0x1a0(%rsp)
jmp 0x42dc9
movq 0x1a0(%rsp), %rax
movq %rax, 0x310(%rsp)
movq 0x358(%rsp), %rdi
movq 0x310(%rsp), %rsi
callq 0x2cad0
jmp 0x42df0
movq 0x310(%rsp), %rsi
leaq 0x338(%rsp), %rdi
callq 0x483d0
jmp 0x42e07
jmp 0x42e09
movl 0x334(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x334(%rsp)
jmp 0x42d4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
jmp 0x43b45
leaq 0x300(%rsp), %rdi
callq 0x48180
jmp 0x42e47
movl $0x0, 0x2fc(%rsp)
movl 0x2fc(%rsp), %eax
movl %eax, 0x198(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2c060
movl %eax, 0x19c(%rsp)
jmp 0x42e76
movl 0x198(%rsp), %eax
movl 0x19c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x42f83
movq 0x360(%rsp), %rdi
movl 0x2fc(%rsp), %esi
callq 0x482b0
movq %rax, 0x190(%rsp)
jmp 0x42eaa
movq 0x190(%rsp), %rax
movq %rax, 0x2f0(%rsp)
movl $0x50, %edi
callq 0x229e0
movq %rax, 0x188(%rsp)
jmp 0x42ece
movq 0x188(%rsp), %rdi
movq 0x2f0(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x657c0
jmp 0x42ee9
movq 0x188(%rsp), %rax
movq %rax, 0x2e8(%rsp)
movq 0x2e8(%rsp), %rsi
leaq 0x300(%rsp), %rdi
callq 0x484c0
jmp 0x42f10
movq 0x358(%rsp), %rdi
movq 0x2e8(%rsp), %rsi
callq 0x2cdd0
jmp 0x42f27
jmp 0x42f29
movl 0x2fc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2fc(%rsp)
jmp 0x42e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
jmp 0x43b38
movq 0x188(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
movl $0x50, %esi
callq 0x22a00
jmp 0x43b38
leaq 0x2d8(%rsp), %rdi
callq 0x48170
jmp 0x42f92
movl $0x0, 0x2d4(%rsp)
movl 0x2d4(%rsp), %eax
movl %eax, 0x180(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2c040
movl %eax, 0x184(%rsp)
jmp 0x42fc1
movl 0x180(%rsp), %eax
movl 0x184(%rsp), %ecx
cmpl %ecx, %eax
jge 0x430ce
movq 0x360(%rsp), %rdi
movl 0x2d4(%rsp), %esi
callq 0x48270
movq %rax, 0x178(%rsp)
jmp 0x42ff5
movq 0x178(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movl $0xb8, %edi
callq 0x229e0
movq %rax, 0x170(%rsp)
jmp 0x43019
movq 0x170(%rsp), %rdi
movq 0x2c8(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x645c0
jmp 0x43034
movq 0x170(%rsp), %rax
movq %rax, 0x2c0(%rsp)
movq 0x2c0(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x48470
jmp 0x4305b
movq 0x358(%rsp), %rdi
movq 0x2c0(%rsp), %rsi
callq 0x2ccd0
jmp 0x43072
jmp 0x43074
movl 0x2d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2d4(%rsp)
jmp 0x42f9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
jmp 0x43b2b
movq 0x170(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
movl $0xb8, %esi
callq 0x22a00
jmp 0x43b2b
leaq 0x2b0(%rsp), %rdi
callq 0x48160
jmp 0x430dd
movl $0x0, 0x2ac(%rsp)
movl 0x2ac(%rsp), %eax
movl %eax, 0x168(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2c020
movl %eax, 0x16c(%rsp)
jmp 0x4310c
movl 0x168(%rsp), %eax
movl 0x16c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x43414
movl 0x2ac(%rsp), %eax
movl %eax, 0x164(%rsp)
movq 0x348(%rsp), %rdi
callq 0x2b8b0
movl %eax, %ecx
movl 0x164(%rsp), %eax
cmpl %ecx, %eax
jge 0x4317a
movq 0x348(%rsp), %rdi
movl 0x2ac(%rsp), %esi
callq 0x49ca0
movq %rax, 0x158(%rsp)
jmp 0x43168
movq 0x158(%rsp), %rax
movq %rax, 0x150(%rsp)
jmp 0x43186
xorl %eax, %eax
movq %rax, 0x150(%rsp)
jmp 0x43186
movq 0x150(%rsp), %rax
movq %rax, 0x2a0(%rsp)
cmpq $0x0, 0x2a0(%rsp)
jne 0x433e5
movq 0x360(%rsp), %rdi
movl 0x2ac(%rsp), %esi
callq 0x48220
movq %rax, 0x148(%rsp)
jmp 0x431c3
movq 0x148(%rsp), %rax
movq %rax, 0x298(%rsp)
movq 0x298(%rsp), %rdi
callq 0x2be70
movq %rax, 0x140(%rsp)
jmp 0x431ea
movq 0x140(%rsp), %rax
cmpq $0x0, %rax
je 0x43258
movq 0x298(%rsp), %rdi
callq 0x2be70
movq %rax, 0x138(%rsp)
jmp 0x4320f
movq 0x138(%rsp), %rdi
callq 0x49d50
movl %eax, 0x134(%rsp)
jmp 0x43225
movl 0x134(%rsp), %esi
leaq 0x2d8(%rsp), %rdi
callq 0x49d30
movq %rax, 0x128(%rsp)
jmp 0x43243
movq 0x128(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x120(%rsp)
jmp 0x43264
xorl %eax, %eax
movq %rax, 0x120(%rsp)
jmp 0x43264
movq 0x120(%rsp), %rax
movq %rax, 0x290(%rsp)
movq 0x298(%rsp), %rdi
callq 0x48b20
movq %rax, 0x118(%rsp)
jmp 0x4328b
movq 0x118(%rsp), %rax
cmpq $0x0, %rax
je 0x432f9
movq 0x298(%rsp), %rdi
callq 0x48b20
movq %rax, 0x110(%rsp)
jmp 0x432b0
movq 0x110(%rsp), %rdi
callq 0x49d80
movl %eax, 0x10c(%rsp)
jmp 0x432c6
movl 0x10c(%rsp), %esi
leaq 0x300(%rsp), %rdi
callq 0x49d60
movq %rax, 0x100(%rsp)
jmp 0x432e4
movq 0x100(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xf8(%rsp)
jmp 0x43305
xorl %eax, %eax
movq %rax, 0xf8(%rsp)
jmp 0x43305
movq 0xf8(%rsp), %rax
movq %rax, 0x288(%rsp)
movl $0x30, %edi
callq 0x229e0
movq %rax, 0xf0(%rsp)
jmp 0x43329
movq 0x290(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x288(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq 0x298(%rsp), %rdi
callq 0x48250
movq 0xf0(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
movq %rax, %rcx
callq 0x63f30
jmp 0x43378
movq 0xf0(%rsp), %rax
movq %rax, 0x2a0(%rsp)
movq 0x358(%rsp), %rdi
movq 0x2a0(%rsp), %rsi
callq 0x2cbd0
jmp 0x4339f
jmp 0x433e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
jmp 0x43b1e
movq 0xf0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
movl $0x30, %esi
callq 0x22a00
jmp 0x43b1e
movq 0x2a0(%rsp), %rsi
leaq 0x2b0(%rsp), %rdi
callq 0x48420
jmp 0x433fc
jmp 0x433fe
movl 0x2ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2ac(%rsp)
jmp 0x430e8
leaq 0x278(%rsp), %rdi
callq 0x48140
jmp 0x43423
movl $0x0, 0x274(%rsp)
movl 0x274(%rsp), %eax
movl %eax, 0xd8(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2bf50
movl %eax, 0xdc(%rsp)
jmp 0x43452
movl 0xd8(%rsp), %eax
movl 0xdc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x43990
movq 0x360(%rsp), %rdi
movl 0x274(%rsp), %esi
callq 0x2bf70
movq %rax, 0xd0(%rsp)
jmp 0x43486
movq 0xd0(%rsp), %rax
movq %rax, 0x268(%rsp)
movl $0x1b0, %edi            # imm = 0x1B0
callq 0x229e0
movq %rax, 0xc8(%rsp)
jmp 0x434aa
movq 0xc8(%rsp), %rdi
movq 0x268(%rsp), %rsi
callq 0x55860
jmp 0x434c1
movq 0xc8(%rsp), %rax
movq %rax, 0x260(%rsp)
movq 0x358(%rsp), %rdi
movq 0x260(%rsp), %rsi
callq 0x2c9d0
jmp 0x434e8
movq 0x260(%rsp), %rsi
leaq 0x278(%rsp), %rdi
callq 0x48340
jmp 0x434ff
movl $0x0, 0x25c(%rsp)
movl 0x25c(%rsp), %eax
movl %eax, 0xc0(%rsp)
movq 0x268(%rsp), %rdi
callq 0x2bba0
movl %eax, 0xc4(%rsp)
jmp 0x4352e
movl 0xc0(%rsp), %eax
movl 0xc4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x437ac
movq 0x268(%rsp), %rdi
movl 0x25c(%rsp), %esi
callq 0x2bbc0
movq %rax, 0xb8(%rsp)
jmp 0x43562
movq 0xb8(%rsp), %rax
movq %rax, 0x250(%rsp)
movq 0x250(%rsp), %rdi
callq 0x48b50
movq %rax, 0xb0(%rsp)
jmp 0x43589
movq 0xb0(%rsp), %rax
movq %rax, 0x248(%rsp)
cmpq $0x0, 0x248(%rsp)
je 0x435ed
movq 0x248(%rsp), %rdi
callq 0x49d90
movl %eax, 0xac(%rsp)
jmp 0x435ba
movl 0xac(%rsp), %esi
leaq 0x2b0(%rsp), %rdi
callq 0x49370
movq %rax, 0xa0(%rsp)
jmp 0x435d8
movq 0xa0(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x98(%rsp)
jmp 0x435f9
xorl %eax, %eax
movq %rax, 0x98(%rsp)
jmp 0x435f9
movq 0x98(%rsp), %rax
movq %rax, 0x240(%rsp)
movl $0x60, %edi
callq 0x229e0
movq %rax, 0x90(%rsp)
jmp 0x4361d
movq 0x90(%rsp), %rdi
movq 0x240(%rsp), %rsi
callq 0x58f20
jmp 0x43634
movq 0x90(%rsp), %rax
movq %rax, 0x238(%rsp)
movq 0x260(%rsp), %rdi
movq 0x238(%rsp), %rsi
callq 0x57510
jmp 0x4365b
movl $0x0, 0x234(%rsp)
movl 0x234(%rsp), %eax
movl %eax, 0x88(%rsp)
movq 0x250(%rsp), %rdi
callq 0x2bbf0
movl %eax, 0x8c(%rsp)
jmp 0x4368a
movl 0x88(%rsp), %eax
movl 0x8c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x43794
movq 0x250(%rsp), %rdi
movl 0x234(%rsp), %esi
callq 0x2bc10
movq %rax, 0x80(%rsp)
jmp 0x436be
movq 0x80(%rsp), %rax
movq %rax, 0x228(%rsp)
movq 0x228(%rsp), %rdi
movq (%rdi), %rax
movq 0x98(%rax), %rax
callq *%rax
movq %rax, 0x78(%rsp)
jmp 0x436e9
movq 0x78(%rsp), %rax
movq %rax, 0x220(%rsp)
movq 0x238(%rsp), %rdi
movq 0x220(%rsp), %rsi
callq 0x59370
jmp 0x4370d
jmp 0x4370f
movl 0x234(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x234(%rsp)
jmp 0x43666
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
jmp 0x43b11
movq 0xc8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
movl $0x1b0, %esi            # imm = 0x1B0
callq 0x22a00
jmp 0x43b11
movq 0x90(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
movl $0x60, %esi
callq 0x22a00
jmp 0x43b11
jmp 0x43796
movl 0x25c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x25c(%rsp)
jmp 0x4350a
movl $0x0, 0x21c(%rsp)
movl 0x21c(%rsp), %eax
movl %eax, 0x70(%rsp)
movq 0x268(%rsp), %rdi
callq 0x2bb40
movl %eax, 0x74(%rsp)
jmp 0x437d5
movl 0x70(%rsp), %eax
movl 0x74(%rsp), %ecx
cmpl %ecx, %eax
jge 0x43978
movq 0x268(%rsp), %rdi
movl 0x21c(%rsp), %esi
callq 0x2bb60
movq %rax, 0x68(%rsp)
jmp 0x43800
movq 0x68(%rsp), %rax
movq %rax, 0x210(%rsp)
movq 0x210(%rsp), %rdi
callq 0x2bb90
movq %rax, 0x60(%rsp)
jmp 0x43821
movq 0x60(%rsp), %rax
movq %rax, 0x208(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x48160
jmp 0x4383d
movl $0x0, 0x1f4(%rsp)
movl 0x1f4(%rsp), %eax
movl %eax, 0x58(%rsp)
movq 0x210(%rsp), %rdi
callq 0x49da0
movl %eax, 0x5c(%rsp)
jmp 0x43866
movl 0x58(%rsp), %eax
movl 0x5c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x4392e
movq 0x210(%rsp), %rdi
movl 0x1f4(%rsp), %esi
callq 0x49dc0
movq %rax, 0x50(%rsp)
jmp 0x43891
movq 0x50(%rsp), %rax
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x49d90
movl %eax, 0x4c(%rsp)
jmp 0x438b1
movl 0x4c(%rsp), %esi
leaq 0x2b0(%rsp), %rdi
callq 0x49370
movq %rax, 0x40(%rsp)
jmp 0x438c9
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x1e0(%rsp)
movq 0x358(%rsp), %rdi
movq 0x1e0(%rsp), %rsi
callq 0x2cbd0
jmp 0x438f0
jmp 0x438f2
movl 0x1f4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1f4(%rsp)
jmp 0x43848
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x328(%rsp)
movl %eax, 0x324(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0x481f0
jmp 0x43b11
movq 0x208(%rsp), %rdi
movq 0x358(%rsp), %rsi
movq 0x260(%rsp), %rdx
leaq 0x1f8(%rsp), %rcx
callq 0x42cd0
jmp 0x43955
leaq 0x1f8(%rsp), %rdi
callq 0x481f0
movl 0x21c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x21c(%rsp)
jmp 0x437b7
jmp 0x4397a
movl 0x274(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x274(%rsp)
jmp 0x4342e
movl $0x0, 0x1dc(%rsp)
movl 0x1dc(%rsp), %eax
movl %eax, 0x38(%rsp)
movq 0x360(%rsp), %rdi
callq 0x2bf50
movl %eax, 0x3c(%rsp)
jmp 0x439b9
movl 0x38(%rsp), %eax
movl 0x3c(%rsp), %ecx
cmpl %ecx, %eax
jge 0x43ac8
movq 0x360(%rsp), %rdi
movl 0x1dc(%rsp), %esi
callq 0x2bf70
movq %rax, 0x30(%rsp)
jmp 0x439e4
movq 0x30(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movl 0x1dc(%rsp), %esi
leaq 0x278(%rsp), %rdi
callq 0x2bd10
movq %rax, 0x28(%rsp)
jmp 0x43a0c
movq 0x28(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rdi
callq 0x49480
movq %rax, 0x20(%rsp)
jmp 0x43a2d
movq 0x20(%rsp), %rax
movq %rax, 0x1c0(%rsp)
cmpq $0x0, 0x1c0(%rsp)
je 0x43a7f
movq 0x1c0(%rsp), %rdi
callq 0x49e10
movl %eax, 0x1c(%rsp)
jmp 0x43a58
movl 0x1c(%rsp), %esi
leaq 0x278(%rsp), %rdi
callq 0x49df0
movq %rax, 0x10(%rsp)
jmp 0x43a70
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x43a8c
movq 0x350(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x1b8(%rsp)
movq 0x1b8(%rsp), %rdi
movq 0x1c8(%rsp), %rsi
callq 0x57450
jmp 0x43ab0
jmp 0x43ab2
movl 0x1dc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1dc(%rsp)
jmp 0x4399b
leaq 0x278(%rsp), %rdi
callq 0x48210
leaq 0x2b0(%rsp), %rdi
callq 0x481f0
leaq 0x2d8(%rsp), %rdi
callq 0x481e0
leaq 0x300(%rsp), %rdi
callq 0x481d0
leaq 0x338(%rsp), %rdi
callq 0x48200
addq $0x368, %rsp            # imm = 0x368
retq
leaq 0x278(%rsp), %rdi
callq 0x48210
leaq 0x2b0(%rsp), %rdi
callq 0x481f0
leaq 0x2d8(%rsp), %rdi
callq 0x481e0
leaq 0x300(%rsp), %rdi
callq 0x481d0
leaq 0x338(%rsp), %rdi
callq 0x48200
movq 0x328(%rsp), %rdi
callq 0x23290
nop