// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
movq %rsi, %rbx
cmpl $0x2, %edi
jg 0x1283
movq (%rbx), %rcx
leaq 0xdc5(%rip), %rdi       # 0x202e
movq %rcx, %rsi
movq %rcx, %rdx
movq %rcx, %r8
xorl %eax, %eax
callq 0x1070
movl $0x1, %ebx
jmp 0x173a
movl %edi, %ebp
movq 0x8(%rbx), %r14
leaq 0xd74(%rip), %rsi       # 0x2004
movq %r14, %rdi
callq 0x1050
testl %eax, %eax
je 0x12c7
incq %r14
movzbl -0x1(%r14), %eax
cmpl $0x30, %eax
je 0x129c
cmpl $0x78, %eax
je 0x129c
testl %eax, %eax
jne 0x139a
xorl %r13d, %r13d
movl $0x1, %r15d
xorl %r14d, %r14d
jmp 0x1436
movq 0x10(%rbx), %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 0x1393
movl %ecx, %r14d
cmpq $0x2, %rbx
jb 0x133f
xorl %eax, %eax
movq %rbx, %rdx
movq %rbx, %rcx
shrq %rcx
incq %rax
cmpq $0x3, %rdx
movq %rcx, %rdx
ja 0x12fd
leal -0x1(%rax), %ecx
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
shll %cl, %edi
movl %edi, %edx
notl %edx
incl %edi
movl $0x1, %esi
movq %rsi, %r8
addq %rsi, %r8
movq %r8, %rsi
movl %eax, %ecx
shrq %cl, %rsi
testq %rsi, %rsi
cmovneq %rbx, %rsi
xorq %r8, %rsi
incl %edi
jne 0x1321
jmp 0x1348
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
movq %rsi, %rdi
addq %rdi, %rdi
movq %rdi, %r8
movl %eax, %ecx
shrq %cl, %r8
testq %r8, %r8
cmovneq %rbx, %r8
xorq %r8, %rdi
decl %edx
cmpq %rsi, %rdi
jne 0x134b
testl %edx, %edx
jne 0x137d
movq %rbx, %rdi
callq 0x189c
movl $0xa, %edi
callq 0x1040
incq %rbx
movq %rbx, %rax
movl %r14d, %ecx
shrq %cl, %rax
cmpq $0x2, %rax
jb 0x12ef
xorl %ebx, %ebx
jmp 0x173a
movl $0xffffffa9, %edx       # imm = 0xFFFFFFA9
xorl %r13d, %r13d
leaq 0x27(%rdx), %rcx
addq $0x20, %rdx
leal -0x30(%rax), %edi
movq %rcx, %rsi
cmpb $0xa, %dil
jb 0x13d4
leal -0x41(%rax), %edi
movq %rdx, %rsi
cmpb $0x6, %dil
jb 0x13d4
leal -0x61(%rax), %edi
movl $0xffffffa9, %esi       # imm = 0xFFFFFFA9
cmpb $0x6, %dil
jae 0x1797
movq %r13, %rdi
shlq $0x4, %rdi
movsbq %al, %rax
addl %eax, %esi
movq %rsi, %r13
orq %rdi, %r13
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x13aa
cmpq $0x2, %r13
jb 0x142d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %r13, %rcx
movq %r13, %rax
shrq %rax
incl %r14d
cmpq $0x3, %rcx
movq %rax, %rcx
ja 0x1403
movl $0x2, %r15d
movl %r14d, %ecx
shll %cl, %r15d
cmpl $0x10, %r14d
jae 0x1776
incl %r14d
jmp 0x1436
xorl %r14d, %r14d
movl $0x1, %r15d
leal -0x1(%r15), %eax
movl %eax, 0x4(%rsp)
movw %ax, 0x2c5b(%rip)       # 0x40a0
movw %r14w, 0x2c55(%rip)     # 0x40a2
movl $0x4, %edi
movl %r14d, %ecx
shll %cl, %edi
callq 0x10b0
movq %rax, 0x2c2d(%rip)      # 0x4090
testq %rax, %rax
je 0x174b
movq %rax, %r12
movl %r15d, %eax
leaq (%r12,%rax,2), %r15
movq %r15, 0x2c1b(%rip)      # 0x4098
movl %r14d, %ecx
movl $0x1, %edx
xorl %esi, %esi
movw %dx, (%r12,%rsi,2)
movw %si, (%r15,%rdx,2)
addq %rdx, %rdx
movq %rdx, %rdi
shrq %cl, %rdi
testq %rdi, %rdi
cmovneq %r13, %rdi
xorq %rdi, %rdx
incq %rsi
cmpq %rsi, %rax
jne 0x1487
movq 0x10(%rbx), %r13
leaq 0xb54(%rip), %rsi       # 0x200b
movq %r13, %rdi
callq 0x1050
testl %eax, %eax
je 0x171f
leaq 0xb41(%rip), %rsi       # 0x200f
movq %r13, %rdi
callq 0x1050
testl %eax, %eax
je 0x1724
leaq 0xb2e(%rip), %rsi       # 0x2013
movq %r13, %rdi
callq 0x1050
testl %eax, %eax
jne 0x1759
cmpl $0x3, %ebp
je 0x125f
movq 0x18(%rbx), %rdi
callq 0x10d0
movl %eax, (%rsp)
cmpw %ax, 0x4(%rsp)
jbe 0x177d
movl $0x2, %eax
movl %r14d, %ecx
shll %cl, %eax
movslq %eax, %rsi
addq $0x7, %rsi
shrq $0x3, %rsi
movl $0x1, %r15d
movl $0x1, %edi
callq 0x1090
testq %rax, %rax
je 0x1784
movq %rax, %r14
movl (%rsp), %ebp
movzwl %bp, %esi
leaq 0xcbd(%rip), %rdi       # 0x2210
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1070
testw %bp, %bp
je 0x16f5
movl $0x1, %r15d
movw $0x1, %r12w
movzwl %r12w, %r12d
movq 0x2b15(%rip), %rax      # 0x4090
movzwl (%rax,%r12,2), %edx
movzwl 0x2b1b(%rip), %ecx      # 0x40a2
movq 0x2b0a(%rip), %rsi      # 0x4098
movzwl (%rsi,%rdx,2), %edx
movzwl 0x2b07(%rip), %esi      # 0x40a0
movl $0x1, %ebp
testq %rbp, %rbp
je 0x1615
xorl %edi, %edi
movq %rbp, %r9
movq %rbp, %r8
movl %r9d, %r10d
andl $0x1, %r10d
leaq (%r10,%rdi,2), %rdi
shrq %r8
cmpq $0x1, %r9
movq %r8, %r9
ja 0x15ab
testq %rdi, %rdi
je 0x1617
movw $0x1, %r9w
xorl %r8d, %r8d
testb $0x1, %dil
je 0x15de
movzwl %r9w, %r10d
xorw (%rax,%r10,2), %r8w
movq %rdi, %r10
shrq %r10
addl %edx, %r9d
cmpw %r9w, %si
movl %esi, %r11d
cmoval %ebx, %r11d
subl %r11d, %r9d
cmpq $0x1, %rdi
movq %r10, %rdi
ja 0x15cf
testw %r8w, %r8w
je 0x1617
incq %rbp
movq %rbp, %rdi
shrq %cl, %rdi
cmpq $0x2, %rdi
jb 0x159e
jmp 0x1617
xorl %ebp, %ebp
movzwl %bp, %r13d
leaq 0xc08(%rip), %rdi       # 0x222a
movl %r12d, %esi
xorl %eax, %eax
callq 0x1070
movq %r13, %rdi
callq 0x189c
movl %ebp, %ecx
andb $0x7, %cl
movb $0x1, %al
shlb %cl, %al
movl %r13d, %ecx
shrl $0x3, %ecx
movzbl (%r14,%rcx), %edx
andl $0x7, %ebp
btl %ebp, %edx
jae 0x1661
leaq 0xc10(%rip), %rdi       # 0x2267
callq 0x1060
jmp 0x16e6
xorl %esi, %esi
movl $0x0, %edi
cmpl $0x2, %r13d
jb 0x1684
xorl %edi, %edi
movq %r13, %r9
movq %r13, %r8
shrq %r8
incl %edi
cmpq $0x3, %r9
movq %r8, %r9
ja 0x1676
cmpq $0x2, %r15
jb 0x16a0
xorl %esi, %esi
movq %r15, %r9
movq %r15, %r8
shrq %r8
incl %esi
cmpq $0x3, %r9
movq %r8, %r9
ja 0x1692
addl %edi, %esi
cmpl $0x3f, %esi
ja 0x17b9
xorl %ebp, %ebp
testq %r15, %r15
je 0x16d3
movq %r15, %rsi
movl %r15d, %edi
andl $0x1, %edi
negq %rdi
andq %r13, %rdi
xorq %rdi, %rbp
shrq %rsi
addq %r13, %r13
cmpq $0x1, %r15
movq %rsi, %r15
ja 0x16b5
orb %al, %dl
movb %dl, (%r14,%rcx)
movl $0xa, %edi
callq 0x1040
movq %rbp, %r15
addl $0x2, %r12d
cmpw (%rsp), %r12w
jbe 0x1570
leaq 0xb5b(%rip), %rdi       # 0x2257
xorl %eax, %eax
callq 0x1070
movq %r15, %rdi
callq 0x189c
movl $0xa, %edi
callq 0x1040
movq %r14, %rdi
callq 0x1030
jmp 0x172e
movq %r12, %rdi
jmp 0x1727
movq %r15, %rdi
callq 0x17c0
xorl %ebx, %ebx
movq 0x295b(%rip), %rdi      # 0x4090
callq 0x1030
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa61(%rip), %rdi       # 0x21b3
callq 0x10c0
jmp 0x17b2
movq 0x2898(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x8ad(%rip), %rsi       # 0x2017
movq %r13, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x1790
callq 0x1138
jmp 0x17b2
callq 0x1100
jmp 0x1790
leaq 0xa6f(%rip), %rdi       # 0x21fa
callq 0x10c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x172e
movq 0x285a(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0x9bf(%rip), %rsi       # 0x2167
movq %r14, %rdx
xorl %eax, %eax
callq 0x10a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x173a
callq 0x111c
jmp 0x1790