// File: Sooryakiran[P]dotV/src/verilog.cpp
// Function: BehaviourModel::code[abi:cxx11]()
string BehaviourModel::code(){
    /*------------------------------------------------------------------------------------------
    TReturns the verilog code for the current behaviour as string.

    Returns: outs(string), verilog code for the current behaviour.
    ------------------------------------------------------------------------------------------*/
    string outs = "always @(";
    
    for(vector<string>::iterator i = this->sensitivity_list.begin(); i != this->sensitivity_list.end(); i++){
        if(i != this->sensitivity_list.begin()){
            outs += " or ";
        }
        outs += *i;
    }
    outs += ")\nbegin";

    for(vector<string>::iterator i = this->statements.begin(); i != this->statements.end(); i++){
        outs += "\n\t" + *i + ";";
    }
    outs +="\nend";
    return outs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xb0(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x12(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x1da80
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
leaq 0x2711f(%rip), %rsi     # 0x47127
callq 0x1d8a0
jmp 0x2000f
leaq -0x12(%rbp), %rdi
callq 0x1ca40
movq -0xb8(%rbp), %rdi
addq $0x20, %rdi
callq 0x1d760
movq %rax, -0x30(%rbp)
movq -0xb8(%rbp), %rdi
addq $0x20, %rdi
callq 0x1d800
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1cf30
testb $0x1, %al
jne 0x20056
jmp 0x200ef
movq -0xb8(%rbp), %rdi
addq $0x20, %rdi
callq 0x1d760
movq %rax, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1cf30
testb $0x1, %al
jne 0x2007d
jmp 0x200bf
movq -0xb0(%rbp), %rdi
leaq 0x270a6(%rip), %rsi     # 0x47131
callq 0x1c730
jmp 0x20092
jmp 0x200bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x1ca40
jmp 0x20232
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x20226
leaq -0x30(%rbp), %rdi
callq 0x1ddc0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x1ce20
jmp 0x200d9
jmp 0x200db
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x1b860
movq %rax, -0x48(%rbp)
jmp 0x2002c
movq -0xb0(%rbp), %rdi
leaq 0x27039(%rip), %rsi     # 0x47136
callq 0x1c730
jmp 0x20104
movq -0xb8(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d760
movq %rax, -0x50(%rbp)
movq -0xb8(%rbp), %rdi
addq $0x8, %rdi
callq 0x1d800
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1cf30
testb $0x1, %al
jne 0x20142
jmp 0x201eb
leaq -0x50(%rbp), %rdi
callq 0x1ddc0
movq %rax, %rdx
leaq 0x26fba(%rip), %rsi     # 0x4710f
leaq -0x98(%rbp), %rdi
callq 0x1c5a0
jmp 0x20163
leaq 0x27588(%rip), %rdx     # 0x476f2
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x1b430
jmp 0x2017c
movq -0xb0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x1ce20
jmp 0x2018e
leaq -0x78(%rbp), %rdi
callq 0x1bea0
leaq -0x98(%rbp), %rdi
callq 0x1bea0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1b860
movq %rax, -0xa0(%rbp)
jmp 0x20118
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x201dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1bea0
leaq -0x98(%rbp), %rdi
callq 0x1bea0
jmp 0x20226
movq -0xb0(%rbp), %rdi
leaq 0x26f45(%rip), %rsi     # 0x4713e
callq 0x1c730
jmp 0x20200
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x20216
movq -0xb0(%rbp), %rdi
callq 0x1bea0
movq -0xc0(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0xb0(%rbp), %rdi
callq 0x1bea0
movq -0x20(%rbp), %rdi
callq 0x1da60
nopl (%rax,%rax)