// File: lionell[P]huffman-rle/main.cc
// Function: main
int main() {
  string text = read();

  string without = run(text, false);
  write(without, "out.txt");
  string with = run(text, true);
  write(with, "opt.txt");

  cout << without.length() << " chars w/o optimization" << endl;
  cout << with.length() << " chars with optimization" << endl;
  cout << setprecision(3) << 100. - (100. * with.length() / without.length()) << "% benefit";
  return 0;
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movl $0x0, 0x144(%rsp)
leaq 0x120(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x24c0
movq 0x78(%rsp), %rsi
leaq 0x100(%rsp), %rdi
xorl %edx, %edx
callq 0x3180
jmp 0x33aa
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x2330
movq 0x70(%rsp), %rdx
leaq 0x4c76(%rip), %rsi      # 0x803e
leaq 0xd0(%rsp), %rdi
callq 0x2270
jmp 0x33d7
leaq 0x100(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x32f0
jmp 0x33ee
leaq 0xd0(%rsp), %rdi
callq 0x20f0
leaq 0xcf(%rsp), %rdi
callq 0x21f0
leaq 0xa8(%rsp), %rdi
leaq 0x120(%rsp), %rsi
movl $0x1, %edx
callq 0x3180
jmp 0x3424
leaq 0x87(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x2330
movq 0x68(%rsp), %rdx
leaq 0x4c04(%rip), %rsi      # 0x8046
leaq 0x88(%rsp), %rdi
callq 0x2270
jmp 0x3451
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x32f0
jmp 0x3468
leaq 0x88(%rsp), %rdi
callq 0x20f0
leaq 0x87(%rsp), %rdi
callq 0x21f0
leaq 0x100(%rsp), %rdi
callq 0x22b0
movq %rax, %rsi
movq 0x8b37(%rip), %rdi      # 0xbfd0
callq 0x2060
movq %rax, 0x60(%rsp)
jmp 0x34a5
movq 0x60(%rsp), %rdi
leaq 0x4b9d(%rip), %rsi      # 0x804e
callq 0x21a0
movq %rax, 0x58(%rsp)
jmp 0x34bd
movq 0x58(%rsp), %rdi
movq 0x8af7(%rip), %rsi      # 0xbfc0
callq 0x21d0
jmp 0x34d0
leaq 0xa8(%rsp), %rdi
callq 0x22b0
movq %rax, %rsi
movq 0x8ae9(%rip), %rdi      # 0xbfd0
callq 0x2060
movq %rax, 0x50(%rsp)
jmp 0x34f3
movq 0x50(%rsp), %rdi
leaq 0x4b67(%rip), %rsi      # 0x8066
callq 0x21a0
movq %rax, 0x48(%rsp)
jmp 0x350b
movq 0x48(%rsp), %rdi
movq 0x8aa9(%rip), %rsi      # 0xbfc0
callq 0x21d0
jmp 0x351e
movl $0x3, %edi
callq 0x3ec0
movl %eax, 0x44(%rsp)
jmp 0x352e
movl 0x44(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x80(%rsp), %esi
movq 0x8a89(%rip), %rdi      # 0xbfd0
callq 0x22e0
movq %rax, 0x38(%rsp)
jmp 0x3553
leaq 0xa8(%rsp), %rdi
callq 0x22b0
movq %rax, %xmm0
movaps 0x4aa4(%rip), %xmm1     # 0x8010
movaps %xmm1, (%rsp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x4aa4(%rip), %xmm1     # 0x8020
movaps %xmm1, 0x10(%rsp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4a98(%rip), %xmm1     # 0x8030
movsd %xmm1, 0x28(%rsp)
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x22b0
movaps (%rsp), %xmm4
movaps 0x10(%rsp), %xmm3
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
movq 0x38(%rsp), %rdi
movq %rax, %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
callq 0x2350
movq %rax, 0x30(%rsp)
jmp 0x35fb
movq 0x30(%rsp), %rdi
leaq 0x4a78(%rip), %rsi      # 0x807f
callq 0x21a0
jmp 0x360e
movl $0x0, 0x144(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x20f0
leaq 0x100(%rsp), %rdi
callq 0x20f0
leaq 0x120(%rsp), %rdi
callq 0x20f0
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x3738
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x369f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x20f0
leaq 0xcf(%rsp), %rdi
callq 0x21f0
jmp 0x372b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x372b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x36fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x20f0
leaq 0x87(%rsp), %rdi
callq 0x21f0
jmp 0x371e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x20f0
leaq 0x100(%rsp), %rdi
callq 0x20f0
leaq 0x120(%rsp), %rdi
callq 0x20f0
movq 0xf8(%rsp), %rdi
callq 0x2320
nopw %cs:(%rax,%rax)
nopl (%rax)