#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ podesihardver();
int /*<<< orphan*/ podesijacinupwm(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  podesihardver();
  int g, i, odabir, x = 0, d = 0, t = 0, o = 0, z = 0, y = 0, l = 0;
  FILE *fp;
  fp = fopen("jacina.txt", "r");
  fscanf(fp, "%d", &l);
  fclose(fp);
  if (l >= 5000) {
    l = l / 5;
    fp = fopen("jacina.txt", "w");
    podesijacinupwm(l);
    fprintf(fp, "%d", l);
    fclose(fp);
  } else {
    podesijacinupwm(0);
    fp = fopen("jacina.txt", "w");
    fprintf(fp, "%d", 1000);
    fclose(fp);
    printf("\n Osvetljenje je minimalno \n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <podesihardver@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe3b(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0x1388,-0x38(%rbp)
jl     124d <main+0xdd>
mov    -0x38(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
lea    0xdec(%rip),%rdi
lea    0xdf5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%edi
call   1080 <podesijacinupwm@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%edx
lea    0xdd3(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1295 <main+0x125>
xor    %edi,%edi
call   1080 <podesijacinupwm@plt>
lea    0xda5(%rip),%rdi
lea    0xdae(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xd97(%rip),%rsi
mov    $0x3e8,%edx
call   1060 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd82(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <podesihardver@plt>
movl   $0x0,0xc(%rsp)
lea    0xe75(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe6c(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0xc(%rsp),%eax
cmp    $0x1388,%eax
jl     1210 <main+0xa0>
mov    %eax,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
mov    %ecx,0xc(%rsp)
lea    0xe25(%rip),%rdi
lea    0xe2e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%edi
call   1080 <podesijacinupwm@plt>
mov    0xc(%rsp),%edx
lea    0xe0f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    1255 <main+0xe5>
xor    %edi,%edi
call   1080 <podesijacinupwm@plt>
lea    0xde2(%rip),%rdi
lea    0xdeb(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xdd9(%rip),%rsi
mov    %rax,%rdi
mov    $0x3e8,%edx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xdc2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"jacina.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [29 x i8] c"\0A Osvetljenje je minimalno \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = call i32 (...) @podesihardver()
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
%18 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %16
%19 = load i32*, i32** %16
%20 = call i32 @fscanf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%21 = load i32*, i32** %16
%22 = call i32 @fclose(i32* %21)
%23 = load i32, i32* %15
%24 = icmp sge i32 %23, 5000
br i1 %24, label %25, label %36
25: ; preds = %2
%26 = load i32, i32* %15
%27 = sdiv i32 %26, 5
store i32 %27, i32* %15
%28 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %28, i32** %16
%29 = load i32, i32* %15
%30 = call i32 @podesijacinupwm(i32 %29)
%31 = load i32*, i32** %16
%32 = load i32, i32* %15
%33 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i32*, i32** %16
%35 = call i32 @fclose(i32* %34)
br label %44
36: ; preds = %2
%37 = call i32 @podesijacinupwm(i32 0)
%38 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %38, i32** %16
%39 = load i32*, i32** %16
%40 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 1000)
%41 = load i32*, i32** %16
%42 = call i32 @fclose(i32* %41)
%43 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %36, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"jacina.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"w\00"
@str = [28 x i8] c"\0A Osvetljenje je minimalno \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i32 (...) @podesihardver()
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%8 = call i32 @fclose(i32* %6)
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 4999
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = udiv i32 %9, 5
store i32 %12, i32* %3
%13 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = call i32 @podesijacinupwm(i32 %14)
%16 = load i32, i32* %3
%17 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @fclose(i32* %13)
br label %25
19: ; preds = %2
%20 = call i32 @podesijacinupwm(i32 0)
%21 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 1000)
%23 = call i32 @fclose(i32* %21)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %19, %11
ret i32 0
}