#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 main() {
  int a, b, c, d, i, N = 10;
  int tab[20];
  a = b = c = d = 0;
  for (i = 0; i < N; tab[i++] = i)
    ;
  for (i = 0; i < N; tab[++i] = i)
    ;
  i = 1;
  while ((i *= 2) < N) {
    printf("%d\n", i);
  };
  printf("Wynik po petli %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1173 <main+0x63>
jmp    115a <main+0x4a>
mov    -0x18(%rbp),%ecx
mov    -0x18(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
cltq
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1149 <main+0x39>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11a2 <main+0x92>
jmp    118b <main+0x7b>
mov    -0x18(%rbp),%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    117a <main+0x6a>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    -0x1c(%rbp),%eax
jge    11cf <main+0xbf>
mov    -0x18(%rbp),%esi
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    11a9 <main+0x99>
mov    -0x18(%rbp),%esi
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef7(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [19 x i8] c"Wynik po petli %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 16)
ret i32 0
}