#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rekurzivnoPretrazivanjePolja(int *, int, int,
                                                int /*<<< orphan*/);
int /*<<< orphan*/ rekurzivnoPunjenjePolja(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int duzinaPolja, trazenaVrijednost;
  printf("Unesite duzinu polja: ");
  scanf("%d", &duzinaPolja);
  int *polje = (int *)malloc(duzinaPolja * sizeof(int));
  rekurzivnoPunjenjePolja(polje, duzinaPolja, 0);
  printf("Unesite vrijednost koju trazite: ");
  scanf("%d", &trazenaVrijednost);
  rekurzivnoPretrazivanjePolja(polje, duzinaPolja, trazenaVrijednost, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
call   1060 <rekurzivnoPunjenjePolja@plt>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
call   1040 <rekurzivnoPretrazivanjePolja@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
mov    (%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    (%rsp),%esi
mov    %rax,%rdi
xor    %edx,%edx
call   1060 <rekurzivnoPunjenjePolja@plt>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
xor    %ecx,%ecx
call   1040 <rekurzivnoPretrazivanjePolja@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Unesite duzinu polja: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Unesite vrijednost koju trazite: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 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* %2)
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = load i32, i32* %2
%15 = call i32 @rekurzivnoPunjenjePolja(i32* %13, i32 %14, i32 0)
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32*, i32** %4
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @rekurzivnoPretrazivanjePolja(i32* %18, i32 %19, i32 %20, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Unesite duzinu polja: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Unesite vrijednost koju trazite: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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 = load i32, i32* %1
%8 = shl i32 %7, 2
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* %1
%12 = call i32 @rekurzivnoPunjenjePolja(i32* %10, i32 %11, i32 0)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @rekurzivnoPretrazivanjePolja(i32* %10, i32 %15, i32 %16, i32 0)
ret i32 0
}