// File: temelmertcan[P]multgen/src/pp_gen.cpp
// Function: add_extra_ones_to_pp_matrix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*&, int, std::__cxx11::list<int, std::allocator<int>> const&)
void add_extra_ones_to_pp_matrix (string *& last_row, int col_size, const std::list<int>& extra_ones_indices){

  last_row  = new string[col_size];

  // make sure it is empty..
  for (int i = 0; i<col_size; i++)
    last_row[i] = "";

  for (auto e : extra_ones_indices)
    if (e<col_size)
      last_row[e] = "1'b1";

  // for (int i = 0; i<col_size; i++)
  //   cout << i << " " << last_row[i] << ". ";
  // cout << endl;

  bool carry = false;
  for (int i = 0; i < col_size; i++){

    if (!carry && last_row[i] != ""){
      last_row[i] = "1'b1";
      carry = true;
    } else if (carry && last_row[i] == "") {
      last_row[i] = "1'b1";
    } else if (carry) {
      last_row[i] = "";
    }
  }

  // for (int i = 0; i<col_size; i++)
  //   cout << i << " " << last_row[i] << ". ";
  // cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x58(%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 -0x58(%rbp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x50(%rbp)
cmpq $0x0, %rax
je 0x2e919
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x3330
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x60(%rbp)
jne 0x2e8f7
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2e95c
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2ac95(%rip), %rsi     # 0x595e1
callq 0x3310
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2e92b
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1ea20
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1ea50
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1ea80
testb $0x1, %al
jne 0x2e991
jmp 0x2e9d2
leaq -0x30(%rbp), %rdi
callq 0x1eab0
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2e9c5
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x3c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x296a0(%rip), %rsi     # 0x58060
callq 0x3310
jmp 0x2e9c7
leaq -0x30(%rbp), %rdi
callq 0x1eae0
jmp 0x2e97e
movb $0x0, -0x3d(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2eab9
testb $0x1, -0x3d(%rbp)
jne 0x2ea37
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x44(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2abd9(%rip), %rsi     # 0x595e1
callq 0x1e470
testb $0x1, %al
jne 0x2ea13
jmp 0x2ea37
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x44(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x29634(%rip), %rsi     # 0x58060
callq 0x3310
movb $0x1, -0x3d(%rbp)
jmp 0x2eaa9
testb $0x1, -0x3d(%rbp)
je 0x2ea81
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x44(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2ab8b(%rip), %rsi     # 0x595e1
callq 0x1e4a0
testb $0x1, %al
jne 0x2ea61
jmp 0x2ea81
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x44(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x295e6(%rip), %rsi     # 0x58060
callq 0x3310
jmp 0x2eaa7
testb $0x1, -0x3d(%rbp)
je 0x2eaa5
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movslq -0x44(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq 0x2ab41(%rip), %rsi     # 0x595e1
callq 0x3310
jmp 0x2eaa7
jmp 0x2eaa9
jmp 0x2eaab
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2e9dd
addq $0x70, %rsp
popq %rbp
retq
nop