// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0x18dd
movq 0x57ad(%rip), %rsi      # 0x7070
leaq 0x3b2c(%rip), %rdi      # 0x53f6
movb $0x0, %al
callq 0x1050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3b0e(%rip), %rsi      # 0x53fa
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1915
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3af5(%rip), %rsi      # 0x53fd
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x192d
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x11c0
movl $0x0, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2c0c(%rip), %rsi      # 0x4548
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x196a
movq 0x5728(%rip), %rsi      # 0x7078
leaq 0x3a9f(%rip), %rdi      # 0x53f6
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3a8a(%rip), %rsi      # 0x5403
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x19a2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3a71(%rip), %rsi      # 0x5406
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x19d1
leaq 0x3a66(%rip), %rdi      # 0x540f
leaq 0x3a81(%rip), %rsi      # 0x5431
movb $0x0, %al
callq 0x1050
leaq 0x3a78(%rip), %rdi      # 0x5436
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2bd0(%rip), %rsi      # 0x45b0
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1a09
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2bb7(%rip), %rsi      # 0x45b3
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1a1d
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1d90
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2c01(%rip), %rsi      # 0x462d
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1a55
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2be8(%rip), %rsi      # 0x4630
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1a69
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1e10
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2cb1(%rip), %rsi      # 0x4729
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1aa1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2c98(%rip), %rsi      # 0x472c
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1ab5
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1ec0
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2dc0(%rip), %rsi      # 0x4884
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1aed
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2da9(%rip), %rsi      # 0x4889
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1b01
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1f90
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2d15(%rip), %rsi      # 0x4825
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1b39
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2cfc(%rip), %rsi      # 0x4828
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1b4d
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2040
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2e38(%rip), %rsi      # 0x4994
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x1b85
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2e1f(%rip), %rsi      # 0x4997
callq 0x1030
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1bd4
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x20c0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x1ba5
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d7b
cmpl $-0x2, -0x14(%rbp)
jne 0x1bb7
movl $0x0, -0x4(%rbp)
jmp 0x1d7b
movl -0x14(%rbp), %esi
leaq 0x38a3(%rip), %rdi      # 0x5464
movb $0x0, %al
callq 0x1050
movl $0x0, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x324f(%rip), %rsi      # 0x4e32
callq 0x1030
cmpl $0x0, %eax
je 0x1c06
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x323b(%rip), %rsi      # 0x4e37
callq 0x1030
cmpl $0x0, %eax
jne 0x1c1a
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x29b0
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3325(%rip), %rsi      # 0x4f4e
callq 0x1030
cmpl $0x0, %eax
je 0x1c4c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3311(%rip), %rsi      # 0x4f53
callq 0x1030
cmpl $0x0, %eax
jne 0x1c60
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2a80
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x33dd(%rip), %rsi      # 0x504c
callq 0x1030
cmpl $0x0, %eax
jne 0x1c8d
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2b50
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x347b(%rip), %rsi      # 0x5117
callq 0x1030
cmpl $0x0, %eax
jne 0x1cba
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2d20
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3500(%rip), %rsi      # 0x51c9
callq 0x1030
cmpl $0x0, %eax
je 0x1cec
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3786(%rip), %rsi      # 0x5468
callq 0x1030
cmpl $0x0, %eax
jne 0x1cfd
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2e40
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3532(%rip), %rsi      # 0x523e
callq 0x1030
cmpl $0x0, %eax
jne 0x1d27
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2f60
movl %eax, -0x4(%rbp)
jmp 0x1d7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x35b9(%rip), %rsi      # 0x52ef
callq 0x1030
cmpl $0x0, %eax
jne 0x1d51
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3020
movl %eax, -0x4(%rbp)
jmp 0x1d7b
leaq 0x371c(%rip), %rdi      # 0x5474
movb $0x0, %al
callq 0x1050
movq 0x530a(%rip), %rsi      # 0x7070
leaq 0x3689(%rip), %rdi      # 0x53f6
movb $0x0, %al
callq 0x1050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)