#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 shift_11_bit_feedback_register();
unsigned int shift_16_bit_feedback_register();
unsigned char shift_8_bit_feedback_register();
int main() {
  unsigned char r8 = 0;
  unsigned int r11 = 0;
  unsigned int r16 = 0;
  printf("8 bits\n");
  while (r8 != 1) {
    r8 = shift_8_bit_feedback_register();
    printf("%u\n", r8);
  }
  printf("11 bits\n");
  while (r11 != 1) {
    r11 = shift_11_bit_feedback_register();
    printf("%u\n", r11);
  }
  printf("16 bits\n");
  while (r16 != 1) {
    r16 = shift_16_bit_feedback_register();
    printf("%u\n", r16);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzbl -0x5(%rbp),%eax
cmp    $0x1,%eax
je     119d <main+0x5d>
mov    $0x0,%al
call   1050 <shift_8_bit_feedback_register@plt>
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    116f <main+0x2f>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
je     11d5 <main+0x95>
mov    $0x0,%al
call   1030 <shift_11_bit_feedback_register@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ab <main+0x6b>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
je     120d <main+0xcd>
mov    $0x0,%al
call   1060 <shift_16_bit_feedback_register@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e3 <main+0xa3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9a(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <shift_8_bit_feedback_register@plt>
movzbl %al,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%bpl
jne    1170 <main+0x20>
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
lea    0xe61(%rip),%rbx
nop
xor    %eax,%eax
call   1030 <shift_11_bit_feedback_register@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%ebp
jne    11a0 <main+0x50>
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
lea    0xe33(%rip),%rbx
nopl   (%rax)
xor    %eax,%eax
call   1070 <shift_16_bit_feedback_register@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%ebp
jne    11d0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%u\0A\00"
@str = [7 x i8] c"8 bits\00"
@str.4 = [8 x i8] c"11 bits\00"
@str.5 = [8 x i8] c"16 bits\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = tail call zeroext i8 (...) @shift_8_bit_feedback_register()
%4 = zext i8 %3 to i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = icmp eq i8 %3, 1
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0))
br label %9
9: ; preds = %7, %9
%10 = tail call i32 (...) @shift_11_bit_feedback_register()
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = icmp eq i32 %10, 1
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
br label %15
15: ; preds = %13, %15
%16 = tail call i32 (...) @shift_16_bit_feedback_register()
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = icmp eq i32 %16, 1
br i1 %18, label %19, label %15
19: ; preds = %15
ret i32 0
}