// File: /workspace/github_c_makefile_star2_O2/DrYerzinia[P]C_DigiMode/src/NOAA_ATP/NOAA_ATP_main.cpp
// Function: main
int main(int argc, char **argv){

	std::string args;
	for(int i = 0; i < argc; i++) args += std::string(argv[i]) + std::string(" ");
	util::readInArguments(args);

	std::string filename = util::getArgument("--filename");

	std::string sample_rate = util::getArgument("--sample-rate");
	int sample_rate_int = 11025;
	if(sample_rate.compare("NULL")){
		sample_rate_int = atoi(sample_rate.c_str());
	}

	std::string bit_rate = util::getArgument("--bit-rate");
	int bit_rate_int = 1200;
	if(bit_rate.compare("NULL")){
		bit_rate_int = atoi(bit_rate.c_str());
	}

	NOAA_ATP atp(sample_rate_int);

	if(filename.compare("stdin") == 0){
		char c;
		while(std::cin.get(c)){
			if(atp.proccess_byte(c)){
				//
			}
		}
	} else {
		std::fstream input_file(filename.c_str(), std::fstream::in | std::fstream::binary);
		if(!input_file.is_open()){
			std::cout << "Error: Couldn't open input file." << std::endl;
			exit(0);
		}
		char wbuf[1];
		while(!input_file.eof()){
			input_file.read(wbuf, 1);
			if(atp.proccess_byte(wbuf[0])){
				//
			}
		}
	}	
	return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %r12d, %r12d
testl %edi, %edi
cmovlel %r12d, %r14d
movb $0x0, (%rax)
leaq 0x108(%rsp), %r15
leaq 0x8(%rsp), %rbp
leaq 0x1d8(%rsp), %r13
cmpq %r12, %r14
je 0x25f4
movq (%rbx,%r12,8), %rsi
movq %r15, %rdi
leaq 0x28(%rsp), %rdx
callq 0x29ac
movq %rbp, %rdi
leaq 0x2b78(%rip), %rsi      # 0x512a
leaq 0x48(%rsp), %rdx
callq 0x29ac
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x2944
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x2350
movq %r13, %rdi
callq 0x20e0
movq %rbp, %rdi
callq 0x20e0
movq %r15, %rdi
callq 0x20e0
incq %r12
jmp 0x2592
leaq 0xe8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x2240
leaq 0xe8(%rsp), %rdi
callq 0x3d74
leaq 0xe8(%rsp), %rdi
callq 0x20e0
leaq 0x29dd(%rip), %rsi      # 0x5004
leaq 0xc8(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x29ac
leaq 0x8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x3d26
leaq 0xc8(%rsp), %rdi
callq 0x20e0
leaq 0x29ad(%rip), %rsi      # 0x500f
leaq 0xa8(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x29ac
leaq 0x28(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x3d26
leaq 0xa8(%rsp), %rdi
callq 0x20e0
leaq 0x2980(%rip), %rsi      # 0x501d
leaq 0x28(%rsp), %rdi
callq 0x20a0
testl %eax, %eax
je 0x26b9
movq 0x28(%rsp), %rdi
callq 0x2290
movl %eax, %ebx
jmp 0x26be
movl $0x2b11, %ebx           # imm = 0x2B11
leaq 0x295d(%rip), %rsi      # 0x5022
leaq 0x88(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x29ac
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3d26
leaq 0x88(%rsp), %rdi
callq 0x20e0
leaq 0x291d(%rip), %rsi      # 0x501d
leaq 0x48(%rsp), %rdi
callq 0x20a0
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x2b48
leaq 0x290d(%rip), %rsi      # 0x502d
leaq 0x8(%rsp), %rdi
callq 0x20a0
testl %eax, %eax
je 0x27fe
movq 0x8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
pushq $0xc
popq %rdx
callq 0x2230
leaq 0x258(%rsp), %rdi
callq 0x2080
testb %al, %al
je 0x2840
leaq 0x1d8(%rsp), %rbx
leaq 0x7(%rsp), %r14
pushq $0x1
popq %r15
leaq 0x108(%rsp), %r12
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x1f8(%rsp,%rax)
jne 0x27a8
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x21f0
movsbl 0x7(%rsp), %esi
movq %r12, %rdi
callq 0x2c66
jmp 0x2775
leaq 0x1d8(%rsp), %rdi
callq 0x2070
leaq 0x108(%rsp), %rdi
callq 0x2c0c
leaq 0x48(%rsp), %rdi
callq 0x20e0
leaq 0x28(%rsp), %rdi
callq 0x20e0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x68(%rsp), %rdi
callq 0x20e0
xorl %eax, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x57db(%rip), %rbx      # 0x7fe0
leaq 0x1d8(%rsp), %r14
leaq 0x108(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2250
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x27b5
movsbl 0x1d8(%rsp), %esi
movq %r15, %rdi
callq 0x2c66
jmp 0x2815
movq 0x5781(%rip), %rdi      # 0x7fc8
leaq 0x27e5(%rip), %rsi      # 0x5033
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
xorl %edi, %edi
callq 0x21e0
jmp 0x28f7
jmp 0x28bf
movq %rax, %rbx
jmp 0x2914
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x2919
movq %rax, %rbx
jmp 0x291e
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x2923
movq %rax, %rbx
jmp 0x2928
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x292d
jmp 0x28c4
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x292d
jmp 0x28c4
movq %rax, %rbx
jmp 0x2907
movq %rax, %rbx
jmp 0x2932
movq %rax, %rbx
jmp 0x28ed
movq %rax, %rbx
jmp 0x28e3
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x20e0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x108(%rsp), %rdi
jmp 0x292d
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x2070
leaq 0x108(%rsp), %rdi
callq 0x2c0c
leaq 0x48(%rsp), %rdi
callq 0x20e0
leaq 0x28(%rsp), %rdi
callq 0x20e0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x68(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2320