#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int i;
  int a0;
  int a1;
  int step;
  int out;
  unsigned int n;
  a0 = 4;
  a1 = -4;
  step = a1 - a0;
  n = 4;
  out = a0 << n;
  printf("a0=%d  a1=%d  step=%d  n=%d  out=%d\n", a0, a1, step, n, out);
  for (i = 0; i < (1 << n); i++) {
    out += step;
    printf("%d  out=%d (%d)\n", i, out, out >> n);
  }
  printf("out>>n=%d\n", out >> n);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x18(%rbp)
movl   $0xfffffffc,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x4,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x28(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jge    11d1 <main+0xb1>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%eax
mov    -0x28(%rbp),%ecx
sar    %cl,%eax
mov    %eax,%ecx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x65>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%ecx
sar    %cl,%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x4,%esi
mov    $0xfffffffc,%edx
mov    $0xfffffff8,%ecx
mov    $0x4,%r8d
mov    $0x40,%r9d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x38,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x30,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x28,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x20,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x18,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x10,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0xfffffff8,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0xfffffff0,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xffffffe8,%edx
mov    $0xfffffffe,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
mov    $0xffffffe0,%edx
mov    $0xfffffffe,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0xffffffd8,%edx
mov    $0xfffffffd,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0xffffffd0,%edx
mov    $0xfffffffd,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
mov    $0xffffffc8,%edx
mov    $0xfffffffc,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
mov    $0xffffffc0,%edx
mov    $0xfffffffc,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd5a(%rip),%rdi
mov    $0xfffffffc,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2cf1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"a0=%d a1=%d step=%d n=%d out=%d\0A\00"
@.str.1 = [17 x i8] c"%d out=%d (%d)\0A\00"
@.str.2 = [11 x i8] c"out>>n=%d\0A\00"
@EXIT_SUCCESS = global i32 0
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
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4, i32* %7
store i32 -4, i32* %8
%12 = load i32, i32* %8
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
store i32 %14, i32* %9
store i32 4, i32* %11
%15 = load i32, i32* %7
%16 = load i32, i32* %11
%17 = shl i32 %15, %16
store i32 %17, i32* %10
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i32, i32* %11
%22 = load i32, i32* %10
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i32 %20, i32 %21, i32 %22)
store i32 0, i32* %6
br label %24
24: ; preds = %39, %2
%25 = load i32, i32* %6
%26 = load i32, i32* %11
%27 = shl i32 1, %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %42
29: ; preds = %24
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = add nsw i32 %31, %30
store i32 %32, i32* %10
%33 = load i32, i32* %6
%34 = load i32, i32* %10
%35 = load i32, i32* %10
%36 = load i32, i32* %11
%37 = ashr i32 %35, %36
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %33, i32 %34, i32 %37)
br label %39
39: ; preds = %29
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %24
42: ; preds = %24
%43 = load i32, i32* %10
%44 = load i32, i32* %11
%45 = ashr i32 %43, %44
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%47 = load i32, i32* @EXIT_SUCCESS
%48 = call i32 @exit(i32 %47)
unreachable
}

LLVM IR (-O2):
@.str = [37 x i8] c"a0=%d a1=%d step=%d n=%d out=%d\0A\00"
@.str.1 = [17 x i8] c"%d out=%d (%d)\0A\00"
@.str.2 = [11 x i8] c"out>>n=%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 4, i32 -4, i32 -8, i32 4, i32 64)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 56, i32 3)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 48, i32 3)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 40, i32 2)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 32, i32 2)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 24, i32 1)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 16, i32 1)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 8, i32 0)
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 0, i32 0)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 -8, i32 -1)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 -16, i32 -1)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 -24, i32 -2)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 -32, i32 -2)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 12, i32 -40, i32 -3)
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 13, i32 -48, i32 -3)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 14, i32 -56, i32 -4)
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 15, i32 -64, i32 -4)
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 -4)
%21 = load i32, i32* @EXIT_SUCCESS
%22 = tail call i32 @exit(i32 %21)
unreachable
}