#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*/ exit(int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
main() {
  int *q;
  int i, j;
  q = malloc(100 * sizeof(int));
  if (q == NULL) {
    printf("Nema dovoljno memorije!\n");
    exit(1);
  }
  for (i = 0; i < 100; i++)
    q[i] = i * i + 10;
  for (i = 0; i < 10; i++)
    printf("q[%d] = %d\n", i, q[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x190,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <main+0x40>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11a4 <main+0x74>
mov    -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
add    $0xa,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x47>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11df <main+0xaf>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ab <main+0x7b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x190,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     130d <main+0x1cd>
mov    %rax,%rbx
movdqa 0xe9e(%rip),%xmm3
movdqa 0xea6(%rip),%xmm1
mov    $0xc,%eax
movdqa 0xea9(%rip),%xmm2
movdqa 0xeb0(%rip),%xmm8
movdqa 0xeb8(%rip),%xmm4
movdqa 0xec0(%rip),%xmm5
movdqa 0xec8(%rip),%xmm6
nopl   0x0(%rax,%rax,1)
movdqa %xmm1,%xmm7
pmuludq %xmm1,%xmm7
movdqa %xmm3,%xmm0
pmuludq %xmm3,%xmm0
shufps $0x88,%xmm0,%xmm7
paddd  %xmm2,%xmm7
movdqu %xmm7,-0x30(%rbx,%rax,4)
cmp    $0x6c,%rax
je     124c <main+0x10c>
movdqa %xmm3,%xmm0
paddq  %xmm8,%xmm0
movdqa %xmm1,%xmm7
paddq  %xmm8,%xmm7
pmuludq %xmm7,%xmm7
pmuludq %xmm0,%xmm0
shufps $0x88,%xmm0,%xmm7
paddd  %xmm2,%xmm7
movdqu %xmm7,-0x20(%rbx,%rax,4)
movdqa %xmm3,%xmm0
paddq  %xmm4,%xmm0
movdqa %xmm1,%xmm7
paddq  %xmm4,%xmm7
pmuludq %xmm7,%xmm7
pmuludq %xmm0,%xmm0
shufps $0x88,%xmm0,%xmm7
paddd  %xmm2,%xmm7
movdqu %xmm7,-0x10(%rbx,%rax,4)
movdqa %xmm3,%xmm0
paddq  %xmm5,%xmm0
movdqa %xmm1,%xmm7
paddq  %xmm5,%xmm7
pmuludq %xmm7,%xmm7
pmuludq %xmm0,%xmm0
shufps $0x88,%xmm0,%xmm7
paddd  %xmm2,%xmm7
movdqu %xmm7,(%rbx,%rax,4)
paddq  %xmm6,%xmm1
paddq  %xmm6,%xmm3
add    $0x10,%rax
jmp    11a0 <main+0x60>
mov    (%rbx),%edx
lea    0xe1b(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%edx
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%edx
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%edx
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%edx
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rbx),%edx
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx),%edx
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rbx),%edx
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rbx),%edx
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rbx),%edx
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd68(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
@.str.1 = [12 x i8] c"q[%d] = %d\0A\00"
@str = [24 x i8] c"Nema dovoljno memorije!\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 400)
%2 = icmp eq i32* %1, null
br i1 %2, label %36, label %3
3: ; preds = %0, %13
%4 = phi i64 [ %34, %13 ], [ 0, %0 ]
%5 = phi <4 x i64> [ %35, %13 ], [ <i64 0, i64 1, i64 2, i64 3>, %0 ]
%6 = mul nuw nsw <4 x i64> %5, %5
%7 = getelementptr inbounds i32, i32* %1, i64 %4
%8 = trunc <4 x i64> %6 to <4 x i32>
%9 = add <4 x i32> %8, <i32 10, i32 10, i32 10, i32 10>
%10 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %10
%11 = or i64 %4, 4
%12 = icmp eq i64 %11, 100
br i1 %12, label %39, label %13
13: ; preds = %3
%14 = add <4 x i64> %5, <i64 4, i64 4, i64 4, i64 4>
%15 = mul nuw nsw <4 x i64> %14, %14
%16 = getelementptr inbounds i32, i32* %1, i64 %11
%17 = trunc <4 x i64> %15 to <4 x i32>
%18 = add <4 x i32> %17, <i32 10, i32 10, i32 10, i32 10>
%19 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %18, <4 x i32>* %19
%20 = or i64 %4, 8
%21 = add <4 x i64> %5, <i64 8, i64 8, i64 8, i64 8>
%22 = mul nuw nsw <4 x i64> %21, %21
%23 = getelementptr inbounds i32, i32* %1, i64 %20
%24 = trunc <4 x i64> %22 to <4 x i32>
%25 = add <4 x i32> %24, <i32 10, i32 10, i32 10, i32 10>
%26 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %26
%27 = or i64 %4, 12
%28 = add <4 x i64> %5, <i64 12, i64 12, i64 12, i64 12>
%29 = mul nuw nsw <4 x i64> %28, %28
%30 = getelementptr inbounds i32, i32* %1, i64 %27
%31 = trunc <4 x i64> %29 to <4 x i32>
%32 = add <4 x i32> %31, <i32 10, i32 10, i32 10, i32 10>
%33 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %33
%34 = add nuw nsw i64 %4, 16
%35 = add <4 x i64> %5, <i64 16, i64 16, i64 16, i64 16>
br label %3
36: ; preds = %0
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %3
%40 = load i32, i32* %1
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %40)
%42 = getelementptr inbounds i32, i32* %1, i64 1
%43 = load i32, i32* %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %43)
%45 = getelementptr inbounds i32, i32* %1, i64 2
%46 = load i32, i32* %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %46)
%48 = getelementptr inbounds i32, i32* %1, i64 3
%49 = load i32, i32* %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %49)
%51 = getelementptr inbounds i32, i32* %1, i64 4
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %52)
%54 = getelementptr inbounds i32, i32* %1, i64 5
%55 = load i32, i32* %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %55)
%57 = getelementptr inbounds i32, i32* %1, i64 6
%58 = load i32, i32* %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %58)
%60 = getelementptr inbounds i32, i32* %1, i64 7
%61 = load i32, i32* %60
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %61)
%63 = getelementptr inbounds i32, i32* %1, i64 8
%64 = load i32, i32* %63
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %64)
%66 = getelementptr inbounds i32, i32* %1, i64 9
%67 = load i32, i32* %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %67)
ret i32 0
}