// File: /workspace/github_cpp_makefile_star2_O2/temelmertcan[P]multgen/src/adders.cpp
// Function: create_JSkCond_adder(int, bool, std::queue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::deque<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
void create_JSkCond_adder (int size, bool carryin, std::queue<string>& verilog){

  int index = 0;

  string* g = new string[size];
  string* p = new string[size];

  string* gtmp = new string[size];
  string* ptmp = new string[size];


  ppx_preprocess(size,  carryin,  index, "JSkCond", gtmp, ptmp, verilog);
  pgtmp_to_pg(size, gtmp, g);
  pgtmp_to_pg(size, ptmp, p);

  verilog.push("");
  verilog.push("// J. Sklansky – Conditional Adder \n");

  int stage=0;

  
  unsigned long long coef;
  for (coef = 1; coef < size; coef *= 2){
    verilog.push("");
    verilog.push("// Stage " + to_string(++stage)+ " - prop from 1 to " + to_string(coef) + " per group.");

    for (int i=coef; i < size; i++){
      //verilog.push("i:" + to_string(i));

      if((i)/coef % 2 == 0)
        continue;
      int prev = i - (i % coef) - 1;

      string new_p = "p_" + to_string(stage)+ "_" + to_string(i);
      string new_g = "g_" + to_string(stage)+ "_" + to_string(i);

      verilog.push ("wire logic "+ new_p + ";");
      verilog.push ("wire logic "+ new_g + ";");

      verilog.push ("assign "+ new_p + " = " + p[i] + " & " + p[prev] + ";");
      verilog.push ("assign "+ new_g + " = (" + p[i] + " & " + g[prev] + ") | " + g[i] + ";");

      gtmp[i] =  new_g;
      ptmp[i] =  new_p;
    }

    pgtmp_to_pg(size, gtmp, g);
    pgtmp_to_pg(size, ptmp, p);
  }

  verilog.push("");
  verilog.push("// JSkCondA postprocess ");

  ppx_postprocess (size, index, g, p, verilog);

  delete[] p;
  delete[] g;

  delete[] ptmp;
  delete[] gtmp;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, -0x30(%rbp)
movl %esi, %ebx
movl %edi, -0x3c(%rbp)
movslq %edi, %r12
movq %r12, %r15
shlq $0x5, %r15
leaq 0x8(%r15), %rax
testl %r12d, %r12d
pushq $-0x1
popq %r14
cmovnsq %rax, %r14
movq %r14, %rdi
callq 0x2030
leaq 0x8(%rax), %rcx
movq %rcx, -0xd0(%rbp)
movq %r12, (%rax)
movq %r12, -0x38(%rbp)
testl %r12d, %r12d
je 0x18976
addq $0x18, %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %r15
jne 0x18960
movq -0xd0(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %r14, %rdi
callq 0x2030
leaq 0x8(%rax), %rcx
movq %rcx, -0xd8(%rbp)
movq %rax, -0xe8(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
testl %ecx, %ecx
je 0x189d2
movq -0xe8(%rbp), %rax
addq $0x18, %rax
movq -0x38(%rbp), %rcx
shlq $0x5, %rcx
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %rcx
jne 0x189bc
movq -0xd8(%rbp), %rax
movq %rax, -0x138(%rbp)
movq %r14, %rdi
callq 0x2030
leaq 0x8(%rax), %rcx
movq %rcx, -0xf8(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
testl %ecx, %ecx
je 0x18a20
addq $0x18, %rax
movq -0x38(%rbp), %rcx
shlq $0x5, %rcx
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %rcx
jne 0x18a0a
movq -0xf8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %r14, %rdi
callq 0x2030
leaq 0x8(%rax), %rcx
movq %rcx, -0xf0(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
testl %ecx, %ecx
je 0x18a6b
addq $0x18, %rax
movq -0x38(%rbp), %rcx
shlq $0x5, %rcx
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %rcx
jne 0x18a55
movq -0xf0(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq 0x18c68(%rip), %rsi     # 0x316e5
leaq -0x1e0(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x20b0
movq -0x30(%rbp), %rax
movq %rax, (%rsp)
movzbl %bl, %esi
leaq -0x1e0(%rbp), %rcx
leaq -0x80(%rbp), %r8
leaq -0x78(%rbp), %r9
movl -0x3c(%rbp), %ebx
movl %ebx, %edi
callq 0x13d7c
leaq -0x1e0(%rbp), %rdi
callq 0x20f0
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
movl %ebx, %edi
callq 0x14ae8
leaq -0x78(%rbp), %rsi
leaq -0x138(%rbp), %rdx
movl %ebx, %edi
callq 0x14ae8
leaq 0x1aae9(%rip), %rsi     # 0x335d1
leaq -0x60(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x20b0
leaq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x60(%rbp), %rdi
callq 0x20f0
leaq 0x1a295(%rip), %rsi     # 0x32daa
leaq -0x60(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x20b0
leaq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x20f0
pushq $0x1
popq %rax
movq $0x0, -0x68(%rbp)
leaq -0x180(%rbp), %r12
movq %rax, -0x70(%rbp)
cmpq -0x38(%rbp), %rax
jae 0x1913d
movq %rbx, %rdi
leaq 0x1aa69(%rip), %rsi     # 0x335d1
leaq -0xc8(%rbp), %rdx
callq 0x20b0
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x120e4
movq %rbx, %rdi
callq 0x20f0
movq -0x68(%rbp), %rsi
incl %esi
leaq -0x130(%rbp), %r14
movq %r14, %rdi
movq %rsi, -0x68(%rbp)
callq 0x11c73
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
leaq 0x1a18d(%rip), %rsi     # 0x32d3f
movq %r14, %rdx
callq 0x11d49
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1a20a(%rip), %rdx     # 0x32dd1
callq 0x11ba1
leaq -0x158(%rbp), %r14
movq %r14, %rdi
movq -0x70(%rbp), %rsi
callq 0x19511
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x11bca
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x1a1e3(%rip), %rdx     # 0x32de4
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x120e4
movq %rbx, %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x158(%rbp), %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
callq 0x20f0
movq -0x70(%rbp), %rcx
movq %rcx, %rax
negq %rax
movq %rax, -0x160(%rbp)
movslq %ecx, %rbx
movq %rbx, %rcx
shlq $0x5, %rcx
movq -0xd8(%rbp), %rax
leaq (%rax,%rcx), %rsi
movq -0xd0(%rbp), %rax
leaq (%rax,%rcx), %rdi
movq -0xf8(%rbp), %rax
leaq (%rax,%rcx), %r8
addq -0xf0(%rbp), %rcx
cmpq -0x38(%rbp), %rbx
jge 0x19106
movq %rbx, %rax
xorl %edx, %edx
divq -0x70(%rbp)
testb $0x1, %al
je 0x190ee
movq %r8, -0x108(%rbp)
movq %rdi, -0x110(%rbp)
movq %rsi, -0xe0(%rbp)
movq %rcx, -0x100(%rbp)
leaq -0xa8(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
callq 0x11c73
movq %r12, %rdi
leaq 0x198d0(%rip), %rsi     # 0x325b9
movq %r14, %rdx
callq 0x11d49
leaq -0xc8(%rbp), %rdi
movq %r12, %rsi
leaq 0x1a444(%rip), %rdx     # 0x33146
callq 0x11ba1
leaq -0x130(%rbp), %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0x11c73
leaq -0x60(%rbp), %rdi
leaq -0xc8(%rbp), %r13
movq %r13, %rsi
movq %r14, %rdx
callq 0x11bca
movq %r14, %rdi
callq 0x20f0
movq %r13, %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
callq 0x20f0
movq %r14, %rdi
movq -0x68(%rbp), %rsi
callq 0x11c73
movq %r15, %rdi
leaq 0x19f07(%rip), %rsi     # 0x32c72
movq %r14, %rdx
callq 0x11d49
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1a3c6(%rip), %rdx     # 0x33146
callq 0x11ba1
leaq -0x158(%rbp), %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0x11c73
leaq -0xc8(%rbp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x11bca
movq %r14, %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %r14
movq %r14, %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
callq 0x20f0
movq %r14, %rdi
leaq 0x19e7c(%rip), %rsi     # 0x32c59
leaq -0x60(%rbp), %rdx
callq 0x11cd3
movq %r12, %rdi
movq %r14, %rsi
leaq 0x1a8ee(%rip), %rdx     # 0x336e1
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
movq %r12, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x20f0
movq %r14, %rdi
leaq 0x19e3b(%rip), %rsi     # 0x32c59
leaq -0xc8(%rbp), %rdx
callq 0x11cd3
movq %r12, %rdi
movq %r14, %rsi
leaq 0x1a8aa(%rip), %rdx     # 0x336e1
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
movq %r12, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
leaq 0x19742(%rip), %rsi     # 0x325af
leaq -0x60(%rbp), %rdx
callq 0x11cd3
leaq -0x1c0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
leaq 0x193c9(%rip), %rdx     # 0x32253
callq 0x11ba1
leaq -0x158(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq -0xe0(%rbp), %rdx
callq 0x11d77
leaq -0x130(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0x1a2c9(%rip), %rdx     # 0x33185
callq 0x11ba1
movq %r12, %r15
movq %rbx, %r14
andq -0x160(%rbp), %r14
shlq $0x20, %r14
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %rax, %r14
movq %r14, %rdx
sarq $0x1b, %rdx
addq -0xd8(%rbp), %rdx
leaq -0xa8(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x11d77
movq %r15, %rdi
movq %r12, %rsi
leaq 0x1a7d5(%rip), %rdx     # 0x336e1
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x120e4
movq %r15, %r12
movq %r15, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
callq 0x20f0
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
callq 0x20f0
leaq -0x200(%rbp), %r15
movq %r15, %rdi
leaq 0x1963a(%rip), %rsi     # 0x325af
leaq -0xc8(%rbp), %rdx
callq 0x11cd3
leaq -0x220(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x19512(%rip), %rdx     # 0x324a7
callq 0x11ba1
leaq -0x1a0(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq -0xe0(%rbp), %rdx
callq 0x11d77
leaq -0x1c0(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
leaq 0x1a1be(%rip), %rdx     # 0x33185
callq 0x11ba1
sarq $0x20, %r14
shlq $0x5, %r14
addq -0xd0(%rbp), %r14
leaq -0x158(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x11d77
leaq -0x130(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
leaq 0x1a064(%rip), %rdx     # 0x33068
callq 0x11ba1
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq -0x110(%rbp), %rdx
callq 0x11d77
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1a6b2(%rip), %rdx     # 0x336e1
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
movq %r12, %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x20f0
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
callq 0x20f0
leaq -0x220(%rbp), %rdi
callq 0x20f0
leaq -0x200(%rbp), %rdi
callq 0x20f0
movq -0x108(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2130
leaq -0x60(%rbp), %r14
movq -0x100(%rbp), %rdi
movq %r14, %rsi
callq 0x2130
leaq -0xc8(%rbp), %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x20f0
movq -0x100(%rbp), %rcx
movq -0xe0(%rbp), %rsi
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %r8
incq %rbx
addq $0x20, %rsi
addq $0x20, %rdi
addq $0x20, %r8
addq $0x20, %rcx
jmp 0x18c95
movl -0x3c(%rbp), %ebx
movl %ebx, %edi
leaq -0x80(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x14ae8
movl %ebx, %edi
leaq -0x78(%rbp), %rsi
leaq -0x138(%rbp), %rdx
callq 0x14ae8
movq -0x70(%rbp), %rax
addq %rax, %rax
leaq -0x60(%rbp), %rbx
jmp 0x18b50
leaq 0x1a48d(%rip), %rsi     # 0x335d1
leaq -0x60(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x20b0
leaq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x60(%rbp), %rdi
callq 0x20f0
leaq 0x19c7f(%rip), %rsi     # 0x32df0
leaq -0x60(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x20b0
leaq -0x60(%rbp), %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x120e4
leaq -0x60(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdx
movl -0x3c(%rbp), %edi
movq %rbx, %r8
callq 0x146e9
movq -0xe8(%rbp), %r15
movq (%r15), %rbx
testq %rbx, %rbx
je 0x191d5
shlq $0x5, %rbx
movq %r15, %r14
addq $-0x18, %r14
leaq (%r14,%rbx), %rdi
callq 0x20f0
addq $-0x20, %rbx
jne 0x191c6
movq %r15, %rdi
callq 0x2230
movq -0x88(%rbp), %r14
testq %r14, %r14
je 0x19215
leaq -0x8(%r14), %rbx
movq -0x8(%r14), %r15
testq %r15, %r15
je 0x1920d
addq $-0x20, %r14
shlq $0x5, %r15
leaq (%r14,%r15), %rdi
callq 0x20f0
addq $-0x20, %r15
jne 0x191fe
movq %rbx, %rdi
callq 0x2230
movq -0x78(%rbp), %r14
testq %r14, %r14
je 0x1924a
leaq -0x8(%r14), %rbx
movq -0x8(%r14), %r15
testq %r15, %r15
je 0x19242
addq $-0x20, %r14
shlq $0x5, %r15
leaq (%r14,%r15), %rdi
callq 0x20f0
addq $-0x20, %r15
jne 0x19233
movq %rbx, %rdi
callq 0x2230
movq -0x80(%rbp), %r14
testq %r14, %r14
je 0x1927f
leaq -0x8(%r14), %rbx
movq -0x8(%r14), %r15
testq %r15, %r15
je 0x19277
addq $-0x20, %r14
shlq $0x5, %r15
leaq (%r14,%r15), %rdi
callq 0x20f0
addq $-0x20, %r15
jne 0x19268
movq %rbx, %rdi
callq 0x2230
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19336
jmp 0x192ca
jmp 0x19336
jmp 0x192ca
jmp 0x19336
jmp 0x192ca
jmp 0x19336
jmp 0x192ca
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
jmp 0x19504
jmp 0x192ca
jmp 0x19336
movq %rax, %rbx
jmp 0x19300
movq %rax, %rbx
jmp 0x192f4
movq %rax, %rbx
jmp 0x19509
movq %rax, %rbx
jmp 0x1930c
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20f0
jmp 0x192e8
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x180(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
jmp 0x19504
movq %rax, %rbx
jmp 0x19318
movq %rax, %rbx
jmp 0x194b8
jmp 0x194f1
movq %rax, %rbx
jmp 0x19500
movq %rax, %rbx
jmp 0x194e8
movq %rax, %rbx
jmp 0x194ac
movq %rax, %rbx
jmp 0x19414
movq %rax, %rbx
jmp 0x194d0
movq %rax, %rbx
jmp 0x19408
jmp 0x1946f
movq %rax, %rbx
jmp 0x19449
jmp 0x19474
movq %rax, %rbx
jmp 0x194dc
movq %rax, %rbx
jmp 0x193c1
jmp 0x194f1
movq %rax, %rbx
jmp 0x193fc
jmp 0x194f1
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x20f0
jmp 0x193b5
movq %rax, %rbx
jmp 0x193f0
movq %rax, %rbx
jmp 0x19461
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
callq 0x20f0
jmp 0x193e4
movq %rax, %rbx
jmp 0x1942c
jmp 0x194f1
movq %rax, %rbx
jmp 0x194a0
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
callq 0x20f0
leaq -0x220(%rbp), %rdi
callq 0x20f0
leaq -0x200(%rbp), %rdi
jmp 0x1948a
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
jmp 0x1943d
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x20f0
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x20f0
leaq -0x1a0(%rbp), %rdi
jmp 0x1948a
movq %rax, %rbx
jmp 0x19455
movq %rax, %rbx
jmp 0x19483
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
jmp 0x194f4
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x180(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
jmp 0x19504
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x20f0
leaq -0x180(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0x130(%rbp), %rdi
jmp 0x194fb
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x60(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2330