// File: /workspace/github_cpp_makefile_star2_O1/biotomas[P]ipasir/app/ipasir-check-satunsat/ipasir-check-satunsat.cc
// Function: main
int main(int argc, char* argv[])
{
  std::cout << "Norbert Manthey -- IPASIR iterative satunsat checker" << std::endl;
  std::cout << "  add formula that has sub formulas of blocks" << std::endl
            << "  use almost full stack of assumptions, except last variable for each block" << std::endl
            << "  and modify last polarities per call" << std::endl;
  if(argc < 3) {
    std::cout << "usage: " << argv[0] << " X Y Z ... with 2 < X < 2^30, 1 < Y < 10, 1 < Z" << std::endl;
    return 1;
  }
  
  int X = atoi(argv[1]);
  int Y = atoi(argv[2]);
  int Z = atoi(argv[3]);
  
  if(X<3) {
    std::cout << "error: given first number " << X << " is not in limits" << std::endl;
    return 1;
  }
  
  if(Y<1 || Y>9) {
    std::cout << "error: given second number " << Y << " is not in limits" << std::endl;
    return 1;
  }
  
  if(Z < 2)  {
    std::cout << "error: given third number " << Z << " is not in limits" << std::endl;
    return 1;
  }

  SATSolver solver;
  
  const int periodsize = (1 << Y);
  vector<int> clause(Y,0);
  int index = 0;
  int clauses = 0;
  int maxvar = 0;
  for(int i = 1 ; i < periodsize; ++i) {
    index = i;
    int sum = 0;
    for(int j = 0 ; j < Y; ++j) {
      clause[j] = ((index & 1) == 0) ? j+1 : -j-1;
      sum += clause[j] > 0 ? 1 : -1;
      index = index >> 1;
    }
    assert(sum < (int)clause.size() && "clause with positive literals only should not be created");
    
    for(int j = 0; j < Z; ++ j) {
      if(j>0) {
	for(int k=0; k < Y; ++k) {
	  clause[k] = clause[k] > 0 ? clause[k] + Y : clause[k] - Y;
	  maxvar = maxvar > clause[k] ? maxvar : clause[k];
	}
      }
      solver.addClause(clause);
      clauses ++;
    }
  }
  
  std::cout << "created formula with " << clauses << " clauses, and maxvar " << maxvar << std::endl;
  
  vector<int> assumptions;
  std::vector<int> model;
  std::vector<int> conflict;
  
  for(int i = 1 ; i <= maxvar; ++i) 
  {
    // do not add last variable per block
    if((i % periodsize) != 0 ) assumptions.push_back(-i);
  }

  // create a map with pointers to the assumption vector
  int *map[maxvar + 1];
  int fakeentry = 0;
  int pointat = 0;
  for(int i = 1; i <= maxvar; ++i)
  {
    if((i % periodsize) != 0 ) {
      map[i] = &(assumptions[pointat]);
      pointat++;
    } else {
      map[i] = &fakeentry;
    }
  }

  int ret = solver.solve(assumptions, model, conflict);
  std::cout << "initial call returned with " << ret << std::endl;
  if(ret != 10)
  {
    std::cout << "error: first call did not result in model, but " << ret << ", abort" << std::endl;
    return 1;
  }
  
  double runtime = cpuTime();
  int call = 0, satresults = 0, unsatresults = 0;
  for(int i = 2; i <= X; ++ i)
  {
    // modify last bits of assumptions
    int mask = call;
    int index = 1;
    bool expectUNSAT = false;
    while(mask > 0 && index <= maxvar) {
      if((mask & 1)==1) {
        *(map[maxvar - index]) = -(*(map[maxvar - index]));
        if(map[maxvar - index] != &fakeentry && !expectUNSAT) {
          expectUNSAT = true;
        }
      }
      mask = mask >> 1;
      index ++;
    }
    conflict.clear();
    int ret = solver.solve(assumptions, model, conflict);
    call ++;
    if(i % 256 == 0) std::cout << "  after " << i << " calls: " << (double)X / (cpuTime()-runtime) << " calls per second" << std::endl;
    if (ret==20) {
      ++ unsatresults;
      solver.addClause(conflict);
    } else {
      ++ satresults;
    }

    if(expectUNSAT && ret != 20 && call!=1) {
      std::cout << "error: in call " << call << ", did not detect conflict (but " << ret << ") on unsatisfiable input, abort" << std::endl;
      std::cout << "used assumptions: " << assumptions << std::endl;
      return 1;
    } else if (!expectUNSAT && ret != 10) {
      std::cout << "error: in call " << call << ", did not detect model (but " << ret << ") on satisfiable input, abort" << std::endl;
      std::cout << "used assumptions: " << assumptions << std::endl;
      return 1;
    }

    // modify last bits of assumptions back to negative
    mask = call;
    index = 1;
    while(mask > 0 && index <= maxvar) {
      if(*(map[maxvar - index]) > 0) {
        *(map[maxvar - index]) = -(*(map[maxvar - index]));
      }
      mask = mask >> 1;
      index ++;
    }
  }
  runtime = cpuTime() - runtime;
  std::cout << "performed " << (double)X / runtime << " calls per second, " 
            << satresults << " SAT, " << unsatresults << " UNSAT"
            << std::endl;
  
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %rbx
movl %edi, %r14d
movq 0x167ab(%rip), %r15     # 0x18fc8
leaq 0xf7ec(%rip), %rsi      # 0x12010
movl $0x34, %edx
movq %r15, %rdi
callq 0x21b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0xf7e6(%rip), %rsi      # 0x12045
movl $0x2d, %edx
movq %r15, %rdi
callq 0x21b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq %rax, %r15
leaq 0xf7d6(%rip), %rsi      # 0x12073
movl $0x4b, %edx
movq %rax, %rdi
callq 0x21b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq %rax, %r15
leaq 0xf7e4(%rip), %rsi      # 0x120bf
movl $0x25, %edx
movq %rax, %rdi
callq 0x21b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
cmpl $0x2, %r14d
jg 0x295b
movq 0x166ac(%rip), %r14     # 0x18fc8
leaq 0xf7c2(%rip), %rsi      # 0x120e5
movl $0x7, %edx
movq %r14, %rdi
callq 0x21b0
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x29d9
movq %rbx, %rdi
callq 0x2080
movq 0x1667d(%rip), %rdi     # 0x18fc8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21b0
jmp 0x29f1
movq 0x8(%rbx), %rdi
callq 0x2250
movl %eax, %r12d
movq 0x10(%rbx), %rdi
callq 0x2250
movl %eax, %r14d
movq 0x18(%rbx), %rdi
callq 0x2250
cmpl $0x2, %r12d
jg 0x29a8
movq 0x1663f(%rip), %rbx     # 0x18fc8
leaq 0xf78d(%rip), %rsi      # 0x1211d
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x21b0
movq %rbx, %rdi
movl %r12d, %esi
jmp 0x2a46
movl %eax, %ebx
movl %r14d, %r15d
leal -0xa(%r15), %eax
cmpl $-0xa, %eax
ja 0x2a21
movq 0x1660b(%rip), %rbx     # 0x18fc8
leaq 0xf786(%rip), %rsi      # 0x1214a
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x21b0
movq %rbx, %rdi
movl %r15d, %esi
jmp 0x2a46
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2290
leaq 0xf6f5(%rip), %rsi      # 0x120ed
movl $0x2f, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
jmp 0x2a7c
cmpl $0x1, %ebx
jg 0x2aa1
movq 0x1659b(%rip), %r14     # 0x18fc8
leaq 0xf732(%rip), %rsi      # 0x12166
movl $0x1a, %edx
movq %r14, %rdi
callq 0x21b0
movq %r14, %rdi
movl %ebx, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0xf6e3(%rip), %rsi      # 0x12138
movl $0x11, %edx
movq %rax, %rdi
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x1, %r14d
movl %r14d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xb8(%rbp), %rdi
callq 0x34e4
movl $0x1, %eax
movl %r15d, %ecx
shll %cl, %eax
movq %rax, -0x30(%rbp)
leaq -0x198(%rbp), %rdx
movl $0x0, (%rdx)
leaq -0xd0(%rbp), %rdi
leaq -0x50(%rbp), %rcx
movq %r15, %rsi
callq 0x35bc
movl %r12d, -0x70(%rbp)
testq %r15, %r15
je 0x2bd3
movl %r15d, %r13d
negl %r13d
movq -0x30(%rbp), %rax
cmpl $0x3, %eax
movl $0x2, %ecx
cmovael %eax, %ecx
movq %rcx, -0x60(%rbp)
leal -0x1(%rcx), %eax
imull %ebx, %eax
movl %eax, -0x80(%rbp)
xorl %r14d, %r14d
movl $0x1, %r10d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq -0xd0(%rbp), %rdx
xorl %edi, %edi
xorl %eax, %eax
movl %r10d, %esi
leaq 0x1(%rdi), %r8
testb $0x1, %sil
movl %r8d, %r9d
cmovnel %ecx, %r9d
movl %r9d, (%rdx,%rdi,4)
xorl %edi, %edi
testl %r9d, %r9d
setg %dil
leal (%rax,%rdi,2), %eax
decl %eax
shrl %esi
decl %ecx
movq %r8, %rdi
cmpq %r8, %r15
jne 0x2b26
movl %r10d, -0x58(%rbp)
movq -0xc8(%rbp), %rcx
subq -0xd0(%rbp), %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jge 0x3431
xorl %r12d, %r12d
testl %r12d, %r12d
je 0x2ba2
movq -0xd0(%rbp), %rax
xorl %ecx, %ecx
movl (%rax,%rcx,4), %edx
testl %edx, %edx
movl %r13d, %esi
cmovgl %r15d, %esi
addl %edx, %esi
movl %esi, (%rax,%rcx,4)
cmpl %esi, %r14d
cmovlel %esi, %r14d
incq %rcx
cmpq %rcx, %r15
jne 0x2b82
leaq -0xb8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x363a
incl %r12d
cmpl %ebx, %r12d
jne 0x2b74
movl -0x58(%rbp), %r10d
incl %r10d
cmpl -0x60(%rbp), %r10d
jne 0x2b13
movl -0x80(%rbp), %ebx
jmp 0x2bd8
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x163e9(%rip), %rdi     # 0x18fc8
leaq 0xf622(%rip), %rsi      # 0x12208
movl $0x15, %edx
callq 0x21b0
movq 0x163d1(%rip), %rdi     # 0x18fc8
movl %ebx, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0xf616(%rip), %rsi      # 0x1221e
movl $0x15, %edx
movq %rax, %rdi
callq 0x21b0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x22a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
xorpd %xmm0, %xmm0
movapd %xmm0, -0x50(%rbp)
xorl %eax, %eax
movq %rax, -0x40(%rbp)
movq %rax, -0xf0(%rbp)
movapd %xmm0, -0x100(%rbp)
movq %rax, -0x90(%rbp)
movapd %xmm0, -0xa0(%rbp)
testl %r14d, %r14d
jle 0x2cdb
movq -0x30(%rbp), %rax
leal -0x1(%rax), %r12d
movl %r14d, %r13d
negl %r13d
movl $0x1, %r15d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %r12d, %r15d
je 0x2cc6
movl %ebx, -0x198(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x2cb6
movl %ebx, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2cc6
leaq -0x50(%rbp), %rdi
leaq -0x198(%rbp), %rdx
callq 0x3b2e
leal (%r15,%r13), %eax
incl %eax
movl %r15d, %ecx
incl %ecx
decl %ebx
movl %ecx, %r15d
cmpl $0x1, %eax
jne 0x2c95
movq %rsp, -0x108(%rbp)
movl %r14d, %r13d
movq %rsp, %r15
leaq 0x17(,%r13,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movl $0x0, -0x74(%rbp)
testl %r14d, %r14d
movq -0x30(%rbp), %r9
jle 0x2d40
decl %r9d
movq -0x50(%rbp), %rax
leal 0x1(%r14), %ecx
xorl %edx, %edx
movl $0x1, %esi
leaq -0x74(%rbp), %rdi
testl %esi, %r9d
je 0x2d34
movslq %edx, %rdx
leaq (%rax,%rdx,4), %r8
movq %r8, (%r15,%rsi,8)
incl %edx
jmp 0x2d38
movq %rdi, (%r15,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x2d20
leaq -0xb8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
callq 0x36a2
movl %eax, %ebx
movq 0x16261(%rip), %rdi     # 0x18fc8
leaq 0xf4c6(%rip), %rsi      # 0x12234
movl $0x1b, %edx
callq 0x21b0
movq 0x16249(%rip), %rdi     # 0x18fc8
movl %ebx, %esi
callq 0x22a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
cmpl $0xa, %ebx
jne 0x3349
movq $0x0, -0x80(%rbp)
leaq -0x198(%rbp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x20d0
cvtsi2sdq (%rbx), %xmm0
cvtsi2sdq 0x8(%rbx), %xmm1
divsd 0xf223(%rip), %xmm1     # 0x12008
addsd %xmm0, %xmm1
movsd %xmm1, -0xd8(%rbp)
movl -0x70(%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0xe0(%rbp)
cmpl $0x3, %eax
movl $0x2, %ecx
cmovgel %eax, %ecx
movl $0x2, %eax
movq %rax, -0x60(%rbp)
addl $-0x2, %ecx
movl %ecx, -0xa4(%rbp)
leaq (%r15,%r13,8), %rax
addq $-0x8, %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
xorl %eax, %eax
xorl %r15d, %r15d
movq %rax, -0x58(%rbp)
testl %eax, %eax
je 0x2ea4
testl %r14d, %r14d
jle 0x2ea4
movl $0x1, %eax
xorl %r15d, %r15d
movq -0xe8(%rbp), %rcx
movq -0x58(%rbp), %rdx
testb $0x1, %dl
je 0x2e8d
movq (%rcx), %rsi
negl (%rsi)
leaq -0x74(%rbp), %rdi
cmpq %rdi, %rsi
je 0x2e8d
movzbl %r15b, %r15d
testb $0x1, %r15b
movl $0x1, %esi
cmovel %esi, %r15d
cmpl $0x2, %edx
jb 0x2ea4
shrl %edx
leaq 0x1(%rax), %rsi
addq $-0x8, %rcx
cmpq %r13, %rax
movq %rsi, %rax
jb 0x2e69
movq -0xa0(%rbp), %rax
cmpq %rax, -0x98(%rbp)
je 0x2ebb
movq %rax, -0x98(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
callq 0x36a2
movl %eax, %r12d
cmpb $0x0, -0x60(%rbp)
jne 0x2fb1
movl $0x8, %edx
movq 0x160d6(%rip), %rdi     # 0x18fc8
leaq 0xf387(%rip), %rsi      # 0x12280
callq 0x21b0
movq 0x160c3(%rip), %rdi     # 0x18fc8
movq -0x60(%rbp), %rsi
callq 0x22a0
movq %rax, %rbx
movl $0x8, %edx
movq %rax, %rdi
leaq 0xf369(%rip), %rsi      # 0x12289
callq 0x21b0
xorl %edi, %edi
leaq -0x198(%rbp), %rsi
callq 0x20d0
xorps %xmm0, %xmm0
cvtsi2sdq -0x198(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq -0x190(%rbp), %xmm1
divsd 0xf0b5(%rip), %xmm1     # 0x12008
addsd %xmm0, %xmm1
subsd -0xd8(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x2260
movq %rax, %rbx
movl $0x11, %edx
movq %rax, %rdi
leaq 0xf30d(%rip), %rsi      # 0x12292
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
cmpl $0x14, %r12d
jne 0x2fcf
leaq -0xb8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x363a
incl -0x64(%rbp)
jmp 0x2fd2
incl -0x68(%rbp)
movq -0x58(%rbp), %rcx
leal 0x1(%rcx), %eax
movl %eax, -0x30(%rbp)
cmpl $0x14, %r12d
setne %al
testl %ecx, %ecx
setne %cl
andb %r15b, %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x30e8
movl $0xf, %edx
movq 0x15fc6(%rip), %rdi     # 0x18fc8
leaq 0xf29b(%rip), %rsi      # 0x122a4
callq 0x21b0
movq 0x15fb3(%rip), %rdi     # 0x18fc8
movl -0x30(%rbp), %esi
callq 0x22a0
movq %rax, %rbx
movl $0x1f, %edx
movq %rax, %rdi
leaq 0xf285(%rip), %rsi      # 0x122b4
callq 0x21b0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x22a0
movq %rax, %rbx
movl $0x1f, %edx
movq %rax, %rdi
leaq 0xf283(%rip), %rsi      # 0x122d4
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x12, %edx
movq 0x15f3f(%rip), %rdi     # 0x18fc8
leaq 0xf264(%rip), %rsi      # 0x122f4
callq 0x21b0
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
movq 0x15f24(%rip), %r15     # 0x18fc8
je 0x322c
xorl %ebx, %ebx
movl $0x1, %edx
movq %r15, %rdi
leaq 0xf2ab(%rip), %rsi      # 0x12366
callq 0x21b0
movq -0x50(%rbp), %rax
movl (%rax,%rbx,4), %esi
movq %r15, %rdi
callq 0x22a0
incq %rbx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x30ac
jmp 0x322c
cmpl $0xa, %r12d
setne %al
xorb $0x1, %r15b
testb %r15b, %al
jne 0x3143
movb $0x1, %al
testl %r14d, %r14d
jle 0x3260
movl $0x1, %edx
movq -0xe8(%rbp), %rcx
movl -0x30(%rbp), %esi
movq (%rcx), %rdi
movl (%rdi), %r8d
testl %r8d, %r8d
jle 0x3123
negl %r8d
movl %r8d, (%rdi)
cmpl $0x2, %esi
jb 0x3260
shrl %esi
leaq 0x1(%rdx), %rdi
addq $-0x8, %rcx
cmpq %r13, %rdx
movq %rdi, %rdx
jb 0x3112
jmp 0x3260
movl $0xf, %edx
movq 0x15e79(%rip), %rdi     # 0x18fc8
leaq 0xf14e(%rip), %rsi      # 0x122a4
callq 0x21b0
movq 0x15e66(%rip), %rdi     # 0x18fc8
movl -0x30(%rbp), %esi
callq 0x22a0
movq %rax, %rbx
movl $0x1c, %edx
movq %rax, %rdi
leaq 0xf18b(%rip), %rsi      # 0x12307
callq 0x21b0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x22a0
movq %rax, %rbx
movl $0x1d, %edx
movq %rax, %rdi
leaq 0xf186(%rip), %rsi      # 0x12324
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x12, %edx
movq 0x15df2(%rip), %rdi     # 0x18fc8
leaq 0xf117(%rip), %rsi      # 0x122f4
callq 0x21b0
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
movq 0x15dd7(%rip), %r15     # 0x18fc8
je 0x322c
xorl %ebx, %ebx
movl $0x1, %edx
movq %r15, %rdi
leaq 0xf162(%rip), %rsi      # 0x12366
callq 0x21b0
movq -0x50(%rbp), %rax
movl (%rax,%rbx,4), %esi
movq %r15, %rdi
callq 0x22a0
incq %rbx
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x31f5
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq 0x15d7e(%rip), %rdi     # 0x18fc8
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x1, -0x6c(%rbp)
xorl %eax, %eax
testb %al, %al
movq -0x58(%rbp), %rdx
je 0x328c
movq -0x60(%rbp), %rax
cmpl -0x70(%rbp), %eax
leal 0x1(%rax), %eax
setge %cl
movq %rcx, -0x80(%rbp)
movq %rax, -0x60(%rbp)
cmpl -0xa4(%rbp), %edx
movl -0x30(%rbp), %eax
jne 0x2e46
testb $0x1, -0x80(%rbp)
movl -0x6c(%rbp), %r14d
je 0x33b3
callq 0x386f
movsd %xmm0, -0x58(%rbp)
movq 0x15d1d(%rip), %rdi     # 0x18fc8
leaq 0xf090(%rip), %rsi      # 0x12342
movl $0xa, %edx
callq 0x21b0
movsd -0x58(%rbp), %xmm1
subsd -0xd8(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
divsd %xmm1, %xmm0
movq 0x15cec(%rip), %rdi     # 0x18fc8
callq 0x2260
movq %rax, %rbx
leaq 0xf062(%rip), %rsi      # 0x1234d
movl $0x13, %edx
movq %rax, %rdi
callq 0x21b0
movq %rbx, %rdi
movl -0x68(%rbp), %esi
callq 0x22a0
movq %rax, %rbx
leaq 0xf054(%rip), %rsi      # 0x12361
movl $0x6, %edx
movq %rax, %rdi
callq 0x21b0
movq %rbx, %rdi
movl -0x64(%rbp), %esi
callq 0x22a0
movq %rax, %rbx
leaq 0xf039(%rip), %rsi      # 0x12368
movl $0x6, %edx
movq %rax, %rdi
callq 0x21b0
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x2090
jmp 0x33b3
movq 0x15c78(%rip), %rdi     # 0x18fc8
leaq 0xeef9(%rip), %rsi      # 0x12250
movl $0x2f, %edx
callq 0x21b0
movq 0x15c60(%rip), %rdi     # 0x18fc8
movl %ebx, %esi
callq 0x22a0
movq %rax, %rbx
leaq 0xefc1(%rip), %rsi      # 0x1233a
movl $0x7, %edx
movq %rax, %rdi
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movl $0x1, %r14d
movq %rax, %rdi
callq 0x20f0
movq -0x108(%rbp), %rsp
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x33d5
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x33f0
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3405
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x3420
movq -0xc0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq -0xb8(%rbp), %rdi
callq 0x38a4
jmp 0x2a8f
leaq 0xed49(%rip), %rdi      # 0x12181
leaq 0xed99(%rip), %rsi      # 0x121d8
leaq 0xedab(%rip), %rcx      # 0x121f1
movl $0x47, %edx
callq 0x20e0
movq %rax, %rbx
jmp 0x34cf
jmp 0x3461
jmp 0x3461
jmp 0x34b1
jmp 0x3461
jmp 0x3461
jmp 0x3461
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x347f
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x349a
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x34b4
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0x34b4
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x34cf
movq -0xc0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq -0xb8(%rbp), %rdi
callq 0x38a4
movq %rbx, %rdi
callq 0x22b0
nop