// File: /workspace/github_cpp_makefile_star2_O2/temelmertcan[P]multgen/src/adders.cpp
// Function: create_rp_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_rp_adder (int size, bool carryin, std::queue<string>& verilog){

  string module_name = (string)"RP_"+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("");

  string carry_decs = "logic ";
  for (int i=0; i < size+1; i++){
    carry_decs+= "C" + to_string(i);
    if (i == size)
      carry_decs += ";";
    else
      carry_decs += ", ";
  }

  verilog.push (carry_decs);

  for (int i=0; i < size; i++){
    if (i == 0)
      if (carryin)
	verilog.push ("fa m0 (carryin, IN1[0], IN2[0], OUT[0], C0);");
      else
	verilog.push ("ha m0 (IN1[0], IN2[0], OUT[0], C0);");
    else
      verilog.push ("fa m" + to_string(i) + " (IN1[" +  to_string(i) + "], IN2["
                    + to_string(i) + "], C" + to_string(i-1) + ", OUT[" + to_string(i) + "], C"
                    + to_string(i) + ");");
  }

  verilog.push ("assign OUT[" + to_string(size) + "] = C" + to_string(size-1) + ";");

  verilog.push("outdent");
  verilog.push("");
  verilog.push("endmodule");

  verilog.push("");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdx, -0x30(%rbp)
movl %esi, -0x74(%rbp)
movl %edi, %ebx
leaq 0x1f850(%rip), %rsi     # 0x32acc
leaq -0x50(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x20b0
leaq -0x98(%rbp), %rdi
movl %ebx, %esi
callq 0x11c73
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x11bca
leaq 0x1e9ec(%rip), %rax     # 0x31ca1
leaq 0x20315(%rip), %rdx     # 0x335d1
cmpb $0x0, -0x74(%rbp)
cmovneq %rax, %rdx
leaq -0x1a8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x11ba1
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x1e9af(%rip), %rsi     # 0x31ca8
leaq -0x50(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
callq 0x11cd3
leaq 0x1f7c0(%rip), %rdx     # 0x32ad0
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x11ba1
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x1e975(%rip), %rsi     # 0x31cb8
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq 0x1e94b(%rip), %rsi     # 0x31cb8
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
cmpb $0x0, -0x74(%rbp)
je 0x133c0
leaq 0x1e922(%rip), %rsi     # 0x31cbf
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leal -0x1(%rbx), %r14d
leaq -0x98(%rbp), %rdi
movl %r14d, %esi
callq 0x11c73
leaq 0x1e8fa(%rip), %rsi     # 0x31cd4
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x11d49
leaq 0x1e8f1(%rip), %rdx     # 0x31ce2
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x11ba1
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
movl %r14d, %esi
callq 0x11c73
leaq 0x1e895(%rip), %rsi     # 0x31cd4
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x11d49
leaq 0x1e895(%rip), %rdx     # 0x31ceb
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x11ba1
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
movl %ebx, %esi
callq 0x11c73
leaq 0x1e86d(%rip), %rsi     # 0x31d10
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x11d49
leaq 0x1f61a(%rip), %rdx     # 0x32ad4
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x11ba1
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq 0x1e835(%rip), %rsi     # 0x31d2e
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq 0x200ae(%rip), %rsi     # 0x335d1
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
movl %r14d, -0xa4(%rbp)
movq %rbx, -0xa0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq 0x1f703(%rip), %rsi     # 0x32c5e
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20b0
xorl %ebx, %ebx
leaq -0x98(%rbp), %r14
leaq -0x50(%rbp), %r12
leaq -0x70(%rbp), %r13
leaq 0x1f076(%rip), %r15     # 0x325f6
cmpl -0xa0(%rbp), %ebx
jg 0x135df
movq %r14, %rdi
movl %ebx, %esi
callq 0x11c73
movq %r12, %rdi
leaq 0x1f59b(%rip), %rsi     # 0x32b37
movq %r14, %rdx
callq 0x11d49
movq %r13, %rdi
movq %r12, %rsi
callq 0x2360
movq %r12, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x20f0
cmpl %ebx, -0xa0(%rbp)
movq %r15, %rsi
leaq 0x20112(%rip), %rax     # 0x336e1
cmoveq %rax, %rsi
movq %r13, %rdi
callq 0x2340
incl %ebx
jmp 0x13580
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x19602
xorl %r13d, %r13d
movq -0xa0(%rbp), %rax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, -0xa8(%rbp)
leaq -0x50(%rbp), %r12
leaq -0x98(%rbp), %r15
cmpl %r13d, -0xa8(%rbp)
je 0x138d0
testl %r13d, %r13d
je 0x1387c
leaq -0x268(%rbp), %r14
movq %r14, %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x288(%rbp), %rbx
movq %rbx, %rdi
leaq 0x1f4e5(%rip), %rsi     # 0x32b2f
movq %r14, %rdx
callq 0x11d49
leaq -0x148(%rbp), %rdi
movq %rbx, %rsi
leaq 0x1ec88(%rip), %rdx     # 0x322eb
callq 0x11ba1
leaq -0x248(%rbp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x2a8(%rbp), %r14
movq %r14, %rdi
leaq -0x148(%rbp), %rsi
movq %rbx, %rdx
callq 0x11bca
leaq -0x168(%rbp), %rdi
movq %r14, %rsi
leaq 0x1e76b(%rip), %rdx     # 0x31e0f
callq 0x11ba1
leaq -0x228(%rbp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x2c8(%rbp), %r14
movq %r14, %rdi
leaq -0x168(%rbp), %rsi
movq %rbx, %rdx
callq 0x11bca
leaq -0x188(%rbp), %rdi
movq %r14, %rsi
leaq 0x1f44f(%rip), %rdx     # 0x32b34
callq 0x11ba1
leal -0x1(%r13), %esi
leaq -0x208(%rbp), %rbx
movq %rbx, %rdi
callq 0x11c73
leaq -0x108(%rbp), %r14
movq %r14, %rdi
leaq -0x188(%rbp), %rsi
movq %rbx, %rdx
callq 0x11bca
leaq -0xe8(%rbp), %rdi
movq %r14, %rsi
leaq 0x1f412(%rip), %rdx     # 0x32b39
callq 0x11ba1
leaq -0x1e8(%rbp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x11c73
leaq -0x128(%rbp), %r14
movq %r14, %rdi
leaq -0xe8(%rbp), %rsi
movq %rbx, %rdx
callq 0x11bca
leaq -0xc8(%rbp), %rdi
movq %r14, %rsi
leaq 0x1f3cc(%rip), %rdx     # 0x32b34
callq 0x11ba1
leaq -0x1c8(%rbp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x11c73
movq %r15, %rdi
leaq -0xc8(%rbp), %rsi
movq %rbx, %rdx
callq 0x11bca
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1ff42(%rip), %rdx     # 0x336e0
callq 0x11ba1
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
movq %r12, %rdi
callq 0x20f0
movq %r15, %rdi
callq 0x20f0
leaq -0x1c8(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x128(%rbp), %rdi
callq 0x20f0
leaq -0x1e8(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x20f0
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0x208(%rbp), %rdi
callq 0x20f0
leaq -0x188(%rbp), %rdi
callq 0x20f0
leaq -0x2c8(%rbp), %rdi
callq 0x20f0
leaq -0x228(%rbp), %rdi
callq 0x20f0
leaq -0x168(%rbp), %rdi
callq 0x20f0
leaq -0x2a8(%rbp), %rdi
callq 0x20f0
leaq -0x248(%rbp), %rdi
callq 0x20f0
leaq -0x148(%rbp), %rdi
callq 0x20f0
leaq -0x288(%rbp), %rdi
callq 0x20f0
leaq -0x268(%rbp), %rdi
jmp 0x138c3
cmpb $0x0, -0x74(%rbp)
je 0x138a2
movq %r12, %rdi
leaq 0x1f252(%rip), %rsi     # 0x32ade
movq %r15, %rdx
callq 0x20b0
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
jmp 0x138c0
movq %r12, %rdi
leaq 0x1f25f(%rip), %rsi     # 0x32b0b
movq %r15, %rdx
callq 0x20b0
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x120e4
movq %r12, %rdi
callq 0x20f0
incl %r13d
jmp 0x13611
leaq -0xe8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x11c73
leaq 0x1f256(%rip), %rsi     # 0x32b40
leaq -0x128(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
callq 0x11d49
movl -0xa4(%rbp), %ebx
leaq 0x1f242(%rip), %rdx     # 0x32b4c
leaq -0xc8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x11ba1
leaq -0x108(%rbp), %rdi
movl %ebx, %esi
callq 0x11c73
leaq -0x98(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0x108(%rbp), %rdx
callq 0x11bca
leaq 0x1fd95(%rip), %rdx     # 0x336e1
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x11ba1
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x128(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x20f0
leaq 0x1e379(%rip), %rsi     # 0x31d2e
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x20b0
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x1fbef(%rip), %rsi     # 0x335d1
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x20b0
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x1e3c7(%rip), %rsi     # 0x31dd6
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x20b0
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq 0x1fb95(%rip), %rsi     # 0x335d1
leaq -0x50(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x20b0
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x120e4
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x1a8(%rbp), %rdi
callq 0x20f0
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13d77
jmp 0x13b9b
jmp 0x13bdd
jmp 0x13d77
jmp 0x13bdd
jmp 0x13d77
jmp 0x13bdd
jmp 0x13d77
jmp 0x13bdd
jmp 0x13d77
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
jmp 0x13acc
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x20f0
jmp 0x13add
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x20f0
jmp 0x13aee
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x20f0
jmp 0x13aff
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
jmp 0x13d2c
movq %rax, %rbx
jmp 0x13b0b
jmp 0x13d77
jmp 0x13d77
jmp 0x13b9b
jmp 0x13d77
jmp 0x13b9b
jmp 0x13d77
jmp 0x13b9b
jmp 0x13b46
jmp 0x13b54
jmp 0x13b62
jmp 0x13b9b
jmp 0x13b46
jmp 0x13b54
jmp 0x13b62
jmp 0x13b9b
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20f0
jmp 0x13b57
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
jmp 0x13b65
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x13d35
jmp 0x13b9b
jmp 0x13d77
jmp 0x13b9b
jmp 0x13d77
jmp 0x13b9b
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20f0
jmp 0x13b92
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x13d35
movq %rax, %rbx
jmp 0x13d3a
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x20f0
jmp 0x13bb4
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x20f0
jmp 0x13bc5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x13d41
movq %rax, %rbx
jmp 0x13d46
jmp 0x13bdd
jmp 0x13d77
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x13d2c
jmp 0x13d77
movq %rax, %rbx
jmp 0x13c89
movq %rax, %rbx
jmp 0x13d0d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
jmp 0x13c65
movq %rax, %rbx
jmp 0x13cdd
movq %rax, %rbx
jmp 0x13cad
jmp 0x13d77
movq %rax, %rbx
jmp 0x13c7d
movq %rax, %rbx
jmp 0x13d01
movq %rax, %rbx
jmp 0x13cd1
movq %rax, %rbx
jmp 0x13ca1
movq %rax, %rbx
jmp 0x13d25
movq %rax, %rbx
jmp 0x13c71
movq %rax, %rbx
jmp 0x13cf5
movq %rax, %rbx
jmp 0x13cc5
movq %rax, %rbx
jmp 0x13c95
movq %rax, %rbx
jmp 0x13d19
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x20f0
leaq -0x1c8(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x128(%rbp), %rdi
callq 0x20f0
leaq -0x1e8(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x20f0
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0x208(%rbp), %rdi
callq 0x20f0
leaq -0x188(%rbp), %rdi
callq 0x20f0
leaq -0x2c8(%rbp), %rdi
callq 0x20f0
leaq -0x228(%rbp), %rdi
callq 0x20f0
leaq -0x168(%rbp), %rdi
callq 0x20f0
leaq -0x2a8(%rbp), %rdi
callq 0x20f0
leaq -0x248(%rbp), %rdi
callq 0x20f0
leaq -0x148(%rbp), %rdi
callq 0x20f0
leaq -0x288(%rbp), %rdi
callq 0x20f0
leaq -0x268(%rbp), %rdi
callq 0x20f0
leaq -0x70(%rbp), %rdi
callq 0x20f0
leaq -0x1a8(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2330
movq %rax, %rbx
jmp 0x13ce9
movq %rax, %rbx
jmp 0x13cb9
jmp 0x13d77
movq %rax, %rbx
jmp 0x13d6e
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20f0
leaq -0x98(%rbp), %rdi
jmp 0x13d2c
movq %rax, %rbx
jmp 0x13d31