// File: mirkat1206[P]Quine-McCluskey-Petrick-Method/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	if( argc!=3 ) {
		cerr<<"Wrong number of arguments. Please execute as follow : \n"
			<<"./hw1.o <input_file name> <output_file name>"<< endl;
		exit(-1);
	}

	ifstream fin( argv[1] );
	ofstream fout( argv[2] );			

	cout<<"\n***** Quine-McCluskey Algorithm *****"<< endl;
	Quine_McCluskey QM;
	Init( fin , QM );
	QM.Solve();
	QM.Print_Prime_Impli();

	cout<<"\n***** Petrick's Method *****"<< endl;
	Petrick_Method PM( QM.Get_Prime_Impli() , QM.Get_On_Set() );
	PM.Solve();
	PM.Print_POS();
//	PM.Print_SOP();

	cout<<"\n***** All possible fewest-terms results *****"<< endl;
	PM.Print_FewestTerm_P();
	
	cout<<"\n***** Final Answer *****"<< endl;
	Output( fout , QM , PM );
	
	fin.close();
	fout.close();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5a0, %rsp            # imm = 0x5A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x25aa
movq 0x16a7a(%rip), %rdi     # 0x18ff0
leaq 0xea87(%rip), %rsi      # 0x11004
callq 0x21d0
movq %rax, %rdi
leaq 0xeab0(%rip), %rsi      # 0x1103c
callq 0x21d0
movq %rax, %rdi
movq 0x16a25(%rip), %rsi     # 0x18fc0
callq 0x2210
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2250
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x2350
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x418(%rbp), %rdi
movl $0x10, %edx
callq 0x2220
jmp 0x25de
movq 0x169eb(%rip), %rdi     # 0x18fd0
leaq 0xea7d(%rip), %rsi      # 0x11069
callq 0x21d0
movq %rax, -0x570(%rbp)
jmp 0x25fa
movq -0x570(%rbp), %rdi
movq 0x169b8(%rip), %rsi     # 0x18fc0
callq 0x2210
jmp 0x260f
leaq -0x4a8(%rbp), %rdi
callq 0x32e0
jmp 0x261d
leaq -0x218(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x2880
jmp 0x2632
leaq -0x4c0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x3420
jmp 0x2647
leaq -0x4c0(%rbp), %rdi
callq 0x2bc0
leaq -0x4a8(%rbp), %rdi
callq 0x3ec0
jmp 0x2661
movq 0x16968(%rip), %rdi     # 0x18fd0
leaq 0xea21(%rip), %rsi      # 0x11090
callq 0x21d0
movq %rax, -0x578(%rbp)
jmp 0x267d
movq -0x578(%rbp), %rdi
movq 0x16935(%rip), %rsi     # 0x18fc0
callq 0x2210
jmp 0x2692
leaq -0x4a8(%rbp), %rdi
callq 0x3bc0
movq %rax, -0x580(%rbp)
jmp 0x26a7
leaq -0x4a8(%rbp), %rdi
callq 0x3ba0
movq %rax, -0x588(%rbp)
jmp 0x26bc
movq -0x588(%rbp), %rdx
movq -0x580(%rbp), %rsi
leaq -0x538(%rbp), %rdi
callq 0xae40
jmp 0x26d8
leaq -0x568(%rbp), %rdi
leaq -0x538(%rbp), %rsi
callq 0xb150
jmp 0x26ed
leaq -0x568(%rbp), %rdi
callq 0x2c20
leaq -0x538(%rbp), %rdi
callq 0xb810
jmp 0x2707
movq 0x168c2(%rip), %rdi     # 0x18fd0
leaq 0xe999(%rip), %rsi      # 0x110ae
callq 0x21d0
movq %rax, -0x590(%rbp)
jmp 0x2723
movq -0x590(%rbp), %rdi
movq 0x1688f(%rip), %rsi     # 0x18fc0
callq 0x2210
jmp 0x2738
leaq -0x538(%rbp), %rdi
callq 0xbae0
jmp 0x2746
movq 0x16883(%rip), %rdi     # 0x18fd0
leaq 0xe989(%rip), %rsi      # 0x110dd
callq 0x21d0
movq %rax, -0x598(%rbp)
jmp 0x2762
movq -0x598(%rbp), %rdi
movq 0x16850(%rip), %rsi     # 0x18fc0
callq 0x2210
jmp 0x2777
leaq -0x418(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
leaq -0x538(%rbp), %rdx
callq 0x2b60
jmp 0x2793
leaq -0x218(%rbp), %rdi
callq 0x2060
jmp 0x27a1
leaq -0x418(%rbp), %rdi
callq 0x22c0
jmp 0x27af
movl $0x0, -0x4(%rbp)
leaq -0x538(%rbp), %rdi
callq 0xb100
leaq -0x4a8(%rbp), %rdi
callq 0x3340
leaq -0x418(%rbp), %rdi
callq 0x22e0
leaq -0x218(%rbp), %rdi
callq 0x2070
movl -0x4(%rbp), %eax
addq $0x5a0, %rsp            # imm = 0x5A0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x2864
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x2858
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x284c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0x538(%rbp), %rdi
callq 0xb100
leaq -0x4a8(%rbp), %rdi
callq 0x3340
leaq -0x418(%rbp), %rdi
callq 0x22e0
leaq -0x218(%rbp), %rdi
callq 0x2070
movq -0x420(%rbp), %rdi
callq 0x2340
nopl (%rax)