#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 *, ...);
void petla_for_i_plus_plus(int tab[], int size) {
  int i;
  for (i = 0; i < size;)
    printf("%i ", tab[i++]);
  printf("\n Wartosci i : \t");
  for (i = 0; i < size;)
    printf("%i ", i++);
}


x86 assembly (clang, -O0):
<petla_for_i_plus_plus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <petla_for_i_plus_plus+0x4a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1126 <petla_for_i_plus_plus+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1199 <petla_for_i_plus_plus+0x89>
mov    -0x10(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116f <petla_for_i_plus_plus+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<petla_for_i_plus_plus>:
test   %esi,%esi
jle    118d <petla_for_i_plus_plus+0x7d>
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
mov    %esi,%ebp
lea    0xed5(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r12,%rbx,4),%esi
add    $0x1,%rbx
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    %rbx,%rbp
jne    1130 <petla_for_i_plus_plus+0x20>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r14d,%r14d
jle    1184 <petla_for_i_plus_plus+0x74>
lea    0xe9f(%rip),%rbx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rsi),%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%esi
cmp    %ebp,%r14d
jne    1170 <petla_for_i_plus_plus+0x60>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe70(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%i \00"
@.str.1 = [17 x i8] c"\0A Wartosci i : \09\00"
define void @petla_for_i_plus_plus(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %5
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds i32, i32* %11, i64 %14
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %6
18: ; preds = %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %20
20: ; preds = %24, %18
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %20
28: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
@.str.1 = [17 x i8] c"\0A Wartosci i : \09\00"
define void @petla_for_i_plus_plus(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %22
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %10, %8 ]
%10 = add nuw nsw i64 %9, 1
%11 = getelementptr inbounds i32, i32* %0, i64 %9
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp eq i64 %10, %7
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br i1 %3, label %17, label %22
17: ; preds = %15, %17
%18 = phi i32 [ %19, %17 ], [ 0, %15 ]
%19 = add nuw nsw i32 %18, 1
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%21 = icmp eq i32 %19, %1
br i1 %21, label %22, label %17
22: ; preds = %17, %4, %15
ret void
}