#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, long *);
int get_boravak(long *boravak) {
  long tmp;
  printf("Dužina boravka [min]: ");
  scanf("%ld", &tmp);
  if (tmp <= 0 || tmp > 1000000) {
    puts("Vreme boravka moze biti od 0 do 1 000 000 minuta.");
    return 0;
  } else {
    *boravak = tmp;
    return 1;
  }
}


x86 assembly (clang, -O0):
<get_boravak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x18(%rbp)
jle    1171 <get_boravak+0x41>
cmpq   $0xf4240,-0x18(%rbp)
jle    1189 <get_boravak+0x59>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    119b <get_boravak+0x6b>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_boravak>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rax
lea    -0xf4241(%rax),%rcx
cmp    $0xfffffffffff0bdbf,%rcx
ja     117a <get_boravak+0x4a>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    1182 <get_boravak+0x52>
mov    %rax,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Du\C5\BEina boravka [min]: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [50 x i8] c"Vreme boravka moze biti od 0 do 1 000 000 minuta.\00"
define i32 @get_boravak(i64* %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%7 = load i64, i64* %4
%8 = icmp sle i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i64, i64* %4
%11 = icmp sgt i64 %10, 1000000
br i1 %11, label %12, label %14
12: ; preds = %9, %1
%13 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %17
14: ; preds = %9
%15 = load i64, i64* %4
%16 = load i64*, i64** %3
store i64 %15, i64* %16
store i32 1, i32* %2
br label %17
17: ; preds = %14, %12
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@.str = [24 x i8] c"Du\C5\BEina boravka [min]: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [50 x i8] c"Vreme boravka moze biti od 0 do 1 000 000 minuta.\00"
define i32 @get_boravak(i64* nocapture writeonly %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = add i64 %6, -1000001
%8 = icmp ult i64 %7, -1000000
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %12
11: ; preds = %1
store i64 %6, i64* %0
br label %12
12: ; preds = %11, %9
%13 = phi i32 [ 0, %9 ], [ 1, %11 ]
ret i32 %13
}