// File: jaxonwang[P]suffixtree/main.cc
// Function: main
int main(int argc, char *argv[]) {

  if (argc != 2) {
    std::cout << "Usage: a.out str" << std::endl;
    return -1;
  }

  std::string s1 = rand_str(stoi(argv[1]));

  auto t_start = steady_clock::now();
  SuffixTreeNaive st2{s1};
  st2.build();

  auto t_end = steady_clock::now();
  auto dur = duration<double>(t_end - t_start).count();
  cout << "Test: naive Execution time: " << dur << endl;

  t_start = steady_clock::now();
  SuffixTreeImpl st1{s1};
  st1.build();
  t_end = steady_clock::now();
  dur = duration<double>(t_end - t_start).count();
  cout << "Test: impl Execution time: " << dur << endl;

  std::cout << (st2 == st1) << std::endl;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x257d
movq 0xea72(%rip), %rdi      # 0x10fc8
leaq 0x7ab3(%rip), %rsi      # 0xa010
callq 0x2180
movq %rax, %rdi
movq 0xea3c(%rip), %rsi      # 0x10fa8
callq 0x21a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x28cf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x158(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x2290
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2210
jmp 0x25b5
xorl %eax, %eax
movl %eax, %esi
leaq -0x50(%rbp), %rdi
movl $0xa, %edx
callq 0x28f0
movl %eax, -0x15c(%rbp)
jmp 0x25cf
movl -0x15c(%rbp), %eax
movslq %eax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x2410
jmp 0x25e3
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x51(%rbp), %rdi
callq 0x21b0
callq 0x2200
movq %rax, -0x70(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2930
jmp 0x2610
leaq -0xb8(%rbp), %rdi
callq 0x2960
jmp 0x261e
callq 0x2200
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2b80
movq %rax, -0x168(%rbp)
jmp 0x2643
movq -0x168(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x2bd0
jmp 0x2666
leaq -0xd0(%rbp), %rdi
callq 0x2c10
movsd %xmm0, -0x170(%rbp)
jmp 0x267c
movsd -0x170(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq 0xe935(%rip), %rdi      # 0x10fc8
leaq 0x7987(%rip), %rsi      # 0xa021
callq 0x2180
movq %rax, -0x178(%rbp)
jmp 0x26a8
movq -0x178(%rbp), %rdi
movsd -0xc8(%rbp), %xmm0
callq 0x22c0
movq %rax, -0x180(%rbp)
jmp 0x26c5
movq -0x180(%rbp), %rdi
movq 0xe8d5(%rip), %rsi      # 0x10fa8
callq 0x21a0
jmp 0x26da
callq 0x2200
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2c30
jmp 0x2703
leaq -0x130(%rbp), %rdi
callq 0x2c70
jmp 0x2711
callq 0x2200
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2b80
movq %rax, -0x188(%rbp)
jmp 0x2744
movq -0x188(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x2bd0
jmp 0x2767
leaq -0x140(%rbp), %rdi
callq 0x2c10
movsd %xmm0, -0x190(%rbp)
jmp 0x277d
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq 0xe834(%rip), %rdi      # 0x10fc8
leaq 0x78a3(%rip), %rsi      # 0xa03e
callq 0x2180
movq %rax, -0x198(%rbp)
jmp 0x27a9
movq -0x198(%rbp), %rdi
movsd -0xc8(%rbp), %xmm0
callq 0x22c0
movq %rax, -0x1a0(%rbp)
jmp 0x27c6
movq -0x1a0(%rbp), %rdi
movq 0xe7d4(%rip), %rsi      # 0x10fa8
callq 0x21a0
jmp 0x27db
leaq -0xb8(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2dd0
movb %al, -0x1a1(%rbp)
jmp 0x27f6
movb -0x1a1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
movq 0xe7bf(%rip), %rdi      # 0x10fc8
callq 0x22a0
movq %rax, -0x1b0(%rbp)
jmp 0x2817
movq -0x1b0(%rbp), %rdi
movq 0xe783(%rip), %rsi      # 0x10fa8
callq 0x21a0
jmp 0x282c
movl $0x0, -0x4(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x2e00
leaq -0xb8(%rbp), %rdi
callq 0x2e20
leaq -0x30(%rbp), %rdi
callq 0x20e0
jmp 0x28cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2879
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x51(%rbp), %rdi
callq 0x21b0
jmp 0x28db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x28c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x28b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x2e00
leaq -0xb8(%rbp), %rdi
callq 0x2e20
leaq -0x30(%rbp), %rdi
callq 0x20e0
jmp 0x28db
movl -0x4(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)
nop