// File: /workspace/github_c_makefile_star2_O1/SequentMicrosystems[P]wdt-rpi/src/wdt.c
// Function: main
int main(int argc, char *argv[])
{
	// no argument
	if (argc == 1)
	{
		printf("%s\n", usage);
		return FAIL;
	}

	// Help
	if (0 == strcasecmp(argv[1], "-h") || 0 == strcasecmp(argv[1], "-help"))
	{
		doHelp(argc, argv);
		return OK;
	}

	// Warranty
	if (0 == strcasecmp(argv[1], "-warranty"))
	{
		printf("%s\n", warranty);
		return OK;
	}

	if (0 == strcasecmp(argv[1], "-v") || 0 == strcasecmp(argv[1], "-version"))
	{
		printf("Watchdog Control Software ver %s\n", WDT_SOFTWARE_VER_STR);
		printf("Copyright (c) 2016-2023 Sequent Microsystems\n");
		return OK;
	}

	if (0 == strcasecmp(argv[1], "-r") || 0 == strcasecmp(argv[1], "-reload"))
	{
		return doReload(argc, argv);
	}

	if (0 == strcasecmp(argv[1], "-d") || 0 == strcasecmp(argv[1], "-default"))
	{
		return doDefault(argc, argv);
	}

	if (0 == strcasecmp(argv[1], "-p") || 0 == strcasecmp(argv[1], "-period"))
	{
		return doPeriod(argc, argv);
	}

	if (0 == strcasecmp(argv[1], "-off")
		|| 0 == strcasecmp(argv[1], "-offinterval"))
	{
		return doSetOffTime(argc, argv);
	}

	if (0 == strcasecmp(argv[1], "-c") || 0 == strcasecmp(argv[1], "-clear"))
	{
		return doClear(argc, argv);
	}

	if (0 == strcasecmp(argv[1], "-g") || 0 == strcasecmp(argv[1], "-get"))
	{
		int i = doGet(argc, argv);
		if (i == FAIL)
		{
			return i;
		}
		if (i == NO_PRINT)
		{
			return OK;
		}
		printf("%d\n", i);
		return OK;
	}
	if (strcasecmp(argv[1], "-rob") == 0
		|| strcasecmp(argv[1], "-repoweronbattery") == 0)
	{
		return doSetRepowerOnBattery(argc, argv);
	}
	if (strcasecmp(argv[1], "-pbe") == 0
		|| strcasecmp(argv[1], "-powerbuttonenable") == 0)
	{
		return doSetPowerButtonEnable(argc, argv);
	}
	if (strcasecmp(argv[1], "-rtc") == 0)
	{
		return doSetRtc(argc, argv);
	}
	if (strcasecmp(argv[1], "-bint") == 0)
	{
		return doSetButtonInt(argc, argv);
	}
	if (strcasecmp(argv[1], "-bc") == 0 || strcasecmp(argv[1], "-blockharge") == 0)
	{
		return doBlockCharge(argc, argv);
	}
	if (strcasecmp(argv[1], "-buv") == 0)
	{
		return doUndervoltage(argc, argv);
	}
	if (strcasecmp(argv[1], "-chsel") == 0)
	{
		return doChemSel(argc, argv);
	}
	printf("Invalid argument(s)!\n");
	printf("%s\n", usage);
	return FAIL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x1, %edi
jne 0x1773
movq 0x590c(%rip), %rdi      # 0x7070
callq 0x1040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1a06
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %r14
leaq 0x1e57(%rip), %rsi      # 0x35da
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x19fa
leaq 0x1e43(%rip), %rsi      # 0x35dd
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x19fa
leaq 0x2c7e(%rip), %rsi      # 0x442f
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a36
leaq 0x1e1b(%rip), %rsi      # 0x35e3
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a11
leaq 0x1e07(%rip), %rsi      # 0x35e6
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a11
leaq 0x2bec(%rip), %rsi      # 0x43e2
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a44
leaq 0x1d3b(%rip), %rsi      # 0x3548
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a44
leaq 0x1d2c(%rip), %rsi      # 0x3550
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a83
leaq 0x1d18(%rip), %rsi      # 0x3553
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a83
leaq 0x1d0a(%rip), %rsi      # 0x355c
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a95
leaq 0x1cf6(%rip), %rsi      # 0x355f
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1a95
leaq 0x1cee(%rip), %rsi      # 0x356e
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1aa7
leaq 0x1cdc(%rip), %rsi      # 0x3573
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1aa7
leaq 0x28ef(%rip), %rsi      # 0x419d
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1ab9
leaq 0x1ca2(%rip), %rsi      # 0x3567
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1ab9
leaq 0x1ca4(%rip), %rsi      # 0x3580
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1ac8
leaq 0x1c90(%rip), %rsi      # 0x3583
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1ac8
leaq 0x1c7e(%rip), %rsi      # 0x3588
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1afb
leaq 0x1c6c(%rip), %rsi      # 0x358d
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1afb
leaq 0x1c67(%rip), %rsi      # 0x359f
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b0d
leaq 0x1c55(%rip), %rsi      # 0x35a4
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b0d
leaq 0x1c51(%rip), %rsi      # 0x35b7
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b1f
leaq 0x1c3f(%rip), %rsi      # 0x35bc
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b43
leaq 0x1c2e(%rip), %rsi      # 0x35c2
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b31
leaq 0x1c6f(%rip), %rsi      # 0x361a
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b31
leaq 0x1c04(%rip), %rsi      # 0x35c6
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b55
leaq 0x1bf2(%rip), %rsi      # 0x35cb
movq %r14, %rdi
callq 0x1030
testl %eax, %eax
je 0x1b67
leaq 0x2a65(%rip), %rdi      # 0x4455
callq 0x1040
jmp 0x175d
movl %ebp, %edi
movq %rbx, %rsi
callq 0x11bc
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1bd7(%rip), %rdi      # 0x35ef
leaq 0x1bf2(%rip), %rsi      # 0x3611
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1060
leaq 0x2a3b(%rip), %rdi      # 0x446a
callq 0x1040
jmp 0x1a06
movq 0x563b(%rip), %rdi      # 0x7078
callq 0x1040
jmp 0x1a04
movb $0x0, 0xf(%rsp)
cmpl $0x2, %ebp
jne 0x1a77
leaq 0xf(%rsp), %rsi
movl $0x30, %edi
callq 0x28d3
testl %eax, %eax
jle 0x1769
movl %eax, %edi
xorl %esi, %esi
movl $0xca, %edx
callq 0x2a25
movl %eax, %ebx
jmp 0x1a06
leaq 0x2cc5(%rip), %rdi      # 0x4743
jmp 0x1764
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1b79
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1bea
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1c6d
movl %ebp, %edi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1cde
movl %ebp, %edi
movq %rbx, %rsi
callq 0x1d22
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x1a06
cmpl $-0x2, %ebx
je 0x1a04
leaq 0x1b29(%rip), %rdi      # 0x3616
movl %ebx, %esi
xorl %eax, %eax
callq 0x1060
jmp 0x1a04
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x2342
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x23cb
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x245a
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x2689
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x25d6
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x273c
movl %ebp, %edi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x27be