// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]dhara/tools/gftool.c
// Function: main
int main(int argc, char **argv)
{
	poly_t p;
	int r = 0;

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

	if (!strcasecmp(argv[1], "search"))
		return poly_search(atoi(argv[2]));

	if (parse_poly(argv[1], &p) < 0)
		return -1;

	if (gf_init(p) < 0)
		return -1;

	if (!strcasecmp(argv[2], "exp")) {
		gf_dump(gf_exp);
	} else if (!strcasecmp(argv[2], "log")) {
		gf_dump(gf_log);
	} else if (!strcasecmp(argv[2], "bch")) {
		poly_t gen;

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

		if (bch_generator(atoi(argv[3]), &gen) < 0)
			r = -1;
	} else {
		fprintf(stderr, "unknown operation: %s\n", argv[2]);
		r = -1;
	}

	gf_exit();
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
cmpl $0x2, %edi
jg 0x1286
movq (%r14), %rcx
leaq 0xdc2(%rip), %rdi       # 0x202e
movq %rcx, %rsi
movq %rcx, %rdx
movq %rcx, %r8
xorl %eax, %eax
callq 0x1070
movl $0x1, %eax
jmp 0x180b
movl %edi, %ebx
movq 0x8(%r14), %r15
leaq 0xd71(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x135a
incq %r15
movzbl -0x1(%r15), %eax
cmpl $0x30, %eax
je 0x12a3
cmpl $0x78, %eax
je 0x12a3
movq %r14, 0x8(%rsp)
movl %ebx, 0x4(%rsp)
movl $0xffffffa9, %eax       # imm = 0xFFFFFFA9
xorl %r13d, %r13d
leaq 0x27(%rax), %rbp
leaq 0x20(%rax), %r8
movq 0x2d23(%rip), %rdx      # 0x3ff8
leaq 0xe8b(%rip), %rsi       # 0x2167
movq %r13, %rbx
movsbq -0x1(%r15), %r14
testq %r14, %r14
je 0x143f
movq %rbx, %r13
shlq $0x4, %r13
leal -0x30(%r14), %ecx
movq %rbp, %rax
cmpb $0xa, %cl
jb 0x131a
leal -0x41(%r14), %ecx
movq %r8, %rax
cmpb $0x6, %cl
jb 0x131a
leal -0x61(%r14), %ecx
movl $0xffffffa9, %eax       # imm = 0xFFFFFFA9
cmpb $0x6, %cl
jae 0x1330
addl %r14d, %eax
orq %rax, %r13
movb $0x1, %r12b
incq %r15
testb %r12b, %r12b
jne 0x12dc
jmp 0x1431
movq (%rdx), %rdi
xorl %r12d, %r12d
movq %r8, 0x10(%rsp)
movq %r15, %rdx
xorl %eax, %eax
callq 0x10a0
leaq 0xe1b(%rip), %rsi       # 0x2167
movq 0x10(%rsp), %r8
movq 0x2ca0(%rip), %rdx      # 0x3ff8
jmp 0x1323
movq 0x10(%r14), %rdi
callq 0x10d0
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
movslq %eax, %rbx
movq %rbx, %rax
shrq %cl, %rax
cmpq $0x1, %rax
ja 0x142a
movl %ecx, %r14d
xorl %eax, %eax
cmpq $0x2, %rbx
jb 0x13a0
xorl %eax, %eax
movq %rbx, %rdx
movq %rbx, %rcx
shrq %rcx
incl %eax
cmpq $0x3, %rdx
movq %rcx, %rdx
ja 0x1392
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
movl %eax, %ecx
testl %eax, %eax
je 0x13da
movl %edx, %esi
notl %esi
cmpl $0x1, %esi
adcl $0x0, %esi
movl $0x1, %edi
addq %rdi, %rdi
movq %rdi, %rax
shrq %cl, %rax
testq %rax, %rax
cmovneq %rbx, %rax
xorq %rdi, %rax
movq %rax, %rdi
decl %esi
jne 0x13be
jmp 0x13df
movl $0x1, %eax
incl %edx
movq %rax, %rsi
addq %rsi, %rsi
movq %rsi, %rdi
shrq %cl, %rdi
testq %rdi, %rdi
cmovneq %rbx, %rdi
xorq %rdi, %rsi
incl %edx
cmpq %rax, %rsi
jne 0x13e4
testl %edx, %edx
jne 0x1414
movq %rbx, %rdi
callq 0x192b
movl $0xa, %edi
callq 0x1040
incq %rbx
movq %rbx, %rax
movl %r14d, %ecx
shrq %cl, %rax
cmpq $0x2, %rax
jb 0x1382
xorl %eax, %eax
jmp 0x180b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %r14b, %r14b
jne 0x180b
xorl %ebp, %ebp
cmpq $0x2, %rbx
jb 0x145d
xorl %ebp, %ebp
movq %rbx, %rcx
movq %rbx, %rax
shrq %rax
incl %ebp
cmpq $0x3, %rcx
movq %rax, %rcx
ja 0x144f
movl $0x1, %r14d
movl %ebp, %ecx
shll %cl, %r14d
cmpl $0x11, %ebp
movl 0x4(%rsp), %r12d
jae 0x17d1
movq %rdx, %r13
leal -0x1(%r14), %eax
movl $0x2, %edx
movl %ebp, %ecx
shll %cl, %edx
movw %ax, 0x2c13(%rip)       # 0x40a0
movw %bp, 0x2c0e(%rip)       # 0x40a2
movslq %edx, %rdi
addq %rdi, %rdi
callq 0x10b0
movq %rax, 0x2bea(%rip)      # 0x4090
testq %rax, %rax
je 0x17d8
movslq %r14d, %rcx
leaq (%rax,%rcx,2), %rdx
movq %rdx, 0x2bdb(%rip)      # 0x4098
movl %ebp, %ecx
cmpl $0x2, %r14d
movl $0x1, %esi
cmovgel %r14d, %esi
movl $0x1, %edi
xorl %r8d, %r8d
movw %di, (%rax,%r8,2)
movw %r8w, (%rdx,%rdi,2)
addq %rdi, %rdi
movq %rdi, %r9
shrq %cl, %r9
testq %r9, %r9
cmovneq %rbx, %r9
xorq %r9, %rdi
incq %r8
cmpq %r8, %rsi
jne 0x14d4
movq 0x8(%rsp), %rbx
movq 0x10(%rbx), %r15
leaq 0xb02(%rip), %rsi       # 0x200b
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x156b
leaq 0xaf3(%rip), %rsi       # 0x200f
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x1574
leaq 0xae4(%rip), %rsi       # 0x2013
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0x181a
cmpl $0x3, %r12d
jne 0x1587
movq (%rbx), %rcx
leaq 0xadf(%rip), %rdi       # 0x202e
xorl %ebp, %ebp
movq %rcx, %rsi
movq %rcx, %rdx
movq %rcx, %r8
xorl %eax, %eax
callq 0x1070
movl $0x1, %eax
jmp 0x17f7
movq 0x2b1e(%rip), %rdi      # 0x4090
jmp 0x157b
movq 0x2b1d(%rip), %rdi      # 0x4098
callq 0x1852
xorl %ebp, %ebp
jmp 0x17fd
movq 0x18(%rbx), %rdi
callq 0x10d0
movb 0x2b0c(%rip), %cl       # 0x40a2
movl $0x2, %edx
shll %cl, %edx
movl %eax, 0x8(%rsp)
cmpw %ax, 0x2af8(%rip)       # 0x40a0
jbe 0x1836
movslq %edx, %r15
addq $0x7, %r15
shrq $0x3, %r15
movq %r15, %rdi
callq 0x10b0
testq %rax, %rax
je 0x183d
movq %rax, %rbx
movzwl 0x8(%rsp), %r12d
xorl %ebp, %ebp
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x1090
leaq 0xc27(%rip), %rdi       # 0x2210
movl %r12d, %esi
xorl %eax, %eax
callq 0x1070
movl $0x1, %r13d
testw %r12w, %r12w
je 0x17a5
movw $0x1, %r15w
movzwl %r15w, %r15d
movq 0x2a7d(%rip), %rax      # 0x4090
movzwl (%rax,%r15,2), %edx
movzwl 0x2a83(%rip), %ecx      # 0x40a2
movq 0x2a72(%rip), %rsi      # 0x4098
movzwl (%rsi,%rdx,2), %edx
movzwl 0x2a6f(%rip), %esi      # 0x40a0
movl $0x1, %r14d
xorl %edi, %edi
testq %r14, %r14
je 0x165b
movq %r14, %r9
movq %r14, %r8
movl %r9d, %r10d
andl $0x1, %r10d
leaq (%r10,%rdi,2), %rdi
shrq %r8
cmpq $0x1, %r9
movq %r8, %r9
ja 0x1644
testq %rdi, %rdi
je 0x16ac
movw $0x1, %r9w
xorl %r8d, %r8d
testb $0x1, %dil
je 0x1677
movzwl %r9w, %r10d
xorw (%rax,%r10,2), %r8w
movq %rdi, %r10
shrq %r10
addl %edx, %r9d
cmpw %r9w, %si
movl %esi, %r11d
cmoval %ebp, %r11d
subl %r11d, %r9d
cmpq $0x1, %rdi
movq %r10, %rdi
ja 0x1668
testw %r8w, %r8w
je 0x16ac
incq %r14
movq %r14, %rdi
shrq %cl, %rdi
cmpq $0x2, %rdi
jb 0x1637
movzwl %r14w, %r12d
leaq 0xb73(%rip), %rdi       # 0x222a
movl %r15d, %esi
xorl %eax, %eax
callq 0x1070
movq %r12, %rdi
callq 0x192b
movl %r14d, %ecx
andb $0x7, %cl
movb $0x1, %al
shlb %cl, %al
movl %r12d, %ecx
shrl $0x3, %ecx
movzbl (%rbx,%rcx), %edx
andl $0x7, %r14d
btl %r14d, %edx
jae 0x16fa
leaq 0xb79(%rip), %rdi       # 0x2267
callq 0x1060
movb $0x1, %al
jmp 0x1786
xorl %esi, %esi
movl $0x0, %edi
cmpl $0x2, %r12d
jb 0x171d
xorl %edi, %edi
movq %r12, %r9
movq %r12, %r8
shrq %r8
incl %edi
cmpq $0x3, %r9
movq %r8, %r9
ja 0x170f
cmpq $0x2, %r13
jb 0x1739
xorl %esi, %esi
movq %r13, %r9
movq %r13, %r8
shrq %r8
incl %esi
cmpq $0x3, %r9
movq %r8, %r9
ja 0x172b
addl %edi, %esi
cmpl $0x40, %esi
jae 0x179c
movq %rbx, %r8
xorl %ebx, %ebx
testq %r13, %r13
je 0x176b
movq %r13, %rsi
movl %r13d, %edi
andl $0x1, %edi
negq %rdi
andq %r12, %rdi
xorq %rdi, %rbx
shrq %rsi
addq %r12, %r12
cmpq $0x1, %r13
movq %rsi, %r13
ja 0x174d
orb %al, %dl
movq %r8, %r14
movb %dl, (%r8,%rcx)
movl $0xa, %edi
callq 0x1040
movb $0x1, %al
movq %rbx, %r13
movq %r14, %rbx
testb %al, %al
je 0x17eb
addl $0x2, %r15d
cmpw 0x8(%rsp), %r15w
jbe 0x1608
jmp 0x17a5
callq 0x111c
xorl %eax, %eax
jmp 0x1786
leaq 0xaab(%rip), %rdi       # 0x2257
xorl %eax, %eax
callq 0x1070
movq %r13, %rdi
callq 0x192b
movl $0xa, %edi
callq 0x1040
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x17f2
callq 0x1138
jmp 0x17e4
leaq 0x9d4(%rip), %rdi       # 0x21b3
callq 0x10c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x180b
xorl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl 0x4(%rsp), %r12d
cmpl $0x3, %r12d
je 0x180b
movq 0x288c(%rip), %rdi      # 0x4090
callq 0x1030
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r13), %rdi
leaq 0x7f2(%rip), %rsi       # 0x2017
movq %r15, %rdx
xorl %eax, %eax
callq 0x10a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x17fd
callq 0x1100
jmp 0x1849
leaq 0x9b6(%rip), %rdi       # 0x21fa
callq 0x10c0
xorl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x17f7