// File: /workspace/github_cpp_makefile_star2_O3/cegme[P]vose/VoseTree.cc
// Function: VoseTree::merge_bags()
Vose VoseTree::merge_bags() {
  Vose v;
  size_t i = 0;
  for(; i != nodes.size(); ++i) {
    if (!nodes[i].isBag) break;
    v = v.merge(nodes[i].bag);
  }
  nodes.erase(nodes.begin(), nodes.begin()+i-1); // -1 because we have to replace it
  nodes[0] = vosetreenode(v);
  
  branches.erase(branches.begin(), branches.begin()+i-1);
  branches[0] = v.weight();
  v.init();
  return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rsi, %r14
xorl %ebx, %ebx
movl $0x90, %edx
movq %rdi, -0x30(%rbp)
xorl %esi, %esi
callq 0x2100
movq 0x38(%r14), %rdx
cmpq %rdx, 0x40(%r14)
je 0x2fda
movl $0x38, %r15d
xorl %ebx, %ebx
leaq -0xf8(%rbp), %r13
movq -0x30(%rbp), %r12
cmpb $0x1, -0x38(%rdx,%r15)
jne 0x2fda
addq %r15, %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x70b8
movq %r12, %rdi
movq %r13, %rsi
callq 0x414a
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x2f57
callq 0x21c0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x2f68
callq 0x21c0
leaq -0xb8(%rbp), %rdi
callq 0x46c4
movq -0xc8(%rbp), %rax
testq %rax, %rax
je 0x2f91
leaq -0xd8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xe8(%rbp), %rax
testq %rax, %rax
je 0x2faa
movq %r13, %rdi
movq %r13, %rsi
movl $0x3, %edx
callq *%rax
incq %rbx
movq 0x38(%r14), %rdx
movq 0x40(%r14), %rax
subq %rdx, %rax
sarq $0x3, %rax
movabsq $-0x70a3d70a3d70a3d7, %rcx # imm = 0x8F5C28F5C28F5C29
imulq %rcx, %rax
addq $0xc8, %r15
cmpq %rax, %rbx
jne 0x2f24
leaq 0x38(%r14), %r15
imulq $0xc8, %rbx, %rax
addq %rdx, %rax
addq $-0xc8, %rax
movq %r15, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x5b16
leaq -0x188(%rbp), %rdi
movq -0x30(%rbp), %r13
movq %r13, %rsi
callq 0x3f36
leaq -0xf8(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x400c
movq (%r15), %r12
leaq -0xe8(%rbp), %r15
movb -0x10(%r15), %al
movb %al, (%r12)
movq -0x8(%r15), %rax
movq %rax, 0x8(%r12)
leaq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x2220
movq 0x20(%r15), %rax
movq %rax, 0x30(%r12)
addq $0x38, %r12
leaq -0xc0(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x414a
movq 0x78(%r15), %rdi
testq %rdi, %rdi
je 0x3077
callq 0x21c0
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3085
callq 0x21c0
leaq -0x80(%rbp), %r12
movq %r12, %rdi
callq 0x46c4
movq -0x10(%r12), %rax
testq %rax, %rax
je 0x30ac
leaq -0xa0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x30c5
movq %r15, %rdi
movq %r15, %rsi
movl $0x3, %edx
callq *%rax
leaq -0xd8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30da
callq 0x21c0
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x30eb
callq 0x21c0
movq -0x128(%rbp), %rdi
testq %rdi, %rdi
je 0x30fc
callq 0x21c0
leaq -0x148(%rbp), %r15
movq %r15, %rdi
callq 0x46c4
movq -0x10(%r15), %rax
testq %rax, %rax
je 0x3125
leaq -0x168(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x178(%rbp), %rax
testq %rax, %rax
je 0x3142
leaq -0x188(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x20(%r14), %r15
leaq (%r15,%rbx,8), %r12
addq $-0x8, %r12
cmpq %r12, %r15
je 0x3185
movq 0x28(%r14), %rdx
subq %r12, %rdx
je 0x3170
movq %r15, %rdi
movq %r12, %rsi
callq 0x2270
movq 0x28(%r14), %rax
movq %rax, %rcx
jmp 0x3176
movq %r12, %rax
movq %r12, %rcx
subq %r12, %rax
addq %rax, %r15
cmpq %r15, %rcx
je 0x3185
movq %r15, 0x28(%r14)
movq 0x58(%r13), %rax
movq 0x20(%r14), %rcx
movq %rax, (%rcx)
movq %r13, %rdi
callq 0x6984
movq %r13, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x31ce
jmp 0x31ce
jmp 0x31ce
jmp 0x31ce
jmp 0x31d6
movq %rax, %r14
leaq -0x188(%rbp), %rdi
callq 0x405e
jmp 0x31d9
jmp 0x31d6
jmp 0x31d6
jmp 0x31ce
movq %rax, %rdi
callq 0x4411
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x405e
movq %r14, %rdi
callq 0x22b0