#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 char);
int main() {
  unsigned char x, y, z, a;
  x = 0;
  y = 0;
  z = 0;
  a = 1;
  for (unsigned long i = 0;; i++) {
    unsigned char t = x ^ (x << 4);
    x = y;
    y = z;
    z = a;
    a = z ^ t ^ (z >> 1) ^ (t << 1);
    printf("%i\n", a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
movb   $0x0,-0x7(%rbp)
movb   $0x1,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movzbl -0x5(%rbp),%eax
movzbl -0x5(%rbp),%ecx
shl    $0x4,%ecx
xor    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0x7(%rbp)
movzbl -0x7(%rbp),%eax
movzbl -0x11(%rbp),%ecx
xor    %ecx,%eax
movzbl -0x7(%rbp),%ecx
sar    $0x1,%ecx
xor    %ecx,%eax
movzbl -0x11(%rbp),%ecx
shl    $0x1,%ecx
xor    %ecx,%eax
mov    %al,-0x8(%rbp)
lea    0xe81(%rip),%rdi
movzbl -0x8(%rbp),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <main+0x27>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r12b
xor    %eax,%eax
lea    0xedc(%rip),%r14
xor    %ebp,%ebp
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %eax,%r15d
mov    %ecx,%ebx
shl    $0x4,%bl
xor    %cl,%bl
mov    %r12d,%eax
shr    %al
xor    %r12b,%al
xor    %bl,%al
add    %bl,%bl
xor    %al,%bl
movzbl %bl,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %ebp,%eax
mov    %r12d,%ebp
mov    %ebx,%r12d
mov    %r15d,%ecx
jmp    1130 <main+0x20>

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i64
%7 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
store i8 0, i8* %3
store i8 0, i8* %4
store i8 1, i8* %5
store i64 0, i64* %6
br label %8
8: ; preds = %35, %0
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 4
%14 = xor i32 %10, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %7
%16 = load i8, i8* %3
store i8 %16, i8* %2
%17 = load i8, i8* %4
store i8 %17, i8* %3
%18 = load i8, i8* %5
store i8 %18, i8* %4
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = load i8, i8* %7
%22 = zext i8 %21 to i32
%23 = xor i32 %20, %22
%24 = load i8, i8* %4
%25 = zext i8 %24 to i32
%26 = ashr i32 %25, 1
%27 = xor i32 %23, %26
%28 = load i8, i8* %7
%29 = zext i8 %28 to i32
%30 = shl i32 %29, 1
%31 = xor i32 %27, %30
%32 = trunc i32 %31 to i8
store i8 %32, i8* %5
%33 = load i8, i8* %5
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %33)
br label %35
35: ; preds = %8
%36 = load i64, i64* %6
%37 = add i64 %36, 1
store i64 %37, i64* %6
br label %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i8 [ 0, %0 ], [ %3, %1 ]
%3 = phi i8 [ 0, %0 ], [ %4, %1 ]
%4 = phi i8 [ 1, %0 ], [ %12, %1 ]
%5 = phi i8 [ 0, %0 ], [ %2, %1 ]
%6 = shl i8 %5, 4
%7 = xor i8 %6, %5
%8 = lshr i8 %4, 1
%9 = shl i8 %7, 1
%10 = xor i8 %8, %4
%11 = xor i8 %10, %7
%12 = xor i8 %11, %9
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
br label %1
}