// File: /workspace/github_c_makefile_star2_O1/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
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
testl %edi, %edi
jle 0x26de
movq %rsi, %rbx
leaq 0x18(%rsp), %r13
leaq 0x1e8(%rsp), %r15
movl %edi, %ebp
xorl %r12d, %r12d
leaq 0x108(%rsp), %r14
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
leaq 0x48(%rsp), %rdx
callq 0x2bbe
movq %r13, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x2bd2(%rip), %rsi      # 0x516a
leaq 0x2bcc(%rip), %rdx      # 0x516b
callq 0x2c8c
movq 0x108(%rsp), %rcx
movl $0xf, %esi
leaq 0x118(%rsp), %rax
cmpq %rax, %rcx
je 0x25c6
movq 0x118(%rsp), %rsi
movq 0x110(%rsp), %r8
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x25f2
movl $0xf, %esi
cmpq %r13, 0x8(%rsp)
je 0x25ed
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x2601
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x20c0
jmp 0x260f
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21e0
movq %r15, 0x1d8(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x2638
movq %rdx, 0x1d8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x1e8(%rsp)
jmp 0x263f
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x1e0(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x1d8(%rsp), %rsi
movq 0x1e0(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0x20c0
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2696
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x26ad
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x26d2
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21c0
incq %r12
cmpq %r12, %rbp
jne 0x2576
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x2bfc
leaq 0xc8(%rsp), %rdi
callq 0x4212
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x272e
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x28c3(%rip), %rsi      # 0x5004
leaq 0x28c6(%rip), %rdx      # 0x500e
leaq 0xa8(%rsp), %rdi
callq 0x2c8c
leaq 0x8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x41b8
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2784
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2878(%rip), %rsi      # 0x500f
leaq 0x287e(%rip), %rdx      # 0x501c
leaq 0x88(%rsp), %rdi
callq 0x2c8c
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x41b8
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x27da
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x283c(%rip), %rsi      # 0x501d
leaq 0x48(%rsp), %rdi
callq 0x20b0
testl %eax, %eax
je 0x27fd
movq 0x48(%rsp), %rdi
callq 0x2290
movl %eax, %ebx
jmp 0x2802
movl $0x2b11, %ebx           # imm = 0x2B11
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2810(%rip), %rsi      # 0x5022
leaq 0x2813(%rip), %rdx      # 0x502c
leaq 0x68(%rsp), %rdi
callq 0x2c8c
leaq 0xe8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x41b8
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x284c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x27ca(%rip), %rsi      # 0x501d
leaq 0xe8(%rsp), %rdi
callq 0x20b0
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x2dde
leaq 0x27b7(%rip), %rsi      # 0x502d
leaq 0x8(%rsp), %rdi
callq 0x20b0
testl %eax, %eax
je 0x299f
movq 0x8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
movl $0xc, %edx
callq 0x2240
leaq 0x258(%rsp), %rdi
callq 0x2090
testb %al, %al
je 0x29e5
leaq 0x1d8(%rsp), %rbx
leaq 0x7(%rsp), %r14
leaq 0x108(%rsp), %r15
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x1f8(%rsp,%rax)
jne 0x28fe
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2210
movsbl 0x7(%rsp), %esi
movq %r15, %rdi
callq 0x2fb6
jmp 0x28c9
leaq 0x1d8(%rsp), %rdi
callq 0x2080
leaq 0x108(%rsp), %rdi
callq 0x2e9c
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2939
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2954
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x296f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x298b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
xorl %eax, %eax
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x563a(%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 0x290b
movsbl 0x1d8(%rsp), %esi
movq %r15, %rdi
callq 0x2fb6
jmp 0x29b6
movq 0x55dc(%rip), %rdi      # 0x7fc8
leaq 0x2640(%rip), %rsi      # 0x5033
movl $0x20, %edx
callq 0x21f0
movq 0x55c4(%rip), %rdi      # 0x7fc8
callq 0x2110
xorl %edi, %edi
callq 0x2200
jmp 0x2b25
jmp 0x2b20
movq %rax, %rbx
jmp 0x2b42
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b63
movq 0x78(%rsp), %rsi
jmp 0x2b5b
movq %rax, %rbx
jmp 0x2b63
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b7e
movq 0x98(%rsp), %rsi
jmp 0x2b76
movq %rax, %rbx
jmp 0x2b7e
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b99
movq 0xb8(%rsp), %rsi
jmp 0x2b91
jmp 0x2ab4
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b99
movq 0xd8(%rsp), %rsi
jmp 0x2b91
jmp 0x2ab4
movq %rax, %rbx
jmp 0x2b99
movq %rax, %rbx
jmp 0x2afd
movq %rax, %rbx
jmp 0x2ae6
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ae6
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2afd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x2b99
movq 0x118(%rsp), %rsi
jmp 0x2b91
movq %rax, %rbx
jmp 0x2b35
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x2080
leaq 0x108(%rsp), %rdi
callq 0x2e9c
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b63
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b7e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b99
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x38(%rsp), %rax
movq 0x28(%rsp), %rdi
cmpq %rax, %rdi
je 0x2bb5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
nop