// File: /workspace/github_c_makefile_star2_O2/anuwu[P]ERPLAG-Compiler/erplag.c
// Function: checkCommand
void checkCommand (int argc, char **argv, char **outputFile)
{
	if (argc == 1)
	{
		errFatal () ;
		printf ("No source file\n") ;
		exit (1) ;
	}

	if (argc != 2 && argc != 3)
	{
		errFatal () ;
		printf ("Incorrect number of arguments\n") ;
		exit (1) ;
	}

	int len = strlen (argv[1]) ;
	if (!(len > 4 && argv[1][len-1] == 'p' && argv[1][len-2] == 'r' && argv[1][len-3] == 'e' && argv[1][len-4] == '.'))
	{
		errFatal () ;
		#if defined __linux__ || defined __MACH__
			printf ("Unsupported source format. Use file with " ANSI_BOLD ".erp" ANSI_RESET " extension\n") ;
		#endif
		#ifdef _WIN64
			printf ("Unsupported source format. Use file with .erp extension\n") ;
		#endif
		exit (1) ;
	}

	if (argc == 2)
	{
		*outputFile = (char *) malloc (sizeof(char) * (len + 1)) ;
		strcpy (*outputFile, argv[1]) ;

		(*outputFile)[len - 1] = 'm' ;
		(*outputFile)[len - 2] = 's' ;
		(*outputFile)[len - 3] = 'a' ;
	}
	else if (argc == 3)
	{
		len = strlen (argv[2]) ;
		if (!(len > 4 && argv[2][len-1] == 'm' && argv[2][len-2] == 's' && argv[2][len-3] == 'a' && argv[2][len-4] == '.'))
		{
			errFatal () ;
			#if defined __linux__ || defined __MACH__
				printf ("Unsupported output format. Use " ANSI_BOLD ".asm" ANSI_RESET " extension\n") ;
			#endif
			#ifdef _WIN64
				printf ("Unsupported output format. Use .asm extension\n") ;
			#endif
			exit (1) ;
		}

		*outputFile = argv[2] ;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x1, %edi
je 0x13c2
movl %edi, %r15d
movq %rdx, -0x30(%rbp)
leal -0x4(%r15), %eax
cmpl $-0x3, %eax
jbe 0x13d2
movq %rsi, -0x38(%rbp)
movq 0x8(%rsi), %r12
movq %r12, %rdi
callq 0x10a0
cmpl $0x5, %eax
jl 0x13a2
leal -0x1(%rax), %ebx
cmpb $0x70, (%r12,%rbx)
jne 0x13a2
movl $0xfffffffc, %ecx       # imm = 0xFFFFFFFC
leal (%rcx,%rax), %r13d
addl $0x2, %r13d
cmpb $0x72, (%r12,%r13)
jne 0x13a2
leal (%rcx,%rax), %r14d
incl %r14d
cmpb $0x65, (%r12,%r14)
jne 0x13a2
addl %eax, %ecx
cmpb $0x2e, (%r12,%rcx)
jne 0x13a2
cmpl $0x2, %r15d
jne 0x1343
incl %eax
movq %rax, %rdi
callq 0x1110
movq %rax, %r15
movq -0x30(%rbp), %rax
movq %r15, (%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x1050
movb $0x6d, (%r15,%rbx)
movb $0x73, (%r15,%r13)
movb $0x61, (%r15,%r14)
jmp 0x1393
movq -0x38(%rbp), %rax
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x10a0
movl $0xfffffffc, %edx       # imm = 0xFFFFFFFC
cmpl $0x5, %eax
jl 0x13b2
leal (%rdx,%rax), %ecx
addl $0x3, %ecx
cmpb $0x6d, (%r14,%rcx)
jne 0x13b2
leal (%rdx,%rax), %ecx
addl $0x2, %ecx
cmpb $0x73, (%r14,%rcx)
jne 0x13b2
leal (%rdx,%rax), %ecx
incl %ecx
cmpb $0x61, (%r14,%rcx)
jne 0x13b2
addl %edx, %eax
cmpb $0x2e, (%r14,%rax)
jne 0x13b2
movq -0x30(%rbp), %rax
movq %r14, (%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
callq 0xd60f
leaq 0xcc9f(%rip), %rdi      # 0xe04f
jmp 0x13e0
xorl %eax, %eax
callq 0xd60f
leaq 0xcccf(%rip), %rdi      # 0xe08f
jmp 0x13e0
xorl %eax, %eax
callq 0xd60f
leaq 0xcd13(%rip), %rdi      # 0xe0e3
jmp 0x13e0
xorl %eax, %eax
callq 0xd60f
leaq 0xcce5(%rip), %rdi      # 0xe0c5
callq 0x1070
pushq $0x1
popq %rdi
callq 0x1150