#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*/ scanf(char *, ...);
main() {
  int days, count1 = 0, count3 = 0, count2 = 0;
  double temp;
  int i = 0;
  double avg = 0.0;
  printf("Please enter the total numbers of days to observed\n");
  scanf("%d", &days);
  while (i <= days) {
    printf("Please enter the tempretures\n");
    scanf("%lf", &temp);
    avg = avg + (double)temp / days;
    if (temp >= 85)
      count1 += 1;
    else if (temp < 85 && temp >= 60)
      count2 += 1;
    else if (temp < 60)
      count3 += 1;
    i = i + 1;
  }
  printf("no of hot days %d\nno of avg temp days %d\nno of cold days %d\n",
         count1, count2, count3);
  printf("The averege is %f\n", avg);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     124c <main+0x12c>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe38(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11e0 <main+0xc0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    123e <main+0x11e>
movsd  0xe18(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1218 <main+0xf8>
movsd  -0x20(%rbp),%xmm0
movsd  0xe08(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1218 <main+0xf8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1239 <main+0x119>
movsd  0xde8(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1234 <main+0x114>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1239 <main+0x119>
jmp    123e <main+0x11e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1173 <main+0x53>
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xe37(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf22(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
xor    %ebx,%ebx
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
js     1227 <main+0xf7>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xffffffff,%r14d
lea    0xf19(%rip),%r15
lea    0xe8b(%rip),%r12
lea    0x10(%rsp),%r13
xor    %ebp,%ebp
movl   $0x0,(%rsp)
xor    %ebx,%ebx
jmp    11cb <main+0x9b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    0x4(%rsp),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
add    $0x1,%r14d
cmp    %eax,%r14d
jge    123a <main+0x10a>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0xe18(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jae    11a0 <main+0x70>
ucomisd %xmm0,%xmm1
jbe    1210 <main+0xe0>
ucomisd 0xe06(%rip),%xmm0
jb     1210 <main+0xe0>
add    $0x1,%ebp
jmp    11a3 <main+0x73>
nopl   0x0(%rax)
movsd  0xdf0(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a3 <main+0x73>
addl   $0x1,(%rsp)
jmp    11a3 <main+0x73>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
xor    %ebp,%ebp
lea    0xdd6(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    (%rsp),%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfe(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Please enter the total numbers of days to observed\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"Please enter the tempretures\0A\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [61 x i8] c"no of hot days %d\0Ano of avg temp days %d\0Ano of cold days %d\0A\00"
@.str.5 = [19 x i8] c"The averege is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %7
store double 0.000000e+00, double* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %46, %0
%12 = load i32, i32* %7
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %49
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %6)
%18 = load double, double* %8
%19 = load double, double* %6
%20 = load i32, i32* %2
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = fadd double %18, %22
store double %23, double* %8
%24 = load double, double* %6
%25 = fcmp oge double %24, 8.500000e+01
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %46
29: ; preds = %15
%30 = load double, double* %6
%31 = fcmp olt double %30, 8.500000e+01
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = load double, double* %6
%34 = fcmp oge double %33, 6.000000e+01
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %45
38: ; preds = %32, %29
%39 = load double, double* %6
%40 = fcmp olt double %39, 6.000000e+01
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %44
44: ; preds = %41, %38
br label %45
45: ; preds = %44, %35
br label %46
46: ; preds = %45, %26
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %11
49: ; preds = %11
%50 = load i32, i32* %3
%51 = load i32, i32* %5
%52 = load i32, i32* %4
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %50, i32 %51, i32 %52)
%54 = load double, double* %8
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %54)
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [61 x i8] c"no of hot days %d\0Ano of avg temp days %d\0Ano of cold days %d\0A\00"
@.str.5 = [19 x i8] c"The averege is %f\0A\00"
@str = [51 x i8] c"Please enter the total numbers of days to observed\00"
@str.6 = [29 x i8] c"Please enter the tempretures\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %41, label %9
9: ; preds = %0, %35
%10 = phi double [ %21, %35 ], [ 0.000000e+00, %0 ]
%11 = phi i32 [ %39, %35 ], [ 0, %0 ]
%12 = phi i32 [ %38, %35 ], [ 0, %0 ]
%13 = phi i32 [ %37, %35 ], [ 0, %0 ]
%14 = phi i32 [ %36, %35 ], [ 0, %0 ]
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%17 = load double, double* %2
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
%21 = fadd double %10, %20
%22 = fcmp ult double %17, 8.500000e+01
br i1 %22, label %25, label %23
23: ; preds = %9
%24 = add nsw i32 %14, 1
br label %35
25: ; preds = %9
%26 = fcmp olt double %17, 8.500000e+01
%27 = fcmp oge double %17, 6.000000e+01
%28 = and i1 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = add nsw i32 %12, 1
br label %35
31: ; preds = %25
%32 = fcmp olt double %17, 6.000000e+01
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = add nsw i32 %13, 1
br label %35
35: ; preds = %29, %33, %31, %23
%36 = phi i32 [ %24, %23 ], [ %14, %29 ], [ %14, %33 ], [ %14, %31 ]
%37 = phi i32 [ %13, %23 ], [ %13, %29 ], [ %34, %33 ], [ %13, %31 ]
%38 = phi i32 [ %12, %23 ], [ %30, %29 ], [ %12, %33 ], [ %12, %31 ]
%39 = add nuw nsw i32 %11, 1
%40 = icmp slt i32 %11, %18
br i1 %40, label %9, label %41
41: ; preds = %35, %0
%42 = phi i32 [ 0, %0 ], [ %36, %35 ]
%43 = phi i32 [ 0, %0 ], [ %37, %35 ]
%44 = phi i32 [ 0, %0 ], [ %38, %35 ]
%45 = phi double [ 0.000000e+00, %0 ], [ %21, %35 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0), i32 %42, i32 %44, i32 %43)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %45)
ret i32 0
}