#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 NZD(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n, a[100];
  printf("Vnesi ja goleminata na nizata: ");
  scanf("%d", &n);
  printf("Vnesi gi elementite na nizata: \n");
  for (i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int nzd = NZD(a[0], a[1]);
  for (i = 2; i < n; ++i) {
    nzd = NZD(nzd, a[i]);
  }
  printf("NZD na elementite od nizata e %d", nzd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ad <main+0x7d>
movslq -0x8(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec5(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x45>
mov    -0x1a0(%rbp),%edi
mov    -0x19c(%rbp),%esi
call   1040 <NZD@plt>
mov    %eax,-0x1a4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1201 <main+0xd1>
mov    -0x1a4(%rbp),%edi
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
call   1040 <NZD@plt>
mov    %eax,-0x1a4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cb <main+0x9b>
mov    -0x1a4(%rbp),%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xead(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeda(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r15
jl     1190 <main+0x50>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <NZD@plt>
cmpl   $0x3,0xc(%rsp)
jl     11e9 <main+0xa9>
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %eax,%edi
call   1050 <NZD@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rcx
cmp    %rcx,%rbx
jl     11d0 <main+0x90>
lea    0xe30(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [32 x i8] c"Vnesi ja goleminata na nizata: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [33 x i8] c"NZD na elementite od nizata e %d\00"
@str = [32 x i8] c"Vnesi gi elementite na nizata: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br label %10
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %19
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 1
%22 = load i32, i32* %21
%23 = call i32 @NZD(i32 %20, i32 %22)
%24 = load i32, i32* %1
%25 = icmp sgt i32 %24, 2
br i1 %25, label %26, label %36
26: ; preds = %18, %26
%27 = phi i64 [ %32, %26 ], [ 2, %18 ]
%28 = phi i32 [ %31, %26 ], [ %23, %18 ]
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %27
%30 = load i32, i32* %29
%31 = call i32 @NZD(i32 %28, i32 %30)
%32 = add nuw nsw i64 %27, 1
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %26, label %36
36: ; preds = %26, %18
%37 = phi i32 [ %23, %18 ], [ %31, %26 ]
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %37)
ret i32 0
}