// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x508, %rsp            # imm = 0x508
movl $0x0, 0x504(%rsp)
movl %edi, 0x500(%rsp)
movq %rsi, 0x4f8(%rsp)
leaq 0x4d8(%rsp), %rdi
callq 0x3340
movl $0x0, 0x4d4(%rsp)
movl 0x4d4(%rsp), %eax
cmpl 0x500(%rsp), %eax
jge 0x38c7
movq 0x4f8(%rsp), %rax
movslq 0x4d4(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x58(%rsp)
leaq 0x48f(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x3450
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x490(%rsp), %rdi
callq 0x3f50
jmp 0x3771
leaq 0x457(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x3450
movq 0x50(%rsp), %rdx
leaq 0x6987(%rip), %rsi      # 0xa116
leaq 0x458(%rsp), %rdi
callq 0x3f50
jmp 0x379e
leaq 0x4b0(%rsp), %rdi
leaq 0x490(%rsp), %rsi
leaq 0x458(%rsp), %rdx
callq 0x3e60
jmp 0x37bd
leaq 0x4d8(%rsp), %rdi
leaq 0x4b0(%rsp), %rsi
callq 0x3300
jmp 0x37d4
leaq 0x4b0(%rsp), %rdi
callq 0x3140
leaq 0x458(%rsp), %rdi
callq 0x3140
leaq 0x457(%rsp), %rdi
callq 0x3280
leaq 0x490(%rsp), %rdi
callq 0x3140
leaq 0x48f(%rsp), %rdi
callq 0x3280
movl 0x4d4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4d4(%rsp)
jmp 0x3719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x38b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x389b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x388e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x4b0(%rsp), %rdi
callq 0x3140
leaq 0x458(%rsp), %rdi
callq 0x3140
leaq 0x457(%rsp), %rdi
callq 0x3280
leaq 0x490(%rsp), %rdi
callq 0x3140
leaq 0x48f(%rsp), %rdi
callq 0x3280
jmp 0x3e39
leaq 0x430(%rsp), %rdi
leaq 0x4d8(%rsp), %rsi
callq 0x30f0
jmp 0x38de
leaq 0x430(%rsp), %rdi
callq 0x8b80
jmp 0x38ed
leaq 0x430(%rsp), %rdi
callq 0x3140
leaq 0x3ef(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x3450
movq 0x48(%rsp), %rdx
leaq 0x66ec(%rip), %rsi      # 0xa004
leaq 0x3f0(%rsp), %rdi
callq 0x3f50
jmp 0x3927
leaq 0x410(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x8ab0
jmp 0x393e
leaq 0x3f0(%rsp), %rdi
callq 0x3140
leaq 0x3ef(%rsp), %rdi
callq 0x3280
leaq 0x3a7(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x3450
movq 0x40(%rsp), %rdx
leaq 0x6699(%rip), %rsi      # 0xa00f
leaq 0x3a8(%rsp), %rdi
callq 0x3f50
jmp 0x3985
leaq 0x3c8(%rsp), %rdi
leaq 0x3a8(%rsp), %rsi
callq 0x8ab0
jmp 0x399c
leaq 0x3a8(%rsp), %rdi
callq 0x3140
leaq 0x3a7(%rsp), %rdi
callq 0x3280
movl $0x2b11, 0x3a0(%rsp) # imm = 0x2B11
leaq 0x3c8(%rsp), %rdi
leaq 0x664d(%rip), %rsi      # 0xa01d
callq 0x30b0
cmpl $0x0, %eax
je 0x3ad0
leaq 0x3c8(%rsp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x3390
movl %eax, 0x3a0(%rsp)
jmp 0x3ad0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3e39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x430(%rsp), %rdi
callq 0x3140
jmp 0x3e39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3a75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x3f0(%rsp), %rdi
callq 0x3140
leaq 0x3ef(%rsp), %rdi
callq 0x3280
jmp 0x3e39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3abe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x3a8(%rsp), %rdi
callq 0x3140
leaq 0x3a7(%rsp), %rdi
callq 0x3280
jmp 0x3e2c
leaq 0x35f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x3450
movq 0x38(%rsp), %rdx
leaq 0x6534(%rip), %rsi      # 0xa022
leaq 0x360(%rsp), %rdi
callq 0x3f50
jmp 0x3afd
leaq 0x380(%rsp), %rdi
leaq 0x360(%rsp), %rsi
callq 0x8ab0
jmp 0x3b14
leaq 0x360(%rsp), %rdi
callq 0x3140
leaq 0x35f(%rsp), %rdi
callq 0x3280
movl $0x4b0, 0x358(%rsp) # imm = 0x4B0
leaq 0x380(%rsp), %rdi
leaq 0x64d5(%rip), %rsi      # 0xa01d
callq 0x30b0
cmpl $0x0, %eax
je 0x3bb9
leaq 0x380(%rsp), %rdi
callq 0x30e0
movq %rax, %rdi
callq 0x3390
movl %eax, 0x358(%rsp)
jmp 0x3bb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3ba7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x360(%rsp), %rdi
callq 0x3140
leaq 0x35f(%rsp), %rdi
callq 0x3280
jmp 0x3e1f
movl 0x3a0(%rsp), %esi
leaq 0x288(%rsp), %rdi
callq 0x4430
jmp 0x3bcf
leaq 0x410(%rsp), %rdi
leaq 0x644f(%rip), %rsi      # 0xa02d
callq 0x30b0
cmpl $0x0, %eax
jne 0x3c90
jmp 0x3bee
movq 0xb3eb(%rip), %rdi      # 0xefe0
leaq 0x287(%rsp), %rsi
callq 0x3330
movq %rax, 0x30(%rsp)
jmp 0x3c09
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32e0
movb %al, 0x2f(%rsp)
jmp 0x3c23
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x3c2d
jmp 0x3c8b
movsbl 0x287(%rsp), %esi
leaq 0x288(%rsp), %rdi
callq 0x4600
movb %al, 0x2e(%rsp)
jmp 0x3c48
movb 0x2e(%rsp), %al
testb $0x1, %al
jne 0x3c52
jmp 0x3c86
jmp 0x3c86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3e12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0x3e05
jmp 0x3bee
jmp 0x3daa
leaq 0x410(%rsp), %rdi
callq 0x30e0
movq %rax, 0x20(%rsp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x4010
movl %eax, 0x28(%rsp)
jmp 0x3cb7
movl 0x28(%rsp), %edx
movq 0x20(%rsp), %rsi
leaq 0x70(%rsp), %rdi
callq 0x3320
jmp 0x3ccc
leaq 0x70(%rsp), %rdi
callq 0x3410
movb %al, 0x1f(%rsp)
jmp 0x3cdc
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x3d3d
jmp 0x3ce6
movq 0xb2db(%rip), %rdi      # 0xefc8
leaq 0x633f(%rip), %rsi      # 0xa033
callq 0x3220
movq %rax, 0x10(%rsp)
jmp 0x3d00
movq 0x10(%rsp), %rdi
movq 0xb2ac(%rip), %rsi      # 0xefb8
callq 0x3260
jmp 0x3d13
xorl %edi, %edi
callq 0x32c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x3090
jmp 0x3e05
jmp 0x3d3f
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x70(%rsp,%rax), %rdi
callq 0x3470
movb %al, 0xf(%rsp)
jmp 0x3d58
movb 0xf(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3d64
jmp 0x3da0
leaq 0x70(%rsp), %rdi
leaq 0x6f(%rsp), %rsi
movl $0x1, %edx
callq 0x32f0
jmp 0x3d7a
movsbl 0x6f(%rsp), %esi
leaq 0x288(%rsp), %rdi
callq 0x4600
movb %al, 0xe(%rsp)
jmp 0x3d92
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x3d9c
jmp 0x3d9e
jmp 0x3d9e
jmp 0x3d3f
leaq 0x70(%rsp), %rdi
callq 0x3090
movl $0x0, 0x504(%rsp)
leaq 0x288(%rsp), %rdi
callq 0x4570
leaq 0x380(%rsp), %rdi
callq 0x3140
leaq 0x3c8(%rsp), %rdi
callq 0x3140
leaq 0x410(%rsp), %rdi
callq 0x3140
leaq 0x4d8(%rsp), %rdi
callq 0x3140
movl 0x504(%rsp), %eax
addq $0x508, %rsp            # imm = 0x508
retq
leaq 0x288(%rsp), %rdi
callq 0x4570
leaq 0x380(%rsp), %rdi
callq 0x3140
leaq 0x3c8(%rsp), %rdi
callq 0x3140
leaq 0x410(%rsp), %rdi
callq 0x3140
leaq 0x4d8(%rsp), %rdi
callq 0x3140
movq 0x480(%rsp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)
nopl (%rax)