#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 char evalpoly(unsigned char *, unsigned char);
void syndrome(unsigned char c[255], unsigned char s[7]) {
  extern unsigned char e2v[256];
  int i;
  s[0] = 0;
  for (i = 1; i < 7; i++) {
    s[i] = evalpoly(c, e2v[i]);
    s[0] = s[0] | s[i];
  }
}


x86 assembly (clang, -O0):
<syndrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1188 <syndrome+0x78>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rcx
mov    0x2ea1(%rip),%rax
movzbl (%rax,%rcx,1),%esi
call   1030 <evalpoly@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <syndrome+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syndrome>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
movb   $0x0,(%rsi)
mov    0x2ec3(%rip),%r15
movzbl 0x1(%r15),%esi
call   1030 <evalpoly@plt>
mov    %al,0x1(%rbx)
or     %al,(%rbx)
movzbl 0x2(%r15),%esi
mov    %r14,%rdi
call   1030 <evalpoly@plt>
mov    %al,0x2(%rbx)
or     %al,(%rbx)
movzbl 0x3(%r15),%esi
mov    %r14,%rdi
call   1030 <evalpoly@plt>
mov    %al,0x3(%rbx)
or     %al,(%rbx)
movzbl 0x4(%r15),%esi
mov    %r14,%rdi
call   1030 <evalpoly@plt>
mov    %al,0x4(%rbx)
or     %al,(%rbx)
movzbl 0x5(%r15),%esi
mov    %r14,%rdi
call   1030 <evalpoly@plt>
mov    %al,0x5(%rbx)
or     %al,(%rbx)
movzbl 0x6(%r15),%esi
mov    %r14,%rdi
call   1030 <evalpoly@plt>
mov    %al,0x6(%rbx)
or     %al,(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@e2v = external global [256 x i8]
define void @syndrome(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
store i32 1, i32* %5
br label %8
8: ; preds = %36, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %39
11: ; preds = %8
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [256 x i8], [256 x i8]* @e2v, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call zeroext i8 @evalpoly(i8* %12, i8 zeroext %16)
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = or i32 %25, %31
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 0
store i8 %33, i8* %35
br label %36
36: ; preds = %11
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %8
39: ; preds = %8
ret void
}

LLVM IR (-O2):
@e2v = external global [256 x i8]
define void @syndrome(i8* %0, i8* nocapture %1) {
store i8 0, i8* %1
%3 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 1)
%4 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %3)
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %4, i8* %5
%6 = load i8, i8* %1
%7 = or i8 %6, %4
store i8 %7, i8* %1
%8 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 2)
%9 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %8)
%10 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %9, i8* %10
%11 = load i8, i8* %1
%12 = or i8 %11, %9
store i8 %12, i8* %1
%13 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 3)
%14 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %13)
%15 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %14, i8* %15
%16 = load i8, i8* %1
%17 = or i8 %16, %14
store i8 %17, i8* %1
%18 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 4)
%19 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %18)
%20 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %19, i8* %20
%21 = load i8, i8* %1
%22 = or i8 %21, %19
store i8 %22, i8* %1
%23 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 5)
%24 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %23)
%25 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %24, i8* %25
%26 = load i8, i8* %1
%27 = or i8 %26, %24
store i8 %27, i8* %1
%28 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @e2v, i64 0, i64 6)
%29 = tail call zeroext i8 @evalpoly(i8* %0, i8 zeroext %28)
%30 = getelementptr inbounds i8, i8* %1, i64 6
store i8 %29, i8* %30
%31 = load i8, i8* %1
%32 = or i8 %31, %29
store i8 %32, i8* %1
ret void
}