// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %r9, (%rsp)
movq %r8, 0x8(%rsp)
movq 0x8(%rcx), %rax
movq %rcx, 0x10(%rsp)
subq (%rcx), %rax
movl %edi, 0x2c(%rsp)
cvtsi2sd %edi, %xmm0
movsd %xmm0, 0x60(%rsp)
movl %esi, 0x28(%rsp)
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x58(%rsp)
movl %edx, 0x24(%rsp)
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x50(%rsp)
shrq $0x2, %rax
cltq
movq %rax, 0x68(%rsp)
movb $0x1, %bl
xorl %r13d, %r13d
leaq 0x30(%rsp), %rbp
pushq $0x1
popq %r14
cmpq 0x68(%rsp), %r13
jge 0x7760f
testb $0x1, %bl
je 0x7760f
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
movl 0x2c(%rsp), %ecx
cmpl %ecx, (%rax)
jne 0x7742a
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
movl 0x28(%rsp), %ecx
cmpl %ecx, (%rax)
jne 0x7742a
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xac00
movl 0x24(%rsp), %ecx
cmpl %ecx, (%rax)
jne 0x7742a
xorl %ebx, %ebx
jmp 0x775a9
andq $0x0, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
cmpl $0x0, 0x2c(%rsp)
je 0x77498
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x774ae
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x77493
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cvtsi2sdl (%rax), %xmm0
movsd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9fe
xorl %r12d, %r12d
jmp 0x774b1
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
setne %r12b
jmp 0x774b1
movb $0x1, %r12b
cmpl $0x0, 0x28(%rsp)
je 0x7750c
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x77527
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x7752a
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cvtsi2sdl (%rax), %xmm0
movsd 0x58(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9fe
jmp 0x7752a
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
setne %al
orb %r12b, %al
movl %eax, %r12d
jmp 0x7752a
movb $0x1, %r12b
cmpl $0x0, 0x24(%rsp)
je 0x77588
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x775a1
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
je 0x77580
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cvtsi2sdl (%rax), %xmm0
movsd 0x50(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
callq 0xf9fe
testb $0x1, %r12b
jne 0x775a1
jmp 0x775b1
movq (%rsp), %rdi
movq %r13, %rsi
callq 0xac00
cmpl $0x0, (%rax)
setne %al
orb %r12b, %al
testb $0x1, %al
je 0x775b1
movq %rbp, %rdi
callq 0xb25c
incq %r13
jmp 0x773d1
movq 0x38(%rsp), %rbx
subq 0x30(%rsp), %rbx
shrq $0x3, %rbx
testl %ebx, %ebx
je 0x77623
movq %rbp, %rdi
xorl %esi, %esi
callq 0xaa50
movsd (%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
movslq %ebx, %r15
xorl %ebx, %ebx
pushq $0x1
popq %r12
cmpq %r15, %r12
jge 0x775a1
testb $0x1, %bl
jne 0x775a1
movq %rbp, %rdi
movq %r12, %rsi
callq 0xaa50
movsd 0x70(%rsp), %xmm0
ucomisd (%rax), %xmm0
movzbl %bl, %ebx
cmovnel %r14d, %ebx
cmovpl %r14d, %ebx
incq %r12
jmp 0x775e0
andb $0x1, %bl
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e025(%rip), %rdi     # 0x10564f
callq 0x4670
pushq $0x1
popq %rdi
callq 0x524c
jmp 0x77641
jmp 0x77641
jmp 0x77641
jmp 0x77641
jmp 0x77641
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb25c
movq %rbx, %rdi
callq 0x4780