// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rsi, %r14
movq $0x0, -0x48(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
cmpl $0x2, %edi
jl 0x1399
movl %edi, %ebx
leaq -0x38(%rbp), %r8
movl $0x0, (%r8)
leaq 0xe43(%rip), %rdx       # 0x2073
leaq 0x2e99(%rip), %rcx      # 0x40d0
movq %r14, %rsi
callq 0x1060
cmpl $-0x1, %eax
je 0x138a
leaq 0xdb5(%rip), %r15       # 0x2004
leaq 0x2e3a(%rip), %r13      # 0x4090
movq $0x0, -0x30(%rbp)
movl %ebx, -0x3c(%rbp)
addl $-0x6c, %eax
rorl %eax
cmpl $0x5, %eax
ja 0x1399
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq %r14, %r15
movq 0x2d5e(%rip), %rbx      # 0x3fe0
movq (%rbx), %rsi
leaq 0xdf0(%rip), %rdi       # 0x207c
xorl %eax, %eax
callq 0x1070
movq (%rbx), %r12
movq 0x2df3(%rip), %rbx      # 0x4090
testq %rbx, %rbx
je 0x19bc
movl $0x1, %r14d
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x1090
testl %eax, %eax
je 0x1340
movl %r14d, %eax
movq (%r13,%rax,8), %rbx
incl %r14d
testq %rbx, %rbx
jne 0x12ac
jmp 0x19bc
movq 0x2d05(%rip), %r12      # 0x3fe0
movq (%r12), %rsi
leaq 0xdba(%rip), %rdi       # 0x20a0
xorl %eax, %eax
callq 0x1070
movq (%r12), %r12
movq %r12, %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x1a4e
testl %eax, %eax
je 0x19a6
leaq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x1030
jmp 0x1354
movq 0x2cc2(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10c0
leaq 0xdab(%rip), %rdi       # 0x20dc
movq %rax, -0x30(%rbp)
movl %eax, %esi
xorl %eax, %eax
callq 0x1070
jmp 0x1354
movq %rbx, 0x2d79(%rip)      # 0x40c0
movq %r15, %r14
movl -0x3c(%rbp), %ebx
leaq 0xcb0(%rip), %r15       # 0x2004
movl $0x0, -0x38(%rbp)
movl %ebx, %edi
movq %r14, %rsi
leaq 0xd0c(%rip), %rdx       # 0x2073
leaq 0x2d62(%rip), %rcx      # 0x40d0
leaq -0x38(%rbp), %r8
callq 0x1060
cmpl $-0x1, %eax
jne 0x1261
movq -0x48(%rbp), %rbx
movq -0x30(%rbp), %r13
jmp 0x138f
xorl %ebx, %ebx
xorl %r13d, %r13d
testq %rbx, %rbx
jne 0x13b9
testl %r13d, %r13d
jne 0x13b9
movq (%r14), %rdi
callq 0x19e4
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d00(%rip), %rax      # 0x40c0
movq (%rax), %rsi
leaq 0xd3a(%rip), %rdi       # 0x2104
xorl %eax, %eax
callq 0x1070
testq %rbx, %rbx
je 0x14c4
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x1a4e
testl %eax, %eax
je 0x19d7
leaq 0xd5c(%rip), %rdi       # 0x2156
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
callq 0x1070
movq -0x38(%rbp), %r14
movq (%r14), %rsi
leaq 0xd5c(%rip), %rdi       # 0x216f
xorl %eax, %eax
callq 0x1070
movl 0x8(%r14), %esi
leaq 0xd63(%rip), %rdi       # 0x2188
xorl %eax, %eax
callq 0x1070
movl -0x40(%rbp), %ebx
leaq 0xd6d(%rip), %rdi       # 0x21a3
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1070
movq 0x2c78(%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
leaq (%rbx,%rcx), %r15
addq $0x4, %r15
leaq 0xd53(%rip), %rdi       # 0x21c4
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
leaq 0xd65(%rip), %rdi       # 0x21e7
movq %r15, %rsi
xorl %eax, %eax
callq 0x1070
movq %r14, %rdi
callq 0x1b11
movl %eax, %r13d
movq %r15, %rdi
callq 0x1b11
movl %eax, %r14d
leaq 0xd62(%rip), %rdi       # 0x220b
movl %r13d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xd6d(%rip), %rdi       # 0x2227
movl %r14d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0x14dd(%rip), %rdi      # 0x29a8
callq 0x1040
movl %r13d, %eax
movq %rax, -0x30(%rbp)
movl %r13d, %r15d
shrl $0x1e, %r15d
leaq 0xd88(%rip), %rdi       # 0x226d
leaq 0xd9c(%rip), %rcx       # 0x2288
xorl %r14d, %r14d
movl $0x1f, %esi
movl $0x1e, %edx
movq %r15, %r8
xorl %eax, %eax
callq 0x1070
leaq 0xb12(%rip), %rax       # 0x201c
movslq (%rax,%r15,4), %rsi
addq %rax, %rsi
leaq 0xd83(%rip), %r15       # 0x229b
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x1d, %ecx
andl $0x1, %ecx
leaq 0xd98(%rip), %r12       # 0x22ca
leaq 0xda8(%rip), %rdx       # 0x22e1
movq %r12, %rdi
movl $0x1d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xdd1(%rip), %rax       # 0x2320
leaq 0xda1(%rip), %rsi       # 0x22f7
btl $0x1d, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x1c, %ecx
andl $0x1, %ecx
leaq 0xdbd(%rip), %rdx       # 0x2336
movq %r12, %rdi
movl $0x1c, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xfbf(%rip), %rax       # 0x254e
leaq 0xdb9(%rip), %rsi       # 0x234f
btl $0x1c, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ebx
shrl $0x19, %ebx
andl $0x3, %ebx
leaq 0xda2(%rip), %rcx       # 0x235b
leaq 0xcad(%rip), %rdi       # 0x226d
movl $0x1a, %esi
movl $0x19, %edx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1070
leaq 0xa61(%rip), %rax       # 0x203c
movslq (%rax,%rbx,4), %rsi
addq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x18, %ecx
andl $0x1, %ecx
leaq 0xde1(%rip), %rdx       # 0x23dd
movq %r12, %rdi
movl $0x18, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe28(%rip), %rax       # 0x243a
leaq 0xdf2(%rip), %rsi       # 0x240b
btl $0x18, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x17, %ecx
andl $0x1, %ecx
leaq 0xe29(%rip), %rdx       # 0x2465
movq %r12, %rdi
movl $0x17, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xe2c(%rip), %rax       # 0x247e
leaq 0xe18(%rip), %rsi       # 0x2471
btl $0x17, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ebx
shrl $0x15, %ebx
andl $0x3, %ebx
leaq 0xe0c(%rip), %rcx       # 0x2488
leaq 0xbea(%rip), %rdi       # 0x226d
movl $0x16, %esi
movl $0x15, %edx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1070
leaq 0x98e(%rip), %rax       # 0x202c
movslq (%rax,%rbx,4), %rsi
addq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x14, %ecx
andl $0x1, %ecx
leaq 0xedb(%rip), %rdx       # 0x259a
movq %r12, %rdi
movl $0x14, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf06(%rip), %rax       # 0x25db
leaq 0xed9(%rip), %rsi       # 0x25b5
btl $0x14, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x13, %ecx
andl $0x1, %ecx
leaq 0xefd(%rip), %rdx       # 0x25fc
movq %r12, %rdi
movl $0x13, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf21(%rip), %rax       # 0x2636
leaq 0xef7(%rip), %rsi       # 0x2613
btl $0x13, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x12, %ecx
andl $0x1, %ecx
leaq 0xf0d(%rip), %rdx       # 0x264c
movq %r12, %rdi
movl $0x12, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf29(%rip), %rbx       # 0x267e
leaq 0xf07(%rip), %rsi       # 0x2663
btl $0x12, %r13d
cmovbq %rbx, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x11, %ecx
andl $0x1, %ecx
leaq 0xf15(%rip), %rdx       # 0x2694
movq %r12, %rdi
movl $0x11, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf16(%rip), %rsi       # 0x26ab
btl $0x11, %r13d
cmovbq %rbx, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
shrl $0xa, %r13d
andl $0x7, %r13d
leaq 0xf0f(%rip), %rdi       # 0x26c6
movq %r13, %rsi
xorl %eax, %eax
callq 0x1070
cmpl $0x5, %r13d
ja 0x17d7
leaq 0x87e(%rip), %rax       # 0x204c
movslq (%rax,%r13,4), %rdi
addq %rax, %rdi
jmp 0x17de
leaq 0x130b(%rip), %rdi      # 0x2ae9
callq 0x1040
movq -0x30(%rbp), %r12
movl %r12d, %ecx
shrl $0x9, %ecx
andl $0x1, %ecx
leaq 0xad3(%rip), %rbx       # 0x22ca
leaq 0xefa(%rip), %rdx       # 0x26f8
movq %rbx, %rdi
movl $0x9, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf2d(%rip), %rax       # 0x2741
leaq 0xeef(%rip), %rsi       # 0x270a
btl $0x9, %r12d
cmovbq %rax, %rsi
leaq 0xa70(%rip), %r15       # 0x229b
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x8, %ecx
andl $0x1, %ecx
leaq 0xf20(%rip), %rdx       # 0x2765
movq %rbx, %rdi
movl $0x8, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf54(%rip), %rax       # 0x27af
leaq 0xf15(%rip), %rsi       # 0x2777
btl $0x8, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl %ecx
andl $0x1, %ecx
leaq 0xf50(%rip), %rdx       # 0x27d4
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf4a(%rip), %rsi       # 0x27e4
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
andl $0x1, %ecx
leaq 0xf51(%rip), %rdx       # 0x2802
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf75(%rip), %rax       # 0x2839
leaq 0xf47(%rip), %rsi       # 0x2812
testb $0x1, %r12b
cmovneq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0x1212(%rip), %rdi      # 0x2af6
callq 0x1040
jmp 0x13a7
movq 0x27cb(%rip), %rax      # 0x40c0
movq (%rax), %rsi
leaq 0x805(%rip), %rdi       # 0x2104
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x1070
leaq 0x1206(%rip), %rdi      # 0x2b16
callq 0x1040
movq 0x27a4(%rip), %rax      # 0x40c0
cmpl $0x0, 0x28(%rax)
je 0x13a7
movl $0x10, %ecx
movq %rcx, -0x30(%rbp)
leaq 0x81a(%rip), %r14       # 0x2150
xorl %r13d, %r13d
movq 0x30(%rax), %r15
imulq $0x1010, %r13, %rbx     # imm = 0x1010
movq (%r15,%rbx), %rsi
leaq 0x7fb(%rip), %rdi       # 0x214a
xorl %eax, %eax
callq 0x1070
cmpl $0x0, 0xc(%r15,%rbx)
je 0x1984
addq %r15, %rbx
addq -0x30(%rbp), %r15
xorl %r12d, %r12d
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1070
incq %r12
movl 0xc(%rbx), %eax
addq $0x20, %r15
cmpq %rax, %r12
jb 0x1968
incq %r13
movq 0x2732(%rip), %rax      # 0x40c0
movl 0x28(%rax), %ecx
addq $0x1010, -0x30(%rbp)    # imm = 0x1010
cmpq %rcx, %r13
jb 0x1939
xorl %r14d, %r14d
jmp 0x13a7
leaq 0x717(%rip), %rdi       # 0x20c4
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
jmp 0x13a1
leaq 0x771(%rip), %rdi       # 0x2134
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x10e0
leaq 0x6e6(%rip), %rdi       # 0x20c4
leaq -0x70(%rbp), %rsi
jmp 0x19c6