// File: riyadparvez[P]louvain-method/main_community.cpp
// Function: main
int
main(int argc, char **argv) {
  srand(time(NULL)+getpid());

  parse_args(argc, argv);
  time_t time_begin, time_end;
  time(&time_begin);
  if (verbose)
    display_time("Begin");

  Community c(filename, filename_w, type, -1, precision);
  if (filename_part!=NULL)
    c.init_partition(filename_part);
  Graph g;
  bool improvement=true;
  double mod=c.modularity(), new_mod;
  int level=0;

  do {
    if (verbose) {
      cerr << "level " << level << ":\n";
      display_time("  start computation");
      cerr << "  network size: " 
	   << c.g.nb_nodes << " nodes, " 
	   << c.g.nb_links << " links, "
	   << c.g.total_weight << " weight." << endl;
    }

    improvement = c.one_level();
    new_mod = c.modularity();
    if (++level==display_level)
      g.display();
    if (display_level==-1)
      c.display_partition();
    g = c.partition2graph_binary();
    c = Community(g, -1, precision);

    if (verbose)
      cerr << "  modularity increased from " << mod << " to " << new_mod << endl;

    mod=new_mod;
    if (verbose)
      display_time("  end computation");

    if (filename_part!=NULL && level==1) // do at least one more computation if partition is provided
      improvement=true;
  } while(improvement);

  time(&time_end);
  if (verbose) {
    display_time("End");
    cerr << "Total duration: " << (time_end-time_begin) << " sec." << endl;
  }
  if (write_community) {
    g.write_community(filename_comm);
  }
  cerr << new_mod << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2170
movq %rax, -0x3e0(%rbp)
callq 0x2280
movl %eax, %ecx
movq -0x3e0(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, %edi
callq 0x2180
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x132c0
leaq -0x18(%rbp), %rdi
callq 0x2170
testb $0x1, 0xcc94(%rip)      # 0x20204
je 0x1357e
leaq 0x20f2(%rip), %rdi      # 0x1566b
callq 0x134b0
movq 0xcc5b(%rip), %rsi      # 0x201e0
movq 0xcc5c(%rip), %rdx      # 0x201e8
movl 0xcc26(%rip), %ecx      # 0x201b8
movsd 0xcc26(%rip), %xmm0     # 0x201c0
leaq -0x130(%rbp), %rdi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x7da0
cmpq $0x0, 0xcc44(%rip)      # 0x201f8
je 0x135e4
movq 0xcc3b(%rip), %rsi      # 0x201f8
leaq -0x130(%rbp), %rdi
callq 0x8370
jmp 0x135cb
jmp 0x135e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x13aca
leaq -0x1b8(%rbp), %rdi
callq 0x2500
jmp 0x135f2
movb $0x1, -0x1b9(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x8980
movsd %xmm0, -0x3e8(%rbp)
jmp 0x1360f
movsd -0x3e8(%rbp), %xmm0
movsd %xmm0, -0x1c8(%rbp)
movl $0x0, -0x1d4(%rbp)
testb $0x1, 0xcbd4(%rip)      # 0x20204
je 0x13782
movq 0xc9b3(%rip), %rdi      # 0x1fff0
leaq 0x202d(%rip), %rsi      # 0x15671
callq 0x2190
movq %rax, -0x3f0(%rbp)
jmp 0x13652
movq -0x3f0(%rbp), %rdi
movl -0x1d4(%rbp), %esi
callq 0x22f0
movq %rax, -0x3f8(%rbp)
jmp 0x1366d
movq -0x3f8(%rbp), %rdi
leaq 0x1ffd(%rip), %rsi      # 0x15678
callq 0x2190
jmp 0x13682
leaq 0x1ff2(%rip), %rdi      # 0x1567b
callq 0x134b0
jmp 0x13690
movq 0xc959(%rip), %rdi      # 0x1fff0
leaq 0x1ff1(%rip), %rsi      # 0x1568f
callq 0x2190
movq %rax, -0x400(%rbp)
jmp 0x136ac
movq -0x400(%rbp), %rdi
movl -0xf8(%rbp), %esi
callq 0x2250
movq %rax, -0x408(%rbp)
jmp 0x136c7
movq -0x408(%rbp), %rdi
leaq 0x1fcb(%rip), %rsi      # 0x156a0
callq 0x2190
movq %rax, -0x410(%rbp)
jmp 0x136e3
movq -0x410(%rbp), %rdi
movq -0xf0(%rbp), %rsi
callq 0x2070
movq %rax, -0x418(%rbp)
jmp 0x136ff
movq -0x418(%rbp), %rdi
leaq 0x1f9c(%rip), %rsi      # 0x156a9
callq 0x2190
movq %rax, -0x420(%rbp)
jmp 0x1371b
movq -0x420(%rbp), %rdi
movsd -0xe8(%rbp), %xmm0
callq 0x2330
movq %rax, -0x428(%rbp)
jmp 0x13738
movq -0x428(%rbp), %rdi
leaq 0x1f6c(%rip), %rsi      # 0x156b2
callq 0x2190
movq %rax, -0x430(%rbp)
jmp 0x13754
movq -0x430(%rbp), %rdi
movq 0xc85e(%rip), %rsi      # 0x1ffc0
callq 0x21d0
jmp 0x13769
jmp 0x13782
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
jmp 0x13abe
leaq -0x130(%rbp), %rdi
callq 0x9920
movb %al, -0x431(%rbp)
jmp 0x13796
movb -0x431(%rbp), %al
andb $0x1, %al
movb %al, -0x1b9(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x8980
movsd %xmm0, -0x440(%rbp)
jmp 0x137ba
movsd -0x440(%rbp), %xmm0
movsd %xmm0, -0x1d0(%rbp)
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
cmpl 0xc9e9(%rip), %eax      # 0x201c8
jne 0x137f1
leaq -0x1b8(%rbp), %rdi
callq 0x2bc0
jmp 0x137ef
jmp 0x137f1
cmpl $-0x1, 0xc9d0(%rip)     # 0x201c8
jne 0x1380a
leaq -0x130(%rbp), %rdi
callq 0x8d70
jmp 0x13808
jmp 0x1380a
leaq -0x250(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x8f50
jmp 0x1381f
leaq -0x1b8(%rbp), %rdi
movq %rdi, -0x448(%rbp)
leaq -0x250(%rbp), %rsi
movq %rsi, -0x450(%rbp)
callq 0x9ea0
movq -0x450(%rbp), %rdi
callq 0x9f30
movq -0x448(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x13af0
jmp 0x13861
movsd 0xc957(%rip), %xmm0     # 0x201c0
leaq -0x360(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x80e0
jmp 0x13883
leaq -0x130(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x13bd0
leaq -0x360(%rbp), %rdi
callq 0x13cb0
leaq -0x3d8(%rbp), %rdi
callq 0x9f30
testb $0x1, 0xc94f(%rip)      # 0x20204
je 0x13967
movq 0xc72e(%rip), %rdi      # 0x1fff0
leaq 0x1df2(%rip), %rsi      # 0x156bb
callq 0x2190
movq %rax, -0x458(%rbp)
jmp 0x138d7
movq -0x458(%rbp), %rdi
movsd -0x1c8(%rbp), %xmm0
callq 0x2330
movq %rax, -0x460(%rbp)
jmp 0x138f4
movq -0x460(%rbp), %rdi
leaq 0x1dd6(%rip), %rsi      # 0x156d8
callq 0x2190
movq %rax, -0x468(%rbp)
jmp 0x13910
movq -0x468(%rbp), %rdi
movsd -0x1d0(%rbp), %xmm0
callq 0x2330
movq %rax, -0x470(%rbp)
jmp 0x1392d
movq -0x470(%rbp), %rdi
movq 0xc685(%rip), %rsi      # 0x1ffc0
callq 0x21d0
jmp 0x13942
jmp 0x13967
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0x3d8(%rbp), %rdi
callq 0x9f30
jmp 0x13abe
movsd -0x1d0(%rbp), %xmm0
movsd %xmm0, -0x1c8(%rbp)
testb $0x1, 0xc886(%rip)      # 0x20204
je 0x13990
leaq 0x1d56(%rip), %rdi      # 0x156dd
callq 0x134b0
jmp 0x1398e
jmp 0x13990
cmpq $0x0, 0xc860(%rip)      # 0x201f8
je 0x139aa
cmpl $0x1, -0x1d4(%rbp)
jne 0x139aa
movb $0x1, -0x1b9(%rbp)
jmp 0x139ac
testb $0x1, -0x1b9(%rbp)
jne 0x13629
leaq -0x20(%rbp), %rdi
callq 0x2170
testb $0x1, 0xc83b(%rip)      # 0x20204
je 0x13a48
leaq 0x1d1d(%rip), %rdi      # 0x156ef
callq 0x134b0
jmp 0x139d9
movq 0xc610(%rip), %rdi      # 0x1fff0
leaq 0x1d0c(%rip), %rsi      # 0x156f3
callq 0x2190
movq %rax, -0x478(%rbp)
jmp 0x139f5
movq -0x478(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rax
subq %rax, %rsi
callq 0x2310
movq %rax, -0x480(%rbp)
jmp 0x13a15
movq -0x480(%rbp), %rdi
leaq 0x1ce1(%rip), %rsi      # 0x15704
callq 0x2190
movq %rax, -0x488(%rbp)
jmp 0x13a31
movq -0x488(%rbp), %rdi
movq 0xc581(%rip), %rsi      # 0x1ffc0
callq 0x21d0
jmp 0x13a46
jmp 0x13a48
testb $0x1, 0xc7b6(%rip)      # 0x20205
je 0x13a68
movq 0xc798(%rip), %rsi      # 0x201f0
leaq -0x1b8(%rbp), %rdi
callq 0x2cb0
jmp 0x13a66
jmp 0x13a68
movsd -0x1d0(%rbp), %xmm0
movq 0xc579(%rip), %rdi      # 0x1fff0
callq 0x2330
movq %rax, -0x490(%rbp)
jmp 0x13a85
movq -0x490(%rbp), %rdi
movq 0xc52d(%rip), %rsi      # 0x1ffc0
callq 0x21d0
jmp 0x13a9a
leaq -0x1b8(%rbp), %rdi
callq 0x9f30
leaq -0x130(%rbp), %rdi
callq 0x13cb0
movl -0x4(%rbp), %eax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
leaq -0x1b8(%rbp), %rdi
callq 0x9f30
leaq -0x130(%rbp), %rdi
callq 0x13cb0
movq -0x138(%rbp), %rdi
callq 0x2300
nopw %cs:(%rax,%rax)
nopl (%rax)