#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*/ low_level();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int v, r, x;
  printf("Enter an integer value %c ", 16);
  scanf("%d", &v);
  for (x = 1; x < 8; x++) {
    r = v << x;
    printf("%d << %d = %d\n", v, x, r);
  }
  low_level();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    11a3 <main+0x73>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1169 <main+0x39>
mov    $0x0,%al
call   1040 <low_level@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    (%rsi,%rsi,1),%ecx
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0x0(,%rsi,4),%ecx
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0x0(,%rsi,8),%ecx
mov    %rbx,%rdi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %esi,%ecx
shl    $0x4,%ecx
mov    %rbx,%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %esi,%ecx
shl    $0x5,%ecx
mov    %rbx,%rdi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %esi,%ecx
shl    $0x6,%ecx
mov    %rbx,%rdi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %esi,%ecx
shl    $0x7,%ecx
mov    %rbx,%rdi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <low_level@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter an integer value %c \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"%d << %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 16)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = shl i32 %11, %12
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %7
21: ; preds = %7
%22 = call i32 (...) @low_level()
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter an integer value %c \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"%d << %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl i32 %5, 1
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 1, i32 %6)
%8 = load i32, i32* %1
%9 = shl i32 %8, 2
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 2, i32 %9)
%11 = load i32, i32* %1
%12 = shl i32 %11, 3
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 3, i32 %12)
%14 = load i32, i32* %1
%15 = shl i32 %14, 4
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 4, i32 %15)
%17 = load i32, i32* %1
%18 = shl i32 %17, 5
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 5, i32 %18)
%20 = load i32, i32* %1
%21 = shl i32 %20, 6
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 6, i32 %21)
%23 = load i32, i32* %1
%24 = shl i32 %23, 7
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 7, i32 %24)
%26 = call i32 (...) @low_level()
ret i32 0
}