#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 main(int argc, char *argv[]) {
  unsigned int y, x = 255;
  int count;
  printf("Decimal\t\tshift left by\tresult\n");
  for (count = 1; count < 8; count++) {
    y = x << count;
    printf("%d\t\t%d\t\t%d\n", x, count, y);
  }
  printf("\n\nDecimal\t\tshift right by\tresult\n");
  for (count = 1; count < 8; count++) {
    y = x >> count;
    printf("%d\t\t%d\t\t%d\n", x, count, y);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xff,-0x18(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    117c <main+0x6c>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1142 <main+0x32>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11cb <main+0xbb>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1191 <main+0x81>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x1,%edx
mov    $0x1fe,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x2,%edx
mov    $0x3fc,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x3,%edx
mov    $0x7f8,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x4,%edx
mov    $0xff0,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x5,%edx
mov    $0x1fe0,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x6,%edx
mov    $0x3fc0,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x7,%edx
mov    $0x7f80,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x1,%edx
mov    $0x7f,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x2,%edx
mov    $0x3f,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x3,%edx
mov    $0x1f,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x4,%edx
mov    $0xf,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x5,%edx
mov    $0x7,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x6,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    $0x7,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Decimal\09\09shift left by\09result\0A\00"
@.str.1 = [12 x i8] c"%d\09\09%d\09\09%d\0A\00"
@.str.2 = [34 x i8] c"\0A\0ADecimal\09\09shift right by\09result\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 255, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = shl i32 %14, %15
store i32 %16, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
br label %21
21: ; preds = %13
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %10
24: ; preds = %10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
br label %26
26: ; preds = %37, %24
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 8
br i1 %28, label %29, label %40
29: ; preds = %26
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = lshr i32 %30, %31
store i32 %32, i32* %6
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
br label %37
37: ; preds = %29
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %26
40: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d\09\09%d\09\09%d\0A\00"
@str = [30 x i8] c"Decimal\09\09shift left by\09result\00"
@str.3 = [33 x i8] c"\0A\0ADecimal\09\09shift right by\09result\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 1, i32 510)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 2, i32 1020)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 3, i32 2040)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 4, i32 4080)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 5, i32 8160)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 6, i32 16320)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 7, i32 32640)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.3, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 1, i32 127)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 2, i32 63)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 3, i32 31)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 4, i32 15)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 5, i32 7)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 6, i32 3)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 7, i32 1)
ret i32 0
}