#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 gfexp(unsigned char, int);
unsigned char gfmul(unsigned char, unsigned char);
void errnum(unsigned char s[7], unsigned char *det, int *errs) {
  *det = gfmul(s[2], gfmul(s[4], s[6]));
  *det = ((*det) ^ (gfmul(s[2], gfmul(s[5], s[5]))));
  *det = ((*det) ^ (gfmul(s[6], gfmul(s[3], s[3]))));
  *det = ((*det) ^ (gfmul(s[4], gfmul(s[4], s[4]))));
  *errs = 3;
  if (*det != 0)
    return;
  *det = ((gfmul(s[2], s[4])) ^ (gfexp(s[3], 2)));
  *errs = 2;
  if (*det != 0)
    return;
  *det = s[1];
  *errs = 1;
  if (*det != 0)
    return;
  *errs = 4;
}


x86 assembly (clang, -O0):
<errnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x2e(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %cl,%edi
movzbl 0x6(%rax),%esi
call   1040 <gfmul@plt>
mov    -0x2e(%rbp),%cl
movzbl %cl,%edi
movzbl %al,%esi
call   1040 <gfmul@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x2d(%rbp)
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %cl,%edi
movzbl 0x5(%rax),%esi
call   1040 <gfmul@plt>
mov    -0x2d(%rbp),%cl
movzbl %cl,%edi
movzbl %al,%esi
call   1040 <gfmul@plt>
mov    %al,%cl
mov    -0x2c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%al
mov    %al,-0x25(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %cl,%edi
movzbl 0x3(%rax),%esi
call   1040 <gfmul@plt>
mov    -0x25(%rbp),%cl
movzbl %cl,%edi
movzbl %al,%esi
call   1040 <gfmul@plt>
mov    %al,%cl
mov    -0x24(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,-0x1d(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %cl,%edi
movzbl 0x4(%rax),%esi
call   1040 <gfmul@plt>
mov    -0x1d(%rbp),%cl
movzbl %cl,%edi
movzbl %al,%esi
call   1040 <gfmul@plt>
mov    %al,%cl
mov    -0x1c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     126b <errnum+0x14b>
jmp    1301 <errnum+0x1e1>
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
movzbl %cl,%edi
movzbl 0x4(%rax),%esi
call   1040 <gfmul@plt>
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%esi
movzbl 0x3(%rax),%edi
call   1030 <gfexp@plt>
mov    %al,%cl
mov    -0x34(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     12cb <errnum+0x1ab>
jmp    1301 <errnum+0x1e1>
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     12f7 <errnum+0x1d7>
jmp    1301 <errnum+0x1e1>
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errnum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %rsi,%rbp
mov    %rdi,%r15
movzbl 0x2(%rdi),%ebx
movzbl 0x4(%rdi),%edi
movzbl 0x6(%r15),%esi
call   1040 <gfmul@plt>
movzbl %al,%esi
mov    %ebx,%edi
call   1040 <gfmul@plt>
mov    %eax,%r13d
mov    %al,0x0(%rbp)
movzbl 0x2(%r15),%r12d
movzbl 0x5(%r15),%edi
mov    %edi,%esi
call   1040 <gfmul@plt>
movzbl %al,%esi
mov    %r12d,%edi
call   1040 <gfmul@plt>
mov    %eax,%r14d
xor    %r13b,%r14b
mov    %r14b,0x0(%rbp)
movzbl 0x6(%r15),%r12d
movzbl 0x3(%r15),%edi
mov    %edi,%esi
call   1040 <gfmul@plt>
movzbl %al,%esi
mov    %r12d,%edi
mov    %rbp,%r12
call   1040 <gfmul@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    (%rsp),%r14
mov    %bl,0x0(%rbp)
movzbl 0x4(%r15),%ebp
mov    %ebp,%edi
mov    %ebp,%esi
call   1040 <gfmul@plt>
movzbl %al,%esi
mov    %ebp,%edi
call   1040 <gfmul@plt>
xor    %bl,%al
mov    %al,(%r12)
movl   $0x3,(%r14)
cmpb   $0x0,(%r12)
jne    122a <errnum+0x10a>
movzbl 0x2(%r15),%edi
movzbl 0x4(%r15),%esi
call   1040 <gfmul@plt>
mov    %eax,%ebx
movzbl 0x3(%r15),%edi
mov    $0x2,%esi
call   1030 <gfexp@plt>
xor    %bl,%al
mov    %al,(%r12)
movl   $0x2,(%r14)
cmpb   $0x0,(%r12)
jne    122a <errnum+0x10a>
mov    0x1(%r15),%al
mov    %al,(%r12)
movl   $0x1,(%r14)
xor    %eax,%eax
cmpb   $0x0,(%r12)
sete   %al
lea    (%rax,%rax,2),%eax
add    $0x1,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @errnum(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8, i8* %8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 4
%12 = load i8, i8* %11
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 6
%15 = load i8, i8* %14
%16 = call zeroext i8 @gfmul(i8 zeroext %12, i8 zeroext %15)
%17 = call zeroext i8 @gfmul(i8 zeroext %9, i8 zeroext %16)
%18 = load i8*, i8** %5
store i8 %17, i8* %18
%19 = load i8*, i8** %5
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 5
%27 = load i8, i8* %26
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 5
%30 = load i8, i8* %29
%31 = call zeroext i8 @gfmul(i8 zeroext %27, i8 zeroext %30)
%32 = call zeroext i8 @gfmul(i8 zeroext %24, i8 zeroext %31)
%33 = zext i8 %32 to i32
%34 = xor i32 %21, %33
%35 = trunc i32 %34 to i8
%36 = load i8*, i8** %5
store i8 %35, i8* %36
%37 = load i8*, i8** %5
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 6
%42 = load i8, i8* %41
%43 = load i8*, i8** %4
%44 = getelementptr inbounds i8, i8* %43, i64 3
%45 = load i8, i8* %44
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 3
%48 = load i8, i8* %47
%49 = call zeroext i8 @gfmul(i8 zeroext %45, i8 zeroext %48)
%50 = call zeroext i8 @gfmul(i8 zeroext %42, i8 zeroext %49)
%51 = zext i8 %50 to i32
%52 = xor i32 %39, %51
%53 = trunc i32 %52 to i8
%54 = load i8*, i8** %5
store i8 %53, i8* %54
%55 = load i8*, i8** %5
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 4
%60 = load i8, i8* %59
%61 = load i8*, i8** %4
%62 = getelementptr inbounds i8, i8* %61, i64 4
%63 = load i8, i8* %62
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i64 4
%66 = load i8, i8* %65
%67 = call zeroext i8 @gfmul(i8 zeroext %63, i8 zeroext %66)
%68 = call zeroext i8 @gfmul(i8 zeroext %60, i8 zeroext %67)
%69 = zext i8 %68 to i32
%70 = xor i32 %57, %69
%71 = trunc i32 %70 to i8
%72 = load i8*, i8** %5
store i8 %71, i8* %72
%73 = load i32*, i32** %6
store i32 3, i32* %73
%74 = load i8*, i8** %5
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %3
br label %115
79: ; preds = %3
%80 = load i8*, i8** %4
%81 = getelementptr inbounds i8, i8* %80, i64 2
%82 = load i8, i8* %81
%83 = load i8*, i8** %4
%84 = getelementptr inbounds i8, i8* %83, i64 4
%85 = load i8, i8* %84
%86 = call zeroext i8 @gfmul(i8 zeroext %82, i8 zeroext %85)
%87 = zext i8 %86 to i32
%88 = load i8*, i8** %4
%89 = getelementptr inbounds i8, i8* %88, i64 3
%90 = load i8, i8* %89
%91 = call zeroext i8 @gfexp(i8 zeroext %90, i32 2)
%92 = zext i8 %91 to i32
%93 = xor i32 %87, %92
%94 = trunc i32 %93 to i8
%95 = load i8*, i8** %5
store i8 %94, i8* %95
%96 = load i32*, i32** %6
store i32 2, i32* %96
%97 = load i8*, i8** %5
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %79
br label %115
102: ; preds = %79
%103 = load i8*, i8** %4
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i8, i8* %104
%106 = load i8*, i8** %5
store i8 %105, i8* %106
%107 = load i32*, i32** %6
store i32 1, i32* %107
%108 = load i8*, i8** %5
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %113
112: ; preds = %102
br label %115
113: ; preds = %102
%114 = load i32*, i32** %6
store i32 4, i32* %114
br label %115
115: ; preds = %113, %112, %101, %78
ret void
}

LLVM IR (-O2):
define void @errnum(i8* nocapture %0, i8* nocapture %1, i32* nocapture writeonly %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 2
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 6
%9 = load i8, i8* %8
%10 = tail call zeroext i8 @gfmul(i8 zeroext %7, i8 zeroext %9)
%11 = tail call zeroext i8 @gfmul(i8 zeroext %5, i8 zeroext %10)
store i8 %11, i8* %1
%12 = load i8, i8* %4
%13 = getelementptr inbounds i8, i8* %0, i64 5
%14 = load i8, i8* %13
%15 = tail call zeroext i8 @gfmul(i8 zeroext %14, i8 zeroext %14)
%16 = tail call zeroext i8 @gfmul(i8 zeroext %12, i8 zeroext %15)
%17 = xor i8 %16, %11
store i8 %17, i8* %1
%18 = load i8, i8* %8
%19 = getelementptr inbounds i8, i8* %0, i64 3
%20 = load i8, i8* %19
%21 = tail call zeroext i8 @gfmul(i8 zeroext %20, i8 zeroext %20)
%22 = tail call zeroext i8 @gfmul(i8 zeroext %18, i8 zeroext %21)
%23 = xor i8 %22, %17
store i8 %23, i8* %1
%24 = load i8, i8* %6
%25 = tail call zeroext i8 @gfmul(i8 zeroext %24, i8 zeroext %24)
%26 = tail call zeroext i8 @gfmul(i8 zeroext %24, i8 zeroext %25)
%27 = xor i8 %26, %23
store i8 %27, i8* %1
store i32 3, i32* %2
%28 = load i8, i8* %1
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %45
30: ; preds = %3
%31 = load i8, i8* %4
%32 = load i8, i8* %6
%33 = tail call zeroext i8 @gfmul(i8 zeroext %31, i8 zeroext %32)
%34 = load i8, i8* %19
%35 = tail call zeroext i8 @gfexp(i8 zeroext %34, i32 2)
%36 = xor i8 %35, %33
store i8 %36, i8* %1
store i32 2, i32* %2
%37 = load i8, i8* %1
%38 = icmp eq i8 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %30
%40 = getelementptr inbounds i8, i8* %0, i64 1
%41 = load i8, i8* %40
store i8 %41, i8* %1
store i32 1, i32* %2
%42 = load i8, i8* %1
%43 = icmp eq i8 %42, 0
%44 = select i1 %43, i32 4, i32 1
store i32 %44, i32* %2
br label %45
45: ; preds = %39, %30, %3
ret void
}