// File: /workspace/github_cpp_makefile_star2_O2/Sooryakiran[P]dotV/src/main.cpp
// Function: main
int main(int argc, char * argv[]){
    /*------------------------------------------------------------------------------------------
    Input Validation
    ------------------------------------------------------------------------------------------*/
    if(argc != 5){
        invalid_args(argv[0]);
        return 0;
    }

    if(strcmp(argv[1], "-n") || strcmp(argv[3], "-k")){
        invalid_args(argv[0]);
        return 0;
    }

    string n_str = argv[2];
    string k_str = argv[4];
    int n, k;
    try{
        n = stoi(n_str);
        k = stoi(k_str);
    }
    catch(exception e){
        invalid_args(argv[0]);
        return 0;
    }

    /*------------------------------------------------------------------------------------------
    Create instances of the chips.
    ------------------------------------------------------------------------------------------*/
    WALLACE_TREE_MULTIPLIER_PIPELINED wtm("Sample Adder",
                                         {"input_1", "input_2", "clk"},
                                         "outputs",
                                         n, k);


    /*------------------------------------------------------------------------------------------
    Generate Verilog and write it to file. File save location ./generated_codes/
    ------------------------------------------------------------------------------------------*/
    generate_file("generated_codes/wtm_" + to_string(n) + "_bits_k_" + to_string(k) + ".v", wtm.generate_verilog());
   
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x360, %rsp            # imm = 0x360
movq %rsi, %r15
cmpl $0x5, %edi
jne 0x355b
movq 0x8(%r15), %rax
cmpb $0x2d, (%rax)
jne 0x355b
cmpb $0x6e, 0x1(%rax)
jne 0x355b
cmpb $0x0, 0x2(%rax)
jne 0x355b
movq 0x18(%r15), %rax
cmpb $0x2d, (%rax)
jne 0x355b
cmpb $0x6b, 0x1(%rax)
jne 0x355b
cmpb $0x0, 0x2(%rax)
je 0x3577
movq (%r15), %rdi
callq 0x34c1
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x360, %rsp            # imm = 0x360
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rsi
leaq -0x180(%rbp), %rdi
leaq -0x378(%rbp), %rdx
callq 0x3968
movq 0x20(%r15), %rsi
leaq -0x160(%rbp), %rdi
leaq -0x378(%rbp), %rdx
callq 0x3968
leaq -0x180(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x39a3
movl %eax, %r14d
leaq -0x160(%rbp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x39a3
movl %eax, %ebx
leaq 0x1acb(%rip), %rsi      # 0x509e
leaq -0x140(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x3968
leaq 0x1abe(%rip), %rsi      # 0x50ab
leaq -0x1e0(%rbp), %r15
leaq -0xa0(%rbp), %rdx
movq %r15, %rdi
callq 0x3968
leaq -0x1c0(%rbp), %r12
leaq 0x1aa2(%rip), %rsi      # 0x50b3
leaq -0x80(%rbp), %rdx
movq %r12, %rdi
callq 0x3968
leaq -0x1a0(%rbp), %r12
leaq 0x1a90(%rip), %rsi      # 0x50bb
leaq -0x60(%rbp), %rdx
movq %r12, %rdi
callq 0x3968
leaq -0x40(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
pushq $0x3
popq %rdx
leaq -0x22(%rbp), %rcx
callq 0x39d2
leaq 0x1a6a(%rip), %rsi      # 0x50bf
leaq -0x120(%rbp), %rdi
leaq -0x21(%rbp), %rdx
callq 0x3968
leaq -0x378(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x120(%rbp), %rcx
movl %r14d, %r8d
movl %ebx, %r9d
callq 0x3140
leaq -0x120(%rbp), %rdi
callq 0x30a0
leaq -0x40(%rbp), %rdi
callq 0x3a0c
pushq $0x40
popq %r15
leaq (%r15,%rbp), %rdi
addq $-0x1e0, %rdi           # imm = 0xFE20
callq 0x30a0
addq $-0x20, %r15
cmpq $-0x20, %r15
jne 0x36a2
leaq -0x140(%rbp), %rdi
callq 0x30a0
leaq -0x80(%rbp), %rdi
movl %r14d, %esi
callq 0x3aff
leaq 0x19ec(%rip), %rsi      # 0x50c7
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x3ad1
leaq 0x19ea(%rip), %rdx      # 0x50dc
leaq -0xc0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3a37
leaq -0x60(%rbp), %rdi
movl %ebx, %esi
callq 0x3aff
leaq -0x1e0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x3a60
leaq 0x19b7(%rip), %rdx      # 0x50e5
leaq -0x100(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3a37
leaq -0xe0(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x3040
leaq -0x100(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x33cc
leaq -0xe0(%rbp), %rdi
callq 0x30a0
leaq -0x100(%rbp), %rdi
callq 0x30a0
leaq -0x1e0(%rbp), %rdi
callq 0x30a0
leaq -0x60(%rbp), %rdi
callq 0x30a0
leaq -0xc0(%rbp), %rdi
callq 0x30a0
leaq -0xa0(%rbp), %rdi
callq 0x30a0
leaq -0x80(%rbp), %rdi
callq 0x30a0
leaq -0x378(%rbp), %rdi
callq 0x3e62
pushq $0x1
popq %rbx
leaq -0x160(%rbp), %rdi
callq 0x30a0
leaq -0x180(%rbp), %rdi
callq 0x30a0
jmp 0x3565
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x30a0
jmp 0x37f5
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x30a0
jmp 0x3806
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x30a0
jmp 0x3817
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x30a0
jmp 0x3825
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x30a0
leaq -0xa0(%rbp), %rdi
callq 0x30a0
leaq -0x80(%rbp), %rdi
callq 0x30a0
leaq -0x378(%rbp), %rdi
callq 0x3e62
jmp 0x38cc
movq %rax, %rbx
jmp 0x3831
movq %rax, %rbx
jmp 0x383d
movq %rax, %rbx
jmp 0x3846
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x30a0
jmp 0x3877
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x3a0c
jmp 0x3885
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%r14,%rbp), %rdi
addq $-0x1e0, %rdi           # imm = 0xFE20
callq 0x30a0
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x3889
jmp 0x38c0
jmp 0x38a7
movq %rax, %rbx
addq $-0x20, %r12
movq %r12, %rdi
callq 0x30a0
cmpq %r15, %r12
jne 0x38aa
jmp 0x38c0
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x30a0
leaq -0x160(%rbp), %rdi
callq 0x30a0
leaq -0x180(%rbp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x3240
movq %rax, %rbx
jmp 0x38cc
movq %rax, %rbx
jmp 0x38d8
movq %rax, %rbx
jmp 0x38e4
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x38cc
movq %rbx, %rdi
callq 0x3190
movq 0x36b6(%rip), %rax      # 0x6fc8
addq $0x10, %rax
movq %rax, -0x378(%rbp)
movq %rbx, %rdi
callq 0x3080
movq (%r15), %rdi
callq 0x34c1
leaq -0x378(%rbp), %rdi
callq 0x3280
callq 0x3220
xorl %ebx, %ebx
jmp 0x37c4
jmp 0x38ec
movq %rax, %rbx
leaq -0x378(%rbp), %rdi
callq 0x3280
callq 0x3220
jmp 0x38cc
movq %rax, %rdi
callq 0x39c4