// File: QiumingLu[P]conhash/sample.cc
// Function: main
int main() {
  ConHash conhash;
  Node n1("spanner", 12);
  Node n2("bigtable", 16);
  Node n3("mapreduce", 14);
  Node n4("chubby", 15);
  Node n5("gfs", 10);
  conhash.AddNode(n1);
  conhash.AddNode(n2);
  conhash.AddNode(n3);
  conhash.AddNode(n4);
  conhash.AddNode(n5);
  for (int i = 0; i < 20; ++i) {
    char buf[32];
    snprintf(buf, sizeof(buf), "megastore#%d", i);
    Node node;
    if (conhash.Lookup(buf, &node)) {
      std::cout << node.identify << std::endl;
    } else {
      std::cout << "No server" << std::endl;
    }
  }
  std::cout << "\n";
  conhash.RemoveNode(n3);
  for (int i = 0; i < 20; ++i) {
    char buf[32];
    snprintf(buf, sizeof(buf), "megastore#%d", i);
    Node node;
    if (conhash.Lookup(buf, &node)) {
      std::cout << node.identify << std::endl;
    } else {
      std::cout << "No server" << std::endl;
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movl $0x0, -0x4(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3360
leaq -0x81(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x2290
movq -0x2c8(%rbp), %rdx
leaq 0x3bc8(%rip), %rsi      # 0x6004
leaq -0x80(%rbp), %rdi
callq 0x2bd0
jmp 0x2447
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0xc, %edx
callq 0x2c80
jmp 0x245b
leaq -0x80(%rbp), %rdi
callq 0x20e0
leaq -0x81(%rbp), %rdi
callq 0x21e0
leaq -0xe1(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x2290
movq -0x2d0(%rbp), %rdx
leaq 0x3b7b(%rip), %rsi      # 0x600c
leaq -0xe0(%rbp), %rdi
callq 0x2bd0
jmp 0x249f
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl $0x10, %edx
callq 0x2c80
jmp 0x24b9
leaq -0xe0(%rbp), %rdi
callq 0x20e0
leaq -0xe1(%rbp), %rdi
callq 0x21e0
leaq -0x131(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x2290
movq -0x2d8(%rbp), %rdx
leaq 0x3b23(%rip), %rsi      # 0x6015
leaq -0x130(%rbp), %rdi
callq 0x2bd0
jmp 0x2500
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl $0xe, %edx
callq 0x2c80
jmp 0x251a
leaq -0x130(%rbp), %rdi
callq 0x20e0
leaq -0x131(%rbp), %rdi
callq 0x21e0
leaq -0x181(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x2290
movq -0x2e0(%rbp), %rdx
leaq 0x3acc(%rip), %rsi      # 0x601f
leaq -0x180(%rbp), %rdi
callq 0x2bd0
jmp 0x2561
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
movl $0xf, %edx
callq 0x2c80
jmp 0x257b
leaq -0x180(%rbp), %rdi
callq 0x20e0
leaq -0x181(%rbp), %rdi
callq 0x21e0
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x2290
movq -0x2e8(%rbp), %rdx
leaq 0x3a72(%rip), %rsi      # 0x6026
leaq -0x1d0(%rbp), %rdi
callq 0x2bd0
jmp 0x25c2
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
movl $0xa, %edx
callq 0x2c80
jmp 0x25dc
leaq -0x1d0(%rbp), %rdi
callq 0x20e0
leaq -0x1d1(%rbp), %rdi
callq 0x21e0
leaq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3380
jmp 0x2603
leaq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3380
jmp 0x2615
leaq -0x38(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3380
jmp 0x2627
leaq -0x38(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x3380
jmp 0x2639
leaq -0x38(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x3380
jmp 0x264b
movl $0x0, -0x1d8(%rbp)
cmpl $0x14, -0x1d8(%rbp)
jge 0x2956
movl -0x1d8(%rbp), %ecx
leaq 0x39bb(%rip), %rdx      # 0x602a
xorl %eax, %eax
leaq -0x200(%rbp), %rdi
movl $0x20, %esi
callq 0x2260
leaq -0x228(%rbp), %rdi
callq 0x2cc0
jmp 0x2690
leaq -0x249(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x2290
movq -0x2f0(%rbp), %rdx
leaq -0x248(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x2bd0
jmp 0x26bf
leaq -0x38(%rbp), %rdi
leaq -0x248(%rbp), %rsi
leaq -0x228(%rbp), %rdx
callq 0x3580
movb %al, -0x2f1(%rbp)
jmp 0x26de
leaq -0x248(%rbp), %rdi
callq 0x20e0
leaq -0x249(%rbp), %rdi
callq 0x21e0
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0x2705
jmp 0x28f2
movq 0x68cc(%rip), %rdi      # 0x8fd8
leaq -0x228(%rbp), %rsi
callq 0x2170
movq %rax, -0x300(%rbp)
jmp 0x2721
movq -0x300(%rbp), %rdi
movq 0x6899(%rip), %rsi      # 0x8fc8
callq 0x21c0
jmp 0x2736
jmp 0x2925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x276a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x20e0
leaq -0x81(%rbp), %rdi
callq 0x21e0
jmp 0x2bb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x27ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x20e0
leaq -0xe1(%rbp), %rdi
callq 0x21e0
jmp 0x2ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x27f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x20e0
leaq -0x131(%rbp), %rdi
callq 0x21e0
jmp 0x2b9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2833
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x20e0
leaq -0x181(%rbp), %rdi
callq 0x21e0
jmp 0x2b8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2876
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x20e0
leaq -0x1d1(%rbp), %rdi
callq 0x21e0
jmp 0x2b83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2b77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x28d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x20e0
leaq -0x249(%rbp), %rdi
callq 0x21e0
jmp 0x2945
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2945
movq 0x66df(%rip), %rdi      # 0x8fd8
leaq 0x3737(%rip), %rsi      # 0x6037
callq 0x2180
movq %rax, -0x308(%rbp)
jmp 0x290e
movq -0x308(%rbp), %rdi
movq 0x66ac(%rip), %rsi      # 0x8fc8
callq 0x21c0
jmp 0x2923
jmp 0x2925
leaq -0x228(%rbp), %rdi
callq 0x2cf0
movl -0x1d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
jmp 0x2655
leaq -0x228(%rbp), %rdi
callq 0x2cf0
jmp 0x2b77
movq 0x667b(%rip), %rdi      # 0x8fd8
leaq 0x36dd(%rip), %rsi      # 0x6041
callq 0x2180
jmp 0x296b
leaq -0x38(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3520
jmp 0x297d
movl $0x0, -0x250(%rbp)
cmpl $0x14, -0x250(%rbp)
jge 0x2b22
movl -0x250(%rbp), %ecx
leaq 0x3689(%rip), %rdx      # 0x602a
xorl %eax, %eax
leaq -0x270(%rbp), %rdi
movl $0x20, %esi
callq 0x2260
leaq -0x298(%rbp), %rdi
callq 0x2cc0
jmp 0x29c2
leaq -0x2b9(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x2290
movq -0x310(%rbp), %rdx
leaq -0x2b8(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x2bd0
jmp 0x29f1
leaq -0x38(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
leaq -0x298(%rbp), %rdx
callq 0x3580
movb %al, -0x311(%rbp)
jmp 0x2a10
leaq -0x2b8(%rbp), %rdi
callq 0x20e0
leaq -0x2b9(%rbp), %rdi
callq 0x21e0
movb -0x311(%rbp), %al
testb $0x1, %al
jne 0x2a37
jmp 0x2ac1
movq 0x659a(%rip), %rdi      # 0x8fd8
leaq -0x298(%rbp), %rsi
callq 0x2170
movq %rax, -0x320(%rbp)
jmp 0x2a53
movq -0x320(%rbp), %rdi
movq 0x6567(%rip), %rsi      # 0x8fc8
callq 0x21c0
jmp 0x2a68
jmp 0x2af4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2a9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x20e0
leaq -0x2b9(%rbp), %rdi
callq 0x21e0
jmp 0x2b14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x2b14
movq 0x6510(%rip), %rdi      # 0x8fd8
leaq 0x3568(%rip), %rsi      # 0x6037
callq 0x2180
movq %rax, -0x328(%rbp)
jmp 0x2add
movq -0x328(%rbp), %rdi
movq 0x64dd(%rip), %rsi      # 0x8fc8
callq 0x21c0
jmp 0x2af2
jmp 0x2af4
leaq -0x298(%rbp), %rdi
callq 0x2cf0
movl -0x250(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x250(%rbp)
jmp 0x2987
leaq -0x298(%rbp), %rdi
callq 0x2cf0
jmp 0x2b77
movl $0x0, -0x4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2cf0
leaq -0x160(%rbp), %rdi
callq 0x2cf0
leaq -0x110(%rbp), %rdi
callq 0x2cf0
leaq -0xc0(%rbp), %rdi
callq 0x2cf0
leaq -0x60(%rbp), %rdi
callq 0x2cf0
leaq -0x38(%rbp), %rdi
callq 0x2d10
movl -0x4(%rbp), %eax
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x1b0(%rbp), %rdi
callq 0x2cf0
leaq -0x160(%rbp), %rdi
callq 0x2cf0
leaq -0x110(%rbp), %rdi
callq 0x2cf0
leaq -0xc0(%rbp), %rdi
callq 0x2cf0
leaq -0x60(%rbp), %rdi
callq 0x2cf0
leaq -0x38(%rbp), %rdi
callq 0x2d10
movq -0x90(%rbp), %rdi
callq 0x2280
nopw %cs:(%rax,%rax)
nop