// File: /workspace/github_c_makefile_star2_O3/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), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
testl %edi, %edi
jle 0x26f1
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 0x2bce
movq %r13, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x2bce(%rip), %rsi      # 0x516a
leaq 0x2bc8(%rip), %rdx      # 0x516b
callq 0x2ca2
movq 0x108(%rsp), %rcx
movl $0xf, %edi
leaq 0x118(%rsp), %rax
cmpq %rax, %rcx
je 0x25ca
movq 0x118(%rsp), %rdi
movq 0x110(%rsp), %r8
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
jbe 0x25f9
movl $0xf, %edi
cmpq %r13, %rsi
je 0x25f4
movq 0x18(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x2603
movq %r14, %rdi
callq 0x20c0
jmp 0x2611
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 0x263a
movq %rdx, 0x1d8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x1e8(%rsp)
jmp 0x2641
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 0x2698
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x26af
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x26d4
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21c0
incq %r12
cmpq %r12, %rbp
jne 0x257a
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
leaq 0x38(%rsp), %r12
jmp 0x26f6
xorl %edx, %edx
movq %r12, %rsi
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x2c0c
leaq 0xc8(%rsp), %rdi
callq 0x42d6
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x273c
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x28b5(%rip), %rsi      # 0x5004
leaq 0x28b8(%rip), %rdx      # 0x500e
leaq 0xa8(%rsp), %rdi
callq 0x2ca2
leaq 0x8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x427c
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2792
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x286a(%rip), %rsi      # 0x500f
leaq 0x2870(%rip), %rdx      # 0x501c
leaq 0x88(%rsp), %rdi
callq 0x2ca2
leaq 0x48(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x427c
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x27e8
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x282e(%rip), %rsi      # 0x501d
leaq 0x48(%rsp), %rdi
callq 0x20b0
testl %eax, %eax
je 0x280b
movq 0x48(%rsp), %rdi
callq 0x2290
movl %eax, %ebx
jmp 0x2810
movl $0x2b11, %ebx           # imm = 0x2B11
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2802(%rip), %rsi      # 0x5022
leaq 0x2805(%rip), %rdx      # 0x502c
leaq 0x68(%rsp), %rdi
callq 0x2ca2
leaq 0xe8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x427c
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x285a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x27bc(%rip), %rsi      # 0x501d
leaq 0xe8(%rsp), %rdi
callq 0x20b0
leaq 0x108(%rsp), %rdi
movl %ebx, %esi
callq 0x2dfa
leaq 0x27a9(%rip), %rsi      # 0x502d
leaq 0x8(%rsp), %rdi
callq 0x20b0
testl %eax, %eax
je 0x29a8
movq 0x8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
movl $0xc, %edx
callq 0x2240
leaq 0x258(%rsp), %rdi
callq 0x2090
testb %al, %al
je 0x29ee
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 0x290c
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2210
movsbl 0x7(%rsp), %esi
movq %r15, %rdi
callq 0x2fd2
jmp 0x28d7
leaq 0x1d8(%rsp), %rdi
callq 0x2080
leaq 0x108(%rsp), %rdi
callq 0x2eb8
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2947
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2962
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x297d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2994
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 0x5631(%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 0x2919
movsbl 0x1d8(%rsp), %esi
movq %r15, %rdi
callq 0x2fd2
jmp 0x29bf
movq 0x55d3(%rip), %rdi      # 0x7fc8
leaq 0x2637(%rip), %rsi      # 0x5033
movl $0x20, %edx
callq 0x21f0
movq 0x55bb(%rip), %rdi      # 0x7fc8
callq 0x2110
xorl %edi, %edi
callq 0x2200
jmp 0x2b3a
jmp 0x2b35
movq %rax, %rbx
jmp 0x2b57
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b78
movq 0x78(%rsp), %rsi
jmp 0x2b70
movq %rax, %rbx
jmp 0x2b78
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b93
movq 0x98(%rsp), %rsi
jmp 0x2b8b
movq %rax, %rbx
jmp 0x2b93
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2bae
movq 0xb8(%rsp), %rsi
jmp 0x2ba6
jmp 0x2abb
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2bae
movq 0xd8(%rsp), %rsi
jmp 0x2ba6
movq %rax, %rbx
jmp 0x2bae
movq %rax, %rbx
jmp 0x2b2e
movq %rax, %rbx
jmp 0x2b09
movq %rax, %rbx
jmp 0x2af2
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2af2
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2b09
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x2b2e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x38(%rsp), %r12
jmp 0x2bae
movq %rax, %rbx
jmp 0x2b4a
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x2080
leaq 0x108(%rsp), %rdi
callq 0x2eb8
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b78
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b93
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bae
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2bc5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
nop