// File: Sooryakiran[P]dotV/src/verilog.cpp
// Function: FLIP_FLOP::FLIP_FLOP(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<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>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
FLIP_FLOP::FLIP_FLOP(string name, vector<wire> input_wires, wire output_wire){
    this->name = name;
    this->inputs = input_wires;
    this->outputs.push_back(output_wire);

    this->declare("A", CHIP_INPUTS);
    this->declare("CLK", CHIP_INPUTS);
    this->declare("OUT", CHIP_OUTPUTS_REG);

    BehaviourModel flipflop({"posedge CLK"});
    flipflop.add("OUT", "#" + to_string(FLIP_FLOP_DELAY) + " A", N_BLOCK);
    flipflop.num_transistors = FLIP_FLOP_TRANSISTORS; 

    this->add_submodule(flipflop);

    this->definition = this->auto_gen("module FLIP_FLOP");
    this->generate = "FLIP_FLOP " + this->name + " (" + this->inputs.at(0) + ", " + this->inputs.at(1) + ", " + this->outputs.at(0) + " );";

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movq %rsi, -0x348(%rbp)
movq %rdx, -0x360(%rbp)
movq %rcx, -0x358(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x1c4e0
movq -0x350(%rbp), %rdi
movq -0x348(%rbp), %rsi
callq 0x1b0b0
jmp 0x2cdc5
movq -0x360(%rbp), %rsi
movq -0x350(%rbp), %rdi
subq $-0x80, %rdi
callq 0x1c9a0
jmp 0x2cdde
movq -0x358(%rbp), %rsi
movq -0x350(%rbp), %rdi
addq $0x98, %rdi
callq 0x1bc10
jmp 0x2cdfa
leaq -0x51(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x1da80
movq -0x368(%rbp), %rdx
leaq 0x1a8ba(%rip), %rsi     # 0x476d2
leaq -0x50(%rbp), %rdi
callq 0x1d8a0
jmp 0x2ce23
movq -0x350(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x1b740
jmp 0x2ce37
leaq -0x50(%rbp), %rdi
callq 0x1bea0
leaq -0x51(%rbp), %rdi
callq 0x1ca40
leaq -0x79(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x1da80
movq -0x370(%rbp), %rdx
leaq 0x1a866(%rip), %rsi     # 0x476cd
leaq -0x78(%rbp), %rdi
callq 0x1d8a0
jmp 0x2ce72
movq -0x350(%rbp), %rdi
leaq -0x78(%rbp), %rsi
xorl %edx, %edx
callq 0x1b740
jmp 0x2ce86
leaq -0x78(%rbp), %rdi
callq 0x1bea0
leaq -0x79(%rbp), %rdi
callq 0x1ca40
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x1da80
movq -0x378(%rbp), %rdx
leaq 0x1a8c4(%rip), %rsi     # 0x4777d
leaq -0xa0(%rbp), %rdi
callq 0x1d8a0
jmp 0x2cec7
movq -0x350(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x3, %edx
callq 0x1b740
jmp 0x2cee1
leaq -0xa0(%rbp), %rdi
callq 0x1bea0
leaq -0xa1(%rbp), %rdi
callq 0x1ca40
movb $0x1, -0x132(%rbp)
leaq -0x128(%rbp), %rax
movq %rax, -0x388(%rbp)
movq %rax, -0x130(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x1da80
movq -0x388(%rbp), %rdi
movq -0x380(%rbp), %rdx
leaq 0x1a788(%rip), %rsi     # 0x476c5
callq 0x1d8a0
jmp 0x2cf44
movb $0x0, -0x132(%rbp)
leaq -0x128(%rbp), %rax
movq %rax, -0x108(%rbp)
movq $0x1, -0x100(%rbp)
leaq -0x133(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x1b490
movq -0x390(%rbp), %rcx
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x1b4a0
jmp 0x2cf9a
leaq -0xe0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1cce0
jmp 0x2cfaf
leaq -0xf8(%rbp), %rdi
callq 0x1c100
leaq -0x133(%rbp), %rdi
callq 0x1b420
leaq -0x128(%rbp), %rax
movq %rax, -0x3a0(%rbp)
addq $0x20, %rax
movq %rax, -0x398(%rbp)
movq -0x398(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x1bea0
movq -0x3a0(%rbp), %rcx
movq -0x3a8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x398(%rbp)
jne 0x2cfe0
leaq -0x131(%rbp), %rdi
callq 0x1ca40
leaq -0x159(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x1da80
movq -0x3b0(%rbp), %rdx
leaq 0x1a73f(%rip), %rsi     # 0x4777d
leaq -0x158(%rbp), %rdi
callq 0x1d8a0
jmp 0x2d04c
leaq -0x1c0(%rbp), %rdi
movl $0x6, %esi
callq 0x1ced0
jmp 0x2d05f
leaq 0x1a183(%rip), %rsi     # 0x471e9
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rdx
callq 0x1d820
jmp 0x2d07b
leaq 0x1a64f(%rip), %rdx     # 0x476d1
leaq -0x180(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x1b430
jmp 0x2d097
leaq -0xe0(%rbp), %rdi
leaq -0x158(%rbp), %rsi
leaq -0x180(%rbp), %rdx
xorl %ecx, %ecx
callq 0x1cc50
jmp 0x2d0b5
leaq -0x180(%rbp), %rdi
callq 0x1bea0
leaq -0x1a0(%rbp), %rdi
callq 0x1bea0
leaq -0x1c0(%rbp), %rdi
callq 0x1bea0
leaq -0x158(%rbp), %rdi
callq 0x1bea0
leaq -0x159(%rbp), %rdi
callq 0x1ca40
movl $0x12, -0xe0(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1bc00
jmp 0x2d110
movq -0x350(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x1d220
jmp 0x2d125
leaq -0x1f8(%rbp), %rdi
callq 0x1d1c0
leaq -0x239(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x1da80
movq -0x3b8(%rbp), %rdx
leaq 0x1a582(%rip), %rsi     # 0x476d4
leaq -0x238(%rbp), %rdi
callq 0x1d8a0
jmp 0x2d160
movq -0x350(%rbp), %rsi
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rdx
callq 0x1bc40
jmp 0x2d17c
movq -0x350(%rbp), %rdi
addq $0x20, %rdi
leaq -0x218(%rbp), %rsi
movq %rsi, -0x3c0(%rbp)
callq 0x1cd30
movq -0x3c0(%rbp), %rdi
callq 0x1bea0
leaq -0x238(%rbp), %rdi
callq 0x1bea0
leaq -0x239(%rbp), %rdi
callq 0x1ca40
movq -0x350(%rbp), %rdx
leaq 0x1a519(%rip), %rsi     # 0x476e5
leaq -0x340(%rbp), %rdi
callq 0x1c5a0
jmp 0x2d1da
leaq 0x19e6c(%rip), %rdx     # 0x4704d
leaq -0x320(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x1b430
jmp 0x2d1f6
movq -0x350(%rbp), %rdi
subq $-0x80, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1b640
movq %rax, -0x3c8(%rbp)
jmp 0x2d213
movq -0x3c8(%rbp), %rdx
leaq -0x300(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x1d3b0
jmp 0x2d22f
leaq 0x19e1a(%rip), %rdx     # 0x47050
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x1b430
jmp 0x2d24b
movq -0x350(%rbp), %rdi
subq $-0x80, %rdi
movl $0x1, %esi
callq 0x1b640
movq %rax, -0x3d0(%rbp)
jmp 0x2d269
movq -0x3d0(%rbp), %rdx
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x1d3b0
jmp 0x2d285
leaq 0x19dc4(%rip), %rdx     # 0x47050
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x1b430
jmp 0x2d2a1
movq -0x350(%rbp), %rdi
addq $0x98, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1b640
movq %rax, -0x3d8(%rbp)
jmp 0x2d2c1
movq -0x3d8(%rbp), %rdx
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x1d3b0
jmp 0x2d2dd
leaq 0x1a40c(%rip), %rdx     # 0x476f0
leaq -0x260(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x1b430
jmp 0x2d2f9
movq -0x350(%rbp), %rdi
addq $0x40, %rdi
leaq -0x260(%rbp), %rsi
callq 0x1cd30
leaq -0x260(%rbp), %rdi
callq 0x1bea0
leaq -0x280(%rbp), %rdi
callq 0x1bea0
leaq -0x2a0(%rbp), %rdi
callq 0x1bea0
leaq -0x2c0(%rbp), %rdi
callq 0x1bea0
leaq -0x2e0(%rbp), %rdi
callq 0x1bea0
leaq -0x300(%rbp), %rdi
callq 0x1bea0
leaq -0x320(%rbp), %rdi
callq 0x1bea0
leaq -0x340(%rbp), %rdi
callq 0x1bea0
leaq -0xe0(%rbp), %rdi
callq 0x1d1c0
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d3b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x1bea0
leaq -0x51(%rbp), %rdi
callq 0x1ca40
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d3ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1bea0
leaq -0x79(%rbp), %rdi
callq 0x1ca40
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d41e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x1bea0
leaq -0xa1(%rbp), %rdi
callq 0x1ca40
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d4bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d463
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x1c100
leaq -0x133(%rbp), %rdi
callq 0x1b420
leaq -0x128(%rbp), %rax
movq %rax, -0x3e8(%rbp)
addq $0x20, %rax
movq %rax, -0x3e0(%rbp)
movq -0x3e0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x1bea0
movq -0x3e8(%rbp), %rcx
movq -0x3f0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x3e0(%rbp)
jne 0x2d488
jmp 0x2d4bb
leaq -0x131(%rbp), %rdi
callq 0x1ca40
testb $0x1, -0x132(%rbp)
jne 0x2d4d2
jmp 0x2d51f
movq -0x130(%rbp), %rax
leaq -0x128(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x3f8(%rbp)
je 0x2d51d
movq -0x3f8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x400(%rbp)
callq 0x1bea0
movq -0x400(%rbp), %rax
leaq -0x128(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x3f8(%rbp)
jne 0x2d4ec
jmp 0x2d51f
jmp 0x2d6d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d598
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d58c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d580
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d574
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x1bea0
leaq -0x1a0(%rbp), %rdi
callq 0x1bea0
leaq -0x1c0(%rbp), %rdi
callq 0x1bea0
leaq -0x158(%rbp), %rdi
callq 0x1bea0
leaq -0x159(%rbp), %rdi
callq 0x1ca40
jmp 0x2d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x1d1c0
jmp 0x2d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d5fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x1bea0
leaq -0x239(%rbp), %rdi
callq 0x1ca40
jmp 0x2d6c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d6bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d6b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d6a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d698
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d68c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2d680
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x1bea0
leaq -0x2a0(%rbp), %rdi
callq 0x1bea0
leaq -0x2c0(%rbp), %rdi
callq 0x1bea0
leaq -0x2e0(%rbp), %rdi
callq 0x1bea0
leaq -0x300(%rbp), %rdi
callq 0x1bea0
leaq -0x320(%rbp), %rdi
callq 0x1bea0
leaq -0x340(%rbp), %rdi
callq 0x1bea0
leaq -0xe0(%rbp), %rdi
callq 0x1d1c0
movq -0x350(%rbp), %rdi
callq 0x1b6d0
movq -0x28(%rbp), %rdi
callq 0x1da60
nopl (%rax)