// File: /workspace/github_cpp_makefile_star2_O1/Luthaf[P]zeopp/net.cc
// Function: loop_is_unique(int, int, int, std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*)
bool loop_is_unique(int a, int b, int c, vector<int> *loops_a, vector<int> *loops_b, vector<int> *loops_c) {
  bool verbose = false;
  bool unique = true; //unique until proven otherwise
  int num_loops = loops_a->size();
if(verbose) printf("DEBUG: testing new loop uniqueness versus %d existing loops\n", num_loops);
  for(int i=0; i<num_loops && unique; i++) {
if(verbose) printf("DEBUG: checking against existing loop %d: (%d %d %d)\n", i, loops_a->at(i), loops_b->at(i), loops_c->at(i));
    //first, test for plain equivalence
    if(a==loops_a->at(i) && b==loops_b->at(i) && c==loops_c->at(i)) {
      unique = false;
if(verbose) printf("DEBUG: trivial equivalence\n");
    } else {
      //second, we are definitely unique if there are any zero-nonzero pairings
      vector<double> ratios;
      bool zero_nonzero_pairing = false;
      if((a==0 && loops_a->at(i)!=0) || (a!=0 && loops_a->at(i)==0)) zero_nonzero_pairing = true; else if(a!=0 && loops_a->at(i)!=0) ratios.push_back(((double)(a))/loops_a->at(i));
      if((b==0 && loops_b->at(i)!=0) || (b!=0 && loops_b->at(i)==0)) zero_nonzero_pairing = true; else if(b!=0 && loops_b->at(i)!=0) ratios.push_back(((double)(b))/loops_b->at(i));
      if((c==0 && loops_c->at(i)!=0) || (c!=0 && loops_c->at(i)==0)) zero_nonzero_pairing = true; else if(c!=0 && loops_c->at(i)!=0) ratios.push_back(((double)(c))/loops_c->at(i));
      if(!zero_nonzero_pairing) {
        //third, given that there was no zero-nonzero pairing, check the ratios to see if one is a multiple of the other
        int num_ratios = ratios.size();
        if(num_ratios==0) {
          printf("ERROR: passed trivial equivalence filter but both loops are completely zero (no ratios between elements could be found)\n");
          exit(EXIT_FAILURE);
        }
        double ratio = ratios.at(0); //there should always be at least one ratio, otherwise we would have been caught by the trivial equivalence filter
        unique = false; //here we assume not unique, and it becomes unique if any ratios are different
        for(int j=1; j<num_ratios && !unique; j++) {
          if(ratio!=ratios.at(j)) unique = true;
        }
if(verbose && !unique) printf("DEBUG: equivalence by ratio (%.3f)\n", ratio);
      }
    }
  }
  return unique;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, 0x38(%rsp)
movq 0x8(%rcx), %r14
movq %rcx, 0x60(%rsp)
subq (%rcx), %r14
shrq $0x2, %r14
testl %r14d, %r14d
jle 0xa159a
movq %r8, %r15
movl %edi, %r12d
cvtsi2sd %edi, %xmm0
movsd %xmm0, 0x40(%rsp)
movl %esi, 0xc(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x50(%rsp)
movl %edx, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x48(%rsp)
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movb $0x1, %r13b
xorl %ebx, %ebx
movl $0x1, %ebp
movq %r14, 0x58(%rsp)
movq 0x60(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15d2
cmpl %r12d, (%rax,%rbx,4)
jne 0xa130f
movq (%r15), %rcx
movq 0x8(%r15), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15d2
movl 0xc(%rsp), %edx
cmpl %edx, (%rcx,%rbx,4)
jne 0xa130f
movq 0x38(%rsp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15d2
movl 0x8(%rsp), %edx
cmpl %edx, (%rcx,%rbx,4)
jne 0xa130f
xorl %r13d, %r13d
jmp 0xa1586
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl (%rax,%rbx,4), %ecx
movl %r12d, %r14d
testl %r12d, %r12d
je 0xa1368
testl %ecx, %ecx
sete %r12b
je 0xa1382
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%rbx,4), %xmm1
movsd 0x40(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xa1370
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xa137f
testl %ecx, %ecx
setne %r12b
jmp 0xa1382
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x139c2
xorl %r12d, %r12d
movzbl %r12b, %eax
cmpl $0x0, 0xc(%rsp)
jne 0xa13c3
movq (%r15), %rcx
movq 0x8(%r15), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15c1
cmpl $0x0, 0xc(%rsp)
sete %dl
cmpl $0x0, (%rcx,%rbx,4)
setne %sil
movl %eax, %ecx
cmovnel %ebp, %ecx
orb %dl, %sil
je 0xa13c3
movl %ecx, %r12d
jmp 0xa142a
movq (%r15), %rcx
movq 0x8(%r15), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15c1
cmpl $0x0, (%rcx,%rbx,4)
cmovel %ebp, %eax
je 0xa1416
xorps %xmm1, %xmm1
cvtsi2sdl (%rcx,%rbx,4), %xmm1
movsd 0x50(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xa141b
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xa142a
movl %eax, %r12d
jmp 0xa142a
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x139c2
movzbl %r12b, %eax
cmpl $0x0, 0x8(%rsp)
jne 0xa1470
movq 0x38(%rsp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15c1
cmpl $0x0, 0x8(%rsp)
sete %dl
cmpl $0x0, (%rcx,%rbx,4)
setne %sil
movl %eax, %ecx
cmovnel %ebp, %ecx
orb %dl, %sil
je 0xa1470
movl %ecx, %r12d
jmp 0xa14dc
movq 0x38(%rsp), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
jbe 0xa15c1
cmpl $0x0, (%rcx,%rbx,4)
cmovel %ebp, %eax
je 0xa14c8
xorps %xmm1, %xmm1
cvtsi2sdl (%rcx,%rbx,4), %xmm1
movsd 0x48(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xa14cd
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xa14dc
movl %eax, %r12d
jmp 0xa14dc
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x139c2
testb %r12b, %r12b
movl %r14d, %r12d
movq 0x58(%rsp), %r14
jne 0xa156f
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
je 0xa15f3
cmpq %rax, %rcx
je 0xa15e3
cmpl $0x2, %edx
jge 0xa151c
xorl %r13d, %r13d
jmp 0xa156f
movsd (%rax), %xmm0
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq $0x1, %rdx
movq %rdx, %rsi
adcq $0x0, %rsi
movl $0x1, %edi
subq %rsi, %rdi
movl $0x2, %r8d
xorl %r13d, %r13d
leaq (%rdi,%r8), %r9
cmpq $0x2, %r9
je 0xa15b3
ucomisd -0x8(%rax,%r8,8), %xmm0
movzbl %r13b, %r13d
cmovnel %ebp, %r13d
cmovpl %ebp, %r13d
cmpq %rcx, %r8
jae 0xa156f
incq %r8
testb $0x1, %r13b
je 0xa1544
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xa1586
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
incq %rbx
cmpq %r14, %rbx
jae 0xa159d
testb $0x1, %r13b
jne 0xa12a0
jmp 0xa159d
movb $0x1, %r13b
andb $0x1, %r13b
movl %r13d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xae0eb(%rip), %rdi     # 0x14f6a5
xorl %eax, %eax
callq 0x4630
leaq 0xae0dd(%rip), %rdi     # 0x14f6a5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xae0cc(%rip), %rdi     # 0x14f6a5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4630
leaq 0xae0bb(%rip), %rdi     # 0x14f6a5
xorl %esi, %esi
xorl %eax, %eax
callq 0x4630
leaq 0xb6fb5(%rip), %rdi     # 0x1585af
callq 0x4660
movl $0x1, %edi
callq 0x710c
jmp 0xa1613
jmp 0xa1613
jmp 0xa1613
jmp 0xa1613
jmp 0xa1613
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xa162d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780