#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 *, int);
int main() {
  int i, y = 0;
  for (i = 0; i < 256; ++i) {
    int y0 = (y & 1) ^ ((y >> 3) & 1) ^ ((y >> 7) & 1) ^ 1;
    y = ((y << 1) & 0xff) | y0;
    printf("%d\n", y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    118a <main+0x7a>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
and    $0x1,%ecx
xor    %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x7,%ecx
and    $0x1,%ecx
xor    %ecx,%eax
xor    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
and    $0xff,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
mov    $0x100,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%eax
shr    $0x3,%eax
xor    %ebx,%eax
mov    %ebx,%ecx
shr    $0x7,%ecx
xor    %eax,%ecx
and    $0x1,%ecx
and    $0x7f,%ebx
lea    (%rcx,%rbx,2),%ebx
xor    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %2
br label %5
5: ; preds = %27, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load i32, i32* %3
%10 = and i32 %9, 1
%11 = load i32, i32* %3
%12 = ashr i32 %11, 3
%13 = and i32 %12, 1
%14 = xor i32 %10, %13
%15 = load i32, i32* %3
%16 = ashr i32 %15, 7
%17 = and i32 %16, 1
%18 = xor i32 %14, %17
%19 = xor i32 %18, 1
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = shl i32 %20, 1
%22 = and i32 %21, 255
%23 = load i32, i32* %4
%24 = or i32 %22, %23
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %8
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %5
30: ; preds = %5
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %14, %1 ]
%3 = phi i32 [ 0, %0 ], [ %12, %1 ]
%4 = lshr i32 %3, 3
%5 = xor i32 %4, %3
%6 = lshr i32 %3, 7
%7 = xor i32 %5, %6
%8 = and i32 %7, 1
%9 = shl nsw i32 %3, 1
%10 = and i32 %9, 254
%11 = or i32 %8, %10
%12 = xor i32 %11, 1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i32 %2, 1
%15 = icmp eq i32 %14, 256
br i1 %15, label %16, label %1
16: ; preds = %1
ret i32 0
}