#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 scanf(char *, int *);
int main() {
  int ocena, suma = 0, broceni = 0, padnal = 0;
  while (scanf("%d", &ocena) == 1) {
    switch (ocena) {
    case 6:
    case 7:
    case 8:
    case 9:
    case 10:
      suma += ocena;
      broceni++;
      break;
    case 5:
      padnal++;
      break;
    default:
      printf("vnesi ocena od 5 do 10 : ");
      break;
    }
  }
  if (broceni == 0)
    printf("Nema polozeni ispiti");
  else
    printf("Prosekot e %4.2f\n", (float)suma / broceni);
  if (padnal != 0)
    printf("Padnal na %d ispiti\n", padnal);
  else
    printf("Ne padnal na ispit\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11bd <main+0x9d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x5,%eax
je     119c <main+0x7c>
jmp    1171 <main+0x51>
mov    -0x18(%rbp),%eax
add    $0xfffffffa,%eax
sub    $0x4,%eax
ja     11aa <main+0x8a>
jmp    1185 <main+0x65>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b8 <main+0x98>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b8 <main+0x98>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1144 <main+0x24>
cmpl   $0x0,-0x10(%rbp)
jne    11da <main+0xba>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fa <main+0xda>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     121a <main+0xfa>
mov    -0x14(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1228 <main+0x108>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %r14d,%r14d
cmp    $0x1,%eax
jne    11ef <main+0xbf>
lea    0xea1(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xe98(%rip),%r15
xor    %r14d,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1197 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %ebp,%eax
add    $0x1,%ebx
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ba <main+0x8a>
mov    0x4(%rsp),%eax
lea    -0x6(%rax),%ecx
cmp    $0x5,%ecx
jb     1180 <main+0x50>
cmp    $0x5,%eax
jne    11ae <main+0x7e>
add    $0x1,%r14d
jmp    1187 <main+0x57>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1187 <main+0x57>
test   %ebx,%ebx
je     11ef <main+0xbf>
cvtsi2ss %ebp,%xmm0
cvtsi2ss %ebx,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
test   %r14d,%r14d
jne    1202 <main+0xd2>
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
jmp    1213 <main+0xe3>
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
je     11e1 <main+0xb1>
lea    0xe3b(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [26 x i8] c"vnesi ocena od 5 do 10 : \00"
@.str.2 = [21 x i8] c"Nema polozeni ispiti\00"
@.str.3 = [18 x i8] c"Prosekot e %4.2f\0A\00"
@.str.4 = [21 x i8] c"Padnal na %d ispiti\0A\00"
@.str.5 = [20 x i8] c"Ne padnal na ispit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %22, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %2
switch i32 %10, label %20 [
i32 6, label %11
i32 7, label %11
i32 8, label %11
i32 9, label %11
i32 10, label %11
i32 5, label %17
]
11: ; preds = %9, %9, %9, %9, %9
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, %12
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %22
17: ; preds = %9
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %22
20: ; preds = %9
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %17, %11
br label %6
23: ; preds = %6
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %36
28: ; preds = %23
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to float
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to float
%33 = fdiv float %30, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %34)
br label %36
36: ; preds = %28, %26
%37 = load i32, i32* %5
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %5
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %40)
br label %44
42: ; preds = %36
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [26 x i8] c"vnesi ocena od 5 do 10 : \00"
@.str.2 = [21 x i8] c"Nema polozeni ispiti\00"
@.str.3 = [18 x i8] c"Prosekot e %4.2f\0A\00"
@.str.4 = [21 x i8] c"Padnal na %d ispiti\0A\00"
@str = [19 x i8] c"Ne padnal na ispit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %25
5: ; preds = %0, %17
%6 = phi i32 [ %20, %17 ], [ 0, %0 ]
%7 = phi i32 [ %19, %17 ], [ 0, %0 ]
%8 = phi i32 [ %18, %17 ], [ 0, %0 ]
%9 = load i32, i32* %1
switch i32 %9, label %15 [
i32 6, label %10
i32 7, label %10
i32 8, label %10
i32 9, label %10
i32 10, label %10
i32 5, label %13
]
10: ; preds = %5, %5, %5, %5, %5
%11 = add nsw i32 %9, %8
%12 = add nsw i32 %7, 1
br label %17
13: ; preds = %5
%14 = add nsw i32 %6, 1
br label %17
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %13, %10
%18 = phi i32 [ %8, %15 ], [ %8, %13 ], [ %11, %10 ]
%19 = phi i32 [ %7, %15 ], [ %7, %13 ], [ %12, %10 ]
%20 = phi i32 [ %6, %15 ], [ %14, %13 ], [ %6, %10 ]
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%22 = icmp eq i32 %21, 1
br i1 %22, label %5, label %23
23: ; preds = %17
%24 = icmp eq i32 %19, 0
br i1 %24, label %25, label %28
25: ; preds = %0, %23
%26 = phi i32 [ %20, %23 ], [ 0, %0 ]
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %34
28: ; preds = %23
%29 = sitofp i32 %18 to float
%30 = sitofp i32 %19 to float
%31 = fdiv float %29, %30
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %32)
br label %34
34: ; preds = %28, %25
%35 = phi i32 [ %20, %28 ], [ %26, %25 ]
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %35)
br label %41
39: ; preds = %34
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
ret i32 0
}