// File: shammellee[P]mdl/mdl.cpp
// Function: main
int main(int argc, char* argv[])
{
  command_init();

  try
  {
    po::options_description options("Options");
    options.add_options()
      ("help,h", "display help info")
      ("type,t", po::value<string>(&media_type)->value_name("TYPE")->default_value(MDL_VIDEO_PLAYLIST), MDL_MEDIATYPE_DESCRIPTION.c_str())
      ("list-formats,F", "List available download formats")
      ("format,f", po::value<string>(&audio_format)->value_name("FORMAT")->default_value(MDL_MP3), "audio format")
      ("format-id,i", po::value<string>(&format_id)->value_name("REGEX"), "download video whose format id matches specified regex (eg, \"^480[pP]$\")")
      ("closest-video-resolution,c", po::value<int>(&closest_video_resolution)->value_name("RESOLUTION"), "download video with resolution closest to value specified (eg, 480)")
      ("rate,r", po::value<string>(&rate)->value_name("RATE"), "download rate (eg, 420k, 4.2M, etc)")
      ("filter,q", po::value<string>(&filter)->value_name("FILTER"), "quality filter (eg, 22, 135, 136, best, worst, bestvideo, worstaudio, etc)")
      ("subtitles,s", "Include subtitles")
      ("manifest-file,m", po::value<string>(&manifest_file_path)->value_name("FILE")->default_value(MDL_DEFAULT_MANIFEST), "manifest file")
      ("dry-run,N", "show command line instead of downloading")
      ;

    po::positional_options_description p;
    p.add("manifest-file", -1);

    po::variables_map vm;
    po::store(po::command_line_parser(argc, argv).options(options).positional(p).run(), vm);
    po::notify(vm);

    if(vm.count("help"))
    {
      cout << options << endl;

      return 0;
    }

    if(vm.count("list-formats"))
    {
      command_add_flag("--list-formats");
    }

    media_type_to_lower = media_type;
    boost::to_lower(media_type_to_lower);
    audio_format_to_lower = audio_format;
    boost::to_lower(audio_format_to_lower);

    if(is_audio(media_type_to_lower))
    {
      if(
        audio_format_to_lower == MDL_MP3
        || audio_format_to_lower == MDL_M4A
        || audio_format == MDL_WAV
      )
      {
        command_add_flag("--extract-audio");
        command_add_flag("--audio-format " + audio_format_to_lower);
      }else
      {
        cout << "Invalid audio format: " << audio_format << endl;

        return 1;
      }
    }

    if(vm.count("format-id"))
    {
      command_add_flag("--format '[format_id~=\"" + format_id + "\"]'");
    }

    if(closest_video_resolution)
    {
      command_add_flag("--format-sort 'res~" + std::to_string(closest_video_resolution) + "'");
    }

    if(!rate.empty()) command_add_flag("--rate " + rate);

    if(!filter.empty()) command_add_flag("--format " + filter);

    if(vm.count("subtitles"))
    {
      command_add_flag("--write-auto-sub");
      command_add_flag("--sub-format srt/vtt/ttml/best");
      command_add_flag("--sub-lang en");
      command_add_flag("--embed-subs");
      command_add_flag("--convert-subs srt");
    }

    command_add_flag("--output " + (is_playlist(media_type_to_lower) ? MDL_PLAYLIST_TEMPLATE : MDL_FILE_TEMPLATE));

    if(vm.count("dry-run")) dry_run = true;

    command_call();
  }
  catch(exception& error)
  {
    cerr << "error: " << error.what() << endl;

    return 1;
  }
  catch(...)
  {
    cerr << "Unknown exception!" << endl;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8f0, %rsp            # imm = 0x8F0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x7200
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x6c0(%rbp)
callq 0x65d0
movq -0x6c0(%rbp), %rdx
leaq 0xeb4a(%rip), %rsi      # 0x16129
leaq -0xb0(%rbp), %rdi
callq 0x8e80
jmp 0x75ed
movq 0x19994(%rip), %rax     # 0x20f88
movl (%rax), %edx
movl %edx, %ecx
shrl %ecx
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x64a0
jmp 0x760f
leaq -0xb0(%rbp), %rdi
callq 0x6688
leaq -0xb1(%rbp), %rdi
callq 0x6380
leaq -0x90(%rbp), %rdi
callq 0x63f0
movq %rax, -0x6c8(%rbp)
jmp 0x763c
movq -0x6c8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq 0xeae0(%rip), %rsi      # 0x16131
leaq 0xeae0(%rip), %rdx      # 0x16138
leaq -0xd0(%rbp), %rdi
callq 0x6600
movq %rax, -0x6d0(%rbp)
jmp 0x766d
leaq 0x19eac(%rip), %rdi     # 0x21520
callq 0x9170
movq %rax, -0x6d8(%rbp)
jmp 0x7682
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x65d0
movq -0x6e0(%rbp), %rdx
leaq 0xeaae(%rip), %rsi      # 0x16151
leaq -0xf0(%rbp), %rdi
callq 0x8e80
jmp 0x76b1
movq -0x6d8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x91d0
movq %rax, -0x6e8(%rbp)
jmp 0x76cd
movq -0x6e8(%rbp), %rdi
leaq 0x19d3d(%rip), %rsi     # 0x21418
callq 0x9200
movq %rax, -0x6f0(%rbp)
jmp 0x76e9
leaq 0x19dc8(%rip), %rdi     # 0x214b8
callq 0x6110
movq -0x6d0(%rbp), %rdi
movq -0x6f0(%rbp), %rdx
movq %rax, %rcx
leaq 0xea3d(%rip), %rsi      # 0x1614a
callq 0x6630
movq %rax, -0x6f8(%rbp)
jmp 0x771b
movq -0x6f8(%rbp), %rdi
leaq 0xea2d(%rip), %rsi      # 0x16156
leaq 0xea35(%rip), %rdx      # 0x16165
callq 0x6600
movq %rax, -0x700(%rbp)
jmp 0x773e
leaq 0x19e1b(%rip), %rdi     # 0x21560
callq 0x9170
movq %rax, -0x708(%rbp)
jmp 0x7753
leaq -0x119(%rbp), %rdi
movq %rdi, -0x710(%rbp)
callq 0x65d0
movq -0x710(%rbp), %rdx
leaq 0xea1a(%rip), %rsi      # 0x1618e
leaq -0x118(%rbp), %rdi
callq 0x8e80
jmp 0x7782
movq -0x708(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x91d0
movq %rax, -0x718(%rbp)
jmp 0x779e
movq -0x718(%rbp), %rdi
leaq 0x19cac(%rip), %rsi     # 0x21458
callq 0x9200
movq %rax, -0x720(%rbp)
jmp 0x77ba
movq -0x720(%rbp), %rdx
movq -0x700(%rbp), %rdi
leaq 0xe9b6(%rip), %rsi      # 0x16185
leaq 0xe9bf(%rip), %rcx      # 0x16195
callq 0x6630
movq %rax, -0x728(%rbp)
jmp 0x77e4
leaq 0x19db5(%rip), %rdi     # 0x215a0
callq 0x9170
movq %rax, -0x730(%rbp)
jmp 0x77f9
leaq -0x141(%rbp), %rdi
movq %rdi, -0x738(%rbp)
callq 0x65d0
movq -0x738(%rbp), %rdx
leaq 0xe994(%rip), %rsi      # 0x161ae
leaq -0x140(%rbp), %rdi
callq 0x8e80
jmp 0x7828
movq -0x730(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x91d0
movq %rax, -0x740(%rbp)
jmp 0x7844
movq -0x740(%rbp), %rdx
movq -0x728(%rbp), %rdi
leaq 0xe949(%rip), %rsi      # 0x161a2
leaq 0xe954(%rip), %rcx      # 0x161b4
callq 0x6630
movq %rax, -0x748(%rbp)
jmp 0x786e
leaq 0x19c87(%rip), %rdi     # 0x214fc
callq 0x9270
movq %rax, -0x750(%rbp)
jmp 0x7883
leaq -0x169(%rbp), %rdi
movq %rdi, -0x758(%rbp)
callq 0x65d0
movq -0x758(%rbp), %rdx
leaq 0xe974(%rip), %rsi      # 0x16218
leaq -0x168(%rbp), %rdi
callq 0x8e80
jmp 0x78b2
movq -0x750(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x92d0
movq %rax, -0x760(%rbp)
jmp 0x78ce
movq -0x760(%rbp), %rdx
movq -0x748(%rbp), %rdi
leaq 0xe91a(%rip), %rsi      # 0x161fd
leaq 0xe939(%rip), %rcx      # 0x16223
callq 0x6630
movq %rax, -0x768(%rbp)
jmp 0x78f8
leaq 0x19ce1(%rip), %rdi     # 0x215e0
callq 0x9170
movq %rax, -0x770(%rbp)
jmp 0x790d
leaq -0x191(%rbp), %rdi
movq %rdi, -0x778(%rbp)
callq 0x65d0
movq -0x778(%rbp), %rdx
leaq 0xe940(%rip), %rsi      # 0x1626e
leaq -0x190(%rbp), %rdi
callq 0x8e80
jmp 0x793c
movq -0x770(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x91d0
movq %rax, -0x780(%rbp)
jmp 0x7958
movq -0x780(%rbp), %rdx
movq -0x768(%rbp), %rdi
leaq 0xe8fa(%rip), %rsi      # 0x16267
leaq 0xe8ff(%rip), %rcx      # 0x16273
callq 0x6630
movq %rax, -0x788(%rbp)
jmp 0x7982
leaq 0x19c77(%rip), %rdi     # 0x21600
callq 0x9170
movq %rax, -0x790(%rbp)
jmp 0x7997
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x798(%rbp)
callq 0x65d0
movq -0x798(%rbp), %rdx
leaq 0xe8e8(%rip), %rsi      # 0x162a0
leaq -0x1b8(%rbp), %rdi
callq 0x8e80
jmp 0x79c6
movq -0x790(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x91d0
movq %rax, -0x7a0(%rbp)
jmp 0x79e2
movq -0x7a0(%rbp), %rdx
movq -0x788(%rbp), %rdi
leaq 0xe8a0(%rip), %rsi      # 0x16297
leaq 0xe8a9(%rip), %rcx      # 0x162a7
callq 0x6630
movq %rax, -0x7a8(%rbp)
jmp 0x7a0c
movq -0x7a8(%rbp), %rdi
leaq 0xe8d8(%rip), %rsi      # 0x162f2
leaq 0xe8dd(%rip), %rdx      # 0x162fe
callq 0x6600
movq %rax, -0x7b0(%rbp)
jmp 0x7a2f
leaq 0x19b8a(%rip), %rdi     # 0x215c0
callq 0x9170
movq %rax, -0x7b8(%rbp)
jmp 0x7a44
leaq -0x1e1(%rbp), %rdi
movq %rdi, -0x7c0(%rbp)
callq 0x65d0
movq -0x7c0(%rbp), %rdx
leaq 0xe8bb(%rip), %rsi      # 0x16320
leaq -0x1e0(%rbp), %rdi
callq 0x8e80
jmp 0x7a73
movq -0x7b8(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x91d0
movq %rax, -0x7c8(%rbp)
jmp 0x7a8f
movq -0x7c8(%rbp), %rdi
leaq 0x19a3b(%rip), %rsi     # 0x214d8
callq 0x9200
movq %rax, -0x7d0(%rbp)
jmp 0x7aab
movq -0x7d0(%rbp), %rdx
movq -0x7b0(%rbp), %rdi
leaq 0xe850(%rip), %rsi      # 0x16310
leaq 0xe85e(%rip), %rcx      # 0x16325
callq 0x6630
movq %rax, -0x7d8(%rbp)
jmp 0x7ad5
movq -0x7d8(%rbp), %rdi
leaq 0xe850(%rip), %rsi      # 0x16333
leaq 0xe853(%rip), %rdx      # 0x1633d
callq 0x6600
jmp 0x7af1
leaq -0x1e0(%rbp), %rdi
callq 0x6688
leaq -0x1e1(%rbp), %rdi
callq 0x6380
leaq -0x1b8(%rbp), %rdi
callq 0x6688
leaq -0x1b9(%rbp), %rdi
callq 0x6380
leaq -0x190(%rbp), %rdi
callq 0x6688
leaq -0x191(%rbp), %rdi
callq 0x6380
leaq -0x168(%rbp), %rdi
callq 0x6688
leaq -0x169(%rbp), %rdi
callq 0x6380
leaq -0x140(%rbp), %rdi
callq 0x6688
leaq -0x141(%rbp), %rdi
callq 0x6380
leaq -0x118(%rbp), %rdi
callq 0x6688
leaq -0x119(%rbp), %rdi
callq 0x6380
leaq -0xf0(%rbp), %rdi
callq 0x6688
leaq -0xf1(%rbp), %rdi
callq 0x6380
leaq -0x220(%rbp), %rdi
callq 0x6470
jmp 0x7ba7
leaq 0xe7b8(%rip), %rsi      # 0x16366
leaq -0x220(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x6390
jmp 0x7bc1
leaq -0x2c0(%rbp), %rdi
callq 0x6130
jmp 0x7bcf
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0x360(%rbp), %rdi
callq 0x9300
jmp 0x7be4
leaq -0x360(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x9420
movq %rax, -0x7e0(%rbp)
jmp 0x7c00
movq -0x7e0(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x9460
movq %rax, -0x7e8(%rbp)
jmp 0x7c1c
movq -0x7e8(%rbp), %rsi
leaq -0x2e8(%rbp), %rdi
callq 0x9490
jmp 0x7c31
leaq -0x2e8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
xorl %edx, %edx
callq 0x65a0
jmp 0x7c48
leaq -0x2e8(%rbp), %rdi
callq 0x9550
leaq -0x360(%rbp), %rdi
callq 0x9570
leaq -0x2c0(%rbp), %rdi
callq 0x61b0
jmp 0x7c6e
leaq -0x2b0(%rbp), %rax
movq %rax, -0x7f8(%rbp)
leaq -0x381(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0x65d0
movq -0x7f0(%rbp), %rdx
leaq 0xe6d7(%rip), %rsi      # 0x16374
leaq -0x380(%rbp), %rdi
callq 0x8e80
jmp 0x7cab
movq -0x7f8(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x9590
movq %rax, -0x800(%rbp)
jmp 0x7cc7
leaq -0x380(%rbp), %rdi
callq 0x6688
leaq -0x381(%rbp), %rdi
callq 0x6380
movq -0x800(%rbp), %rax
cmpq $0x0, %rax
je 0x8023
movq 0x192c9(%rip), %rdi     # 0x20fc0
leaq -0x90(%rbp), %rsi
callq 0x6090
movq %rax, -0x808(%rbp)
jmp 0x7d0c
movq -0x808(%rbp), %rdi
movq 0x19266(%rip), %rsi     # 0x20f80
callq 0x6360
jmp 0x7d21
movl $0x0, -0x4(%rbp)
movl $0x1, -0x388(%rbp)
jmp 0x8ce2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7d69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x6688
leaq -0xb1(%rbp), %rdi
callq 0x6380
jmp 0x8d40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8d34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7f0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7efe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7ef2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7ee6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7eda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7ece
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x6688
leaq -0x1e1(%rbp), %rdi
callq 0x6380
leaq -0x1b8(%rbp), %rdi
callq 0x6688
leaq -0x1b9(%rbp), %rdi
callq 0x6380
leaq -0x190(%rbp), %rdi
callq 0x6688
leaq -0x191(%rbp), %rdi
callq 0x6380
leaq -0x168(%rbp), %rdi
callq 0x6688
leaq -0x169(%rbp), %rdi
callq 0x6380
leaq -0x140(%rbp), %rdi
callq 0x6688
leaq -0x141(%rbp), %rdi
callq 0x6380
leaq -0x118(%rbp), %rdi
callq 0x6688
leaq -0x119(%rbp), %rdi
callq 0x6380
leaq -0xf0(%rbp), %rdi
callq 0x6688
leaq -0xf1(%rbp), %rdi
callq 0x6380
jmp 0x8d34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8d28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x7fcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x9550
leaq -0x360(%rbp), %rdi
callq 0x9570
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8012
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x6688
leaq -0x381(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
leaq -0x2b0(%rbp), %rax
movq %rax, -0x818(%rbp)
leaq -0x3a9(%rbp), %rdi
movq %rdi, -0x810(%rbp)
callq 0x65d0
movq -0x810(%rbp), %rdx
leaq 0xe329(%rip), %rsi      # 0x1637b
leaq -0x3a8(%rbp), %rdi
callq 0x8e80
jmp 0x8060
movq -0x818(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x9590
movq %rax, -0x820(%rbp)
jmp 0x807c
leaq -0x3a8(%rbp), %rdi
callq 0x6688
leaq -0x3a9(%rbp), %rdi
callq 0x6380
movq -0x820(%rbp), %rax
cmpq $0x0, %rax
je 0x8185
leaq -0x3d1(%rbp), %rdi
movq %rdi, -0x828(%rbp)
callq 0x65d0
movq -0x828(%rbp), %rdx
leaq 0xe2b3(%rip), %rsi      # 0x16379
leaq -0x3d0(%rbp), %rdi
callq 0x8e80
jmp 0x80d4
leaq -0x3d0(%rbp), %rdi
callq 0x7190
jmp 0x80e2
leaq -0x3d0(%rbp), %rdi
callq 0x6688
leaq -0x3d1(%rbp), %rdi
callq 0x6380
jmp 0x8185
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8131
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x6688
leaq -0x3a9(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8174
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x6688
leaq -0x3d1(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
leaq 0x193b4(%rip), %rdi     # 0x21540
leaq 0x1938d(%rip), %rsi     # 0x21520
callq 0x6040
jmp 0x819a
leaq -0x3e0(%rbp), %rdi
movq %rdi, -0x830(%rbp)
callq 0x6670
movq -0x830(%rbp), %rsi
leaq 0x19385(%rip), %rdi     # 0x21540
callq 0x95f0
jmp 0x81c2
leaq -0x3e0(%rbp), %rdi
callq 0x64d0
leaq 0x193ab(%rip), %rdi     # 0x21580
leaq 0x19384(%rip), %rsi     # 0x21560
callq 0x6040
jmp 0x81e3
leaq -0x3e8(%rbp), %rdi
movq %rdi, -0x838(%rbp)
callq 0x6670
movq -0x838(%rbp), %rsi
leaq 0x1937c(%rip), %rdi     # 0x21580
callq 0x95f0
jmp 0x820b
leaq -0x3e8(%rbp), %rdi
callq 0x64d0
leaq 0x19322(%rip), %rsi     # 0x21540
leaq -0x408(%rbp), %rdi
callq 0x6140
jmp 0x822c
leaq -0x408(%rbp), %rdi
callq 0x7500
movb %al, -0x839(%rbp)
leaq -0x408(%rbp), %rdi
callq 0x6688
movb -0x839(%rbp), %al
testb $0x1, %al
jne 0x8259
jmp 0x8444
leaq 0x19320(%rip), %rdi     # 0x21580
leaq 0x191f1(%rip), %rsi     # 0x21458
callq 0x90e0
testb $0x1, %al
jne 0x82a3
leaq 0x19309(%rip), %rdi     # 0x21580
leaq 0x191fa(%rip), %rsi     # 0x21478
callq 0x90e0
testb $0x1, %al
jne 0x82a3
leaq 0x192d2(%rip), %rdi     # 0x21560
leaq 0x19203(%rip), %rsi     # 0x21498
callq 0x90e0
testb $0x1, %al
jne 0x82a3
jmp 0x83df
leaq -0x429(%rbp), %rdi
movq %rdi, -0x848(%rbp)
callq 0x65d0
movq -0x848(%rbp), %rdx
leaq 0xe0c4(%rip), %rsi      # 0x16388
leaq -0x428(%rbp), %rdi
callq 0x8e80
jmp 0x82d2
leaq -0x428(%rbp), %rdi
callq 0x7190
jmp 0x82e0
leaq -0x428(%rbp), %rdi
callq 0x6688
leaq -0x429(%rbp), %rdi
callq 0x6380
leaq 0xe099(%rip), %rsi      # 0x16398
leaq 0x1927a(%rip), %rdx     # 0x21580
leaq -0x450(%rbp), %rdi
callq 0x8fd0
jmp 0x8314
leaq -0x450(%rbp), %rdi
callq 0x7190
jmp 0x8322
leaq -0x450(%rbp), %rdi
callq 0x6688
jmp 0x8442
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x64d0
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x64d0
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x83ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x6688
leaq -0x429(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x450(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
movq 0x18bda(%rip), %rdi     # 0x20fc0
leaq 0xdfbb(%rip), %rsi      # 0x163a8
callq 0x6320
movq %rax, -0x850(%rbp)
jmp 0x83fb
movq -0x850(%rbp), %rdi
leaq 0x19157(%rip), %rsi     # 0x21560
callq 0x6300
movq %rax, -0x858(%rbp)
jmp 0x8417
movq -0x858(%rbp), %rdi
movq 0x18b5b(%rip), %rsi     # 0x20f80
callq 0x6360
jmp 0x842c
movl $0x1, -0x4(%rbp)
movl $0x1, -0x388(%rbp)
jmp 0x8ce2
jmp 0x8444
leaq -0x2b0(%rbp), %rax
movq %rax, -0x868(%rbp)
leaq -0x471(%rbp), %rdi
movq %rdi, -0x860(%rbp)
callq 0x65d0
movq -0x860(%rbp), %rdx
leaq 0xdf4c(%rip), %rsi      # 0x163bf
leaq -0x470(%rbp), %rdi
callq 0x8e80
jmp 0x8481
movq -0x868(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x9590
movq %rax, -0x870(%rbp)
jmp 0x849d
leaq -0x470(%rbp), %rdi
callq 0x6688
leaq -0x471(%rbp), %rdi
callq 0x6380
movq -0x870(%rbp), %rax
cmpq $0x0, %rax
je 0x85af
leaq 0xdefc(%rip), %rsi      # 0x163c9
leaq 0x190cc(%rip), %rdx     # 0x215a0
leaq -0x4b8(%rbp), %rdi
callq 0x8fd0
jmp 0x84e2
leaq 0xdef8(%rip), %rdx      # 0x163e1
leaq -0x498(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x8f30
jmp 0x84fe
leaq -0x498(%rbp), %rdi
callq 0x7190
jmp 0x850c
leaq -0x498(%rbp), %rdi
callq 0x6688
leaq -0x4b8(%rbp), %rdi
callq 0x6688
jmp 0x85af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x855b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x6688
leaq -0x471(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x859e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x6688
leaq -0x4b8(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
cmpl $0x0, 0x18f46(%rip)     # 0x214fc
je 0x869f
movl 0x18f3a(%rip), %esi     # 0x214fc
leaq -0x518(%rbp), %rdi
callq 0x9690
jmp 0x85d0
leaq 0xde0e(%rip), %rsi      # 0x163e5
leaq -0x4f8(%rbp), %rdi
leaq -0x518(%rbp), %rdx
callq 0x9640
jmp 0x85ec
leaq 0xddf0(%rip), %rdx      # 0x163e3
leaq -0x4d8(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
callq 0x8f30
jmp 0x8608
leaq -0x4d8(%rbp), %rdi
callq 0x7190
jmp 0x8616
leaq -0x4d8(%rbp), %rdi
callq 0x6688
leaq -0x4f8(%rbp), %rdi
callq 0x6688
leaq -0x518(%rbp), %rdi
callq 0x6688
jmp 0x869f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x868e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8682
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x4d8(%rbp), %rdi
callq 0x6688
leaq -0x4f8(%rbp), %rdi
callq 0x6688
leaq -0x518(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
leaq 0x18f3a(%rip), %rdi     # 0x215e0
callq 0x6560
testb $0x1, %al
jne 0x870a
leaq 0xdd43(%rip), %rsi      # 0x163f9
leaq 0x18f23(%rip), %rdx     # 0x215e0
leaq -0x538(%rbp), %rdi
callq 0x8fd0
jmp 0x86cb
leaq -0x538(%rbp), %rdi
callq 0x7190
jmp 0x86d9
leaq -0x538(%rbp), %rdi
callq 0x6688
jmp 0x870a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
leaq 0x18eef(%rip), %rdi     # 0x21600
callq 0x6560
testb $0x1, %al
jne 0x8775
leaq 0xdce0(%rip), %rsi      # 0x16401
leaq 0x18ed8(%rip), %rdx     # 0x21600
leaq -0x558(%rbp), %rdi
callq 0x8fd0
jmp 0x8736
leaq -0x558(%rbp), %rdi
callq 0x7190
jmp 0x8744
leaq -0x558(%rbp), %rdi
callq 0x6688
jmp 0x8775
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
leaq -0x2b0(%rbp), %rax
movq %rax, -0x880(%rbp)
leaq -0x579(%rbp), %rdi
movq %rdi, -0x878(%rbp)
callq 0x65d0
movq -0x878(%rbp), %rdx
leaq 0xdb62(%rip), %rsi      # 0x16306
leaq -0x578(%rbp), %rdi
callq 0x8e80
jmp 0x87b2
movq -0x880(%rbp), %rdi
leaq -0x578(%rbp), %rsi
callq 0x9590
movq %rax, -0x888(%rbp)
jmp 0x87ce
leaq -0x578(%rbp), %rdi
callq 0x6688
leaq -0x579(%rbp), %rdi
callq 0x6380
movq -0x888(%rbp), %rax
cmpq $0x0, %rax
je 0x8b37
leaq -0x5a1(%rbp), %rdi
movq %rdi, -0x890(%rbp)
callq 0x65d0
movq -0x890(%rbp), %rdx
leaq 0xdbf3(%rip), %rsi      # 0x1640b
leaq -0x5a0(%rbp), %rdi
callq 0x8e80
jmp 0x8826
leaq -0x5a0(%rbp), %rdi
callq 0x7190
jmp 0x8834
leaq -0x5a0(%rbp), %rdi
callq 0x6688
leaq -0x5a1(%rbp), %rdi
callq 0x6380
leaq -0x5c9(%rbp), %rdi
movq %rdi, -0x898(%rbp)
callq 0x65d0
movq -0x898(%rbp), %rdx
leaq 0xdbaf(%rip), %rsi      # 0x1641c
leaq -0x5c8(%rbp), %rdi
callq 0x8e80
jmp 0x887b
leaq -0x5c8(%rbp), %rdi
callq 0x7190
jmp 0x8889
leaq -0x5c8(%rbp), %rdi
callq 0x6688
leaq -0x5c9(%rbp), %rdi
callq 0x6380
leaq -0x5f1(%rbp), %rdi
movq %rdi, -0x8a0(%rbp)
callq 0x65d0
movq -0x8a0(%rbp), %rdx
leaq 0xdb79(%rip), %rsi      # 0x1643b
leaq -0x5f0(%rbp), %rdi
callq 0x8e80
jmp 0x88d0
leaq -0x5f0(%rbp), %rdi
callq 0x7190
jmp 0x88de
leaq -0x5f0(%rbp), %rdi
callq 0x6688
leaq -0x5f1(%rbp), %rdi
callq 0x6380
leaq -0x619(%rbp), %rdi
movq %rdi, -0x8a8(%rbp)
callq 0x65d0
movq -0x8a8(%rbp), %rdx
leaq 0xdb32(%rip), %rsi      # 0x16449
leaq -0x618(%rbp), %rdi
callq 0x8e80
jmp 0x8925
leaq -0x618(%rbp), %rdi
callq 0x7190
jmp 0x8933
leaq -0x618(%rbp), %rdi
callq 0x6688
leaq -0x619(%rbp), %rdi
callq 0x6380
leaq -0x641(%rbp), %rdi
movq %rdi, -0x8b0(%rbp)
callq 0x65d0
movq -0x8b0(%rbp), %rdx
leaq 0xdaea(%rip), %rsi      # 0x16456
leaq -0x640(%rbp), %rdi
callq 0x8e80
jmp 0x897a
leaq -0x640(%rbp), %rdi
callq 0x7190
jmp 0x8988
leaq -0x640(%rbp), %rdi
callq 0x6688
leaq -0x641(%rbp), %rdi
callq 0x6380
jmp 0x8b37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x89d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x578(%rbp), %rdi
callq 0x6688
leaq -0x579(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8a1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0x6688
leaq -0x5a1(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8a5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x5c8(%rbp), %rdi
callq 0x6688
leaq -0x5c9(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8aa0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x5f0(%rbp), %rdi
callq 0x6688
leaq -0x5f1(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8ae3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x618(%rbp), %rdi
callq 0x6688
leaq -0x619(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8b26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x640(%rbp), %rdi
callq 0x6688
leaq -0x641(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
leaq 0x18a02(%rip), %rsi     # 0x21540
leaq -0x688(%rbp), %rdi
callq 0x6140
jmp 0x8b4c
leaq -0x688(%rbp), %rdi
callq 0x74b0
testb $0x1, %al
jne 0x8b5e
jmp 0x8b6e
leaq 0x18853(%rip), %rax     # 0x213b8
movq %rax, -0x8b8(%rbp)
jmp 0x8b7e
leaq 0x18823(%rip), %rax     # 0x21398
movq %rax, -0x8b8(%rbp)
jmp 0x8b7e
movq -0x8b8(%rbp), %rdx
leaq 0xd8dd(%rip), %rsi      # 0x16469
leaq -0x668(%rbp), %rdi
callq 0x8fd0
jmp 0x8b9a
leaq -0x668(%rbp), %rdi
callq 0x7190
jmp 0x8ba8
leaq -0x668(%rbp), %rdi
callq 0x6688
leaq -0x688(%rbp), %rdi
callq 0x6688
leaq -0x2b0(%rbp), %rax
movq %rax, -0x8c8(%rbp)
leaq -0x6a9(%rbp), %rdi
movq %rdi, -0x8c0(%rbp)
callq 0x65d0
movq -0x8c0(%rbp), %rdx
leaq 0xd884(%rip), %rsi      # 0x16473
leaq -0x6a8(%rbp), %rdi
callq 0x8e80
jmp 0x8bfd
movq -0x8c8(%rbp), %rdi
leaq -0x6a8(%rbp), %rsi
callq 0x9590
movq %rax, -0x8d0(%rbp)
jmp 0x8c19
leaq -0x6a8(%rbp), %rdi
callq 0x6688
leaq -0x6a9(%rbp), %rdi
callq 0x6380
movq -0x8d0(%rbp), %rax
cmpq $0x0, %rax
je 0x8cd1
movb $0x1, 0x188af(%rip)     # 0x214f8
jmp 0x8cd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8c80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x668(%rbp), %rdi
callq 0x6688
leaq -0x688(%rbp), %rdi
callq 0x6688
jmp 0x8d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x8cc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x6a8(%rbp), %rdi
callq 0x6688
leaq -0x6a9(%rbp), %rdi
callq 0x6380
jmp 0x8d1c
callq 0x73e0
jmp 0x8cd8
movl $0x0, -0x388(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x97b0
leaq -0x220(%rbp), %rdi
callq 0x9810
leaq -0x90(%rbp), %rdi
callq 0x9840
movl -0x388(%rbp), %eax
testl %eax, %eax
je 0x8d17
jmp 0x8d12
jmp 0x8e5b
jmp 0x8e54
leaq -0x2c0(%rbp), %rdi
callq 0x97b0
leaq -0x220(%rbp), %rdi
callq 0x9810
leaq -0x90(%rbp), %rdi
callq 0x9840
movl -0xc4(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x8dda
movq -0xc0(%rbp), %rdi
callq 0x6100
movq %rax, -0x6b8(%rbp)
movq 0x18283(%rip), %rdi     # 0x20ff0
leaq 0xd71a(%rip), %rsi      # 0x1648e
callq 0x6320
movq %rax, -0x8d8(%rbp)
jmp 0x8d82
movq -0x6b8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x8d8(%rbp), %rdi
movq %rax, %rsi
callq 0x6320
movq %rax, -0x8e0(%rbp)
jmp 0x8daa
movq -0x8e0(%rbp), %rdi
movq 0x181c8(%rip), %rsi     # 0x20f80
callq 0x6360
jmp 0x8dbf
movl $0x1, -0x4(%rbp)
movl $0x1, -0x388(%rbp)
callq 0x6530
jmp 0x8e5b
movq -0xc0(%rbp), %rdi
callq 0x6100
movq 0x18203(%rip), %rdi     # 0x20ff0
leaq 0xd687(%rip), %rsi      # 0x1647b
callq 0x6320
movq %rax, -0x8e8(%rbp)
jmp 0x8e02
movq -0x8e8(%rbp), %rdi
movq 0x18170(%rip), %rsi     # 0x20f80
callq 0x6360
jmp 0x8e17
callq 0x6530
jmp 0x8e54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
callq 0x6530
jmp 0x8e37
jmp 0x8e67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
callq 0x6530
jmp 0x8e52
jmp 0x8e67
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x8f0, %rsp            # imm = 0x8F0
popq %rbp
retq
movq -0xc0(%rbp), %rdi
callq 0x65b0
movq %rax, %rdi
callq 0x9890
nopl (%rax,%rax)