#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 mpy_mod_gf(unsigned int, unsigned int);
int /*<<< orphan*/ pr_debug(char *, ...);
void syndrome(unsigned int select_4_8, unsigned char *ecc, unsigned int syn[]) {
  unsigned int k, l, t;
  unsigned int alpha_bit, R_bit;
  int ecc_pos, ecc_min;
  unsigned int pow_alpha[8] = {0x0002, 0x0008, 0x0020, 0x0080,
                               0x0200, 0x0800, 0x001B, 0x006C};
  pr_debug("\n ECC[0..n]: ");
  for (k = 0; k < 13; k++)
    pr_debug("0x%x ", ecc[k]);
  if (select_4_8 == 0) {
    t = 4;
    ecc_pos = 55;
    ecc_min = 4;
  } else {
    t = 8;
    ecc_pos = 103;
    ecc_min = 0;
  }
  R_bit = ((ecc[ecc_pos / 8] >> (7 - ecc_pos % 8)) & 1);
  ecc_pos--;
  for (k = 0; k < t; k++)
    syn[2 * k] = R_bit;
  while (ecc_pos >= ecc_min) {
    R_bit = ((ecc[ecc_pos / 8] >> (7 - ecc_pos % 8)) & 1);
    ecc_pos--;
    for (k = 0; k < t; k++) {
      if (R_bit == 1)
        syn[2 * k] ^= pow_alpha[k];
      for (l = 0; l < (2 * k + 1); l++) {
        alpha_bit = (pow_alpha[k] >> 12) & 1;
        pow_alpha[k] = (pow_alpha[k] << 1) & 0x1FFF;
        if (alpha_bit == 1)
          pow_alpha[k] ^= 0x001B;
      }
    }
  }
  for (k = 0; k < t; k++)
    syn[2 * k + 1] = mpy_mod_gf(syn[k], syn[k]);
  pr_debug("\n Syndromes: ");
  for (k = 0; k < 16; k++)
    pr_debug("0x%x ", syn[k]);
}


x86 assembly (clang, -O0):
<syndrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <pr_debug@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xd,-0x1c(%rbp)
jae    11a8 <syndrome+0x88>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movzbl (%rax,%rcx,1),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <pr_debug@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1177 <syndrome+0x57>
cmpl   $0x0,-0x4(%rbp)
jne    11cc <syndrome+0xac>
movl   $0x4,-0x24(%rbp)
movl   $0x37,-0x30(%rbp)
movl   $0x4,-0x34(%rbp)
jmp    11e1 <syndrome+0xc1>
movl   $0x8,-0x24(%rbp)
movl   $0x67,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x64(%rbp),%eax
mov    $0x7,%ecx
sub    %edx,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    125d <syndrome+0x13d>
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1231 <syndrome+0x111>
jmp    1262 <syndrome+0x142>
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jl     1372 <syndrome+0x252>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x80(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x74(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x74(%rbp),%eax
mov    $0x7,%ecx
sub    %edx,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    136d <syndrome+0x24d>
cmpl   $0x1,-0x2c(%rbp)
jne    12ed <syndrome+0x1cd>
mov    -0x1c(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
mov    %ecx,%ecx
xor    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    135a <syndrome+0x23a>
mov    -0x1c(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%eax
shr    $0xc,%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%ecx
shl    $0x1,%ecx
and    $0x1fff,%ecx
mov    -0x1c(%rbp),%eax
mov    %ecx,-0x60(%rbp,%rax,4)
cmpl   $0x1,-0x28(%rbp)
jne    1347 <syndrome+0x227>
mov    -0x1c(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%ecx
xor    $0x1b,%ecx
mov    %ecx,-0x60(%rbp,%rax,4)
jmp    134c <syndrome+0x22c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12f4 <syndrome+0x1d4>
jmp    135f <syndrome+0x23f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12be <syndrome+0x19e>
jmp    1262 <syndrome+0x142>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    13c0 <syndrome+0x2a0>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1040 <mpy_mod_gf@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1379 <syndrome+0x259>
lea    0xc6d(%rip),%rdi
mov    $0x0,%al
call   1030 <pr_debug@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jae    1405 <syndrome+0x2e5>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1030 <pr_debug@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13d5 <syndrome+0x2b5>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syndrome>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %edi,%r15d
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xecb(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl (%r14),%esi
lea    0xec5(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x1(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x2(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x3(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x4(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x5(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x6(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x7(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x8(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0x9(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0xa(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0xb(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
movzbl 0xc(%r14),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
xor    %ecx,%ecx
test   %r15d,%r15d
setne  %cl
mov    $0x37,%edx
mov    $0x67,%r9d
cmove  %edx,%r9d
lea    0x4(,%rcx,4),%r13
mov    %r9,%rcx
shr    $0x3,%rcx
movzbl (%r14,%rcx,1),%ecx
and    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,(%r12,%rbx,8)
mov    %ecx,0x8(%r12,%rbx,8)
mov    %ecx,0x10(%r12,%rbx,8)
mov    %ecx,0x18(%r12,%rbx,8)
add    $0x4,%rbx
cmp    %rbx,%r13
jne    1260 <syndrome+0x140>
xor    %r8d,%r8d
test   %r15d,%r15d
sete   %r8b
shl    $0x2,%r8d
jmp    1299 <syndrome+0x179>
nopl   0x0(%rax)
cmp    %r8d,%r9d
jle    1364 <syndrome+0x244>
mov    %r9d,%ecx
lea    -0x1(%rcx),%r9d
lea    0x6(%rcx),%edx
test   %r9d,%r9d
cmovns %r9d,%edx
mov    %edx,%edi
sar    $0x3,%edi
and    $0xfffffff8,%edx
neg    %edx
add    %ecx,%edx
add    $0xffffffff,%edx
mov    $0x7,%cl
sub    %dl,%cl
mov    $0x1,%esi
shl    %cl,%esi
movzbl (%r14,%rdi,1),%edx
mov    $0x1,%ecx
and    %edx,%esi
xor    %edi,%edi
jmp    12ef <syndrome+0x1cf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,(%rsp,%rdi,4)
add    $0x1,%rdi
add    $0x2,%ecx
cmp    %r13,%rdi
je     1290 <syndrome+0x170>
mov    (%rsp,%rdi,4),%ebx
test   %esi,%esi
je     12fa <syndrome+0x1da>
xor    %ebx,(%r12,%rdi,8)
test   $0x7fffffff,%edi
je     1342 <syndrome+0x222>
mov    %edi,%edx
and    $0x3fffffff,%edx
add    %edx,%edx
nopl   0x0(%rax)
lea    (%rbx,%rbx,1),%eax
and    $0x1ffe,%eax
mov    %eax,%ebp
xor    $0x1b,%ebp
test   $0x1000,%ebx
cmove  %eax,%ebp
lea    0x0(%rbp,%rbp,1),%eax
and    $0x1ffe,%eax
mov    %eax,%ebx
xor    $0x1b,%ebx
test   $0x1000,%ebp
cmove  %eax,%ebx
add    $0xfffffffe,%edx
jne    1310 <syndrome+0x1f0>
test   $0x1,%cl
je     12e0 <syndrome+0x1c0>
lea    (%rbx,%rbx,1),%eax
and    $0x1ffe,%eax
mov    %eax,%edx
xor    $0x1b,%edx
test   $0x1000,%ebx
cmove  %eax,%edx
mov    %edx,%ebx
jmp    12e0 <syndrome+0x1c0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%edi
mov    %edi,%esi
call   1040 <mpy_mod_gf@plt>
mov    %eax,0x4(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1370 <syndrome+0x250>
lea    0xca4(%rip),%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    (%r12),%esi
lea    0xc8c(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x4(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x8(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0xc(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x10(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x14(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x18(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x1c(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x20(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x24(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x28(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x2c(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x30(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x34(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x38(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <pr_debug@plt>
mov    0x3c(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <pr_debug@plt>

LLVM IR (-O0):
@__const.syndrome.pow_alpha = [8 x i32] [i32 2, i32 8, i32 32, i32 128, i32 512, i32 2048, i32 27, i32 108]
@.str = [14 x i8] c"\0A ECC[0..n]: \00"
@.str.1 = [6 x i8] c"0x%x \00"
@.str.2 = [14 x i8] c"\0A Syndromes: \00"
define void @syndrome(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [8 x i32]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%15 = bitcast [8 x i32]* %14 to i8*
%16 = call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %17
17: ; preds = %28, %3
%18 = load i32, i32* %7
%19 = icmp ult i32 %18, 13
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load i8*, i8** %5
%22 = load i32, i32* %7
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %20
%29 = load i32, i32* %7
%30 = add i32 %29, 1
store i32 %30, i32* %7
br label %17
31: ; preds = %17
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 4, i32* %9
store i32 55, i32* %12
store i32 4, i32* %13
br label %36
35: ; preds = %31
store i32 8, i32* %9
store i32 103, i32* %12
store i32 0, i32* %13
br label %36
36: ; preds = %35, %34
%37 = load i8*, i8** %5
%38 = load i32, i32* %12
%39 = sdiv i32 %38, 8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = load i32, i32* %12
%45 = srem i32 %44, 8
%46 = sub nsw i32 7, %45
%47 = ashr i32 %43, %46
%48 = and i32 %47, 1
store i32 %48, i32* %11
%49 = load i32, i32* %12
%50 = add nsw i32 %49, -1
store i32 %50, i32* %12
store i32 0, i32* %7
br label %51
51: ; preds = %62, %36
%52 = load i32, i32* %7
%53 = load i32, i32* %9
%54 = icmp ult i32 %52, %53
br i1 %54, label %55, label %65
55: ; preds = %51
%56 = load i32, i32* %11
%57 = load i32*, i32** %6
%58 = load i32, i32* %7
%59 = mul i32 2, %58
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %57, i64 %60
store i32 %56, i32* %61
br label %62
62: ; preds = %55
%63 = load i32, i32* %7
%64 = add i32 %63, 1
store i32 %64, i32* %7
br label %51
65: ; preds = %51
br label %66
66: ; preds = %143, %65
%67 = load i32, i32* %12
%68 = load i32, i32* %13
%69 = icmp sge i32 %67, %68
br i1 %69, label %70, label %144
70: ; preds = %66
%71 = load i8*, i8** %5
%72 = load i32, i32* %12
%73 = sdiv i32 %72, 8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %71, i64 %74
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = load i32, i32* %12
%79 = srem i32 %78, 8
%80 = sub nsw i32 7, %79
%81 = ashr i32 %77, %80
%82 = and i32 %81, 1
store i32 %82, i32* %11
%83 = load i32, i32* %12
%84 = add nsw i32 %83, -1
store i32 %84, i32* %12
store i32 0, i32* %7
br label %85
85: ; preds = %140, %70
%86 = load i32, i32* %7
%87 = load i32, i32* %9
%88 = icmp ult i32 %86, %87
br i1 %88, label %89, label %143
89: ; preds = %85
%90 = load i32, i32* %11
%91 = icmp eq i32 %90, 1
br i1 %91, label %92, label %104
92: ; preds = %89
%93 = load i32, i32* %7
%94 = zext i32 %93 to i64
%95 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = load i32*, i32** %6
%98 = load i32, i32* %7
%99 = mul i32 2, %98
%100 = zext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %97, i64 %100
%102 = load i32, i32* %101
%103 = xor i32 %102, %96
store i32 %103, i32* %101
br label %104
104: ; preds = %92, %89
store i32 0, i32* %8
br label %105
105: ; preds = %136, %104
%106 = load i32, i32* %8
%107 = load i32, i32* %7
%108 = mul i32 2, %107
%109 = add i32 %108, 1
%110 = icmp ult i32 %106, %109
br i1 %110, label %111, label %139
111: ; preds = %105
%112 = load i32, i32* %7
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = lshr i32 %115, 12
%117 = and i32 %116, 1
store i32 %117, i32* %10
%118 = load i32, i32* %7
%119 = zext i32 %118 to i64
%120 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %119
%121 = load i32, i32* %120
%122 = shl i32 %121, 1
%123 = and i32 %122, 8191
%124 = load i32, i32* %7
%125 = zext i32 %124 to i64
%126 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %125
store i32 %123, i32* %126
%127 = load i32, i32* %10
%128 = icmp eq i32 %127, 1
br i1 %128, label %129, label %135
129: ; preds = %111
%130 = load i32, i32* %7
%131 = zext i32 %130 to i64
%132 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %131
%133 = load i32, i32* %132
%134 = xor i32 %133, 27
store i32 %134, i32* %132
br label %135
135: ; preds = %129, %111
br label %136
136: ; preds = %135
%137 = load i32, i32* %8
%138 = add i32 %137, 1
store i32 %138, i32* %8
br label %105
139: ; preds = %105
br label %140
140: ; preds = %139
%141 = load i32, i32* %7
%142 = add i32 %141, 1
store i32 %142, i32* %7
br label %85
143: ; preds = %85
br label %66
144: ; preds = %66
store i32 0, i32* %7
br label %145
145: ; preds = %167, %144
%146 = load i32, i32* %7
%147 = load i32, i32* %9
%148 = icmp ult i32 %146, %147
br i1 %148, label %149, label %170
149: ; preds = %145
%150 = load i32*, i32** %6
%151 = load i32, i32* %7
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %150, i64 %152
%154 = load i32, i32* %153
%155 = load i32*, i32** %6
%156 = load i32, i32* %7
%157 = zext i32 %156 to i64
%158 = getelementptr inbounds i32, i32* %155, i64 %157
%159 = load i32, i32* %158
%160 = call i32 @mpy_mod_gf(i32 %154, i32 %159)
%161 = load i32*, i32** %6
%162 = load i32, i32* %7
%163 = mul i32 2, %162
%164 = add i32 %163, 1
%165 = zext i32 %164 to i64
%166 = getelementptr inbounds i32, i32* %161, i64 %165
store i32 %160, i32* %166
br label %167
167: ; preds = %149
%168 = load i32, i32* %7
%169 = add i32 %168, 1
store i32 %169, i32* %7
br label %145
170: ; preds = %145
%171 = call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %172
172: ; preds = %182, %170
%173 = load i32, i32* %7
%174 = icmp ult i32 %173, 16
br i1 %174, label %175, label %185
175: ; preds = %172
%176 = load i32*, i32** %6
%177 = load i32, i32* %7
%178 = zext i32 %177 to i64
%179 = getelementptr inbounds i32, i32* %176, i64 %178
%180 = load i32, i32* %179
%181 = call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %180)
br label %182
182: ; preds = %175
%183 = load i32, i32* %7
%184 = add i32 %183, 1
store i32 %184, i32* %7
br label %172
185: ; preds = %172
ret void
}

LLVM IR (-O2):
@__const.syndrome.pow_alpha = [8 x i32] [i32 2, i32 8, i32 32, i32 128, i32 512, i32 2048, i32 27, i32 108]
@.str = [14 x i8] c"\0A ECC[0..n]: \00"
@.str.1 = [6 x i8] c"0x%x \00"
@.str.2 = [14 x i8] c"\0A Syndromes: \00"
define void @syndrome(i32 %0, i8* nocapture %1, i32* nocapture %2) {
%4 = alloca [8 x i32]
%5 = bitcast [8 x i32]* %4 to i8*
%6 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i8, i8* %1, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds i8, i8* %1, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds i8, i8* %1, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds i8, i8* %1, i64 4
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds i8, i8* %1, i64 5
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds i8, i8* %1, i64 6
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i8, i8* %1, i64 7
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds i8, i8* %1, i64 8
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds i8, i8* %1, i64 9
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds i8, i8* %1, i64 10
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds i8, i8* %1, i64 11
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds i8, i8* %1, i64 12
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = icmp eq i32 %0, 0
%59 = select i1 %58, i64 4, i64 8
%60 = select i1 %58, i32 55, i32 103
%61 = lshr i32 %60, 3
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %1, i64 %62
%64 = load i8, i8* %63
%65 = and i8 %64, 1
%66 = zext i8 %65 to i32
br label %69
67: ; preds = %69
%68 = select i1 %58, i32 4, i32 0
br label %86
69: ; preds = %69, %3
%70 = phi i64 [ 0, %3 ], [ %82, %69 ]
%71 = shl nuw i64 %70, 1
%72 = getelementptr inbounds i32, i32* %2, i64 %71
store i32 %66, i32* %72
%73 = shl nuw i64 %70, 1
%74 = or i64 %73, 2
%75 = getelementptr inbounds i32, i32* %2, i64 %74
store i32 %66, i32* %75
%76 = shl nuw i64 %70, 1
%77 = or i64 %76, 4
%78 = getelementptr inbounds i32, i32* %2, i64 %77
store i32 %66, i32* %78
%79 = shl nuw i64 %70, 1
%80 = or i64 %79, 6
%81 = getelementptr inbounds i32, i32* %2, i64 %80
store i32 %66, i32* %81
%82 = add nuw nsw i64 %70, 4
%83 = icmp eq i64 %82, %59
br i1 %83, label %67, label %69
84: ; preds = %144
%85 = icmp sgt i32 %88, %68
br i1 %85, label %86, label %149
86: ; preds = %67, %84
%87 = phi i32 [ %60, %67 ], [ %88, %84 ]
%88 = add nsw i32 %87, -1
%89 = sdiv i32 %88, 8
%90 = zext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %1, i64 %90
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = srem i32 %88, 8
%95 = sub nsw i32 7, %94
%96 = shl nuw nsw i32 1, %95
%97 = and i32 %96, %93
%98 = icmp eq i32 %97, 0
br label %99
99: ; preds = %86, %144
%100 = phi i64 [ 0, %86 ], [ %146, %144 ]
%101 = phi i32 [ 1, %86 ], [ %147, %144 ]
%102 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 %100
%103 = load i32, i32* %102
br i1 %98, label %109, label %104
104: ; preds = %99
%105 = shl nuw i64 %100, 1
%106 = getelementptr inbounds i32, i32* %2, i64 %105
%107 = load i32, i32* %106
%108 = xor i32 %107, %103
store i32 %108, i32* %106
br label %109
109: ; preds = %99, %104
%110 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 %100
%111 = and i32 %101, 1
%112 = and i64 %100, 2147483647
%113 = icmp eq i64 %112, 0
br i1 %113, label %133, label %114
114: ; preds = %109
%115 = and i32 %101, 2147483646
br label %116
116: ; preds = %116, %114
%117 = phi i32 [ %103, %114 ], [ %130, %116 ]
%118 = phi i32 [ 0, %114 ], [ %131, %116 ]
%119 = shl i32 %117, 1
%120 = and i32 %119, 8190
%121 = and i32 %117, 4096
%122 = icmp eq i32 %121, 0
%123 = xor i32 %120, 27
%124 = select i1 %122, i32 %120, i32 %123
%125 = shl nuw nsw i32 %124, 1
%126 = and i32 %125, 8190
%127 = and i32 %124, 4096
%128 = icmp eq i32 %127, 0
%129 = xor i32 %126, 27
%130 = select i1 %128, i32 %126, i32 %129
%131 = add i32 %118, 2
%132 = icmp eq i32 %131, %115
br i1 %132, label %133, label %116
133: ; preds = %116, %109
%134 = phi i32 [ undef, %109 ], [ %130, %116 ]
%135 = phi i32 [ %103, %109 ], [ %130, %116 ]
%136 = icmp eq i32 %111, 0
br i1 %136, label %144, label %137
137: ; preds = %133
%138 = shl i32 %135, 1
%139 = and i32 %138, 8190
%140 = and i32 %135, 4096
%141 = icmp eq i32 %140, 0
%142 = xor i32 %139, 27
%143 = select i1 %141, i32 %139, i32 %142
br label %144
144: ; preds = %133, %137
%145 = phi i32 [ %134, %133 ], [ %143, %137 ]
store i32 %145, i32* %110
%146 = add nuw nsw i64 %100, 1
%147 = add nuw nsw i32 %101, 2
%148 = icmp eq i64 %146, %59
br i1 %148, label %84, label %99
149: ; preds = %84, %149
%150 = phi i64 [ %157, %149 ], [ 0, %84 ]
%151 = getelementptr inbounds i32, i32* %2, i64 %150
%152 = load i32, i32* %151
%153 = tail call i32 @mpy_mod_gf(i32 %152, i32 %152)
%154 = shl nuw i64 %150, 1
%155 = or i64 %154, 1
%156 = getelementptr inbounds i32, i32* %2, i64 %155
store i32 %153, i32* %156
%157 = add nuw nsw i64 %150, 1
%158 = icmp eq i64 %157, %59
br i1 %158, label %159, label %149
159: ; preds = %149
%160 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%161 = load i32, i32* %2
%162 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %161)
%163 = getelementptr inbounds i32, i32* %2, i64 1
%164 = load i32, i32* %163
%165 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %164)
%166 = getelementptr inbounds i32, i32* %2, i64 2
%167 = load i32, i32* %166
%168 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %167)
%169 = getelementptr inbounds i32, i32* %2, i64 3
%170 = load i32, i32* %169
%171 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %170)
%172 = getelementptr inbounds i32, i32* %2, i64 4
%173 = load i32, i32* %172
%174 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %173)
%175 = getelementptr inbounds i32, i32* %2, i64 5
%176 = load i32, i32* %175
%177 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %176)
%178 = getelementptr inbounds i32, i32* %2, i64 6
%179 = load i32, i32* %178
%180 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %179)
%181 = getelementptr inbounds i32, i32* %2, i64 7
%182 = load i32, i32* %181
%183 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %182)
%184 = getelementptr inbounds i32, i32* %2, i64 8
%185 = load i32, i32* %184
%186 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %185)
%187 = getelementptr inbounds i32, i32* %2, i64 9
%188 = load i32, i32* %187
%189 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %188)
%190 = getelementptr inbounds i32, i32* %2, i64 10
%191 = load i32, i32* %190
%192 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %191)
%193 = getelementptr inbounds i32, i32* %2, i64 11
%194 = load i32, i32* %193
%195 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %194)
%196 = getelementptr inbounds i32, i32* %2, i64 12
%197 = load i32, i32* %196
%198 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %197)
%199 = getelementptr inbounds i32, i32* %2, i64 13
%200 = load i32, i32* %199
%201 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %200)
%202 = getelementptr inbounds i32, i32* %2, i64 14
%203 = load i32, i32* %202
%204 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %203)
%205 = getelementptr inbounds i32, i32* %2, i64 15
%206 = load i32, i32* %205
%207 = tail call i32 (i8*, ...) @pr_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %206)
ret void
}