#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 izbaci_prost(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int niz[10] = {1, 11, 5, 4, 7, 2, 3, 8, 13, 41};
  int vel = 10, i;
  int *p1 = niz;
  int *p2 = p1 + izbaci_prost(niz + 3, vel - 3);
  while (p1 != p2)
    printf("%d ", *p1++);
  printf("\n");
  for (i = 0; i < 10; i++)
    printf("%d, ", niz[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
add    $0xc,%rdi
mov    -0x34(%rbp),%esi
sub    $0x3,%esi
call   1040 <izbaci_prost@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     11c4 <main+0x94>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x40(%rbp)
mov    (%rax),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1192 <main+0x62>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    1207 <main+0xd7>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d9 <main+0xa9>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xee0(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x7,%esi
call   1050 <izbaci_prost@plt>
test   %eax,%eax
je     1196 <main+0x66>
movslq %eax,%r15
shl    $0x2,%r15
lea    0xeab(%rip),%r14
xor    %ebx,%ebx
nop
mov    (%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%esi
lea    0xe82(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@__const.main.niz = [10 x i32] [i32 1, i32 11, i32 5, i32 4, i32 7, i32 2, i32 3, i32 8, i32 13, i32 41]
@.str = [4 x i8] c"%d \00"
@.str.2 = [5 x i8] c"%d, \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%5 = call i32 @izbaci_prost(i32* %4, i32 7)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %6
%8 = icmp eq i32 %5, 0
br i1 %8, label %15, label %9
9: ; preds = %0, %9
%10 = phi i32* [ %11, %9 ], [ %3, %0 ]
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %10
%13 = 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 i32* %11, %7
br i1 %14, label %15, label %9
15: ; preds = %9, %0
%16 = call i32 @putchar(i32 10)
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %43)
ret i32 0
}