#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 */
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int input = 0x0000;
  while (input < 0xFFFF) {
    unsigned int seed = input;
    unsigned int seed_tmp = 0;
    unsigned char count = 0;
    unsigned char idx;
    unsigned char fib_tap = 0;
    count = ((seed >> 0xC & 0x8) | (seed >> 0x5 & 0x4) | (seed >> 0x3 & 0x2) |
             (seed & 0x1)) +
            1;
    for (idx = 1; idx <= count; idx++) {
      fib_tap = ((seed >> 1) ^ (seed >> 2) ^ (seed >> 8) ^ (seed >> 9)) & 1;
      seed_tmp = ((seed >> 1) | (fib_tap << 0xF));
      if ((seed >> 0x3 & 1) && (seed >> 0xD & 1)) {
        seed = seed_tmp & ~1;
      } else {
        seed = seed_tmp | 1;
      }
    }
    printf("%#06x ", input);
    printf("%#06x\n", seed);
    input++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xffff,-0x8(%rbp)
jae    1238 <main+0x128>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x13(%rbp)
mov    -0xc(%rbp),%eax
shr    $0xc,%eax
and    $0x8,%eax
mov    -0xc(%rbp),%ecx
shr    $0x5,%ecx
and    $0x4,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shr    $0x3,%ecx
and    $0x2,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
add    $0x1,%eax
mov    %al,-0x11(%rbp)
movb   $0x1,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jg     120c <main+0xfc>
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    -0xc(%rbp),%ecx
shr    $0x2,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
shr    $0x8,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
shr    $0x9,%ecx
xor    %ecx,%eax
and    $0x1,%eax
mov    %al,-0x13(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
movzbl -0x13(%rbp),%ecx
shl    $0xf,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x3,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f1 <main+0xe1>
mov    -0xc(%rbp),%eax
shr    $0xd,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11f1 <main+0xe1>
mov    -0x10(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0xc(%rbp)
jmp    11fa <main+0xea>
mov    -0x10(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ff <main+0xef>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1179 <main+0x69>
mov    -0x8(%rbp),%esi
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xde2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r12d,%r12d
lea    0xede(%rip),%r14
lea    0xede(%rip),%r15
nopl   0x0(%rax)
mov    %r12d,%eax
shr    $0xc,%eax
and    $0x8,%eax
mov    %r12d,%ecx
shr    $0x5,%ecx
and    $0x4,%ecx
mov    %r12d,%edx
shr    $0x3,%edx
and    $0x2,%edx
mov    %r12d,%esi
and    $0x1,%esi
or     %edx,%esi
or     %ecx,%esi
add    %esi,%eax
add    $0x1,%eax
xor    %ecx,%ecx
mov    %r12d,%ebx
nop
mov    %ebx,%edx
shr    %edx
mov    %ebx,%esi
shr    $0x2,%esi
xor    %edx,%esi
mov    %ebx,%edi
shr    $0x8,%edi
mov    %ebx,%ebp
shr    $0x9,%ebp
xor    %edi,%ebp
xor    %esi,%ebp
shl    $0xf,%ebp
movzwl %bp,%esi
or     %edx,%esi
not    %ebx
mov    %esi,%edx
and    $0xfffffffe,%edx
or     $0x1,%esi
test   $0x2008,%ebx
mov    %esi,%ebx
cmove  %edx,%ebx
add    $0x1,%ecx
cmp    %ecx,%eax
ja     1160 <main+0x50>
mov    %r14,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%r12d
cmp    $0xffff,%r12d
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%x \00"
@.str.1 = [7 x i8] c"%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
br label %8
8: ; preds = %74, %0
%9 = load i32, i32* %2
%10 = icmp ult i32 %9, 65535
br i1 %10, label %11, label %81
11: ; preds = %8
%12 = load i32, i32* %2
store i32 %12, i32* %3
store i32 0, i32* %4
store i8 0, i8* %5
store i8 0, i8* %7
%13 = load i32, i32* %3
%14 = lshr i32 %13, 12
%15 = and i32 %14, 8
%16 = load i32, i32* %3
%17 = lshr i32 %16, 5
%18 = and i32 %17, 4
%19 = or i32 %15, %18
%20 = load i32, i32* %3
%21 = lshr i32 %20, 3
%22 = and i32 %21, 2
%23 = or i32 %19, %22
%24 = load i32, i32* %3
%25 = and i32 %24, 1
%26 = or i32 %23, %25
%27 = add i32 %26, 1
%28 = trunc i32 %27 to i8
store i8 %28, i8* %5
store i8 1, i8* %6
br label %29
29: ; preds = %71, %11
%30 = load i8, i8* %6
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = icmp sle i32 %31, %33
br i1 %34, label %35, label %74
35: ; preds = %29
%36 = load i32, i32* %3
%37 = lshr i32 %36, 1
%38 = load i32, i32* %3
%39 = lshr i32 %38, 2
%40 = xor i32 %37, %39
%41 = load i32, i32* %3
%42 = lshr i32 %41, 8
%43 = xor i32 %40, %42
%44 = load i32, i32* %3
%45 = lshr i32 %44, 9
%46 = xor i32 %43, %45
%47 = and i32 %46, 1
%48 = trunc i32 %47 to i8
store i8 %48, i8* %7
%49 = load i32, i32* %3
%50 = lshr i32 %49, 1
%51 = load i8, i8* %7
%52 = zext i8 %51 to i32
%53 = shl i32 %52, 15
%54 = or i32 %50, %53
store i32 %54, i32* %4
%55 = load i32, i32* %3
%56 = lshr i32 %55, 3
%57 = and i32 %56, 1
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %67
59: ; preds = %35
%60 = load i32, i32* %3
%61 = lshr i32 %60, 13
%62 = and i32 %61, 1
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = load i32, i32* %4
%66 = and i32 %65, -2
store i32 %66, i32* %3
br label %70
67: ; preds = %59, %35
%68 = load i32, i32* %4
%69 = or i32 %68, 1
store i32 %69, i32* %3
br label %70
70: ; preds = %67, %64
br label %71
71: ; preds = %70
%72 = load i8, i8* %6
%73 = add i8 %72, 1
store i8 %73, i8* %6
br label %29
74: ; preds = %29
%75 = load i32, i32* %2
%76 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %3
%78 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %77)
%79 = load i32, i32* %2
%80 = add i32 %79, 1
store i32 %80, i32* %2
br label %8
81: ; preds = %8
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
@.str = [7 x i8] c"%x \00"
@.str.1 = [7 x i8] c"%x\0A\00"
define i32 @main() {
br label %1
1: ; preds = %34, %0
%2 = phi i32 [ 0, %0 ], [ %37, %34 ]
%3 = lshr i32 %2, 12
%4 = and i32 %3, 8
%5 = lshr i32 %2, 5
%6 = and i32 %5, 4
%7 = lshr i32 %2, 3
%8 = and i32 %7, 2
%9 = and i32 %2, 1
%10 = add nuw nsw i32 %9, 1
%11 = add nuw nsw i32 %10, %8
%12 = add nuw nsw i32 %11, %6
%13 = add nuw nsw i32 %12, %4
br label %14
14: ; preds = %1, %14
%15 = phi i32 [ 1, %1 ], [ %32, %14 ]
%16 = phi i32 [ %2, %1 ], [ %31, %14 ]
%17 = lshr i32 %16, 1
%18 = lshr i32 %16, 2
%19 = xor i32 %17, %18
%20 = lshr i32 %16, 8
%21 = xor i32 %19, %20
%22 = lshr i32 %16, 9
%23 = xor i32 %21, %22
%24 = shl i32 %23, 15
%25 = and i32 %24, 32768
%26 = or i32 %25, %17
%27 = and i32 %16, 8200
%28 = icmp eq i32 %27, 8200
%29 = and i32 %26, 2147483646
%30 = or i32 %26, 1
%31 = select i1 %28, i32 %29, i32 %30
%32 = add nuw nsw i32 %15, 1
%33 = icmp ugt i32 %13, %15
br i1 %33, label %14, label %34
34: ; preds = %14
%35 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%37 = add nuw nsw i32 %2, 1
%38 = icmp eq i32 %37, 65535
br i1 %38, label %39, label %1
39: ; preds = %34
ret i32 0
}