// File: /workspace/github_cpp_makefile_star2_O2/cajun-jsonapi[P]cajun-jsonapi/example.cpp
// Function: main
int main()
{
   using namespace json;

   /* we'll generate: 
      {
         "Delicious Beers" : [
            {
               "Name" : "Schlafly American Pale Ale",
               "Origin" : "St. Louis, MO, USA",
               "ABV" : 5.9,
               "BottleConditioned" : true
            },
            {
               "Name" : "John Smith's Extra Smooth",
               "Origin" : "Tadcaster, Yorkshire, UK",
               "ABV" : 3.8,
               "Bottle Conditioned" : false
            }
         ]
      }
   */

   ////////////////////////////////////////////////////////////////////
   // construction

   // we can build a document piece by piece...
   Object objAPA;
   objAPA["Name"] = String("Schlafly American Pale Ale");
   objAPA["Origin"] = String("St. Louis, MO, USA");
   objAPA["ABV"] = Number(3.8);
   objAPA["BottleConditioned"] = Boolean(true);

   Array arrayBeer;
   arrayBeer.Insert(objAPA);

   Object objDocument;
   objDocument["Delicious Beers"] = arrayBeer;

   Number numDeleteThis = objDocument["AnotherMember"];

   // ...or, we can use UnknownElement's chaining child element access to quickly
   //  construct the remainder

   objDocument["Delicious Beers"][1]["Name"] = String("John Smith's Extra Smooth");
   objDocument["Delicious Beers"][1]["Origin"] = String("Tadcaster, Yorkshire, UK");
   objDocument["Delicious Beers"][1]["ABV"] = Number(3.8);
   objDocument["Delicious Beers"][1]["BottleConditioned"] = Boolean(false);

   
   ////////////////////////////////////////////////////////////////////
   // interpretation
      
   // perform all read operations on a const ref, otherwise we may end up
   //  manipulating the document instead of catching errors
   const Object& objRoot = objDocument;

   // the return type of Object::operator[string] & Array::operator[size_t] is UnknownElement, which 
   //  provides implicit casting to any of the other element types...
   const Array& arrayBeers = objRoot["Delicious Beers"];
   const Object& objBeer0 = arrayBeers[0];
   const String& strName0 = objBeer0["Name"];

   // ...it also supports operator[string] & operator[size_t] itself, which takes the implicit casting
   //  one step further. operator[string] implicitly casts to Object, and operator[size_t] to Array.
   //  the return value is another UnknownElement, so these operations can be strung together
   const Number numAbv1 = objRoot["Delicious Beers"][1]["ABV"];

   std::cout << "First beer name: " << strName0.Value() << std::endl;
   std::cout << "First beer ABV: " << numAbv1.Value() << std::endl;

   // we can also iterate through the child elements of an array or object, which is necessary
   //  when we don't know the structure of the document
   Array::const_iterator itBeers(arrayBeers.Begin()),
                         itBeersEnd(arrayBeers.End());
   for (; itBeers != itBeersEnd; ++itBeers)
   {
      // remember, *itArray is an UnknownElement, which can be implicitly cast to another element type
      const Object& objBeer = *itBeers;
      Object::const_iterator itBeerFacts(objBeer.Begin()),
                             itBeerFactsEnd(objBeer.End());
      for (; itBeerFacts != itBeerFactsEnd; ++itBeerFacts)
      {
         const Object::Member& member = *itBeerFacts;
         const std::string& name = member.name;
         const UnknownElement& element = member.element;

         // if we didn't know the structure of the itBeerFacts subtree, we could visit it
         // element.Accept(nonExistantVisitor);
      }
   }

   // everything's cool until we try to access a non-existent array element
   try
   {
      std::cout << "Expecting exception: Array out of bounds" << std::endl;
      const String& strName2 = arrayBeers[2];
   }
   catch (const Exception& e)
   {
      std::cout << "Caught json::Exception: " << e.what() << std::endl << std::endl;
   }

   // an exception will be thrown when expected data not found, since "Rice" is never a member of good beer
   try 
   {
      std::cout << "Expecting exception: Object member not found" << std::endl;
      const Boolean& boolRice = objRoot["Delicious Beers"][1]["Rice"];
   }
   catch (const Exception& e)
   {
      std::cout << "Caught json::Exception: " << e.what() << std::endl << std::endl;
   }

   // we'll also get an error if the document structure isn't quite what we expect
   try 
   {
      // objRoot["Delicious Beers"] is an Array, not another Object, so the second chained operator[string] will fail
      std::cout << "Expecting exception: Bad cast" << std::endl;
      const UnknownElement& elem = objRoot["Delicious Beers"]["Some Object Member"];
   }
   catch (json::Exception& e)
   {
      std::cout << "Caught json::Exception: " << e.what() << std::endl << std::endl;
   }


   ////////////////////////////////////////////////////////////////////
   // document deep copying
    
   // we can make an exact duplicate too
   Object objRoot2 = objRoot; 

   // the two documents should start out equal
   bool bEqualInitially = (objRoot == objRoot2);
   std::cout << "Document copies should start out equivalent. operator == returned: "
             << (bEqualInitially ? "true" : "false") << std::endl;

   // prove objRoot2 is a deep copy of objRoot:
   //  remove Beers[1]
   Array& array = objRoot2["Delicious Beers"];
   array.Erase(array.Begin()); // trim it down to one. this leaves elemRoot the same

   // the two documents should start out equal
   bool bEqualNow = (objRoot == objRoot2);
   std::cout << "Document copies should now be different. operator == returned: "
             << (bEqualNow ? "true" : "false") << std::endl << std::endl;


   ////////////////////////////////////////////////////////////////////
   // read/write sanity check

   // write it out to a string stream (file stream would work the same)....
   std::cout << "Writing file out...";

   std::stringstream stream;
   Writer::Write(objRoot, stream);

   // ...then read it back in. we know it's an Object
   std::cout << "then reading it back in." << std::endl;
   Object elemRootFile;
   Reader::Read(elemRootFile, stream);

   // still look right?
   bool bEquals = (objRoot == elemRootFile);
   std::cout << "Original document and streamed document should be equivalent. operator == returned: "
      << (bEquals ? "true" : "false") << std::endl << std::endl;


   ////////////////////////////////////////////////////////////////////
   // document read error handling

   // mis-predicting type type will fail with a parse error. we'll try reading an array into an object
   try
   {
      std::istringstream sBadDocument("[1, 2]"); // missing comma!
      std::cout << "Reading Object-based document into an Array; expecting Parse exception" << std::endl;
      Object objDocument;
      Reader::Read(objDocument, sBadDocument);
   }
   catch (Reader::ParseException& e)
   {
      // lines/offsets are zero-indexed, so bump them up by one for human presentation
      std::cout << "Caught json::ParseException: " << e.what() << ", Line/offset: " << e.m_locTokenBegin.m_nLine + 1
                << '/' << e.m_locTokenBegin.m_nLineOffset + 1 << std::endl << std::endl;
   }

   // reading in a slightly malformed document may result in a parse error
   try
   {
      std::istringstream sBadDocument("[1, 2 3]"); // missing comma!
      std::cout << "Reading malformed document; expecting Parse exception" << std::endl;
      Array arrayDocument;
      Reader::Read(arrayDocument, sBadDocument);
   }
   catch (Reader::ParseException& e)
   {
      std::cout << "Caught json::ParseException: " << e.what() << ", Line/offset: " << e.m_locTokenBegin.m_nLine + 1
                << '/' << e.m_locTokenBegin.m_nLineOffset + 1 << std::endl << std::endl;
   }

   // reading in gibberish will generate a scan error
   try
   {
      std::istringstream sBadDocument("[true, false, true, #.&@k*k4L!`1");
      std::cout << "Reading complete garbage; expecting Scan exception" << std::endl;
      Array arrayDocument;
      Reader::Read(arrayDocument, sBadDocument);
   }
   catch (Reader::ScanException& e)
   {
      std::cout << "Caught json::ScanException: " << e.what() << ", Line/offset: " << e.m_locError.m_nLine + 1
                << '/' << e.m_locError.m_nLineOffset + 1 << std::endl << std::endl;
   }

   try {
      std::istringstream sIncompleteDocument("[ true, ");
      std::cout << "Reading incomplete document; expecting Parse exception" << std::endl;

      json::Array arrayDocument;
      json::Reader::Read(arrayDocument, sIncompleteDocument);
   }
   catch (Reader::ParseException& e)
   {
      std::cout << "Caught json::ParseException: " << e.what() << ", Line/offset: " << e.m_locTokenBegin.m_nLine + 1
                << '/' << e.m_locTokenBegin.m_nLineOffset + 1 << std::endl << std::endl;
   }


   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x448, %rsp            # imm = 0x448
leaq -0xe8(%rbp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x8bce(%rip), %rsi      # 0xd0c8
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x5c7e
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x42c0
leaq -0x98(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5cba
leaq 0x8ba9(%rip), %rsi      # 0xd0e3
leaq -0x2c0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x5c7e
leaq -0xe8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x5d04
leaq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x2c0(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x458a
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq 0x8b3f(%rip), %rsi      # 0xd0e8
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x5c7e
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x42c0
leaq -0x98(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5cba
leaq 0x8b12(%rip), %rsi      # 0xd0fb
leaq -0x2c0(%rbp), %rdi
leaq -0x48(%rbp), %rbx
movq %rbx, %rdx
callq 0x5c7e
leaq -0xe8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x5d04
leaq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x2c0(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x463c
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
callq 0x40d0
movabsq $0x400e666666666666, %r14 # imm = 0x400E666666666666
leaq -0x2c0(%rbp), %rsi
movq %r14, (%rsi)
leaq -0x270(%rbp), %rdi
callq 0x5dd8
leaq 0x8a87(%rip), %rsi      # 0xd102
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0xe8(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
leaq -0x270(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x46ce
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x2c0(%rbp), %rsi
movb $0x1, (%rsi)
leaq -0x270(%rbp), %rdi
callq 0x5e06
leaq 0x8a1b(%rip), %rsi      # 0xd106
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0xe8(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
leaq -0x270(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x473e
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x2c0(%rbp), %rdi
callq 0x6aae
leaq -0x270(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x5e70
leaq -0x448(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
leaq -0x270(%rbp), %rdx
callq 0x5e32
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x4789
movq (%rdi), %rax
callq *0x8(%rax)
movq %rbx, -0x40(%rbp)
movq %rbx, -0x48(%rbp)
andq $0x0, -0x38(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x5eba
leaq 0x8968(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
leaq -0x270(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x4800
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x8921(%rip), %rsi      # 0xd128
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
movq %rax, %rdi
callq 0x898e
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq 0x88f1(%rip), %rsi      # 0xd136
leaq -0x270(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x42c0
leaq -0xb0(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5cba
leaq 0x8896(%rip), %rsi      # 0xd118
leaq -0x98(%rbp), %rdi
leaq -0x2b(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5d04
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x5f04
movq %rax, %rbx
leaq 0x882c(%rip), %rsi      # 0xd0e3
leaq -0xd0(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x5c7e
leaq -0xd0(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f24
leaq -0xb0(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0xd0(%rbp), %rdi
callq 0x40d0
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x490f
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq 0x8822(%rip), %rsi      # 0xd150
leaq -0x270(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x42c0
leaq -0xb0(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5cba
leaq 0x87ad(%rip), %rsi      # 0xd118
leaq -0x98(%rbp), %rdi
leaq -0x2b(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5d04
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x5f04
movq %rax, %rbx
leaq 0x875b(%rip), %rsi      # 0xd0fb
leaq -0xd0(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x5c7e
leaq -0xd0(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f24
leaq -0xb0(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0xd0(%rbp), %rdi
callq 0x40d0
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x49f8
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0xd0(%rbp), %rsi
movq %r14, (%rsi)
leaq -0x98(%rbp), %rdi
callq 0x5dd8
leaq 0x86eb(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x5f04
movq %rax, %rbx
leaq 0x869d(%rip), %rsi      # 0xd102
leaq -0x270(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f24
leaq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x4abd
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0xd0(%rbp), %rsi
movb $0x0, (%rsi)
leaq -0x98(%rbp), %rdi
callq 0x5e06
leaq 0x863e(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x5f04
movq %rax, %rbx
leaq 0x85f4(%rip), %rsi      # 0xd106
leaq -0x270(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rsi
movq %rbx, %rdi
callq 0x5f24
leaq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x5da4
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x4b6a
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x85a7(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5f44
movq %rax, %rdi
callq 0x9330
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5ffe
movq %rax, %rdi
callq 0x93de
movq %rax, %r15
leaq 0x851c(%rip), %rsi      # 0xd0e3
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x5c7e
leaq -0x448(%rbp), %rsi
movq %r15, %rdi
callq 0x5f44
movq %rax, %rdi
callq 0x948c
movq %rax, %r15
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq 0x8511(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5f44
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x60a2
movq %rax, %r12
leaq 0x84c3(%rip), %rsi      # 0xd102
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rsi
movq %r12, %rdi
callq 0x60c2
movq %rax, %rdi
callq 0x953a
movsd (%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq 0xf344(%rip), %rdi      # 0x13fd8
leaq 0x84ce(%rip), %rsi      # 0xd169
callq 0x4210
movq %rax, %rdi
movq %r15, %rsi
callq 0x4200
movq %rax, %rdi
callq 0x40f0
movq 0xf31e(%rip), %rdi      # 0x13fd8
leaq 0x84ba(%rip), %rsi      # 0xd17b
callq 0x4210
movq %rax, %rdi
movsd -0xf0(%rbp), %xmm0
callq 0x4300
movq %rax, %rdi
callq 0x40f0
movq 0x10(%rbx), %r15
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r12
movq 0x30(%rbx), %r13
cmpq %r13, %r15
je 0x4d16
movq %r15, %rdi
callq 0x93de
addq $0x8, %r15
cmpq %r14, %r15
jne 0x4cee
movq 0x8(%r12), %r15
addq $0x8, %r12
leaq 0x200(%r15), %r14
jmp 0x4cee
movq 0xf2bb(%rip), %rdi      # 0x13fd8
leaq 0x8468(%rip), %rsi      # 0xd18c
callq 0x4210
movq %rax, %rdi
callq 0x40f0
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x5ffe
movq %rax, %rdi
callq 0x948c
movq 0xf28d(%rip), %rdi      # 0x13fd8
leaq 0x847c(%rip), %rsi      # 0xd1ce
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq 0x83b2(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5f44
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x60a2
movq %rax, %rbx
leaq 0x845d(%rip), %rsi      # 0xd1fb
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rsi
movq %rbx, %rdi
callq 0x60c2
movq %rax, %rdi
callq 0x95e8
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq 0xf1f1(%rip), %rdi      # 0x13fd8
leaq 0x8412(%rip), %rsi      # 0xd200
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq 0x8316(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x5c7e
leaq -0x48(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5f44
movq %rax, %rbx
leaq 0x83ef(%rip), %rsi      # 0xd21e
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rsi
movq %rbx, %rdi
callq 0x60c2
leaq -0x270(%rbp), %rdi
callq 0x40d0
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0xd0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9696
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x9791
movl %eax, %r15d
movq 0xf145(%rip), %rdi      # 0x13fd8
leaq 0x8397(%rip), %rsi      # 0xd231
callq 0x4210
leaq 0x83cf(%rip), %r12      # 0xd275
leaq 0x8732(%rip), %rbx      # 0xd5df
testb %r15b, %r15b
movq %rbx, %rsi
cmovneq %r12, %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq 0x824a(%rip), %rsi      # 0xd118
leaq -0x448(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x5c7e
leaq -0xd0(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x5d04
movq %rax, %rdi
callq 0x8a6c
movq %rax, %r15
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq 0x10(%r15), %rax
leaq -0x468(%rbp), %rdx
movq %rax, (%rdx)
movq 0x18(%r15), %rax
movq %rax, 0x8(%rdx)
movq 0x20(%r15), %rax
movq %rax, 0x10(%rdx)
movq 0x28(%r15), %rax
movq %rax, 0x18(%rdx)
leaq -0x448(%rbp), %rdi
movq %r15, %rsi
callq 0x612c
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x9791
movl %eax, %r15d
movq 0xf07e(%rip), %rdi      # 0x13fd8
leaq 0x8319(%rip), %rsi      # 0xd27a
callq 0x4210
testb %r15b, %r15b
movq %rbx, %rsi
cmovneq %r12, %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
movq 0xf049(%rip), %rdi      # 0x13fd8
leaq 0x8324(%rip), %rsi      # 0xd2ba
callq 0x4210
leaq -0x448(%rbp), %rdi
callq 0x4180
leaq -0x438(%rbp), %rsi
leaq -0x48(%rbp), %rdi
xorl %edx, %edx
callq 0x9b7c
movq 0xf018(%rip), %rdi      # 0x13fd8
leaq 0x8307(%rip), %rsi      # 0xd2ce
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq -0xb0(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
movq %rdi, -0xb0(%rbp)
andq $0x0, -0xa0(%rbp)
leaq -0x448(%rbp), %rsi
callq 0x9f18
leaq -0x48(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x9791
movl %eax, %r14d
movq 0xefc1(%rip), %rdi      # 0x13fd8
leaq 0x82c9(%rip), %rsi      # 0xd2e7
callq 0x4210
testb %r14b, %r14b
cmovneq %r12, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
leaq 0x82f0(%rip), %rsi      # 0xd33c
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rdi
leaq -0x98(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x4330
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x40d0
movq 0xef50(%rip), %rdi      # 0x13fd8
leaq 0x82b4(%rip), %rsi      # 0xd343
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rbx, -0x90(%rbp)
movq %rbx, -0x98(%rbp)
andq $0x0, -0x88(%rbp)
leaq -0x270(%rbp), %rsi
movq %rbx, %rdi
callq 0x9f18
leaq -0x98(%rbp), %rdi
callq 0x9752
leaq -0x270(%rbp), %rdi
callq 0x40e0
leaq 0x82d8(%rip), %rsi      # 0xd3b8
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rdi
leaq -0x98(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x4330
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq 0xeebf(%rip), %rdi      # 0x13fd8
leaq 0x82a1(%rip), %rsi      # 0xd3c1
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq -0x98(%rbp), %rdi
callq 0x6aae
leaq -0x98(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xc012
leaq -0x98(%rbp), %rdi
callq 0xc140
leaq -0x270(%rbp), %rdi
callq 0x40e0
leaq 0x828c(%rip), %rsi      # 0xd3f7
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rdi
leaq -0x98(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x4330
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq 0xee34(%rip), %rdi      # 0x13fd8
leaq 0x826d(%rip), %rsi      # 0xd418
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq -0x98(%rbp), %rdi
callq 0x6aae
leaq -0x98(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xc012
leaq -0x98(%rbp), %rdi
callq 0xc140
leaq -0x270(%rbp), %rdi
callq 0x40e0
leaq 0x8272(%rip), %rsi      # 0xd468
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x5c7e
leaq -0x270(%rbp), %rdi
leaq -0x98(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x4330
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq 0xeda9(%rip), %rdi      # 0x13fd8
leaq 0x823b(%rip), %rsi      # 0xd471
callq 0x4210
movq %rax, %rdi
callq 0x40f0
leaq -0x98(%rbp), %rdi
callq 0x6aae
leaq -0x98(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xc012
leaq -0x98(%rbp), %rdi
callq 0xc140
leaq -0x270(%rbp), %rdi
callq 0x40e0
leaq -0xb0(%rbp), %rdi
callq 0x9752
leaq -0x448(%rbp), %rdi
callq 0x41b0
leaq -0xd0(%rbp), %rdi
callq 0x9752
leaq -0x48(%rbp), %rdi
callq 0x9752
leaq -0x2c0(%rbp), %rdi
callq 0xc140
leaq -0xe8(%rbp), %rdi
callq 0x9752
xorl %eax, %eax
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0xc140
jmp 0x54f5
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0xc140
jmp 0x55a6
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0xc140
jmp 0x5657
jmp 0x54ef
jmp 0x55a0
jmp 0x5651
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x9752
jmp 0x5708
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x40d0
jmp 0x5501
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x40d0
jmp 0x55b2
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x40d0
jmp 0x5663
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x40d0
jmp 0x5714
movq %rdx, %r14
movq %rax, %rbx
jmp 0x5501
movq %rdx, %r14
movq %rax, %rbx
jmp 0x55b2
movq %rdx, %r14
movq %rax, %rbx
jmp 0x5663
movq %rdx, %r14
movq %rax, %rbx
jmp 0x5714
jmp 0x5a93
jmp 0x5ab0
jmp 0x5ab0
jmp 0x5ab0
movq %rdx, %r15
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40d0
jmp 0x53fb
jmp 0x57db
jmp 0x53f5
movq %rdx, %r15
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
jmp 0x57fa
jmp 0x57f4
jmp 0x5865
jmp 0x5ac3
jmp 0x59e5
jmp 0x5ac3
jmp 0x5ac3
jmp 0x5ac3
jmp 0x5982
jmp 0x5440
jmp 0x5ac3
jmp 0x5982
movq %rax, %rbx
jmp 0x5991
jmp 0x5ac3
jmp 0x59af
jmp 0x5462
jmp 0x546a
jmp 0x5472
jmp 0x5ac3
jmp 0x59af
movq %rax, %rbx
jmp 0x59be
movq %rax, %rbx
jmp 0x59d0
movq %rax, %rbx
jmp 0x59dc
jmp 0x5ac3
jmp 0x5ac3
movq %rax, %rbx
jmp 0x5a08
jmp 0x5ac3
movq %rax, %rbx
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x5acf
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x5acf
movq %rax, %rbx
jmp 0x5acf
jmp 0x54e7
jmp 0x54bd
jmp 0x54e7
movq %rax, %rbx
jmp 0x5a34
jmp 0x54e7
jmp 0x54cf
jmp 0x54d7
jmp 0x54df
jmp 0x54e7
movq %rax, %rbx
jmp 0x5a60
movq %rax, %rbx
jmp 0x5a72
movq %rax, %rbx
jmp 0x5a7e
movq %rax, %rbx
jmp 0x5adb
movq %rdx, %r14
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40e0
cmpl $0x2, %r14d
jne 0x5a96
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xeabb(%rip), %rdi      # 0x13fd8
leaq 0x7e66(%rip), %rsi      # 0xd38a
callq 0x4210
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x4210
leaq 0x7e61(%rip), %rsi      # 0xd3a8
movq %rax, %rdi
callq 0x4210
movl 0x10(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x4270
movl 0x14(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x527a
jmp 0x5a93
movq %rax, %rbx
callq 0x4320
jmp 0x5a96
movq %rdx, %r14
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40e0
cmpl $0x3, %r14d
jne 0x5a96
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xea0a(%rip), %rdi      # 0x13fd8
leaq 0x7e76(%rip), %rsi      # 0xd44b
callq 0x4210
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x4210
leaq 0x7db0(%rip), %rsi      # 0xd3a8
movq %rax, %rdi
callq 0x4210
movl 0x10(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x4270
movl 0x14(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x51ef
jmp 0x5a93
movq %rax, %rbx
callq 0x4320
jmp 0x5a96
movq %rdx, %r14
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40e0
cmpl $0x2, %r14d
jne 0x5a96
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xe959(%rip), %rdi      # 0x13fd8
leaq 0x7d04(%rip), %rsi      # 0xd38a
callq 0x4210
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x4210
leaq 0x7cff(%rip), %rsi      # 0xd3a8
movq %rax, %rdi
callq 0x4210
movl 0x10(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x4270
movl 0x14(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x5164
jmp 0x5a93
movq %rax, %rbx
callq 0x4320
jmp 0x5a96
movq %rdx, %r14
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40e0
cmpl $0x2, %r14d
jne 0x5a96
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xe8a8(%rip), %rdi      # 0x13fd8
leaq 0x7c53(%rip), %rsi      # 0xd38a
callq 0x4210
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x4210
leaq 0x7c4e(%rip), %rsi      # 0xd3a8
movq %rax, %rdi
callq 0x4210
movl 0x10(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x4270
movl 0x14(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x4150
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x50d9
jmp 0x5a93
movq %rax, %rbx
callq 0x4320
jmp 0x5a96
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
jmp 0x5ab3
movq %rdx, %r15
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40d0
jmp 0x57e1
movq %rdx, %r15
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
jmp 0x586b
jmp 0x58d6
movq %rdx, %r15
movq %rax, %rbx
cmpl $0x1, %r15d
jne 0x5ac6
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xe7c2(%rip), %rdi      # 0x13fd8
leaq 0x7998(%rip), %rsi      # 0xd1b5
callq 0x4210
movq %rax, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x4e69
jmp 0x5ac3
movq %rax, %rbx
callq 0x4320
jmp 0x5ac6
movq %rdx, %r15
movq %rax, %rbx
cmpl $0x1, %r15d
jne 0x5ac6
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xe751(%rip), %rdi      # 0x13fd8
leaq 0x7927(%rip), %rsi      # 0xd1b5
callq 0x4210
movq %rax, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x4de0
jmp 0x5ac3
movq %rax, %rbx
callq 0x4320
jmp 0x5ac6
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x5ac6
movq %rbx, %rdi
callq 0x40a0
movq %rax, %rbx
movq 0xe6e4(%rip), %rdi      # 0x13fd8
leaq 0x78ba(%rip), %rsi      # 0xd1b5
callq 0x4210
movq %rax, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x4210
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40f0
callq 0x4320
jmp 0x4d44
jmp 0x5ac3
movq %rax, %rbx
callq 0x4320
jmp 0x5ac6
movq %rax, %rdi
callq 0x611e
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40d0
jmp 0x59e8
jmp 0x59e5
jmp 0x59e5
jmp 0x5ac3
jmp 0x59e5
jmp 0x5971
jmp 0x5982
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x40d0
jmp 0x5985
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
jmp 0x5a0f
jmp 0x599e
jmp 0x59af
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x40d0
jmp 0x59b2
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x40d0
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x59d0
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
jmp 0x59ef
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
jmp 0x5ac6
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x5ac6
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x5ac6
jmp 0x5a25
movq %rax, %rbx
leaq -0x448(%rbp), %rdi
callq 0x40d0
movq -0x270(%rbp), %rdi
testq %rdi, %rdi
je 0x5adb
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x5adb
jmp 0x5a51
movq %rax, %rbx
leaq -0x2c0(%rbp), %rdi
callq 0x40d0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x5a72
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x448(%rbp), %rdi
callq 0x40d0
leaq -0x270(%rbp), %rdi
callq 0x40d0
jmp 0x5adb
movq %rax, %rbx
jmp 0x5aa2
jmp 0x5ab0
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x9752
leaq -0x448(%rbp), %rdi
callq 0x41b0
jmp 0x5ab3
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x9752
jmp 0x5ac6
jmp 0x5ac3
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x9752
leaq -0x2c0(%rbp), %rdi
callq 0xc140
leaq -0xe8(%rbp), %rdi
callq 0x9752
movq %rbx, %rdi
callq 0x4360
nop