#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 *, ...);
void muggle_parity_gen(unsigned char odd) {
  unsigned char c;
  int cnt = 0;
  for (int i = 0; i < 256; ++i) {
    c = (unsigned char)i;
    c >>= 1;
    unsigned char mask = 0x01;
    unsigned char parity = odd;
    for (int j = 0; j < 7; ++j) {
      if ((mask << j) & c) {
        parity ^= 0x01;
      }
    }
    c = (c << 1) | parity;
    printf("%d, ", (unsigned int)c);
    if (++cnt == 16) {
      cnt = 0;
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<muggle_parity_gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    11f5 <muggle_parity_gen+0xe5>
mov    -0xc(%rbp),%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x2(%rbp)
movb   $0x1,-0xd(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0xe(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1199 <muggle_parity_gen+0x89>
movzbl -0xd(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    %cl,%eax
movzbl -0x2(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1186 <muggle_parity_gen+0x76>
movzbl -0xe(%rbp),%eax
xor    $0x1,%eax
mov    %al,-0xe(%rbp)
jmp    118b <muggle_parity_gen+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <muggle_parity_gen+0x4a>
movzbl -0x2(%rbp),%eax
shl    $0x1,%eax
movzbl -0xe(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x10,%eax
jne    11e2 <muggle_parity_gen+0xd2>
movl   $0x0,-0x8(%rbp)
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <muggle_parity_gen+0xd7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112c <muggle_parity_gen+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<muggle_parity_gen>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0xecf(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    114b <muggle_parity_gen+0x2b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x100,%ebp
je     11b4 <muggle_parity_gen+0x94>
mov    %ebp,%eax
shr    %al
and    $0x1,%al
xor    %r15b,%al
mov    %ebp,%ecx
shr    $0x2,%cl
and    $0x1,%cl
mov    %ebp,%edx
shr    $0x3,%dl
and    $0x1,%dl
xor    %cl,%dl
xor    %al,%dl
mov    %ebp,%eax
shr    $0x4,%al
and    $0x1,%al
mov    %ebp,%ecx
shr    $0x5,%cl
and    $0x1,%cl
xor    %al,%cl
mov    %ebp,%eax
shr    $0x6,%al
and    $0x1,%al
xor    %cl,%al
xor    %dl,%al
mov    %ebp,%ecx
shr    $0x7,%cl
xor    %al,%cl
mov    %ebp,%eax
and    $0xfe,%al
or     %cl,%al
movzbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1140 <muggle_parity_gen+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    1140 <muggle_parity_gen+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d, \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @muggle_parity_gen(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %4
store i32 0, i32* %5
br label %9
9: ; preds = %58, %1
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 256
br i1 %11, label %12, label %61
12: ; preds = %9
%13 = load i32, i32* %5
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = ashr i32 %16, 1
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
store i8 1, i8* %6
%19 = load i8, i8* %2
store i8 %19, i8* %7
store i32 0, i32* %8
br label %20
20: ; preds = %38, %12
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 7
br i1 %22, label %23, label %41
23: ; preds = %20
%24 = load i8, i8* %6
%25 = zext i8 %24 to i32
%26 = load i32, i32* %8
%27 = shl i32 %25, %26
%28 = load i8, i8* %3
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %23
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = xor i32 %34, 1
%36 = trunc i32 %35 to i8
store i8 %36, i8* %7
br label %37
37: ; preds = %32, %23
br label %38
38: ; preds = %37
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %20
41: ; preds = %20
%42 = load i8, i8* %3
%43 = zext i8 %42 to i32
%44 = shl i32 %43, 1
%45 = load i8, i8* %7
%46 = zext i8 %45 to i32
%47 = or i32 %44, %46
%48 = trunc i32 %47 to i8
store i8 %48, i8* %3
%49 = load i8, i8* %3
%50 = zext i8 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
%54 = icmp eq i32 %53, 16
br i1 %54, label %55, label %57
55: ; preds = %41
store i32 0, i32* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %57
57: ; preds = %55, %41
br label %58
58: ; preds = %57
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %9
61: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d, \00"
define void @muggle_parity_gen(i8 zeroext %0) {
br label %3
2: ; preds = %42
ret void
3: ; preds = %1, %42
%4 = phi i32 [ 0, %1 ], [ %44, %42 ]
%5 = phi i32 [ 0, %1 ], [ %43, %42 ]
%6 = trunc i32 %4 to i8
%7 = lshr i8 %6, 1
%8 = and i8 %7, 1
%9 = xor i8 %8, %0
%10 = trunc i32 %4 to i8
%11 = lshr i8 %10, 2
%12 = and i8 %11, 1
%13 = xor i8 %9, %12
%14 = trunc i32 %4 to i8
%15 = lshr i8 %14, 3
%16 = and i8 %15, 1
%17 = xor i8 %13, %16
%18 = trunc i32 %4 to i8
%19 = lshr i8 %18, 4
%20 = and i8 %19, 1
%21 = xor i8 %17, %20
%22 = trunc i32 %4 to i8
%23 = lshr i8 %22, 5
%24 = and i8 %23, 1
%25 = xor i8 %21, %24
%26 = trunc i32 %4 to i8
%27 = lshr i8 %26, 6
%28 = and i8 %27, 1
%29 = xor i8 %25, %28
%30 = trunc i32 %4 to i8
%31 = lshr i8 %30, 7
%32 = xor i8 %29, %31
%33 = trunc i32 %4 to i8
%34 = and i8 %33, -2
%35 = or i8 %32, %34
%36 = zext i8 %35 to i32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = add nsw i32 %5, 1
%39 = icmp eq i32 %38, 16
br i1 %39, label %40, label %42
40: ; preds = %3
%41 = tail call i32 @putchar(i32 10)
br label %42
42: ; preds = %40, %3
%43 = phi i32 [ 0, %40 ], [ %38, %3 ]
%44 = add nuw nsw i32 %4, 1
%45 = icmp eq i32 %44, 256
br i1 %45, label %2, label %3
}