// File: errantlinguist[P]Forecast/src/main.cpp
// Function: main
int main(int argc, char** argv)
{
	int result(EXIT_FAILURE);

	if(argc > 2)
	{
		std::cerr << createUsageMessage(argv[0]);
		result = common::getSysExitCode(common::SysExit::INVALID_COMMAND_LINE);
	}
	else if(argc > 1)
	{
		const char* const& input = argv[1];
		std::ifstream infile(input);
		if(infile)
		{
			std::cerr << "Reading from file path \"" << input
					  << "\"..." << std::endl;
			result = readJsonStream(infile);
		}
		else
		{
			std::cerr << "Reading from URL \"" << input
					  << "\"..." << std::endl;
			result = readUrl(input);
		}
		infile.close();
	}
	else
	{
		std::cerr << createUsageMessage(argv[0]);
		result = common::getSysExitCode(common::SysExit::INVALID_COMMAND_LINE);
	}

	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
cmpl $0x2, -0x8(%rbp)
jle 0xcff4
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0xd220
movq -0x280(%rbp), %rsi
movq 0x90008(%rip), %rdi     # 0x9cfc0
callq 0xa240
jmp 0xcfbf
leaq -0x38(%rbp), %rdi
callq 0xa978
movl $0x40, %edi
callq 0xde60
movl %eax, -0x14(%rbp)
jmp 0xd1fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xa978
jmp 0xd20a
cmpl $0x1, -0x8(%rbp)
jle 0xd19b
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rsi
leaq -0x258(%rbp), %rdi
movl $0x8, %edx
callq 0xa060
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x258(%rbp,%rax), %rdi
callq 0xa2a0
movb %al, -0x281(%rbp)
jmp 0xd042
movb -0x281(%rbp), %al
testb $0x1, %al
jne 0xd051
jmp 0xd0f9
movq 0x8ff68(%rip), %rdi     # 0x9cfc0
leaq 0x59179(%rip), %rsi     # 0x661d8
callq 0xa4a0
movq %rax, -0x290(%rbp)
jmp 0xd06d
movq -0x290(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
callq 0xa4a0
movq %rax, -0x298(%rbp)
jmp 0xd089
movq -0x298(%rbp), %rdi
leaq 0x5915a(%rip), %rsi     # 0x661f1
callq 0xa4a0
movq %rax, -0x2a0(%rbp)
jmp 0xd0a5
movq -0x2a0(%rbp), %rdi
movq 0x8fefd(%rip), %rsi     # 0x9cfb0
callq 0xa800
jmp 0xd0ba
leaq -0x258(%rbp), %rdi
callq 0xd320
movl %eax, -0x2a4(%rbp)
jmp 0xd0ce
movl -0x2a4(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0xd17f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x258(%rbp), %rdi
callq 0xa050
jmp 0xd20a
movq 0x8fec0(%rip), %rdi     # 0x9cfc0
leaq 0x590ef(%rip), %rsi     # 0x661f6
callq 0xa4a0
movq %rax, -0x2b0(%rbp)
jmp 0xd115
movq -0x2b0(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
callq 0xa4a0
movq %rax, -0x2b8(%rbp)
jmp 0xd131
movq -0x2b8(%rbp), %rdi
leaq 0x590b2(%rip), %rsi     # 0x661f1
callq 0xa4a0
movq %rax, -0x2c0(%rbp)
jmp 0xd14d
movq -0x2c0(%rbp), %rdi
movq 0x8fe55(%rip), %rsi     # 0x9cfb0
callq 0xa800
jmp 0xd162
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0xd4e0
movl %eax, -0x2c4(%rbp)
jmp 0xd176
movl -0x2c4(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq -0x258(%rbp), %rdi
callq 0xa510
jmp 0xd18d
leaq -0x258(%rbp), %rdi
callq 0xa050
jmp 0xd1fc
movq -0x10(%rbp), %rsi
leaq -0x278(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0xd220
movq -0x2d0(%rbp), %rsi
movq 0x8fe00(%rip), %rdi     # 0x9cfc0
callq 0xa240
jmp 0xd1c7
leaq -0x278(%rbp), %rdi
callq 0xa978
movl $0x40, %edi
callq 0xde60
movl %eax, -0x14(%rbp)
jmp 0xd1fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x278(%rbp), %rdi
callq 0xa978
jmp 0xd20a
jmp 0xd1fe
movl -0x14(%rbp), %eax
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0xa520
nopw %cs:(%rax,%rax)