// File: srajangarg[P]raytracer/src/core/SceneLoader.cpp
// Function: SceneLoader::doG(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool SceneLoader::doG(istream & str, string & name)
{
  name = getString(str);

  if (name.empty())
  {
    *err << "Couldn't read group name at ";
    errLine(str.tellg());
    return false;
  }

  if (groups[name] != NULL)
  {
    *err << "Illegal re-use of group name \"" << name << "\" at ";
    curPos(*err, str.tellg());
    *err << endl;
    return false;
  }

  SceneGroup * n = new SceneGroup();
  groups[name] = n;
  n->name_ = name;

  do
  {
    int state = findOpenOrClosedParen(str);

    if (state == ERROR)
      return false;
    else if (state == CLOSED)
      return true;
    else if (state == OPEN)
    {
      string cmd;

      if (readCommand(str, cmd))
      {
        if (cmd != "I")
        {
          *err << "Command other than I from G at ";
          curPos(*err, str.tellg());
          *err << endl;
        }

        string iname;
        SceneInstance * newNode;

        if ((newNode = doI(str, iname)) != NULL)
        {
          n->children_.push_back( newNode );
        }

        findCloseParen(str);
      }
    }
  }
  while (true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0xd8(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0xcaa0
movq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x54d0
leaq -0x40(%rbp), %rdi
callq 0x5290
movq -0x20(%rbp), %rdi
callq 0x5690
testb $0x1, %al
jne 0x121f4
jmp 0x1223f
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rdi
leaq 0x35419(%rip), %rsi     # 0x47622
callq 0x53e0
movq -0x18(%rbp), %rdi
callq 0x5700
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x12bc0
movq -0xd8(%rbp), %rdi
movl %eax, %esi
callq 0xd8e0
movb $0x0, -0x1(%rbp)
jmp 0x125b3
movq -0xd8(%rbp), %rdi
addq $0x18, %rdi
movq -0x20(%rbp), %rsi
callq 0x12fe0
cmpq $0x0, (%rax)
je 0x122f9
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rdi
leaq 0x353cd(%rip), %rsi     # 0x4763f
callq 0x53e0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x53c0
movq %rax, %rdi
leaq 0x34f6c(%rip), %rsi     # 0x471f9
callq 0x53e0
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5700
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x12bc0
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movl %eax, %edx
callq 0xc990
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rdi
movq 0x49cc5(%rip), %rsi     # 0x5bfb0
callq 0x5440
movb $0x0, -0x1(%rbp)
jmp 0x125b3
movl $0x68, %edi
callq 0x5400
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
callq 0x86a0
jmp 0x12317
movq -0xd8(%rbp), %rdi
movq -0xe8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xf0(%rbp)
addq $0x18, %rdi
movq -0x20(%rbp), %rsi
callq 0x12fe0
movq -0xf0(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rsi
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x5070
movq -0xd8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xd050
movl %eax, -0x78(%rbp)
cmpl $0x2, -0x78(%rbp)
jne 0x123a0
movb $0x0, -0x1(%rbp)
jmp 0x125b3
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
movl $0x68, %esi
callq 0x5410
jmp 0x125c1
cmpl $0x1, -0x78(%rbp)
jne 0x123af
movb $0x1, -0x1(%rbp)
jmp 0x125b3
cmpl $0x0, -0x78(%rbp)
jne 0x1259f
leaq -0x98(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x55a0
movq -0xd8(%rbp), %rdi
movq -0x100(%rbp), %rdx
movq -0x18(%rbp), %rsi
callq 0xcdc0
movb %al, -0xf1(%rbp)
jmp 0x123eb
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x123fa
jmp 0x12583
leaq 0x35b12(%rip), %rsi     # 0x47f13
leaq -0x98(%rbp), %rdi
callq 0x13980
movb %al, -0x101(%rbp)
jmp 0x12415
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x12424
jmp 0x124ec
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rdi
leaq 0x35225(%rip), %rsi     # 0x4765e
callq 0x53e0
jmp 0x12440
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x120(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5700
movq %rdx, -0x118(%rbp)
movq %rax, -0x110(%rbp)
jmp 0x1246e
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x12bc0
movq %rax, -0x128(%rbp)
jmp 0x1249f
movq -0x120(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movq -0x128(%rbp), %rax
movl %eax, %edx
callq 0xc990
jmp 0x124bd
movq -0xd8(%rbp), %rax
movq 0x90(%rax), %rdi
movq 0x49ade(%rip), %rsi     # 0x5bfb0
callq 0x5440
jmp 0x124d9
jmp 0x124ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x12591
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x55a0
movq -0xd8(%rbp), %rdi
movq -0x138(%rbp), %rdx
movq -0x18(%rbp), %rsi
callq 0xd9a0
movq %rax, -0x130(%rbp)
jmp 0x1251f
movq -0x130(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x12565
movq -0x68(%rbp), %rdi
addq $0x28, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x130c0
jmp 0x12549
jmp 0x12565
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x5290
jmp 0x12591
movq -0xd8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xd240
jmp 0x12577
leaq -0xc8(%rbp), %rdi
callq 0x5290
leaq -0x98(%rbp), %rdi
callq 0x5290
jmp 0x1259f
leaq -0x98(%rbp), %rdi
callq 0x5290
jmp 0x125c1
jmp 0x125a1
jmp 0x125a3
jmp 0x125a5
movb $0x1, %al
testb $0x1, %al
jne 0x1235c
jmp 0x125b1
ud2
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x5720
nopw (%rax,%rax)