// File: /workspace/github_cpp_makefile_star2_O2/temelmertcan[P]multgen/src/adders.cpp
// Function: ppx_preprocess(int, bool, int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*&, 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 ppx_preprocess (int size, bool carryin, int& index, string addertype,
                     string*& g, string*& p, std::queue<string>& verilog){

  string module_name = addertype+"_"+to_string(size)+ (carryin?"_carry":"");

  verilog.push ("module " + module_name + " ( ");
  verilog.push("indent");
  verilog.push("indent");
  if(carryin)
    verilog.push ("input logic carryin,");
  verilog.push ("input logic [" + to_string(size-1) + ":0] IN1,");
  verilog.push ("input logic [" + to_string(size-1) + ":0] IN2,");
  verilog.push ("output logic [" + to_string(size) + ":0] OUT);");
  verilog.push("outdent");
  verilog.push("");

  verilog.push ( "wire logic ["+ to_string(size-1) + ":0] p_0;");
  verilog.push ( "wire logic ["+ to_string(size-1) + ":0] g_0;");

  if(carryin){
    verilog.push ( "assign g_0["+ to_string(size-1) + ":1] = IN1["+ to_string(size-1) + ":1] & IN2["+ to_string(size-1) + ":1];");
    verilog.push ( "assign p_0["+ to_string(size-1) + ":1] = IN1["+ to_string(size-1) + ":1] ^ IN2["+ to_string(size-1) + ":1];");
    verilog.push ("fa m0 (carryin, IN1[0], IN2[0], p_0[0], g_0[0]);");
  }else{
    verilog.push ( "assign g_0 = IN1 & IN2;");
    verilog.push ( "assign p_0 = IN1 ^ IN2;");
  }
    
  for (int i = 0; i<size; i++){
    g[i] = "g_0[" + to_string(i) + "]";
    p[i] = "p_0[" + to_string(i) + "]";
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %r9, -0x90(%rbp)
movq %r8, -0x98(%rbp)
movl %esi, %r15d
movl %edi, %r14d
leaq 0x1f39b(%rip), %rdx     # 0x33146
leaq -0x68(%rbp), %rdi
movq %rcx, %rsi
callq 0x11c3b
leaq -0x88(%rbp), %rdi
movq %r14, %rbx
movl %r14d, %esi
callq 0x11c73
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x11bca
leaq 0x1debd(%rip), %rax     # 0x31ca1
leaq 0x1f7e6(%rip), %rdx     # 0x335d1
testb %r15b, %r15b
cmovneq %rax, %rdx
leaq -0x180(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq 0x1de81(%rip), %rsi     # 0x31ca8
leaq -0x68(%rbp), %rdi
leaq -0x180(%rbp), %rdx
callq 0x11cd3
leaq 0x1ec92(%rip), %rdx     # 0x32ad0
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
movq 0x10(%rbp), %r12
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq 0x1de44(%rip), %rsi     # 0x31cb8
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq 0x1de1b(%rip), %rsi     # 0x31cb8
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
testb %r15b, %r15b
je 0x13eed
leaq 0x1ddf4(%rip), %rsi     # 0x31cbf
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leal -0x1(%rbx), %r13d
leaq -0x88(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1ddcd(%rip), %rsi     # 0x31cd4
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x11d49
leaq 0x1ddc4(%rip), %rdx     # 0x31ce2
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1dd69(%rip), %rsi     # 0x31cd4
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x11d49
leaq 0x1dd69(%rip), %rdx     # 0x31ceb
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
movl %ebx, %esi
callq 0x11c73
leaq 0x1dd42(%rip), %rsi     # 0x31d10
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x11d49
leaq 0x1eaef(%rip), %rdx     # 0x32ad4
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq 0x1dd0b(%rip), %rsi     # 0x31d2e
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq 0x1f585(%rip), %rsi     # 0x335d1
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1dea9(%rip), %rsi     # 0x31f2d
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x11d49
leaq 0x1eab7(%rip), %rdx     # 0x32b52
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1de45(%rip), %rsi     # 0x31f2d
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x11d49
leaq 0x1ea5c(%rip), %rdx     # 0x32b5b
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
testb %r15b, %r15b
je 0x143c5
leaq -0x100(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1ea0f(%rip), %rsi     # 0x32b64
leaq -0x120(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x11d49
leaq 0x1ea01(%rip), %rdx     # 0x32b70
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x11ba1
leaq -0xe0(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x11bca
leaq 0x1e9c9(%rip), %rdx     # 0x32b7b
leaq -0x88(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x11ba1
leaq -0xc0(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x11bca
leaq 0x1e994(%rip), %rdx     # 0x32b86
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0xc0(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x160(%rbp), %rdi
callq 0x20f0
leaq -0xe0(%rbp), %rdi
callq 0x20f0
leaq -0x140(%rbp), %rdi
callq 0x20f0
leaq -0x120(%rbp), %rdi
callq 0x20f0
leaq -0x100(%rbp), %rdi
callq 0x20f0
leaq -0x100(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq 0x1e904(%rip), %rsi     # 0x32b8b
leaq -0x120(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x11d49
leaq 0x1e8cf(%rip), %rdx     # 0x32b70
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x11ba1
leaq -0xe0(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x11bca
leaq 0x1e8b3(%rip), %rdx     # 0x32b97
leaq -0x88(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x11ba1
leaq -0xc0(%rbp), %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x11bca
leaq 0x1e862(%rip), %rdx     # 0x32b86
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x11ba1
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0xc0(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x160(%rbp), %rdi
callq 0x20f0
leaq -0xe0(%rbp), %rdi
callq 0x20f0
leaq -0x140(%rbp), %rdi
callq 0x20f0
leaq -0x120(%rbp), %rdi
callq 0x20f0
leaq -0x100(%rbp), %rdi
callq 0x20f0
leaq 0x1e7f8(%rip), %rsi     # 0x32ba2
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
jmp 0x1440e
leaq 0x1e807(%rip), %rsi     # 0x32bd3
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq 0x1e7f6(%rip), %rsi     # 0x32beb
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x20b0
leaq -0x48(%rbp), %rsi
movq %r12, %rdi
callq 0x120e4
leaq -0x48(%rbp), %rdi
callq 0x20f0
xorl %r14d, %r14d
testl %ebx, %ebx
cmovlel %r14d, %ebx
movq %rbx, -0xa0(%rbp)
leaq -0x88(%rbp), %r12
leaq -0x68(%rbp), %rbx
leaq -0x48(%rbp), %r15
xorl %r13d, %r13d
cmpq %r13, -0xa0(%rbp)
je 0x1450a
movq %r12, %rdi
movl %r13d, %esi
callq 0x11c73
movq %rbx, %rdi
leaq 0x1e710(%rip), %rsi     # 0x32b6b
movq %r12, %rdx
callq 0x11d49
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x1d9a9(%rip), %rdx     # 0x31e19
callq 0x11ba1
movq -0x98(%rbp), %rax
movq (%rax), %rdi
addq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq %r15, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
movq %r12, %rdi
movl %r13d, %esi
callq 0x11c73
movq %rbx, %rdi
leaq 0x1e768(%rip), %rsi     # 0x32c1f
movq %r12, %rdx
callq 0x11d49
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x1d94d(%rip), %rdx     # 0x31e19
callq 0x11ba1
movq -0x90(%rbp), %rax
movq (%rax), %rdi
addq %r14, %rdi
movq %r15, %rsi
callq 0x2210
movq %r15, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
incq %r13
addq $0x20, %r14
jmp 0x14439
leaq -0x180(%rbp), %rdi
callq 0x20f0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14661
jmp 0x146c1
jmp 0x14555
jmp 0x14563
jmp 0x14571
jmp 0x14582
jmp 0x14593
jmp 0x145d2
jmp 0x145dc
jmp 0x145e6
jmp 0x145ed
jmp 0x146c1
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20f0
jmp 0x14566
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x20f0
jmp 0x14574
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x20f0
jmp 0x14585
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20f0
jmp 0x14596
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x20f0
leaq -0xe0(%rbp), %rdi
callq 0x20f0
leaq -0x140(%rbp), %rdi
callq 0x20f0
leaq -0x120(%rbp), %rdi
callq 0x20f0
leaq -0x100(%rbp), %rdi
jmp 0x146d0
movq %rax, %rbx
jmp 0x145a2
jmp 0x14661
movq %rax, %rbx
jmp 0x145ae
jmp 0x146c1
movq %rax, %rbx
jmp 0x145ba
jmp 0x14661
movq %rax, %rbx
jmp 0x145c6
jmp 0x146c1
jmp 0x146c1
jmp 0x14661
jmp 0x146c1
jmp 0x14649
jmp 0x146b3
jmp 0x146c6
jmp 0x146c1
jmp 0x14649
jmp 0x146b3
jmp 0x146c6
jmp 0x146c1
jmp 0x14661
jmp 0x146c1
jmp 0x14661
jmp 0x146c1
jmp 0x14649
jmp 0x146b3
jmp 0x146c6
jmp 0x146c1
jmp 0x14649
jmp 0x146b3
jmp 0x146c6
jmp 0x146c1
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20f0
jmp 0x146b6
jmp 0x146b3
jmp 0x146c6
jmp 0x146c1
jmp 0x14661
jmp 0x146c1
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x146d0
jmp 0x146c1
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20f0
jmp 0x1467d
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x146d0
jmp 0x146c1
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20f0
jmp 0x14696
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20f0
jmp 0x146a7
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x146dc
jmp 0x146b3
jmp 0x146c1
jmp 0x146c6
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x20f0
jmp 0x146c9
movq %rax, %rbx
jmp 0x146d5
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x180(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2330