// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rsi, %r14
pushq $0x1
popq %rbp
cmpl $0x2, %edi
jg 0x1212
movq (%r14), %rdi
callq 0x170e
jmp 0x16fd
movl %edi, %r13d
movq 0x8(%r14), %r12
leaq 0xde4(%rip), %rsi       # 0x2004
movq %r12, %rdi
callq 0x1050
testl %eax, %eax
je 0x13a7
pushq $0x1
popq %rbx
incq %r12
movzbl -0x1(%r12), %eax
cmpl $0x30, %eax
je 0x1233
cmpl $0x78, %eax
je 0x1233
movl $0xffffffa9, %edx       # imm = 0xFFFFFFA9
xorl %r15d, %r15d
leaq 0x27(%rdx), %rcx
addq $0x20, %rdx
testb %al, %al
je 0x129a
leal -0x30(%rax), %edi
movq %rcx, %rsi
cmpb $0xa, %dil
jb 0x1284
leal -0x41(%rax), %edi
movq %rdx, %rsi
cmpb $0x6, %dil
jb 0x1284
leal -0x61(%rax), %edi
movl $0xffffffa9, %esi       # imm = 0xFFFFFFA9
cmpb $0x6, %dil
jae 0x168f
shlq $0x4, %r15
movsbq %al, %rax
addl %eax, %esi
orq %rsi, %r15
movb (%r12), %al
incq %r12
jmp 0x1256
movq %r14, (%rsp)
movq %r15, %rdi
callq 0x188e
movl %eax, %r12d
movl %ebp, %r14d
movl %r12d, %ecx
shll %cl, %r14d
cmpl $0x11, %eax
jae 0x1646
leal -0x1(%r14), %eax
movl %eax, 0x18(%rsp)
movw %ax, 0x2dd6(%rip)       # 0x40a0
movw %r12w, 0x2dd0(%rip)     # 0x40a2
pushq $0x4
popq %rdi
movl %r12d, %ecx
shll %cl, %edi
callq 0x10b0
movq %rax, 0x2daa(%rip)      # 0x4090
testq %rax, %rax
je 0x1664
movq %rax, %rbp
movl %r13d, 0x20(%rsp)
movslq %r14d, %rax
leaq (,%rax,2), %r13
addq %rbp, %r13
movq %r13, 0x2d8c(%rip)      # 0x4098
movl %r12d, %ecx
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
cmpq %rax, %r14
je 0x1340
movw %bx, (%rbp,%rax,2)
movw %ax, (%r13,%rbx,2)
addq %rbx, %rbx
movq %rbx, %rdx
shrq %cl, %rdx
testq %rdx, %rdx
cmovneq %r15, %rdx
xorq %rdx, %rbx
incq %rax
jmp 0x1318
movq (%rsp), %rbx
movq 0x10(%rbx), %r15
leaq 0xcbc(%rip), %rsi       # 0x200b
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x1446
leaq 0xca9(%rip), %rsi       # 0x200f
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x144b
leaq 0xc96(%rip), %rsi       # 0x2013
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0x1672
cmpl $0x3, 0x20(%rsp)
jne 0x145a
movq (%rbx), %rdi
callq 0x170e
pushq $0x1
jmp 0x16ac
movq 0x10(%r14), %rdi
callq 0x10d0
pushq $0x1
popq %rdx
movl %eax, %ecx
shll %cl, %edx
movslq %edx, %rbx
movl %eax, %r14d
pushq $-0x1
popq %r15
pushq $0x1
popq %r12
pushq $0xa
popq %rbp
movq %rbx, %rax
movl %r14d, %ecx
shrq %cl, %rax
cmpq $0x1, %rax
ja 0x143f
movq %rbx, %rdi
callq 0x188e
movl %r15d, %edx
movl %eax, %ecx
shll %cl, %edx
movl %eax, %ecx
incl %edx
movl %edx, %esi
movq %r12, %rax
testl %esi, %esi
je 0x140a
addq %rax, %rax
movq %rax, %rdi
shrq %cl, %rdi
testq %rdi, %rdi
cmovneq %rbx, %rdi
xorq %rdi, %rax
incl %esi
jmp 0x13ef
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 0x140d
testl %edx, %edx
jne 0x143a
movq %rbx, %rdi
callq 0x17f4
movl %ebp, %edi
callq 0x1040
incq %rbx
jmp 0x13c8
xorl %ebp, %ebp
jmp 0x16fd
movq %rbp, %rdi
jmp 0x144e
movq %r13, %rdi
callq 0x1728
xorl %ebp, %ebp
jmp 0x16f1
movq 0x18(%rbx), %rdi
callq 0x10d0
movl %eax, 0xc(%rsp)
cmpw %ax, 0x18(%rsp)
jbe 0x16af
pushq $0x2
popq %rax
movl %r12d, %ecx
shll %cl, %eax
movslq %eax, %rsi
addq $0x7, %rsi
shrq $0x3, %rsi
pushq $0x1
popq %r15
movq %r15, %rdi
callq 0x1090
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x16c4
movzwl 0xc(%rsp), %esi
leaq 0xd65(%rip), %rdi       # 0x2210
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1070
movw $0x1, %ax
movq %r15, %r13
cmpw 0xc(%rsp), %ax
ja 0x1617
movl %eax, 0x2c(%rsp)
movzwl %ax, %eax
movq 0x2bbc(%rip), %r14      # 0x4090
movq %rax, 0x30(%rsp)
movzwl (%r14,%rax,2), %eax
movq %rax, 0x20(%rsp)
movzwl 0x2bb8(%rip), %eax      # 0x40a2
movq %rax, (%rsp)
movq 0x2ba3(%rip), %rax      # 0x4098
movq %rax, 0x18(%rsp)
movzwl 0x2b9f(%rip), %ebp      # 0x40a0
movq %r15, %rax
movq (%rsp), %rcx
shrq %cl, %rax
cmpq $0x1, %rax
ja 0x155b
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rcx
movzwl (%rcx,%rax,2), %r12d
movq %r15, %rdi
callq 0x189e
movw $0x1, %dx
xorl %ecx, %ecx
testq %rax, %rax
je 0x1551
testb $0x1, %al
je 0x153f
movzwl %dx, %esi
xorw (%r14,%rsi,2), %cx
shrq %rax
addl %r12d, %edx
cmpw %dx, %bp
movl %ebp, %esi
cmoval %ebx, %esi
subl %esi, %edx
jmp 0x152e
testw %cx, %cx
je 0x155b
incq %r15
jmp 0x1501
movzwl %r15w, %r12d
leaq 0xcc4(%rip), %rdi       # 0x222a
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x1070
movq %r12, %rdi
callq 0x17f4
movl %r15d, %ecx
andb $0x7, %cl
movb $0x1, %r14b
shlb %cl, %r14b
movl %r12d, %ebp
shrl $0x3, %ebp
movq 0x10(%rsp), %rax
movzbl (%rax,%rbp), %eax
andl $0x7, %r15d
btl %r15d, %eax
jae 0x15ad
leaq 0xcc1(%rip), %rdi       # 0x2267
callq 0x1060
jmp 0x1607
movl %eax, (%rsp)
movq %r12, %rdi
callq 0x188e
movl %eax, %r15d
movq %r13, %rdi
callq 0x188e
addl %r15d, %eax
cmpl $0x3f, %eax
ja 0x16d2
xorl %r15d, %r15d
movl (%rsp), %ecx
testq %r13, %r13
je 0x15f1
movl %r13d, %eax
andl $0x1, %eax
negq %rax
andq %r12, %rax
xorq %rax, %r15
shrq %r13
addq %r12, %r12
jmp 0x15d5
orb %r14b, %cl
movq 0x10(%rsp), %rax
movb %cl, (%rax,%rbp)
pushq $0xa
popq %rdi
callq 0x1040
movq %r15, %r13
movl 0x2c(%rsp), %eax
addl $0x2, %eax
pushq $0x1
popq %r15
jmp 0x14bb
leaq 0xc39(%rip), %rdi       # 0x2257
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1070
movq %r13, %rdi
callq 0x17f4
pushq $0xa
popq %rdi
callq 0x1040
movq 0x10(%rsp), %rdi
callq 0x1030
jmp 0x16f1
movq 0x29ab(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xb33(%rip), %rdi       # 0x218a
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x10e0
jmp 0x16aa
leaq 0xb48(%rip), %rdi       # 0x21b3
callq 0x10c0
jmp 0x16aa
movq 0x297f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x994(%rip), %rsi       # 0x2017
movq %r15, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x16ee
movq 0x2962(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xac7(%rip), %rsi       # 0x2167
movq %r12, %rdx
xorl %eax, %eax
callq 0x10a0
pushq $-0x1
popq %rbp
jmp 0x16fd
movq 0x2942(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xb0d(%rip), %rdi       # 0x21cd
pushq $0x2c
jmp 0x16e5
leaq 0xb2f(%rip), %rdi       # 0x21fa
callq 0x10c0
jmp 0x16ee
movq 0x291f(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xb5b(%rip), %rdi       # 0x223e
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x10e0
pushq $-0x1
popq %rbp
movq 0x2998(%rip), %rdi      # 0x4090
callq 0x1030
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq