// File: temelmertcan[P]multgen/src/pp_gen.cpp
// Function: create_unsignedpp(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>**&, int&, int&, 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_unsignedpp (int m, int n,
                        string**& pp_matrix,
                        int& pp_dim1,
                        int& pp_dim2,
			
                        std::queue<string>& verilog){

  pp_dim1 = m;
  pp_dim2 = n+m-1;

  pp_matrix = new string*[pp_dim1];

  for (int i = 0; i<m; i++)
    verilog.push ( "wire logic [" + to_string(n-1) + ":0] pp" + to_string(i) + ";");

  for (int i = 0; i < m; i++){
    pp_matrix[i] = new string[pp_dim2];
    for (int j = 0; j < i; j++){
      pp_matrix[i][j] = "";
    }
    for (int j = 0; j < n; j++){
      string cur;
      cur = "pp" + to_string(i) + "[" + to_string(j) + "]";
      pp_matrix[i][j+i] = cur;
    }
    for (int j = n+i; j < n+m-1; j++){
      pp_matrix[i][j] = "";
    }

    verilog.push (
                  "assign pp" + to_string(i)  + " = {"
                  + to_string(n)
                  + "{IN1["
                  + to_string(i)
                  + "]}} & IN2;");
  }

  //print_pp(pp_matrix, pp_dim1, pp_dim2, verilog, true);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl -0x4(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x8(%rbp), %ecx
addl -0x4(%rbp), %ecx
subl $0x1, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movslq (%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2f18b
movq -0x28(%rbp), %rax
movq %rax, -0x328(%rbp)
movl -0x8(%rbp), %esi
decl %esi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x1e700
movq -0x320(%rbp), %rdx
leaq 0x28f31(%rip), %rsi     # 0x57f30
leaq -0xb0(%rbp), %rdi
callq 0x1e930
jmp 0x2f00d
leaq 0x29f29(%rip), %rdx     # 0x58f3d
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1e560
jmp 0x2f029
movl -0x2c(%rbp), %esi
leaq -0x100(%rbp), %rdi
callq 0x1e700
jmp 0x2f03a
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x1e5b0
jmp 0x2f053
leaq 0x2a6b1(%rip), %rdx     # 0x5970b
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1e560
jmp 0x2f069
movq -0x328(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1e3c0
jmp 0x2f07b
leaq -0x50(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x31a0
leaq -0x100(%rbp), %rdi
callq 0x31a0
leaq -0x90(%rbp), %rdi
callq 0x31a0
leaq -0xb0(%rbp), %rdi
callq 0x31a0
leaq -0xd0(%rbp), %rdi
callq 0x31a0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2efc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f17a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f16e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f162
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f156
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f14d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x31a0
leaq -0x100(%rbp), %rdi
callq 0x31a0
leaq -0x90(%rbp), %rdi
callq 0x31a0
leaq -0xb0(%rbp), %rdi
callq 0x31a0
leaq -0xd0(%rbp), %rdi
callq 0x31a0
jmp 0x2f818
movl $0x0, -0x104(%rbp)
movl -0x104(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2f80f
movq -0x20(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x338(%rbp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x338(%rbp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x330(%rbp)
cmpq $0x0, %rax
je 0x2f251
movq -0x330(%rbp), %rax
movq -0x338(%rbp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x348(%rbp)
movq %rax, -0x340(%rbp)
movq -0x340(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x3330
movq -0x350(%rbp), %rax
movq -0x348(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x340(%rbp)
jne 0x2f220
movq -0x330(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x104(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x108(%rbp)
movl -0x108(%rbp), %eax
cmpl -0x104(%rbp), %eax
jge 0x2f2bf
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x104(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x108(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2a338(%rip), %rsi     # 0x595e1
callq 0x3310
movl -0x108(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x108(%rbp)
jmp 0x2f274
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2f4fe
leaq -0x130(%rbp), %rdi
callq 0x3330
movl -0x104(%rbp), %esi
leaq -0x1d0(%rbp), %rdi
callq 0x1e700
jmp 0x2f2f8
leaq 0x29c42(%rip), %rsi     # 0x58f41
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
callq 0x1e930
jmp 0x2f314
leaq 0x29172(%rip), %rdx     # 0x5848d
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x1e560
jmp 0x2f330
movl -0x10c(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x1e700
jmp 0x2f344
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
leaq -0x1f0(%rbp), %rdx
callq 0x1e5b0
jmp 0x2f360
leaq 0x28ab5(%rip), %rdx     # 0x57e1c
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x1e560
jmp 0x2f37c
leaq -0x130(%rbp), %rdi
movq %rdi, -0x358(%rbp)
leaq -0x150(%rbp), %rsi
movq %rsi, -0x360(%rbp)
callq 0x32b0
movq -0x360(%rbp), %rdi
callq 0x31a0
leaq -0x170(%rbp), %rdi
callq 0x31a0
leaq -0x1f0(%rbp), %rdi
callq 0x31a0
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0x1b0(%rbp), %rdi
callq 0x31a0
leaq -0x1d0(%rbp), %rdi
callq 0x31a0
movq -0x358(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x104(%rbp), %rdx
movl %edx, %ecx
movq (%rax,%rdx,8), %rdi
movl -0x10c(%rbp), %eax
addl %ecx, %eax
cltq
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3050
jmp 0x2f418
leaq -0x130(%rbp), %rdi
callq 0x31a0
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x2f2c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f4ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f4e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f4d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f4c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f4bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x31a0
leaq -0x1f0(%rbp), %rdi
callq 0x31a0
leaq -0x190(%rbp), %rdi
callq 0x31a0
leaq -0x1b0(%rbp), %rdi
callq 0x31a0
leaq -0x1d0(%rbp), %rdi
callq 0x31a0
leaq -0x130(%rbp), %rdi
callq 0x31a0
jmp 0x2f818
movl -0x8(%rbp), %eax
addl -0x104(%rbp), %eax
movl %eax, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
movl -0x8(%rbp), %ecx
addl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2f55d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x104(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x1f4(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2a09a(%rip), %rsi     # 0x595e1
callq 0x3310
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0x2f50d
movq -0x28(%rbp), %rax
movq %rax, -0x370(%rbp)
movl -0x104(%rbp), %esi
leaq -0x2d8(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x1e700
movq -0x368(%rbp), %rdx
leaq 0x299b5(%rip), %rsi     # 0x58f44
leaq -0x2b8(%rbp), %rdi
callq 0x1e930
jmp 0x2f59d
leaq 0x299aa(%rip), %rdx     # 0x58f4e
leaq -0x298(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x1e560
jmp 0x2f5b9
movl -0x8(%rbp), %esi
leaq -0x2f8(%rbp), %rdi
callq 0x1e700
jmp 0x2f5ca
leaq -0x278(%rbp), %rdi
leaq -0x298(%rbp), %rsi
leaq -0x2f8(%rbp), %rdx
callq 0x1e5b0
jmp 0x2f5e6
leaq 0x28da3(%rip), %rdx     # 0x58390
leaq -0x258(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x1e560
jmp 0x2f602
movl -0x104(%rbp), %esi
leaq -0x318(%rbp), %rdi
callq 0x1e700
jmp 0x2f616
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x318(%rbp), %rdx
callq 0x1e5b0
jmp 0x2f632
leaq 0x2991a(%rip), %rdx     # 0x58f53
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x1e560
jmp 0x2f64e
movq -0x370(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x1e3c0
jmp 0x2f663
leaq -0x218(%rbp), %rdi
callq 0x31a0
leaq -0x238(%rbp), %rdi
callq 0x31a0
leaq -0x318(%rbp), %rdi
callq 0x31a0
leaq -0x258(%rbp), %rdi
callq 0x31a0
leaq -0x278(%rbp), %rdi
callq 0x31a0
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x298(%rbp), %rdi
callq 0x31a0
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x2f195
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f801
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x2f7ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x31a0
leaq -0x238(%rbp), %rdi
callq 0x31a0
leaq -0x318(%rbp), %rdi
callq 0x31a0
leaq -0x258(%rbp), %rdi
callq 0x31a0
leaq -0x278(%rbp), %rdi
callq 0x31a0
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x298(%rbp), %rdi
callq 0x31a0
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
jmp 0x2f818
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)