// File: /workspace/github_c_makefile_star2_O3/UCLA-StarAI[P]TrimBN/src/fnf/compiler.c
// Function: fnf_to_sdd_manual
SddNode* fnf_to_sdd_manual(Fnf* fnf, SddManager* manager) {
  SddCompilerOptions* options = sdd_manager_options(manager);
  int verbose      = options->verbose;
  int period       = options->vtree_search_mode;
  BoolOp op        = fnf->op;
  SddSize count    = fnf->litset_count;
  LitSet** litsets = (LitSet**) malloc(count*sizeof(LitSet*));
  for (SddSize i=0; i<count; i++) litsets[i] = fnf->litsets + i;
  sort_litsets_by_lca(litsets,count,manager);

  if(verbose) { printf("\nclauses: %ld ",count); fflush(stdout); }
  SddNode* node = ONE(manager,op);
  for(int i=0; i<count; i++) {
    if(period > 0 && i > 0 && i%period==0) {
      // after every period clauses
      sdd_ref(node,manager);
      if(options->verbose) { printf("* "); fflush(stdout); }
      sdd_manager_minimize_limited(manager);
      sdd_deref(node,manager);
      sort_litsets_by_lca(litsets+i,count-i,manager);
    }

    SddNode* l = apply_litset(litsets[i],manager);
    node = sdd_apply(l,node,op,manager);
    if(verbose) { printf("%ld ",count-i-1); fflush(stdout); }
  }
  free(litsets);
  return node;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x6830
movl 0x50(%rax), %ecx
movl %ecx, 0x4(%rsp)
movq %rax, 0x10(%rsp)
movl 0x58(%rax), %eax
movl %eax, (%rsp)
movzwl 0x18(%r14), %ebp
movq 0x8(%r14), %r12
leaq (,%r12,8), %rdi
callq 0x21b0
movq %rax, %r15
testq %r12, %r12
je 0x295d
movq 0x10(%r14), %rax
leaq 0x1(%r12), %rcx
andq $-0x2, %rcx
leaq -0x1(%r12), %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x2080c(%rip), %xmm1    # 0x230f0
xorl %edx, %edx
movdqa 0x20812(%rip), %xmm2    # 0x23100
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x20812(%rip), %xmm4    # 0x23110
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x2934
movq %rax, (%r15,%rdx,8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x294c
leaq 0x30(%rax), %rsi
movq %rsi, 0x8(%r15,%rdx,8)
addq $0x2, %rdx
paddq %xmm4, %xmm1
addq $0x60, %rax
cmpq %rdx, %rcx
jne 0x28fe
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2c0f
cmpl $0x0, (%rsp)
je 0x2991
leaq 0x207a8(%rip), %rdi     # 0x23120
movq %r12, %rsi
xorl %eax, %eax
callq 0x20e0
movq 0x28637(%rip), %rax     # 0x2afc0
movq (%rax), %rdi
callq 0x21c0
movq %rbx, %rdi
testw %bp, %bp
je 0x29a0
callq 0x6590
jmp 0x29a5
callq 0x6580
movq %rax, %r13
testq %r12, %r12
movq %r15, 0x8(%rsp)
je 0x2a85
movzwl %bp, %ebp
xorl %r14d, %r14d
cmpl $0x0, 0x4(%rsp)
setle %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x2a2f
movl %r14d, %eax
xorl %edx, %edx
divl 0x4(%rsp)
testl %edx, %edx
jne 0x2a2f
movq %r13, %rdi
movq %rbx, %rsi
callq 0x99a0
movq 0x10(%rsp), %rax
cmpl $0x0, 0x58(%rax)
je 0x2a0e
leaq 0x20737(%rip), %rdi     # 0x2312f
xorl %eax, %eax
callq 0x20e0
movq 0x285ba(%rip), %rax     # 0x2afc0
movq (%rax), %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x68a0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9a90
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2c0f
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x27f9
movq %rax, %rdi
movq %r13, %rsi
movl %ebp, %edx
movq %rbx, %rcx
callq 0xba00
movq %rax, %r13
cmpl $0x0, (%rsp)
je 0x2a75
leaq -0x1(%r12), %rsi
leaq 0x206cb(%rip), %rdi     # 0x2312a
xorl %eax, %eax
callq 0x20e0
movq 0x28553(%rip), %rax     # 0x2afc0
movq (%rax), %rdi
callq 0x21c0
incq %r14
addq $0x8, %r15
decq %r12
jne 0x29bc
movq 0x8(%rsp), %rdi
callq 0x2030
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq