#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ emit_text(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void generate_eq(FILE *f, const char *field) {
  uint32_t i;
  uint32_t j;
  emit_text(f, "static const uint8_t ");
  emit_text(f, field);
  emit_text(f, "[] __attribute__ ((aligned (64)))  = {\n\t");
  for (i = 0U; i <= 0xffff; ++i) {
    for (j = 0U; j < 16U; ++j) {
      uint32_t tst = !!(i & (1U << j));
      if (tst == 0U) {
        break;
      }
    }
    fprintf(f, "%dU,", j);
    if (i && (!(i & 15))) {
      emit_text(f, "\n\t");
    }
  }
  emit_text(f, "\n\t};\n");
}


x86 assembly (clang, -O0):
<generate_eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <emit_text@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <emit_text@plt>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1040 <emit_text@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xffff,-0x14(%rbp)
jg     1216 <generate_eq+0xf6>
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jae    11c7 <generate_eq+0xa7>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11b4 <generate_eq+0x94>
jmp    11c7 <generate_eq+0xa7>
jmp    11b9 <generate_eq+0x99>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1178 <generate_eq+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe6a(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
je     1203 <generate_eq+0xe3>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    1203 <generate_eq+0xe3>
mov    -0x8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1040 <emit_text@plt>
jmp    1208 <generate_eq+0xe8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <generate_eq+0x44>
mov    -0x8(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1040 <emit_text@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_eq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecc(%rip),%rsi
call   1040 <emit_text@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <emit_text@plt>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <emit_text@plt>
xor    %ebp,%ebp
lea    0xee3(%rip),%r14
lea    0xed9(%rip),%r15
jmp    117f <generate_eq+0x5f>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0x10000,%ebp
je     128e <generate_eq+0x16e>
mov    $0x0,%edx
test   $0x1,%bpl
je     1260 <generate_eq+0x140>
mov    $0x1,%edx
test   $0x2,%bpl
je     1260 <generate_eq+0x140>
mov    $0x2,%edx
test   $0x4,%bpl
je     1260 <generate_eq+0x140>
mov    $0x3,%edx
test   $0x8,%bpl
je     1260 <generate_eq+0x140>
mov    $0x4,%edx
test   $0x10,%bpl
je     1260 <generate_eq+0x140>
mov    $0x5,%edx
test   $0x20,%bpl
je     1260 <generate_eq+0x140>
mov    $0x6,%edx
test   $0x40,%bpl
je     1260 <generate_eq+0x140>
mov    $0x7,%edx
test   $0x80,%bpl
je     1260 <generate_eq+0x140>
mov    $0x8,%edx
test   $0x100,%ebp
je     1260 <generate_eq+0x140>
mov    $0x9,%edx
test   $0x200,%ebp
je     1260 <generate_eq+0x140>
mov    $0xa,%edx
test   $0x400,%ebp
je     1260 <generate_eq+0x140>
mov    $0xb,%edx
test   $0x800,%ebp
je     1260 <generate_eq+0x140>
mov    $0xc,%edx
test   $0x1000,%ebp
je     1260 <generate_eq+0x140>
mov    $0xd,%edx
test   $0x2000,%ebp
je     1260 <generate_eq+0x140>
mov    $0xe,%edx
test   $0x4000,%ebp
je     1260 <generate_eq+0x140>
mov    %ebp,%eax
and    $0x8000,%eax
cmp    $0x1,%eax
mov    $0x10,%edx
sbb    $0x0,%edx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fprintf@plt>
test   %ebp,%ebp
je     1170 <generate_eq+0x50>
mov    %ebp,%eax
and    $0xf,%eax
jne    1170 <generate_eq+0x50>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <emit_text@plt>
jmp    1170 <generate_eq+0x50>
lea    0xdaf(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <emit_text@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"static const uint8_t \00"
@.str.1 = [41 x i8] c"[] __attribute__ ((aligned (64))) = {\0A\09\00"
@.str.2 = [5 x i8] c"%dU,\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [6 x i8] c"\0A\09};\0A\00"
define void @generate_eq(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i32*, i32** %3
%9 = call i32 @emit_text(i32* %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %3
%11 = load i8*, i8** %4
%12 = call i32 @emit_text(i32* %10, i8* %11)
%13 = load i32*, i32** %3
%14 = call i32 @emit_text(i32* %13, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %15
15: ; preds = %52, %2
%16 = load i32, i32* %5
%17 = icmp sle i32 %16, 65535
br i1 %17, label %18, label %55
18: ; preds = %15
store i32 0, i32* %6
br label %19
19: ; preds = %35, %18
%20 = load i32, i32* %6
%21 = icmp ult i32 %20, 16
br i1 %21, label %22, label %38
22: ; preds = %19
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = shl i32 1, %24
%26 = and i32 %23, %25
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %22
br label %38
34: ; preds = %22
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %19
38: ; preds = %33, %19
%39 = load i32*, i32** %3
%40 = load i32, i32* %6
%41 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %5
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %51
44: ; preds = %38
%45 = load i32, i32* %5
%46 = and i32 %45, 15
%47 = icmp ne i32 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %44
%49 = load i32*, i32** %3
%50 = call i32 @emit_text(i32* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %48, %44, %38
br label %52
52: ; preds = %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %15
55: ; preds = %15
%56 = load i32*, i32** %3
%57 = call i32 @emit_text(i32* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"static const uint8_t \00"
@.str.1 = [41 x i8] c"[] __attribute__ ((aligned (64))) = {\0A\09\00"
@.str.2 = [5 x i8] c"%dU,\00"
@.str.3 = [3 x i8] c"\0A\09\00"
@.str.4 = [6 x i8] c"\0A\09};\0A\00"
define void @generate_eq(i32* %0, i8* %1) {
%3 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @emit_text(i32* %0, i8* %1)
%5 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %2, %65
%7 = phi i32 [ 0, %2 ], [ %66, %65 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %56, label %10
10: ; preds = %6
%11 = and i32 %7, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %56, label %13
13: ; preds = %10
%14 = and i32 %7, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %56, label %16
16: ; preds = %13
%17 = and i32 %7, 8
%18 = icmp eq i32 %17, 0
br i1 %18, label %56, label %19
19: ; preds = %16
%20 = and i32 %7, 16
%21 = icmp eq i32 %20, 0
br i1 %21, label %56, label %22
22: ; preds = %19
%23 = and i32 %7, 32
%24 = icmp eq i32 %23, 0
br i1 %24, label %56, label %25
25: ; preds = %22
%26 = and i32 %7, 64
%27 = icmp eq i32 %26, 0
br i1 %27, label %56, label %28
28: ; preds = %25
%29 = and i32 %7, 128
%30 = icmp eq i32 %29, 0
br i1 %30, label %56, label %31
31: ; preds = %28
%32 = and i32 %7, 256
%33 = icmp eq i32 %32, 0
br i1 %33, label %56, label %34
34: ; preds = %31
%35 = and i32 %7, 512
%36 = icmp eq i32 %35, 0
br i1 %36, label %56, label %37
37: ; preds = %34
%38 = and i32 %7, 1024
%39 = icmp eq i32 %38, 0
br i1 %39, label %56, label %40
40: ; preds = %37
%41 = and i32 %7, 2048
%42 = icmp eq i32 %41, 0
br i1 %42, label %56, label %43
43: ; preds = %40
%44 = and i32 %7, 4096
%45 = icmp eq i32 %44, 0
br i1 %45, label %56, label %46
46: ; preds = %43
%47 = and i32 %7, 8192
%48 = icmp eq i32 %47, 0
br i1 %48, label %56, label %49
49: ; preds = %46
%50 = and i32 %7, 16384
%51 = icmp eq i32 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %49
%53 = and i32 %7, 32768
%54 = icmp eq i32 %53, 0
%55 = select i1 %54, i32 15, i32 16
br label %56
56: ; preds = %52, %49, %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %6
%57 = phi i32 [ 0, %6 ], [ 1, %10 ], [ 2, %13 ], [ 3, %16 ], [ 4, %19 ], [ 5, %22 ], [ 6, %25 ], [ 7, %28 ], [ 8, %31 ], [ 9, %34 ], [ 10, %37 ], [ 11, %40 ], [ 12, %43 ], [ 13, %46 ], [ 14, %49 ], [ %55, %52 ]
%58 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = icmp ne i32 %7, 0
%60 = and i32 %7, 15
%61 = icmp eq i32 %60, 0
%62 = and i1 %59, %61
br i1 %62, label %63, label %65
63: ; preds = %56
%64 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %65
65: ; preds = %56, %63
%66 = add nuw nsw i32 %7, 1
%67 = icmp eq i32 %66, 65536
br i1 %67, label %68, label %6
68: ; preds = %65
%69 = tail call i32 @emit_text(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}