#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i = 0, j = 0, x = 0, y = 0, z = 0;
  printf("Unesite brojeve (0 za kraj): \n");
  do {
    scanf("%d", &n);
    i++;
    z = y;
    y = x;
    x = n;
    if (i >= 3 && y == z - x)
      j++;
  } while (i < 3 || n != 0);
  printf("%d clana niza zadovoljava uslov.", j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0xc(%rbp)
jl     11af <main+0x8f>
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    11af <main+0x8f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b4 <main+0x94>
mov    $0x1,%al
cmpl   $0x3,-0xc(%rbp)
mov    %al,-0x1d(%rbp)
jl     11cd <main+0xad>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1160 <main+0x40>
mov    -0x10(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
xor    %esi,%esi
lea    0xeb0(%rip),%r14
lea    0x4(%rsp),%r15
xor    %r12d,%r12d
xor    %ecx,%ecx
xor    %r13d,%r13d
nopl   (%rax)
mov    %r13d,%ebp
mov    %ecx,%r13d
mov    %esi,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
lea    0x1(%rbx),%esi
mov    0x4(%rsp),%ecx
cmp    $0x2,%ebx
setae  %dl
sub    %ecx,%ebp
cmp    %ebp,%r13d
sete   %al
and    %dl,%al
movzbl %al,%eax
add    %eax,%r12d
cmp    $0x2,%ebx
jb     1160 <main+0x30>
test   %ecx,%ecx
jne    1160 <main+0x30>
lea    0xe63(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Unesite brojeve (0 za kraj): \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"%d clana niza zadovoljava uslov.\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
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %34, %0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = load i32, i32* %6
store i32 %13, i32* %7
%14 = load i32, i32* %5
store i32 %14, i32* %6
%15 = load i32, i32* %2
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 3
br i1 %17, label %18, label %27
18: ; preds = %9
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = sub nsw i32 %20, %21
%23 = icmp eq i32 %19, %22
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %27
27: ; preds = %24, %18, %9
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 3
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 0
br label %34
34: ; preds = %31, %28
%35 = phi i1 [ true, %28 ], [ %33, %31 ]
br i1 %35, label %9, label %36
36: ; preds = %34
%37 = load i32, i32* %4
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"%d clana niza zadovoljava uslov.\00"
@str = [30 x i8] c"Unesite brojeve (0 za kraj): \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = phi i32 [ 0, %0 ], [ %10, %4 ]
%6 = phi i32 [ 0, %0 ], [ %17, %4 ]
%7 = phi i32 [ 0, %0 ], [ %11, %4 ]
%8 = phi i32 [ 0, %0 ], [ %7, %4 ]
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = add nuw nsw i32 %5, 1
%11 = load i32, i32* %1
%12 = icmp ugt i32 %5, 1
%13 = sub nsw i32 %8, %11
%14 = icmp eq i32 %7, %13
%15 = select i1 %12, i1 %14, i1 false
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %6, %16
%18 = icmp ult i32 %5, 2
%19 = icmp ne i32 %11, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %4, label %21
21: ; preds = %4
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %17)
ret i32 0
}