// File: /workspace/github_c_makefile_star2_O2/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, %rbx
andq $0x0, -0x48(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
cmpl $0x2, %edi
jl 0x135a
movl %edi, %r15d
leaq 0xe50(%rip), %r13       # 0x2073
leaq 0x2e66(%rip), %r14      # 0x4090
movq $0x0, -0x30(%rbp)
movl %edi, -0x3c(%rbp)
andl $0x0, -0x38(%rbp)
movl %r15d, %edi
movq %rbx, %rsi
movq %r13, %rdx
leaq 0x2e87(%rip), %rcx      # 0x40d0
leaq -0x38(%rbp), %r8
callq 0x1060
cmpl $-0x1, %eax
je 0x1348
addl $-0x6c, %eax
rorl %eax
cmpl $0x5, %eax
ja 0x135a
leaq 0xd94(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %r15
movq 0x2d5d(%rip), %rbx      # 0x3fe0
movq (%rbx), %rsi
xorl %r13d, %r13d
leaq 0xdec(%rip), %rdi       # 0x207c
xorl %eax, %eax
callq 0x1070
movq (%rbx), %r12
movl %r13d, %eax
movq (%r14,%rax,8), %rbx
testq %rbx, %rbx
je 0x193d
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x1090
incl %r13d
testl %eax, %eax
jne 0x129a
movq %rbx, 0x2dfd(%rip)      # 0x40c0
movq %r15, %rbx
movl -0x3c(%rbp), %r15d
leaq 0xda2(%rip), %r13       # 0x2073
jmp 0x1235
movq 0x2d03(%rip), %r12      # 0x3fe0
movq (%r12), %rsi
leaq 0xdb8(%rip), %rdi       # 0x20a0
xorl %eax, %eax
callq 0x1070
movq (%r12), %r12
movq %r12, %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x19cd
testl %eax, %eax
je 0x180e
leaq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x1030
jmp 0x1235
movq 0x2cbd(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10c0
leaq 0xda6(%rip), %rdi       # 0x20dc
movq %rax, -0x30(%rbp)
movl %eax, %esi
xorl %eax, %eax
callq 0x1070
jmp 0x1235
movq -0x48(%rbp), %r14
testq %r14, %r14
movq -0x30(%rbp), %r12
jne 0x136a
testl %r12d, %r12d
jne 0x136a
movq (%rbx), %rdi
callq 0x1963
pushq $-0x1
popq %rax
jmp 0x192e
movq 0x2d4f(%rip), %rax      # 0x40c0
movq (%rax), %rsi
leaq 0xd89(%rip), %rdi       # 0x2104
xorl %eax, %eax
callq 0x1070
testq %r14, %r14
je 0x1472
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x19cd
testl %eax, %eax
je 0x1956
leaq 0xdab(%rip), %rdi       # 0x2156
leaq -0x70(%rbp), %rsi
xorl %eax, %eax
callq 0x1070
movq -0x38(%rbp), %r14
movq (%r14), %rsi
leaq 0xdab(%rip), %rdi       # 0x216f
xorl %eax, %eax
callq 0x1070
movl 0x8(%r14), %esi
leaq 0xdb2(%rip), %rdi       # 0x2188
xorl %eax, %eax
callq 0x1070
movl -0x40(%rbp), %ebx
leaq 0xdbc(%rip), %rdi       # 0x21a3
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1070
movq 0x2cc7(%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 0xda3(%rip), %rdi       # 0x21c4
movq %r14, %rsi
xorl %eax, %eax
callq 0x1070
leaq 0xdb5(%rip), %rdi       # 0x21e7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1070
movq %r14, %rdi
callq 0x1a85
movl %eax, %r12d
movq %rbx, %rdi
callq 0x1a85
movl %eax, %ebx
leaq 0xdb3(%rip), %rdi       # 0x220b
movl %r12d, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xdbe(%rip), %rdi       # 0x2227
movl %ebx, %esi
xorl %eax, %eax
callq 0x1070
leaq 0x152f(%rip), %rdi      # 0x29a8
callq 0x1040
movl %r12d, %r13d
movl %r12d, %r14d
shrl $0x1e, %r14d
leaq 0xdde(%rip), %rdi       # 0x226d
leaq 0xdf2(%rip), %rcx       # 0x2288
pushq $0x1f
popq %rsi
pushq $0x1e
popq %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x1070
leaq 0xb6f(%rip), %rax       # 0x201c
movslq (%rax,%r14,4), %rsi
addq %rax, %rsi
leaq 0xde0(%rip), %r15       # 0x229b
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x1d, %ecx
andl $0x1, %ecx
leaq 0xdf5(%rip), %rbx       # 0x22ca
leaq 0xe05(%rip), %rdx       # 0x22e1
pushq $0x1d
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xe30(%rip), %rax       # 0x2320
leaq 0xe00(%rip), %rsi       # 0x22f7
btl $0x1d, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x1c, %ecx
andl $0x1, %ecx
leaq 0xe1c(%rip), %rdx       # 0x2336
pushq $0x1c
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0x1020(%rip), %rax      # 0x254e
leaq 0xe1a(%rip), %rsi       # 0x234f
btl $0x1c, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %r14d
shrl $0x19, %r14d
andl $0x3, %r14d
leaq 0xe01(%rip), %rcx       # 0x235b
pushq $0x1a
popq %rsi
pushq $0x19
popq %rdx
leaq 0xd06(%rip), %rdi       # 0x226d
movq %r14, %r8
xorl %eax, %eax
callq 0x1070
leaq 0xac4(%rip), %rax       # 0x203c
movslq (%rax,%r14,4), %rsi
addq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x18, %ecx
andl $0x1, %ecx
leaq 0xe44(%rip), %rdx       # 0x23dd
pushq $0x18
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xe8d(%rip), %rax       # 0x243a
leaq 0xe57(%rip), %rsi       # 0x240b
btl $0x18, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x17, %ecx
andl $0x1, %ecx
leaq 0xe8e(%rip), %rdx       # 0x2465
pushq $0x17
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xe93(%rip), %rax       # 0x247e
leaq 0xe7f(%rip), %rsi       # 0x2471
btl $0x17, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %r14d
shrl $0x15, %r14d
andl $0x3, %r14d
leaq 0xe71(%rip), %rcx       # 0x2488
pushq $0x16
popq %rsi
pushq $0x15
popq %rdx
leaq 0xc49(%rip), %rdi       # 0x226d
movq %r14, %r8
xorl %eax, %eax
callq 0x1070
leaq 0x9f7(%rip), %rax       # 0x202c
movslq (%rax,%r14,4), %rsi
addq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x14, %ecx
andl $0x1, %ecx
leaq 0xf44(%rip), %rdx       # 0x259a
pushq $0x14
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xf71(%rip), %rax       # 0x25db
leaq 0xf44(%rip), %rsi       # 0x25b5
btl $0x14, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x13, %ecx
andl $0x1, %ecx
leaq 0xf68(%rip), %rdx       # 0x25fc
pushq $0x13
popq %rsi
movq %rbx, %rdi
movq %rbx, %r14
xorl %eax, %eax
callq 0x1070
leaq 0xf8b(%rip), %rax       # 0x2636
leaq 0xf61(%rip), %rsi       # 0x2613
btl $0x13, %r12d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x12, %ecx
andl $0x1, %ecx
leaq 0xf77(%rip), %rdx       # 0x264c
pushq $0x12
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xf95(%rip), %rbx       # 0x267e
leaq 0xf73(%rip), %rsi       # 0x2663
btl $0x12, %r12d
cmovbq %rbx, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r12d, %ecx
shrl $0x11, %ecx
andl $0x1, %ecx
leaq 0xf81(%rip), %rdx       # 0x2694
pushq $0x11
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xf84(%rip), %rsi       # 0x26ab
btl $0x11, %r12d
cmovbq %rbx, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
shrl $0xa, %r12d
andl $0x7, %r12d
leaq 0xf7d(%rip), %rdi       # 0x26c6
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
cmpl $0x5, %r12d
ja 0x1824
leaq 0x8e8(%rip), %rax       # 0x204c
movslq (%rax,%r12,4), %rdi
addq %rax, %rdi
jmp 0x182b
movq 0x2949(%rip), %rax      # 0x40c0
movq (%rax), %rsi
leaq 0x983(%rip), %rdi       # 0x2104
xorl %eax, %eax
callq 0x1070
leaq 0x1387(%rip), %rdi      # 0x2b16
callq 0x1040
pushq $0x10
popq %r13
leaq 0x9b1(%rip), %r15       # 0x2150
xorl %ebx, %ebx
movq 0x2918(%rip), %rax      # 0x40c0
movl 0x28(%rax), %ecx
cmpq %rcx, %rbx
jae 0x192c
movq 0x30(%rax), %r12
imulq $0x1010, %rbx, %rax     # imm = 0x1010
leaq (%r12,%rax), %r14
movq (%r12,%rax), %rsi
leaq 0x97c(%rip), %rdi       # 0x214a
xorl %eax, %eax
callq 0x1070
movq %r13, -0x30(%rbp)
addq %r13, %r12
xorl %r13d, %r13d
movl 0xc(%r14), %eax
cmpq %rax, %r13
jae 0x17fe
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
incq %r13
addq $0x20, %r12
jmp 0x17df
incq %rbx
movq -0x30(%rbp), %r13
addq $0x1010, %r13           # imm = 0x1010
jmp 0x17a1
leaq 0x8af(%rip), %rdi       # 0x20c4
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
jmp 0x1362
leaq 0x12be(%rip), %rdi      # 0x2ae9
callq 0x1040
movl %r13d, %ecx
shrl $0x9, %ecx
andl $0x1, %ecx
leaq 0xa8a(%rip), %r14       # 0x22ca
leaq 0xeb1(%rip), %rdx       # 0x26f8
pushq $0x9
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xee6(%rip), %rax       # 0x2741
leaq 0xea8(%rip), %rsi       # 0x270a
btl $0x9, %r13d
cmovbq %rax, %rsi
leaq 0xa29(%rip), %r15       # 0x229b
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl $0x8, %ecx
andl $0x1, %ecx
leaq 0xed9(%rip), %rdx       # 0x2765
pushq $0x8
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xf0f(%rip), %rax       # 0x27af
leaq 0xed0(%rip), %rsi       # 0x2777
btl $0x8, %r13d
cmovbq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
shrl %ecx
andl $0x1, %ecx
leaq 0xf0b(%rip), %rdx       # 0x27d4
pushq $0x1
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0xf07(%rip), %rsi       # 0x27e4
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
movl %r13d, %ecx
andl $0x1, %ecx
leaq 0xf0e(%rip), %rdx       # 0x2802
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x1070
leaq 0xf32(%rip), %rax       # 0x2839
leaq 0xf04(%rip), %rsi       # 0x2812
testb $0x1, %r13b
cmovneq %rax, %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
leaq 0x11cf(%rip), %rdi      # 0x2af6
callq 0x1040
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7f0(%rip), %rdi       # 0x2134
movq %r12, %rsi
xorl %eax, %eax
callq 0x1070
pushq $-0x1
popq %rdi
callq 0x10e0
leaq 0x767(%rip), %rdi       # 0x20c4
leaq -0x70(%rbp), %rsi
jmp 0x1947