#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 */
unsigned int hamming74_dec_symbol(unsigned int);
unsigned int hamming74_enc_symbol(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned int n = 16;
  unsigned int k = 128;
  unsigned int enc_gentab[n];
  unsigned int p;
  for (p = 0; p < n; p++)
    enc_gentab[p] = hamming74_enc_symbol(p);
  unsigned int dec_gentab[k];
  unsigned int x;
  for (x = 0; x < k; x++)
    dec_gentab[x] = hamming74_dec_symbol(x);
  printf("// Hamming(7,4) table generator\n");
  printf("\n");
  printf("unsigned char enc_gentab[%u] = {\n    ", n);
  for (p = 0; p < n; p++) {
    printf("0x%.2x", enc_gentab[p]);
    if (p == n - 1)
      printf("};\n");
    else if (((p + 1) % 8) == 0)
      printf(",\n    ");
    else
      printf(", ");
  }
  printf("\n");
  printf("unsigned char dec_gentab[%u] = {\n    ", k);
  for (x = 0; x < k; x++) {
    printf("0x%.2x", dec_gentab[x]);
    if (x == k - 1)
      printf("};\n");
    else if (((x + 1) % 8) == 0)
      printf(",\n    ");
    else
      printf(", ");
  }
  unsigned int r;
  unsigned int p_hat;
  unsigned int i;
  unsigned int num_errors = 0;
  for (p = 0; p < n; p++) {
    x = enc_gentab[p];
    p_hat = dec_gentab[x];
    num_errors += (p_hat != p);
    for (i = 0; i < 7; i++) {
      r = x ^ (1 << i);
      p_hat = dec_gentab[r];
      num_errors += (p_hat != p);
    }
  }
  printf("\n");
  printf("// number of decoding errors: %u\n", num_errors);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x10,-0x8(%rbp)
movl   $0x80,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    11a9 <main+0x79>
mov    -0x24(%rbp),%edi
call   1050 <hamming74_enc_symbol@plt>
mov    %eax,%edx
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117b <main+0x4b>
mov    -0xc(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11fe <main+0xce>
mov    -0x34(%rbp),%edi
call   1040 <hamming74_dec_symbol@plt>
mov    %eax,%edx
mov    -0x58(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d0 <main+0xa0>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    12c5 <main+0x195>
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    127a <main+0x14a>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b2 <main+0x182>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    129f <main+0x16f>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ad <main+0x17d>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b2 <main+0x182>
jmp    12b7 <main+0x187>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1232 <main+0x102>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    137e <main+0x24e>
mov    -0x58(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1333 <main+0x203>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    136b <main+0x23b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
and    $0x7,%eax
cmp    $0x0,%eax
jne    1358 <main+0x228>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1366 <main+0x236>
lea    0xcfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    136b <main+0x23b>
jmp    1370 <main+0x240>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12eb <main+0x1bb>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1431 <main+0x301>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    -0x24(%rbp),%edx
mov    (%rcx,%rdx,4),%ecx
mov    %ecx,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x7,-0x40(%rbp)
jae    141e <main+0x2ee>
mov    -0x58(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %ecx,-0x5c(%rbp)
mov    -0x40(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x5c(%rbp),%ecx
xor    %edx,%ecx
mov    %ecx,-0x38(%rbp)
mov    -0x38(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13cd <main+0x29d>
jmp    1423 <main+0x2f3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    138c <main+0x25c>
lea    0xc18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x240,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,%r14d
mov    %eax,(%rsp)
mov    $0x1,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x4(%rsp)
mov    $0x2,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x8(%rsp)
mov    $0x3,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0xc(%rsp)
mov    $0x4,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x10(%rsp)
mov    $0x5,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x14(%rsp)
mov    $0x6,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x18(%rsp)
mov    $0x7,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x1c(%rsp)
mov    $0x8,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x20(%rsp)
mov    $0x9,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x24(%rsp)
mov    $0xa,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x28(%rsp)
mov    $0xb,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x2c(%rsp)
mov    $0xc,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x30(%rsp)
mov    $0xd,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x34(%rsp)
mov    $0xe,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x38(%rsp)
mov    $0xf,%edi
call   1070 <hamming74_enc_symbol@plt>
mov    %eax,0x3c(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1060 <hamming74_dec_symbol@plt>
mov    %eax,0x40(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x80,%rbx
jne    1250 <main+0x100>
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd7b(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd8e(%rip),%r13
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
lea    0xd7c(%rip),%r15
lea    0xd7c(%rip),%r12
nopl   0x0(%rax,%rax,1)
test   $0x7,%bl
mov    %r12,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x10,%rbx
je     12fa <main+0x1aa>
mov    (%rsp,%rbx,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
jne    12c0 <main+0x170>
lea    0xdaa(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd2c(%rip),%rdi
mov    $0x80,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffffffffff80,%rbx
lea    0xd01(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x240(%rsp,%rbx,4),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xffffffffffffffff,%rbx
je     1364 <main+0x214>
lea    0x81(%rbx),%eax
test   $0x7,%al
mov    %r12,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
inc    %rbx
jne    1330 <main+0x1e0>
jmp    1370 <main+0x220>
lea    0xd34(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
add    %ebx,%edx
mov    %r14d,%ecx
xor    $0x1,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %esi,%esi
cmp    %rcx,%rax
setne  %sil
add    %edx,%esi
mov    %r14d,%ecx
xor    $0x2,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
add    %esi,%edx
mov    %r14d,%ecx
xor    $0x4,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %esi,%esi
cmp    %rcx,%rax
setne  %sil
add    %edx,%esi
mov    %r14d,%ecx
xor    $0x8,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
add    %esi,%edx
mov    %r14d,%ecx
xor    $0x10,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %esi,%esi
cmp    %rcx,%rax
setne  %sil
add    %edx,%esi
mov    %r14d,%ecx
xor    $0x20,%ecx
mov    0x40(%rsp,%rcx,4),%ecx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
add    %esi,%edx
xor    $0x40,%r14d
mov    0x40(%rsp,%r14,4),%ecx
xor    %ebx,%ebx
cmp    %rcx,%rax
setne  %bl
add    %edx,%ebx
cmp    $0xf,%rax
je     1433 <main+0x2e3>
mov    0x4(%rsp,%rax,4),%r14d
add    $0x1,%rax
jmp    1380 <main+0x230>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc19(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"// Hamming(7,4) table generator\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [38 x i8] c"unsigned char enc_gentab[%u] = {\0A \00"
@.str.3 = [7 x i8] c"0x%.2x\00"
@.str.4 = [4 x i8] c"};\0A\00"
@.str.5 = [7 x i8] c",\0A \00"
@.str.6 = [3 x i8] c", \00"
@.str.7 = [38 x i8] c"unsigned char dec_gentab[%u] = {\0A \00"
@.str.8 = [34 x i8] c"// number of decoding errors: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
store i32 16, i32* %2
store i32 128, i32* %3
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %4
%16 = alloca i32, i64 %14
store i64 %14, i64* %5
store i32 0, i32* %6
br label %17
17: ; preds = %27, %0
%18 = load i32, i32* %6
%19 = load i32, i32* %2
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32, i32* %6
%23 = call i32 @hamming74_enc_symbol(i32 %22)
%24 = load i32, i32* %6
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %16, i64 %25
store i32 %23, i32* %26
br label %27
27: ; preds = %21
%28 = load i32, i32* %6
%29 = add i32 %28, 1
store i32 %29, i32* %6
br label %17
30: ; preds = %17
%31 = load i32, i32* %3
%32 = zext i32 %31 to i64
%33 = alloca i32, i64 %32
store i64 %32, i64* %7
store i32 0, i32* %8
br label %34
34: ; preds = %44, %30
%35 = load i32, i32* %8
%36 = load i32, i32* %3
%37 = icmp ult i32 %35, %36
br i1 %37, label %38, label %47
38: ; preds = %34
%39 = load i32, i32* %8
%40 = call i32 @hamming74_dec_symbol(i32 %39)
%41 = load i32, i32* %8
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %33, i64 %42
store i32 %40, i32* %43
br label %44
44: ; preds = %38
%45 = load i32, i32* %8
%46 = add i32 %45, 1
store i32 %46, i32* %8
br label %34
47: ; preds = %34
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%50 = load i32, i32* %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %50)
store i32 0, i32* %6
br label %52
52: ; preds = %79, %47
%53 = load i32, i32* %6
%54 = load i32, i32* %2
%55 = icmp ult i32 %53, %54
br i1 %55, label %56, label %82
56: ; preds = %52
%57 = load i32, i32* %6
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %16, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %6
%63 = load i32, i32* %2
%64 = sub i32 %63, 1
%65 = icmp eq i32 %62, %64
br i1 %65, label %66, label %68
66: ; preds = %56
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %78
68: ; preds = %56
%69 = load i32, i32* %6
%70 = add i32 %69, 1
%71 = urem i32 %70, 8
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %68
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %77
75: ; preds = %68
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %77
77: ; preds = %75, %73
br label %78
78: ; preds = %77, %66
br label %79
79: ; preds = %78
%80 = load i32, i32* %6
%81 = add i32 %80, 1
store i32 %81, i32* %6
br label %52
82: ; preds = %52
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%84 = load i32, i32* %3
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %84)
store i32 0, i32* %8
br label %86
86: ; preds = %113, %82
%87 = load i32, i32* %8
%88 = load i32, i32* %3
%89 = icmp ult i32 %87, %88
br i1 %89, label %90, label %116
90: ; preds = %86
%91 = load i32, i32* %8
%92 = zext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %33, i64 %92
%94 = load i32, i32* %93
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %94)
%96 = load i32, i32* %8
%97 = load i32, i32* %3
%98 = sub i32 %97, 1
%99 = icmp eq i32 %96, %98
br i1 %99, label %100, label %102
100: ; preds = %90
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %112
102: ; preds = %90
%103 = load i32, i32* %8
%104 = add i32 %103, 1
%105 = urem i32 %104, 8
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %102
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %111
109: ; preds = %102
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %111
111: ; preds = %109, %107
br label %112
112: ; preds = %111, %100
br label %113
113: ; preds = %112
%114 = load i32, i32* %8
%115 = add i32 %114, 1
store i32 %115, i32* %8
br label %86
116: ; preds = %86
store i32 0, i32* %12
store i32 0, i32* %6
br label %117
117: ; preds = %158, %116
%118 = load i32, i32* %6
%119 = load i32, i32* %2
%120 = icmp ult i32 %118, %119
br i1 %120, label %121, label %161
121: ; preds = %117
%122 = load i32, i32* %6
%123 = zext i32 %122 to i64
%124 = getelementptr inbounds i32, i32* %16, i64 %123
%125 = load i32, i32* %124
store i32 %125, i32* %8
%126 = load i32, i32* %8
%127 = zext i32 %126 to i64
%128 = getelementptr inbounds i32, i32* %33, i64 %127
%129 = load i32, i32* %128
store i32 %129, i32* %10
%130 = load i32, i32* %10
%131 = load i32, i32* %6
%132 = icmp ne i32 %130, %131
%133 = zext i1 %132 to i32
%134 = load i32, i32* %12
%135 = add i32 %134, %133
store i32 %135, i32* %12
store i32 0, i32* %11
br label %136
136: ; preds = %154, %121
%137 = load i32, i32* %11
%138 = icmp ult i32 %137, 7
br i1 %138, label %139, label %157
139: ; preds = %136
%140 = load i32, i32* %8
%141 = load i32, i32* %11
%142 = shl i32 1, %141
%143 = xor i32 %140, %142
store i32 %143, i32* %9
%144 = load i32, i32* %9
%145 = zext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %33, i64 %145
%147 = load i32, i32* %146
store i32 %147, i32* %10
%148 = load i32, i32* %10
%149 = load i32, i32* %6
%150 = icmp ne i32 %148, %149
%151 = zext i1 %150 to i32
%152 = load i32, i32* %12
%153 = add i32 %152, %151
store i32 %153, i32* %12
br label %154
154: ; preds = %139
%155 = load i32, i32* %11
%156 = add i32 %155, 1
store i32 %156, i32* %11
br label %136
157: ; preds = %136
br label %158
158: ; preds = %157
%159 = load i32, i32* %6
%160 = add i32 %159, 1
store i32 %160, i32* %6
br label %117
161: ; preds = %117
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%163 = load i32, i32* %12
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %163)
store i32 0, i32* %1
%165 = load i8*, i8** %4
%166 = load i32, i32* %1
ret i32 %166
}

LLVM IR (-O2):
@.str.2 = [38 x i8] c"unsigned char enc_gentab[%u] = {\0A \00"
@.str.3 = [7 x i8] c"0x%.2x\00"
@.str.5 = [7 x i8] c",\0A \00"
@.str.6 = [3 x i8] c", \00"
@.str.7 = [38 x i8] c"unsigned char dec_gentab[%u] = {\0A \00"
@.str.8 = [34 x i8] c"// number of decoding errors: %u\0A\00"
@str = [32 x i8] c"// Hamming(7,4) table generator\00"
@str.10 = [3 x i8] c"};\00"
define i32 @main() {
%1 = alloca [16 x i32]
%2 = tail call i32 @hamming74_enc_symbol(i32 0)
%3 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 0
store i32 %2, i32* %3
%4 = tail call i32 @hamming74_enc_symbol(i32 1)
%5 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 1
store i32 %4, i32* %5
%6 = tail call i32 @hamming74_enc_symbol(i32 2)
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 2
store i32 %6, i32* %7
%8 = tail call i32 @hamming74_enc_symbol(i32 3)
%9 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 3
store i32 %8, i32* %9
%10 = tail call i32 @hamming74_enc_symbol(i32 4)
%11 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 4
store i32 %10, i32* %11
%12 = tail call i32 @hamming74_enc_symbol(i32 5)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 5
store i32 %12, i32* %13
%14 = tail call i32 @hamming74_enc_symbol(i32 6)
%15 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 6
store i32 %14, i32* %15
%16 = tail call i32 @hamming74_enc_symbol(i32 7)
%17 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 7
store i32 %16, i32* %17
%18 = tail call i32 @hamming74_enc_symbol(i32 8)
%19 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 8
store i32 %18, i32* %19
%20 = tail call i32 @hamming74_enc_symbol(i32 9)
%21 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 9
store i32 %20, i32* %21
%22 = tail call i32 @hamming74_enc_symbol(i32 10)
%23 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 10
store i32 %22, i32* %23
%24 = tail call i32 @hamming74_enc_symbol(i32 11)
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 11
store i32 %24, i32* %25
%26 = tail call i32 @hamming74_enc_symbol(i32 12)
%27 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 12
store i32 %26, i32* %27
%28 = tail call i32 @hamming74_enc_symbol(i32 13)
%29 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 13
store i32 %28, i32* %29
%30 = tail call i32 @hamming74_enc_symbol(i32 14)
%31 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 14
store i32 %30, i32* %31
%32 = tail call i32 @hamming74_enc_symbol(i32 15)
%33 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 15
store i32 %32, i32* %33
%34 = alloca [128 x i32]
br label %35
35: ; preds = %0, %35
%36 = phi i64 [ 0, %0 ], [ %40, %35 ]
%37 = trunc i64 %36 to i32
%38 = tail call i32 @hamming74_dec_symbol(i32 %37)
%39 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %36
store i32 %38, i32* %39
%40 = add nuw nsw i64 %36, 1
%41 = icmp eq i64 %40, 128
br i1 %41, label %42, label %35
42: ; preds = %35
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%44 = tail call i32 @putchar(i32 10)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 16)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %2)
br label %49
47: ; preds = %57
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
br label %62
49: ; preds = %42, %57
%50 = phi i64 [ 0, %42 ], [ %51, %57 ]
%51 = add nuw nsw i64 %50, 1
%52 = and i64 %51, 7
%53 = icmp eq i64 %52, 0
%54 = select i1 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0)
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %54)
%56 = icmp eq i64 %51, 16
br i1 %56, label %62, label %57
57: ; preds = %49
%58 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 %51
%59 = load i32, i32* %58
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %59)
%61 = icmp eq i64 %51, 15
br i1 %61, label %47, label %49
62: ; preds = %49, %47
%63 = tail call i32 @putchar(i32 10)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 128)
br label %65
65: ; preds = %62, %73
%66 = phi i64 [ 0, %62 ], [ %74, %73 ]
%67 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%70 = icmp eq i64 %66, 127
br i1 %70, label %71, label %73
71: ; preds = %65
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.10, i64 0, i64 0))
br label %80
73: ; preds = %65
%74 = add nuw nsw i64 %66, 1
%75 = and i64 %74, 7
%76 = icmp eq i64 %75, 0
%77 = select i1 %76, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %77)
%79 = icmp eq i64 %74, 128
br i1 %79, label %80, label %65
80: ; preds = %73, %71
br label %81
81: ; preds = %80, %150
%82 = phi i32 [ %152, %150 ], [ %2, %80 ]
%83 = phi i64 [ %148, %150 ], [ 0, %80 ]
%84 = phi i32 [ %147, %150 ], [ 0, %80 ]
%85 = zext i32 %82 to i64
%86 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %85
%87 = load i32, i32* %86
%88 = zext i32 %87 to i64
%89 = icmp ne i64 %83, %88
%90 = zext i1 %89 to i32
%91 = add i32 %84, %90
%92 = xor i32 %82, 1
%93 = zext i32 %92 to i64
%94 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = zext i32 %95 to i64
%97 = icmp ne i64 %83, %96
%98 = zext i1 %97 to i32
%99 = add i32 %91, %98
%100 = xor i32 %82, 2
%101 = zext i32 %100 to i64
%102 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %101
%103 = load i32, i32* %102
%104 = zext i32 %103 to i64
%105 = icmp ne i64 %83, %104
%106 = zext i1 %105 to i32
%107 = add i32 %99, %106
%108 = xor i32 %82, 4
%109 = zext i32 %108 to i64
%110 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %109
%111 = load i32, i32* %110
%112 = zext i32 %111 to i64
%113 = icmp ne i64 %83, %112
%114 = zext i1 %113 to i32
%115 = add i32 %107, %114
%116 = xor i32 %82, 8
%117 = zext i32 %116 to i64
%118 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %117
%119 = load i32, i32* %118
%120 = zext i32 %119 to i64
%121 = icmp ne i64 %83, %120
%122 = zext i1 %121 to i32
%123 = add i32 %115, %122
%124 = xor i32 %82, 16
%125 = zext i32 %124 to i64
%126 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %125
%127 = load i32, i32* %126
%128 = zext i32 %127 to i64
%129 = icmp ne i64 %83, %128
%130 = zext i1 %129 to i32
%131 = add i32 %123, %130
%132 = xor i32 %82, 32
%133 = zext i32 %132 to i64
%134 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %133
%135 = load i32, i32* %134
%136 = zext i32 %135 to i64
%137 = icmp ne i64 %83, %136
%138 = zext i1 %137 to i32
%139 = add i32 %131, %138
%140 = xor i32 %82, 64
%141 = zext i32 %140 to i64
%142 = getelementptr inbounds [128 x i32], [128 x i32]* %34, i64 0, i64 %141
%143 = load i32, i32* %142
%144 = zext i32 %143 to i64
%145 = icmp ne i64 %83, %144
%146 = zext i1 %145 to i32
%147 = add i32 %139, %146
%148 = add nuw nsw i64 %83, 1
%149 = icmp eq i64 %148, 16
br i1 %149, label %153, label %150
150: ; preds = %81
%151 = getelementptr inbounds [16 x i32], [16 x i32]* %1, i64 0, i64 %148
%152 = load i32, i32* %151
br label %81
153: ; preds = %81
%154 = tail call i32 @putchar(i32 10)
%155 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %147)
ret i32 0
}