#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 rand();
int /*<<< orphan*/ srand(unsigned int);
int main(void) {
  int feed = 30;
  srand((unsigned)feed);
  for (register unsigned int count = 0; count < 10; count++) {
    printf("%d\n", (1 << rand() % 4));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    1191 <main+0x61>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%esi
shl    %cl,%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <main+0x25>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1e,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%ebp
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
lea    0xea5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    $0x1,%esi
mov    %eax,%ecx
shl    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <rand@plt>
and    $0x3,%al
mov    %eax,%ecx
shl    %cl,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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
store i32 0, i32* %1
store i32 30, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @srand(i32 %4)
store i32 0, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = icmp ult i32 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 4
%12 = shl i32 1, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @srand(i32 30)
%2 = tail call i32 (...) @rand()
%3 = and i32 %2, 3
%4 = shl nuw nsw i32 1, %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @rand()
%7 = and i32 %6, 3
%8 = shl nuw nsw i32 1, %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @rand()
%11 = and i32 %10, 3
%12 = shl nuw nsw i32 1, %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @rand()
%15 = and i32 %14, 3
%16 = shl nuw nsw i32 1, %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = tail call i32 (...) @rand()
%19 = and i32 %18, 3
%20 = shl nuw nsw i32 1, %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = tail call i32 (...) @rand()
%23 = and i32 %22, 3
%24 = shl nuw nsw i32 1, %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = tail call i32 (...) @rand()
%27 = and i32 %26, 3
%28 = shl nuw nsw i32 1, %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = tail call i32 (...) @rand()
%31 = and i32 %30, 3
%32 = shl nuw nsw i32 1, %31
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = tail call i32 (...) @rand()
%35 = and i32 %34, 3
%36 = shl nuw nsw i32 1, %35
%37 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = tail call i32 (...) @rand()
%39 = and i32 %38, 3
%40 = shl nuw nsw i32 1, %39
%41 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %40)
ret i32 0
}