#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  unsigned char logs[256];
  unsigned char exps[255];
  unsigned int x;
  unsigned int i;
  x = 1;
  for (i = 0; i < 255; ++i) {
    exps[i] = x;
    logs[x] = i;
    x <<= 1;
    if (x & 0x100)
      x ^= 0x11d;
  }
  logs[0] = 0;
  fprintf(stdout, "/*\n * This file is autogenerated by gfshare_maketable.\n "
                  "*/\n\nstatic unsigned char logs[256] = {\n  ");
  for (i = 0; i < 256; ++i) {
    fprintf(stdout, "0x%02x", logs[i]);
    if (i == 255)
      fprintf(stdout, " };\n");
    else if ((i % 8) == 7)
      fprintf(stdout, ",\n  ");
    else
      fprintf(stdout, ", ");
  }
  fprintf(stdout, "\nstatic unsigned char exps[510] = {\n  ");
  for (i = 0; i < 510; ++i) {
    fprintf(stdout, "0x%02x", exps[i % 255]);
    if (i == 509)
      fprintf(stdout, " };\n");
    else if ((i % 8) == 7)
      fprintf(stdout, ",\n  ");
    else
      fprintf(stdout, ", ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x214(%rbp)
movl   $0x0,-0x218(%rbp)
cmpl   $0xff,-0x218(%rbp)
jae    11c4 <main+0xb4>
mov    -0x214(%rbp),%eax
mov    %al,%cl
mov    -0x218(%rbp),%eax
mov    %cl,-0x210(%rbp,%rax,1)
mov    -0x218(%rbp),%eax
mov    %al,%cl
mov    -0x214(%rbp),%eax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x214(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x214(%rbp)
mov    -0x214(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     11ab <main+0x9b>
mov    -0x214(%rbp),%eax
xor    $0x11d,%eax
mov    %eax,-0x214(%rbp)
jmp    11b0 <main+0xa0>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    113d <main+0x2d>
movb   $0x0,-0x110(%rbp)
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x218(%rbp)
cmpl   $0x100,-0x218(%rbp)
jae    12b0 <main+0x1a0>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    -0x218(%rbp),%eax
movzbl -0x110(%rbp,%rax,1),%edx
ff
lea    0xe48(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0xff,-0x218(%rbp)
jne    124d <main+0x13d>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1297 <main+0x187>
mov    -0x218(%rbp),%eax
and    $0x7,%eax
cmp    $0x7,%eax
jne    127b <main+0x16b>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1292 <main+0x182>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
lea    0xde8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1297 <main+0x187>
jmp    129c <main+0x18c>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    11ec <main+0xdc>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x218(%rbp)
cmpl   $0x1fe,-0x218(%rbp)
jae    13a0 <main+0x290>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
mov    -0x218(%rbp),%eax
mov    $0xff,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
movzbl -0x210(%rbp,%rax,1),%edx
ff
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x1fd,-0x218(%rbp)
jne    133d <main+0x22d>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1387 <main+0x277>
mov    -0x218(%rbp),%eax
and    $0x7,%eax
cmp    $0x7,%eax
jne    136b <main+0x25b>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1382 <main+0x272>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
lea    0xcf8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1387 <main+0x277>
jmp    138c <main+0x27c>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    12d1 <main+0x1c1>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    $0x1,%ecx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    %cl,0x100(%rsp,%rax,1)
mov    %ecx,%edx
mov    %al,(%rsp,%rdx,1)
mov    %ecx,%esi
add    %ecx,%esi
mov    %esi,%edx
xor    $0x11d,%edx
test   $0x80,%cl
cmove  %esi,%edx
lea    0x1(%rax),%rsi
cmp    $0xff,%rsi
je     1183 <main+0x73>
mov    %dl,0x101(%rsp,%rax,1)
mov    %edx,%eax
mov    %sil,(%rsp,%rax,1)
mov    %edx,%eax
add    %edx,%eax
mov    %eax,%ecx
xor    $0x11d,%ecx
test   $0x80,%dl
cmove  %eax,%ecx
add    $0x1,%rsi
mov    %rsi,%rax
jmp    1130 <main+0x20>
movb   $0x0,(%rsp)
mov    0x2e52(%rip),%r13
mov    0x0(%r13),%edi
lea    0xe67(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xeb7(%rip),%rbx
mov    %rbx,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xeb5(%rip),%r15
xor    %ebp,%ebp
jmp    11f9 <main+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
movzbl (%rsp,%rbp,1),%edx
mov    0x0(%r13),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0xff,%rbp
je     1222 <main+0x112>
mov    %ebp,%eax
not    %eax
mov    0x0(%r13),%edi
test   $0x7,%al
jne    11d0 <main+0xc0>
lea    0xe62(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
cmp    $0x100,%rbp
jne    11de <main+0xce>
jmp    1234 <main+0x124>
mov    0x0(%r13),%edi
lea    0xe3c(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe37(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x100(%rsp),%rbp
movabs $0x8080808080808081,%r14
80 80 80
lea    0xe03(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rax
mul    %r14
shr    $0x7,%rdx
mov    %rdx,%rax
shl    $0x8,%rax
sub    %rax,%rdx
mov    0x0(%r13),%edi
movzbl 0x0(%rbp,%rdx,1),%edx
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x1fd,%ebx
je     12d0 <main+0x1c0>
mov    %ebx,%eax
not    %eax
test   $0x7,%al
mov    0x0(%r13),%edi
mov    %r15,%rsi
lea    0xdbb(%rip),%rax
cmove  %rax,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
add    $0x1,%rbp
cmp    $0x1fe,%ebx
jne    1270 <main+0x160>
jmp    12e2 <main+0x1d2>
mov    0x0(%r13),%edi
lea    0xd8e(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [98 x i8] c"/*\0A * This file is autogenerated by gfshare_maketable.\0A */\0A\0Astatic unsigned char logs[256] = {\0A \00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [5 x i8] c" };\0A\00"
@.str.3 = [5 x i8] c",\0A \00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [39 x i8] c"\0Astatic unsigned char exps[510] = {\0A \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca [255 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %33, %2
%11 = load i32, i32* %9
%12 = icmp ult i32 %11, 255
br i1 %12, label %13, label %36
13: ; preds = %10
%14 = load i32, i32* %8
%15 = trunc i32 %14 to i8
%16 = load i32, i32* %9
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %17
store i8 %15, i8* %18
%19 = load i32, i32* %9
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %8
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %22
store i8 %20, i8* %23
%24 = load i32, i32* %8
%25 = shl i32 %24, 1
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = and i32 %26, 256
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %13
%30 = load i32, i32* %8
%31 = xor i32 %30, 285
store i32 %31, i32* %8
br label %32
32: ; preds = %29, %13
br label %33
33: ; preds = %32
%34 = load i32, i32* %9
%35 = add i32 %34, 1
store i32 %35, i32* %9
br label %10
36: ; preds = %10
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
store i8 0, i8* %37
%38 = load i32, i32* @stdout
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %40
40: ; preds = %68, %36
%41 = load i32, i32* %9
%42 = icmp ult i32 %41, 256
br i1 %42, label %43, label %71
43: ; preds = %40
%44 = load i32, i32* @stdout
%45 = load i32, i32* %9
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %9
%52 = icmp eq i32 %51, 255
br i1 %52, label %53, label %56
53: ; preds = %43
%54 = load i32, i32* @stdout
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %67
56: ; preds = %43
%57 = load i32, i32* %9
%58 = urem i32 %57, 8
%59 = icmp eq i32 %58, 7
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = load i32, i32* @stdout
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %66
63: ; preds = %56
%64 = load i32, i32* @stdout
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %63, %60
br label %67
67: ; preds = %66, %53
br label %68
68: ; preds = %67
%69 = load i32, i32* %9
%70 = add i32 %69, 1
store i32 %70, i32* %9
br label %40
71: ; preds = %40
%72 = load i32, i32* @stdout
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %74
74: ; preds = %103, %71
%75 = load i32, i32* %9
%76 = icmp ult i32 %75, 510
br i1 %76, label %77, label %106
77: ; preds = %74
%78 = load i32, i32* @stdout
%79 = load i32, i32* %9
%80 = urem i32 %79, 255
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %84)
%86 = load i32, i32* %9
%87 = icmp eq i32 %86, 509
br i1 %87, label %88, label %91
88: ; preds = %77
%89 = load i32, i32* @stdout
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %102
91: ; preds = %77
%92 = load i32, i32* %9
%93 = urem i32 %92, 8
%94 = icmp eq i32 %93, 7
br i1 %94, label %95, label %98
95: ; preds = %91
%96 = load i32, i32* @stdout
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %101
98: ; preds = %91
%99 = load i32, i32* @stdout
%100 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %101
101: ; preds = %98, %95
br label %102
102: ; preds = %101, %88
br label %103
103: ; preds = %102
%104 = load i32, i32* %9
%105 = add i32 %104, 1
store i32 %105, i32* %9
br label %74
106: ; preds = %74
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [98 x i8] c"/*\0A * This file is autogenerated by gfshare_maketable.\0A */\0A\0Astatic unsigned char logs[256] = {\0A \00"
@.str.1 = [7 x i8] c"0x%02x\00"
@.str.2 = [5 x i8] c" };\0A\00"
@.str.3 = [5 x i8] c",\0A \00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [39 x i8] c"\0Astatic unsigned char exps[510] = {\0A \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %22, %2
%8 = phi i64 [ 0, %2 ], [ %33, %22 ]
%9 = phi i32 [ 1, %2 ], [ %32, %22 ]
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 %8
store i8 %10, i8* %11
%12 = trunc i64 %8 to i8
%13 = zext i32 %9 to i64
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %13
store i8 %12, i8* %14
%15 = shl i32 %9, 1
%16 = and i32 %9, 128
%17 = icmp eq i32 %16, 0
%18 = xor i32 %15, 285
%19 = select i1 %17, i32 %15, i32 %18
%20 = or i64 %8, 1
%21 = icmp eq i64 %20, 255
br i1 %21, label %34, label %22
22: ; preds = %7
%23 = trunc i32 %19 to i8
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 %20
store i8 %23, i8* %24
%25 = trunc i64 %20 to i8
%26 = zext i32 %19 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %26
store i8 %25, i8* %27
%28 = shl i32 %19, 1
%29 = and i32 %19, 128
%30 = icmp eq i32 %29, 0
%31 = xor i32 %28, 285
%32 = select i1 %30, i32 %28, i32 %31
%33 = add nuw nsw i64 %8, 2
br label %7
34: ; preds = %7
store i8 0, i8* %5
%35 = load i32, i32* @stdout
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
%37 = load i32, i32* @stdout
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %42
39: ; preds = %54
%40 = load i32, i32* @stdout
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %62
42: ; preds = %34, %54
%43 = phi i64 [ 0, %34 ], [ %55, %54 ]
%44 = and i64 %43, 7
%45 = icmp eq i64 %44, 7
%46 = load i32, i32* @stdout
br i1 %45, label %50, label %47
47: ; preds = %42
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%49 = add nuw nsw i64 %43, 1
br label %54
50: ; preds = %42
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%52 = add nuw nsw i64 %43, 1
%53 = icmp eq i64 %52, 256
br i1 %53, label %62, label %54
54: ; preds = %47, %50
%55 = phi i64 [ %49, %47 ], [ %52, %50 ]
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = load i32, i32* @stdout
%59 = zext i8 %57 to i32
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = icmp eq i64 %55, 255
br i1 %61, label %39, label %42
62: ; preds = %50, %39
%63 = load i32, i32* @stdout
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %65
65: ; preds = %62, %79
%66 = phi i32 [ 0, %62 ], [ %85, %79 ]
%67 = load i32, i32* @stdout
%68 = trunc i32 %66 to i16
%69 = urem i16 %68, 255
%70 = zext i16 %69 to i64
%71 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = tail call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = icmp eq i32 %66, 509
br i1 %75, label %76, label %79
76: ; preds = %65
%77 = load i32, i32* @stdout
%78 = tail call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %87
79: ; preds = %65
%80 = and i32 %66, 7
%81 = icmp eq i32 %80, 7
%82 = load i32, i32* @stdout
%83 = select i1 %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%84 = tail call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* %83)
%85 = add nuw nsw i32 %66, 1
%86 = icmp eq i32 %85, 510
br i1 %86, label %87, label %65
87: ; preds = %79, %76
ret i32 0
}