#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 *, int *);
int main() {
  int temp[5];
  int day;
  int total = 0;
  for (day = 0; day < 5; day++) {
    printf("What was the approximate temperature %d days ago? - ", day + 1);
    scanf("%d", &temp[day]);
    total += temp[day];
  }
  float average = total / 5;
  printf("\n\nThe results just came in...\n\n");
  for (day = 0; day < 5; day++)
    printf("%d days ago the temperature was %d\n", day + 1, temp[day]);
  printf("\n\n\tSo the average would be.....\n %20.2f degrees ...\n\n",
         average);
  if (average < 10)
    puts("Brrr.. jerrr!");
  else if (average > 32)
    puts("Canicula, pffff..");
  else if (average < 20)
    puts("Brrr... friggg..!");
  else
    puts("Numa bine, vreme perfecta!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11a2 <main+0x72>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec0(%rip),%rdi
call   1050 <scanf@plt>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <main+0x1d>
mov    -0x28(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x2c(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11ff <main+0xcf>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11cb <main+0x9b>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xde2(%rip),%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1239 <main+0x109>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
jmp    1299 <main+0x169>
movss  -0x2c(%rbp),%xmm0
movss  0xdbe(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1260 <main+0x130>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
jmp    1294 <main+0x164>
movss  0xda0(%rip),%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1283 <main+0x153>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
jmp    128f <main+0x15f>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
jmp    1294 <main+0x164>
jmp    1299 <main+0x169>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xebf(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xede(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%ebp
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x4(%rsp),%ebp
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x8(%rsp),%ebp
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0xc(%rsp),%ebp
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    0x10(%rsp),%ebp
movslq %ebp,%r14
imul   $0x66666667,%r14,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
lea    0xe26(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %r15,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmp    $0x32,%r14d
jge    1292 <main+0x162>
lea    0xe02(%rip),%rdi
jmp    12b8 <main+0x188>
cmp    $0xa4,%ebp
jbe    12a3 <main+0x173>
lea    0xdff(%rip),%rdi
jmp    12b8 <main+0x188>
cmp    $0x64,%ebp
lea    0xe05(%rip),%rax
lea    0xe10(%rip),%rdi
cmovb  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"What was the approximate temperature %d days ago? - \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [32 x i8] c"\0A\0AThe results just came in...\0A\0A\00"
@.str.3 = [36 x i8] c"%d days ago the temperature was %d\0A\00"
@.str.4 = [54 x i8] c"\0A\0A\09So the average would be.....\0A %20.2f degrees ...\0A\0A\00"
@.str.5 = [14 x i8] c"Brrr.. jerrr!\00"
@.str.6 = [18 x i8] c"Canicula, pffff..\00"
@.str.7 = [18 x i8] c"Brrr... friggg..!\00"
@.str.8 = [27 x i8] c"Numa bine, vreme perfecta!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, %20
store i32 %22, i32* %4
br label %23
23: ; preds = %9
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %6
%27 = load i32, i32* %4
%28 = sdiv i32 %27, 5
%29 = sitofp i32 %28 to float
store float %29, float* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %42, %26
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 5
br i1 %33, label %34, label %45
34: ; preds = %31
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %36, i32 %40)
br label %42
42: ; preds = %34
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %31
45: ; preds = %31
%46 = load float, float* %5
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), double %47)
%49 = load float, float* %5
%50 = fcmp olt float %49, 1.000000e+01
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %67
53: ; preds = %45
%54 = load float, float* %5
%55 = fcmp ogt float %54, 3.200000e+01
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %66
58: ; preds = %53
%59 = load float, float* %5
%60 = fcmp olt float %59, 2.000000e+01
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %65
63: ; preds = %58
%64 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %65
65: ; preds = %63, %61
br label %66
66: ; preds = %65, %56
br label %67
67: ; preds = %66, %51
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"What was the approximate temperature %d days ago? - \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"%d days ago the temperature was %d\0A\00"
@.str.4 = [54 x i8] c"\0A\0A\09So the average would be.....\0A %20.2f degrees ...\0A\0A\00"
@.str.5 = [14 x i8] c"Brrr.. jerrr!\00"
@.str.6 = [18 x i8] c"Canicula, pffff..\00"
@.str.7 = [18 x i8] c"Brrr... friggg..!\00"
@.str.8 = [27 x i8] c"Numa bine, vreme perfecta!\00"
@str = [31 x i8] c"\0A\0AThe results just came in...\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = load i32, i32* %8
%11 = add nsw i32 %10, %6
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 3)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %13
%16 = add nsw i32 %15, %11
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 4)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = add nsw i32 %20, %16
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 5)
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
%25 = load i32, i32* %23
%26 = add nsw i32 %25, %21
%27 = sdiv i32 %26, 5
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %29)
%31 = load i32, i32* %8
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %31)
%33 = load i32, i32* %13
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %33)
%35 = load i32, i32* %18
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %35)
%37 = load i32, i32* %23
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 %37)
%39 = sitofp i32 %27 to float
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), double %40)
%42 = icmp slt i32 %26, 50
br i1 %42, label %48, label %43
43: ; preds = %0
%44 = icmp ugt i32 %26, 164
br i1 %44, label %48, label %45
45: ; preds = %43
%46 = icmp ult i32 %26, 100
%47 = select i1 %46, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0)
br label %48
48: ; preds = %45, %43, %0
%49 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), %0 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %43 ], [ %47, %45 ]
%50 = call i32 @puts(i8* dereferenceable(1) %49)
ret i32 0
}