// File: /workspace/github_c_makefile_star2_O1/rajatxjain[P]gpiocfg/gpiocfg.c
// Function: main
int main(int argc, char **argv)
{
	int c;
        struct community *cmty = NULL;
        unsigned int pin_no_in_cmty;
	u_int32_t dw0 = 0, dw1 = 0;
	char pin_name[MAX_PIN_NAME_WIDTH] = "";

	if (argc <= 1) {
		usage(argv[0]);
		return -1;
	}

	while (1) {
		static struct option long_options[] = {
			{"platform", required_argument, 0, 'p'},
			{"read", required_argument, 0, 'r'},
			{"value", required_argument, 0, 'v'},
			{"list", no_argument, 0, 'l'},
			{"help", no_argument, 0, 'h'},
			{0, 0, 0, 0}
		};
		int option_index = 0;
		c = getopt_long (argc, argv, "p:r:v:lh", long_options,
				 &option_index);
		if (c == -1)
			break;

		switch (c) {
		case 'p':
			printf("Platform requested            : %s\n", optarg);
			platform = lookup_platform(optarg);
			break;
		case 'r':
			printf("Pin lookup requested for pin  : %s\n", optarg);
			if (!lookup_pin(optarg, &cmty, &pin_no_in_cmty)) {
				printf("Pin lookup failure: %s\n", optarg);
				return -1;
			}
			strcpy(pin_name, optarg);
			break;
		case 'v':
			dw0 = (u_int32_t) strtoul(optarg, NULL, 0);
			printf("DW0 Value parse requested for : 0x%08X\n", dw0);
			break;
		case 'l':
			list_gpios();
			return 0;
		case 'h':
		case '?':
			/* getopt_long already printed an error message. */
		default:
			usage(argv[0]);
			return -1;
		}
	}
	if (!cmty && !dw0) {
		usage(argv[0]);
		return -1;
	}
		

	printf("Platform : %s\n", platform->name);

	if (cmty)
		read_pin_pad(pin_name, &dw0, &dw1);

	parse_dw0(dw0);
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq $0x0, -0x58(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
cmpl $0x2, %edi
jge 0x122d
movq (%r15), %rdi
callq 0x1a1b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x19df
movl %edi, %r12d
leaq 0xe3c(%rip), %r14       # 0x2073
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r15, -0x48(%rbp)
movl %edi, -0x2c(%rbp)
movl $0x0, -0x38(%rbp)
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
leaq 0x2e76(%rip), %rcx      # 0x40d0
leaq -0x38(%rbp), %r8
callq 0x1060
cmpl $-0x1, %eax
je 0x1361
addl $-0x6c, %eax
rorl %eax
cmpl $0x5, %eax
ja 0x143a
leaq 0xd83(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2e2f(%rip), %rax      # 0x40c0
movq (%rax), %rsi
xorl %ebx, %ebx
leaq 0xe67(%rip), %rdi       # 0x2104
xorl %eax, %eax
callq 0x1070
leaq 0x186b(%rip), %rdi      # 0x2b16
callq 0x1040
movq 0x2e09(%rip), %rax      # 0x40c0
movl $0x1, %ecx
cmpl $0x0, 0x28(%rax)
je 0x1483
movq %r13, -0x60(%rbp)
movl $0x10, %ecx
movq %rcx, -0x50(%rbp)
xorl %r12d, %r12d
movq 0x30(%rax), %r14
imulq $0x1010, %r12, %r15     # imm = 0x1010
movq (%r14,%r15), %rsi
leaq 0xe5e(%rip), %rdi       # 0x214a
xorl %eax, %eax
callq 0x1070
cmpl $0x0, 0xc(%r14,%r15)
leaq 0xe50(%rip), %r13       # 0x2150
je 0x1328
addq %r14, %r15
addq -0x50(%rbp), %r14
xorl %ebx, %ebx
movq %r13, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
incq %rbx
movl 0xc(%r15), %eax
addq $0x20, %r14
cmpq %rax, %rbx
jb 0x130b
incq %r12
movq 0x2d8e(%rip), %rax      # 0x40c0
movl 0x28(%rax), %ecx
addq $0x1010, -0x50(%rbp)    # imm = 0x1010
cmpq %rcx, %r12
jb 0x12d6
xorl %ebx, %ebx
movq -0x60(%rbp), %r13
movq -0x48(%rbp), %r15
movl -0x2c(%rbp), %r12d
leaq 0xd1c(%rip), %r14       # 0x2073
movl $0x1, %ecx
jmp 0x1483
movl $0x3, %ecx
jmp 0x1483
movq 0x2c6e(%rip), %r14      # 0x3fe0
movq (%r14), %rsi
leaq 0xd24(%rip), %rdi       # 0x20a0
xorl %eax, %eax
callq 0x1070
movq (%r14), %r14
movq %r14, %rdi
leaq -0x58(%rbp), %rsi
leaq -0x64(%rbp), %rdx
callq 0x1a85
testl %eax, %eax
je 0x1461
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x1030
xorl %ecx, %ecx
jmp 0x147c
movq 0x2c25(%rip), %r14      # 0x3fe0
movq (%r14), %rsi
leaq 0xcb7(%rip), %rdi       # 0x207c
xorl %eax, %eax
callq 0x1070
movq (%r14), %r14
movq 0x2cba(%rip), %r15      # 0x4090
testq %r15, %r15
je 0x19f0
movl $0x1, %r12d
movq (%r15), %rdi
movq %r14, %rsi
callq 0x1090
testl %eax, %eax
je 0x144e
movl %r12d, %eax
leaq 0x2c92(%rip), %rcx      # 0x4090
movq (%rcx,%rax,8), %r15
incl %r12d
testq %r15, %r15
jne 0x13e5
jmp 0x19f0
movq 0x2bca(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10c0
movq %rax, %r13
leaq 0xcb0(%rip), %rdi       # 0x20dc
movl %r13d, %esi
xorl %eax, %eax
callq 0x1070
xorl %ecx, %ecx
jmp 0x1483
movq (%r15), %rdi
callq 0x1a1b
movl $0x1, %ecx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1483
movq %r15, 0x2c6b(%rip)      # 0x40c0
xorl %ecx, %ecx
movq -0x48(%rbp), %r15
movl -0x2c(%rbp), %r12d
jmp 0x147c
leaq 0xc5c(%rip), %rdi       # 0x20c4
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
movl $0x1, %ecx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0xbf0(%rip), %r14       # 0x2073
testl %ecx, %ecx
je 0x1243
cmpl $0x3, %ecx
jne 0x19df
movq -0x58(%rbp), %rbx
testq %rbx, %rbx
setne %al
testl %r13d, %r13d
setne %cl
orb %al, %cl
je 0x121b
movq 0x2c0d(%rip), %rax      # 0x40c0
movq (%rax), %rsi
leaq 0xc47(%rip), %rdi       # 0x2104
xorl %eax, %eax
callq 0x1070
testq %rbx, %rbx
je 0x15ba
leaq -0x90(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x1a85
testl %eax, %eax
je 0x1a0b
leaq 0xc66(%rip), %rdi       # 0x2156
leaq -0x90(%rbp), %rsi
xorl %eax, %eax
callq 0x1070
movq -0x38(%rbp), %r14
movq (%r14), %rsi
leaq 0xc63(%rip), %rdi       # 0x216f
xorl %eax, %eax
callq 0x1070
movl 0x8(%r14), %esi
leaq 0xc6a(%rip), %rdi       # 0x2188
xorl %eax, %eax
callq 0x1070
movl -0x3c(%rbp), %ebx
leaq 0xc74(%rip), %rdi       # 0x21a3
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1070
movq 0x2b7f(%rip), %rax      # 0x40c0
movl 0x8(%r14), %ecx
imulq 0x10(%rax), %rcx
addq 0x8(%rax), %rcx
addq 0x18(%rax), %rcx
imulq 0x20(%rax), %rbx
leaq (%rcx,%rbx), %r14
addq %rcx, %rbx
addq $0x4, %rbx
leaq 0xc5b(%rip), %rdi       # 0x21c4
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
leaq 0xc6d(%rip), %rdi       # 0x21e7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1070
movq %r14, %rdi
callq 0x1b48
movl %eax, %r13d
movq %rbx, %rdi
callq 0x1b48
movl %eax, %ebx
leaq 0xc6b(%rip), %rdi       # 0x220b
movl %r13d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xc76(%rip), %rdi       # 0x2227
movl %ebx, %esi
xorl %eax, %eax
callq 0x1070
leaq 0x13e7(%rip), %rdi      # 0x29a8
callq 0x1040
movq %r13, %r14
movl %r14d, %r13d
movl %r14d, %ebx
shrl $0x1e, %ebx
leaq 0xc94(%rip), %rdi       # 0x226d
leaq 0xca8(%rip), %rcx       # 0x2288
movl $0x1f, %esi
movl $0x1e, %edx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1070
leaq 0xa21(%rip), %rax       # 0x201c
movslq (%rax,%rbx,4), %rsi
addq %rax, %rsi
leaq 0xc92(%rip), %rbx       # 0x229b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x1d, %ecx
andl $0x1, %ecx
leaq 0xca7(%rip), %r15       # 0x22ca
leaq 0xcb7(%rip), %rdx       # 0x22e1
movq %r15, %rdi
movl $0x1d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xce0(%rip), %rax       # 0x2320
leaq 0xcb0(%rip), %rsi       # 0x22f7
btl $0x1d, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x1c, %ecx
andl $0x1, %ecx
leaq 0xccc(%rip), %rdx       # 0x2336
movq %r15, %rdi
movl $0x1c, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xece(%rip), %rax       # 0x254e
leaq 0xcc8(%rip), %rsi       # 0x234f
btl $0x1c, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %r12d
shrl $0x19, %r12d
andl $0x3, %r12d
leaq 0xcaf(%rip), %rcx       # 0x235b
leaq 0xbba(%rip), %rdi       # 0x226d
movl $0x1a, %esi
movl $0x19, %edx
movq %r12, %r8
xorl %eax, %eax
callq 0x1070
leaq 0x95e(%rip), %rax       # 0x202c
movslq (%rax,%r12,4), %rsi
addq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x18, %ecx
andl $0x1, %ecx
leaq 0xcee(%rip), %rdx       # 0x23dd
movq %r15, %rdi
movl $0x18, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xd35(%rip), %rax       # 0x243a
leaq 0xcff(%rip), %rsi       # 0x240b
btl $0x18, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x17, %ecx
andl $0x1, %ecx
leaq 0xd36(%rip), %rdx       # 0x2465
movq %r15, %rdi
movl $0x17, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xd39(%rip), %rax       # 0x247e
leaq 0xd25(%rip), %rsi       # 0x2471
btl $0x17, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %r12d
shrl $0x15, %r12d
andl $0x3, %r12d
leaq 0xd17(%rip), %rcx       # 0x2488
leaq 0xaf5(%rip), %rdi       # 0x226d
movl $0x16, %esi
movl $0x15, %edx
movq %r12, %r8
xorl %eax, %eax
callq 0x1070
leaq 0x8c1(%rip), %rax       # 0x2054
movslq (%rax,%r12,4), %rsi
addq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x14, %ecx
andl $0x1, %ecx
leaq 0xde6(%rip), %rdx       # 0x259a
movq %r15, %rdi
movl $0x14, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe11(%rip), %rax       # 0x25db
leaq 0xde4(%rip), %rsi       # 0x25b5
btl $0x14, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x13, %ecx
andl $0x1, %ecx
leaq 0xe08(%rip), %rdx       # 0x25fc
movq %r15, %rdi
movq %r15, %r12
movl $0x13, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe29(%rip), %rax       # 0x2636
leaq 0xdff(%rip), %rsi       # 0x2613
btl $0x13, %r14d
cmovbq %rax, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x12, %ecx
andl $0x1, %ecx
leaq 0xe15(%rip), %rdx       # 0x264c
movq %r15, %rdi
movl $0x12, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe31(%rip), %r15       # 0x267e
leaq 0xe0f(%rip), %rsi       # 0x2663
btl $0x12, %r14d
cmovbq %r15, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
movl %r14d, %ecx
shrl $0x11, %ecx
andl $0x1, %ecx
leaq 0xe1d(%rip), %rdx       # 0x2694
movq %r12, %rdi
movl $0x11, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe1e(%rip), %rsi       # 0x26ab
btl $0x11, %r14d
cmovbq %r15, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
shrl $0xa, %r14d
andl $0x7, %r14d
leaq 0xe17(%rip), %rdi       # 0x26c6
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
cmpl $0x5, %r14d
ja 0x18cf
leaq 0x776(%rip), %rax       # 0x203c
movslq (%rax,%r14,4), %rdi
addq %rax, %rdi
jmp 0x18d6
leaq 0x1213(%rip), %rdi      # 0x2ae9
callq 0x1040
movl %r13d, %ecx
shrl $0x9, %ecx
andl $0x1, %ecx
leaq 0x9df(%rip), %rbx       # 0x22ca
leaq 0xe06(%rip), %rdx       # 0x26f8
movq %rbx, %rdi
movl $0x9, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe39(%rip), %rax       # 0x2741
leaq 0xdfb(%rip), %rsi       # 0x270a
btl $0x9, %r13d
cmovbq %rax, %rsi
leaq 0x97c(%rip), %r14       # 0x229b
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x8, %ecx
andl $0x1, %ecx
leaq 0xe2c(%rip), %rdx       # 0x2765
movq %rbx, %rdi
movl $0x8, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe60(%rip), %rax       # 0x27af
leaq 0xe21(%rip), %rsi       # 0x2777
btl $0x8, %r13d
cmovbq %rax, %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl %ecx
andl $0x1, %ecx
leaq 0xe5c(%rip), %rdx       # 0x27d4
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe56(%rip), %rsi       # 0x27e4
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
andl $0x1, %ecx
leaq 0xe5d(%rip), %rdx       # 0x2802
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe81(%rip), %rax       # 0x2839
leaq 0xe53(%rip), %rsi       # 0x2812
testb $0x1, %r13b
cmovneq %rax, %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0x111e(%rip), %rdi      # 0x2af6
callq 0x1040
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x73d(%rip), %rdi       # 0x2134
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x10e0
leaq 0x6b2(%rip), %rdi       # 0x20c4
leaq -0x90(%rbp), %rsi
jmp 0x19fa