// File: /workspace/github_cpp_makefile_star2_O2/blackle[P]LZMA-Vizualizer/LzmaSpec.cpp
// Function: main
int main(int argc, char** argv)
{
  int r = parse_args(argc, argv);
  if (r >= 0) return r;

  CInputStream inStream;
  inStream.File = fopen(options.infile.c_str(), "rb");
  if (inStream.File == 0)
    throw "Can't open input file";
  inStream.Init();

  CLzmaDecoder lzmaDecoder;

  Byte header[13];
  int i;
  for (i = 0; i < 13; i++)
    header[i] = inStream.ReadByte();

  lzmaDecoder.DecodeProperties(header);

  UInt64 unpackSize = 0;
  bool unpackSizeDefined = false;
  for (i = 0; i < 8; i++)
  {
    Byte b = header[5 + i];
    if (b != 0xFF)
      unpackSizeDefined = true;
    unpackSize |= (UInt64)b << (8 * i);
  }

  lzmaDecoder.markerIsMandatory = !unpackSizeDefined;

  lzmaDecoder.RangeDec.InStream = &inStream;

  lzmaDecoder.Create();

  int res = lzmaDecoder.Decode(unpackSizeDefined, unpackSize);

  if (res == LZMA_RES_ERROR)
    throw "LZMA decoding error";

  if (lzmaDecoder.RangeDec.Corrupted)
  {
    std::cerr << "Warning: LZMA stream is corrupted" << std::endl;
  }

  double maxPerplexity = *std::max_element(lzmaDecoder.Perplexities.begin(), lzmaDecoder.Perplexities.end());

  if (!options.kkpout.empty()) {
    return output_kkp(lzmaDecoder, maxPerplexity);
  } else if (options.pretty) {
    return output_console(lzmaDecoder, maxPerplexity);
  } else {
    return output_raw(lzmaDecoder, maxPerplexity);
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xfd8, %rsp            # imm = 0xFD8
movq %rsi, %rbx
movl %edi, %r14d
pushq $0x1
popq %r15
movl %r15d, %edi
callq 0x2230
testl %eax, %eax
setne 0x666f(%rip)            # 0x91a8
leaq 0x6628(%rip), %r12      # 0x9168
andw $0x0, 0x6661(%rip)      # 0x91a9
leaq 0x6639(%rip), %rdi      # 0x9188
leaq 0x3688(%rip), %r13      # 0x61de
movq %r13, %rsi
callq 0x2260
movq %r12, %rdi
movq %r13, %rsi
callq 0x2260
cmpl $0x2, %r14d
jge 0x2b7c
movq %rbx, %rdi
callq 0x33bb
jmp 0x2f1b
leal -0x1(%r14), %eax
movl %eax, -0x2c(%rbp)
cmpl %r14d, %r15d
jge 0x2c64
movslq %r15d, %r12
movq (%rbx,%r12,8), %r13
movq %r13, %rdi
leaq 0x3583(%rip), %rsi      # 0x6120
callq 0x21c0
testl %eax, %eax
je 0x2c23
movq %r13, %rdi
leaq 0x3576(%rip), %rsi      # 0x6126
callq 0x21c0
testl %eax, %eax
je 0x2c35
movq %r13, %rdi
leaq 0x3569(%rip), %rsi      # 0x612c
callq 0x21c0
testl %eax, %eax
je 0x2c2c
movq %r13, %rdi
leaq 0x355d(%rip), %rsi      # 0x6133
callq 0x21c0
testl %eax, %eax
je 0x2c2c
movq %r13, %rdi
leaq 0x3555(%rip), %rsi      # 0x613e
callq 0x21c0
testl %eax, %eax
je 0x2f66
movq %r13, %rdi
leaq 0x3545(%rip), %rsi      # 0x6145
callq 0x21c0
testl %eax, %eax
je 0x2c3e
cmpq $0x0, 0x655f(%rip)      # 0x9170
jne 0x2fcc
leaq 0x654a(%rip), %rdi      # 0x9168
movq %r13, %rsi
jmp 0x2c57
movb $0x0, 0x657e(%rip)      # 0x91a8
jmp 0x2c5c
movb $0x1, 0x6577(%rip)      # 0x91aa
jmp 0x2c5c
movb $0x1, 0x656d(%rip)      # 0x91a9
jmp 0x2c5c
cmpl -0x2c(%rbp), %r15d
je 0x32e2
incl %r15d
movq 0x8(%rbx,%r12,8), %rsi
leaq 0x6531(%rip), %rdi      # 0x9188
callq 0x2260
incl %r15d
jmp 0x2b83
cmpq $0x0, 0x6504(%rip)      # 0x9170
je 0x2ef5
movq 0x64ef(%rip), %rdi      # 0x9168
leaq 0x3420(%rip), %rsi      # 0x60a0
callq 0x2180
movq %rax, -0xa0(%rbp)
testq %rax, %rax
je 0x32fd
leaq -0xa0(%rbp), %r14
andq $0x0, 0x8(%r14)
andq $0x0, -0xfe0(%rbp)
andq $0x0, -0xf88(%rbp)
andl $0x0, -0xf80(%rbp)
andq $0x0, -0xf78(%rbp)
andq $0x0, -0xf58(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xfc8(%rbp)
movups %xmm0, -0xfb8(%rbp)
movups %xmm0, -0xfa8(%rbp)
movups %xmm0, -0xf9c(%rbp)
xorl %ebx, %ebx
cmpq $0xd, %rbx
je 0x2d00
movq %r14, %rdi
callq 0x3400
movb %al, -0x6d(%rbp,%rbx)
incq %rbx
jmp 0x2ce9
leaq -0xff8(%rbp), %rdi
leaq -0x6d(%rbp), %rsi
callq 0x38de
leaq -0x68(%rbp), %rax
xorl %ecx, %ecx
pushq $0x1
popq %rbx
xorl %r15d, %r15d
xorl %edx, %edx
movzbl %dl, %r12d
cmpq $0x40, %rcx
je 0x2d48
movzbl (%rax), %edx
cmpq $0xff, %rdx
cmovnel %ebx, %r12d
shlq %cl, %rdx
orq %rdx, %r15
addq $0x8, %rcx
incq %rax
movl %r12d, %edx
jmp 0x2d1e
notb %dl
andb $0x1, %dl
leaq -0xff8(%rbp), %rdi
movb %dl, 0x88(%rdi)
movq %r14, 0x8(%rdi)
callq 0x3978
andl $0x1, %r12d
leaq -0xff8(%rbp), %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x268e
testl %eax, %eax
je 0x3320
cmpb $0x1, -0xfe8(%rbp)
jne 0x2da5
movq 0x625f(%rip), %rdi      # 0x8ff0
leaq 0x3335(%rip), %rsi      # 0x60cd
callq 0x2130
movq %rax, %rdi
callq 0x2090
movq -0xfb0(%rbp), %rdi
movq -0xfa8(%rbp), %rsi
callq 0x3fb2
cmpq $0x0, 0x63d0(%rip)      # 0x9190
je 0x2f30
movq 0x63bb(%rip), %rdi      # 0x9188
leaq 0x345d(%rip), %rsi      # 0x6231
callq 0x2180
testq %rax, %rax
je 0x32c2
movq %rax, %r14
movl -0xfc0(%rbp), %eax
leaq -0xe0(%rbp), %rbx
andl $0x0, (%rbx)
subl -0xfc8(%rbp), %eax
leaq -0xc0(%rbp), %r12
movl %eax, (%r12)
leaq 0x3427(%rip), %rdi      # 0x6234
pushq $0x1
popq %r15
pushq $0x4
popq %r13
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x2270
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
xorl %r13d, %r13d
pushq $0x2
popq %r12
movq -0xfc8(%rbp), %rax
movq -0xfc0(%rbp), %rcx
subq %rax, %rcx
cmpq %rcx, %r13
jae 0x2f23
movsbl (%rax,%r13), %edi
movq %r14, %rsi
callq 0x2190
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
movq -0xfb0(%rbp), %rax
movss (%rax,%r13,4), %xmm0
mulss 0x3162(%rip), %xmm0     # 0x600c
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
pushq $0x8
popq %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2270
incq %r13
jmp 0x2e5d
movq (%rbx), %rsi
movq 0x60f1(%rip), %rdi      # 0x8ff0
callq 0x2130
leaq 0x32b1(%rip), %rsi      # 0x61bc
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2090
pushq $0x1
popq %rbx
jmp 0x32ce
movq %r14, %rdi
callq 0x2140
jmp 0x32c0
cvtss2sd (%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
cmpb $0x1, 0x6268(%rip)      # 0x91a8
jne 0x2f75
leaq -0x60(%rbp), %rdi
callq 0x3fe2
cmpb $0x1, 0x6257(%rip)      # 0x91a9
jne 0x301f
leaq -0x60(%rbp), %rdi
callq 0x4014
jmp 0x3028
movq %rbx, %rdi
callq 0x33bb
xorl %ebx, %ebx
jmp 0x32ce
xorl %r14d, %r14d
movq 0x6051(%rip), %rbx      # 0x8fd0
movq -0xfc0(%rbp), %rax
subq -0xfc8(%rbp), %rax
cmpq %r14, %rax
jbe 0x2fb9
movq -0xfb0(%rbp), %rax
cvtss2sd (%rax,%r14,4), %xmm0
divsd -0x48(%rbp), %xmm0
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2090
incq %r14
jmp 0x2f7f
xorl %ebx, %ebx
movq 0x600e(%rip), %rdi      # 0x8fd0
callq 0x2090
jmp 0x32c2
movq (%rbx), %rsi
movq 0x601a(%rip), %rdi      # 0x8ff0
callq 0x2130
leaq 0x3195(%rip), %rsi      # 0x6177
movq %rax, %rdi
callq 0x2130
leaq 0x6177(%rip), %rsi      # 0x9168
movq %rax, %rdi
callq 0x2120
leaq 0x31a7(%rip), %rsi      # 0x61a7
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
movq %r13, %rsi
callq 0x2130
leaq 0x319f(%rip), %rsi      # 0x61b9
jmp 0x2f0b
leaq -0x60(%rbp), %rdi
callq 0x40a8
movss 0x2fd8(%rip), %xmm0     # 0x6008
xorps %xmm1, %xmm1
movss %xmm1, -0x30(%rbp)
xorl %r14d, %r14d
leaq -0x90(%rbp), %r15
leaq -0x60(%rbp), %r12
movss %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
movq -0xfc0(%rbp), %rax
subq -0xfc8(%rbp), %rax
cmpq %r14, %rax
jbe 0x32ab
testw $0x3ff, %r14w           # imm = 0x3FF
jne 0x309f
movq %r15, %rdi
movq %r12, %rsi
pushq $0x40
popq %rdx
callq 0x412a
movq 0x5f49(%rip), %rdi      # 0x8fd0
movq %r15, %rsi
callq 0x2120
movq %rax, %rdi
callq 0x2090
movq %r15, %rdi
callq 0x2080
leaq -0xf98(%rbp), %rdi
movq %r14, %rsi
callq 0x423e
movq %rdx, %r13
movq -0xfb0(%rbp), %rcx
cvtss2sd (%rcx,%r14,4), %xmm0
divsd -0x48(%rbp), %xmm0
andq (%rax), %r13
ucomisd 0x2f4a(%rip), %xmm0     # 0x6018
jb 0x30d6
sqrtsd %xmm0, %xmm0
jmp 0x30db
callq 0x2100
xorps %xmm1, %xmm1
testq %r13, %r13
je 0x30eb
movss 0x2f1d(%rip), %xmm1     # 0x6008
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x2c(%rbp)
cmpb $0x0, 0x60af(%rip)      # 0x91aa
jne 0x3102
movss -0x2c(%rbp), %xmm1
movss %xmm1, -0x3c(%rbp)
movq -0xfc8(%rbp), %rax
movsbl (%rax,%r14), %r13d
movl %r13d, %edi
callq 0x2250
testl %eax, %eax
pushq $0x2e
popq %rax
cmovel %eax, %r13d
movq %r15, %rdi
movq %r12, %rsi
movss -0x3c(%rbp), %xmm0
callq 0x4260
movq 0x5e95(%rip), %rdi      # 0x8fd0
movq %r15, %rsi
callq 0x2120
movsbl %r13b, %esi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x4373
movl %r14d, %r13d
andl $0x3f, %r13d
movss -0x34(%rbp), %xmm0
movss -0x2c(%rbp), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movaps %xmm1, %xmm0
maxss -0x30(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
minss -0x38(%rbp), %xmm1
movss %xmm1, -0x2c(%rbp)
movq %r15, %rdi
callq 0x2080
cmpl $0x3f, %r13d
jne 0x328f
movq 0x5e2f(%rip), %rdi      # 0x8fd0
leaq 0x3035(%rip), %rsi      # 0x61dd
callq 0x2130
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
movss -0x2c(%rbp), %xmm0
callq 0x4260
movq %r13, %rdi
movq %r15, %rsi
callq 0x2120
movq %rax, %rdi
leaq 0x3008(%rip), %rsi      # 0x61dd
callq 0x2130
movq %rax, %r13
movss -0x34(%rbp), %xmm0
mulss 0x2e26(%rip), %xmm0     # 0x6010
leaq -0xe0(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2120
movq %rax, %rdi
leaq 0x2fcc(%rip), %rsi      # 0x61dd
callq 0x2130
movq %rax, %r13
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movss -0x30(%rbp), %xmm0
callq 0x4260
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2120
movq %rax, %rdi
leaq 0x2f98(%rip), %rsi      # 0x61dd
callq 0x2130
movq %rax, %rdi
callq 0x4373
movq %rax, %rdi
callq 0x2090
leaq -0xc0(%rbp), %rdi
callq 0x2080
leaq -0xe0(%rbp), %rdi
callq 0x2080
movq %r15, %rdi
callq 0x2080
xorps %xmm1, %xmm1
movss 0x2d83(%rip), %xmm2     # 0x6008
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
jmp 0x3299
movss -0x30(%rbp), %xmm1
movss -0x2c(%rbp), %xmm2
incq %r14
movss %xmm1, -0x30(%rbp)
movss %xmm2, -0x38(%rbp)
jmp 0x3053
movq 0x5d1e(%rip), %rdi      # 0x8fd0
callq 0x2090
leaq -0x60(%rbp), %rdi
callq 0x4392
xorl %ebx, %ebx
leaq -0xff8(%rbp), %rdi
callq 0x399e
movl %ebx, %eax
addq $0xfd8, %rsp            # imm = 0xFD8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rsi
movq 0x5d04(%rip), %rdi      # 0x8ff0
callq 0x2130
leaq 0x2e53(%rip), %rsi      # 0x614b
jmp 0x2f0b
pushq $0x8
popq %rdi
callq 0x20a0
leaq 0x2d97(%rip), %rcx      # 0x60a3
movq %rcx, (%rax)
movq 0x5caa(%rip), %rsi      # 0x8fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2210
pushq $0x8
popq %rdi
callq 0x20a0
leaq 0x2d8a(%rip), %rcx      # 0x60b9
movq %rcx, (%rax)
movq 0x5c87(%rip), %rsi      # 0x8fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2210
jmp 0x335f
jmp 0x335f
jmp 0x33a4
jmp 0x33a4
jmp 0x33a4
jmp 0x33a4
jmp 0x335f
jmp 0x335f
jmp 0x335f
jmp 0x338a
jmp 0x3364
jmp 0x33a4
jmp 0x338a
jmp 0x335f
movq %rax, %rbx
jmp 0x3399
movq %rax, %rbx
jmp 0x337a
jmp 0x338a
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x2080
leaq -0xe0(%rbp), %rdi
callq 0x2080
jmp 0x338d
jmp 0x33a4
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2080
leaq -0x60(%rbp), %rdi
callq 0x4392
jmp 0x33a7
movq %rax, %rbx
leaq -0xff8(%rbp), %rdi
callq 0x399e
movq %rbx, %rdi
callq 0x2240