#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 *, float *);
int main(int argc, char const *argv[]) {
  const int FREEZING = 0;
  float temperature;
  int cold_days = 0;
  int all_days = 0;
  printf("Enter the list of daily low temperature.\n");
  printf("Use Celsius, and enter q to quit.\n");
  while (scanf("%f", &temperature) == 1) {
    all_days++;
    if (temperature < FREEZING) {
      cold_days++;
    }
  }
  if (all_days != 0) {
    printf("%d days total: %.1f%% were below freezing.\n", all_days,
           100.0 * (float)cold_days / all_days);
  }
  if (all_days == 0) {
    printf("No data entered!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11a4 <main+0x84>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    119f <main+0x7f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <main+0x47>
cmpl   $0x0,-0x20(%rbp)
je     11dd <main+0xbd>
mov    -0x20(%rbp),%esi
cvtsi2ssl -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3e(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe82(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jne    11f5 <main+0xd5>
lea    0xe96(%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   %rbx
push   %rax
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11cf <main+0x9f>
xor    %ebx,%ebx
lea    0xe9e(%rip),%r14
lea    0x4(%rsp),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
xor    %eax,%eax
xorps  %xmm0,%xmm0
ucomiss 0x4(%rsp),%xmm0
seta   %al
add    %eax,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1180 <main+0x50>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe4b(%rip),%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
lea    0xe4b(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11db <main+0xab>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Enter the list of daily low temperature.\0A\00"
@.str.1 = [35 x i8] c"Use Celsius, and enter q to quit.\0A\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [44 x i8] c"%d days total: %.1f%% were below freezing.\0A\00"
@.str.4 = [18 x i8] c"No data entered!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %23, %2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %7)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = load i32, i32* %9
%17 = add nsw i32 %16, 1
store i32 %17, i32* %9
%18 = load float, float* %7
%19 = fcmp olt float %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
br label %23
23: ; preds = %20, %15
br label %12
24: ; preds = %12
%25 = load i32, i32* %9
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %9
%29 = load i32, i32* %8
%30 = sitofp i32 %29 to float
%31 = fpext float %30 to double
%32 = fmul double 1.000000e+02, %31
%33 = load i32, i32* %9
%34 = sitofp i32 %33 to double
%35 = fdiv double %32, %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %28, double %35)
br label %37
37: ; preds = %27, %24
%38 = load i32, i32* %9
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [44 x i8] c"%d days total: %.1f%% were below freezing.\0A\00"
@str = [41 x i8] c"Enter the list of daily low temperature.\00"
@str.5 = [34 x i8] c"Use Celsius, and enter q to quit.\00"
@str.6 = [17 x i8] c"No data entered!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %26
9: ; preds = %2, %9
%10 = phi i32 [ %12, %9 ], [ 0, %2 ]
%11 = phi i32 [ %16, %9 ], [ 0, %2 ]
%12 = add nuw nsw i32 %10, 1
%13 = load float, float* %3
%14 = fcmp olt float %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = add nuw nsw i32 %11, %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%18 = icmp eq i32 %17, 1
br i1 %18, label %9, label %19
19: ; preds = %9
%20 = sitofp i32 %16 to float
%21 = fpext float %20 to double
%22 = fmul double %21, 1.000000e+02
%23 = sitofp i32 %12 to double
%24 = fdiv double %22, %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %12, double %24)
br label %28
26: ; preds = %2
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
br label %28
28: ; preds = %19, %26
ret i32 0
}