#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float ozone, nitrogen, carbon;
  FILE *fout = fopen("a4.1.out", "a");
  printf("Enter the ozone level: ");
  scanf("%f", &ozone);
  fprintf(fout, "\nozone level: %.1f\n", ozone);
  printf("Enter the nitrogen dioxide level: ");
  scanf("%f", &nitrogen);
  fprintf(fout, "nitrogen dioxide level: %.1f\n", nitrogen);
  printf("Enter the carbon monoxide level: ");
  scanf("%f", &carbon);
  fprintf(fout, "carbon monoxide level: %.1f\n", carbon);
  if (carbon > 275 || nitrogen > 275 || ozone > 275)
    fprintf(fout, "second-stage smog alert\n");
  else if (carbon > 200 || nitrogen > 200 || ozone > 200)
    fprintf(fout, "first-stage smog alert\n");
  else if (carbon > 100 || nitrogen > 100 || ozone > 100)
    fprintf(fout, "unhealthy\n");
  else
    fprintf(fout, "air ok\n");
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea6(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8c(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8c(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe95(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xdd8(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     125d <main+0x10d>
movss  -0xc(%rbp),%xmm0
movss  0xdc2(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     125d <main+0x10d>
movss  -0x8(%rbp),%xmm0
movss  0xdac(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1274 <main+0x124>
mov    -0x18(%rbp),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1342 <main+0x1f2>
movss  -0x10(%rbp),%xmm0
movss  0xd83(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     12b6 <main+0x166>
movss  -0xc(%rbp),%xmm0
movss  0xd6d(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     12b6 <main+0x166>
movss  -0x8(%rbp),%xmm0
movss  0xd57(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    12cd <main+0x17d>
mov    -0x18(%rbp),%rdi
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133d <main+0x1ed>
movss  -0x10(%rbp),%xmm0
movss  0xd2e(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     130f <main+0x1bf>
movss  -0xc(%rbp),%xmm0
movss  0xd18(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     130f <main+0x1bf>
movss  -0x8(%rbp),%xmm0
movss  0xd02(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1326 <main+0x1d6>
mov    -0x18(%rbp),%rdi
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1338 <main+0x1e8>
mov    -0x18(%rbp),%rdi
lea    0xdd1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    133d <main+0x1ed>
jmp    1342 <main+0x1f2>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe9e(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9f(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <fprintf@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <fprintf@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <fprintf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xdd3(%rip),%xmm0
ja     1291 <main+0x131>
movss  0x10(%rsp),%xmm1
ucomiss 0xdc4(%rip),%xmm1
ja     1291 <main+0x131>
movss  0x14(%rsp),%xmm2
ucomiss 0xdb5(%rip),%xmm2
ja     1291 <main+0x131>
ucomiss 0xdb0(%rip),%xmm0
ja     129f <main+0x13f>
ucomiss 0xda7(%rip),%xmm1
ja     129f <main+0x13f>
ucomiss 0xd9e(%rip),%xmm2
ja     129f <main+0x13f>
ucomiss 0xd99(%rip),%xmm0
ja     12ad <main+0x14d>
ucomiss 0xd90(%rip),%xmm1
ja     12ad <main+0x14d>
ucomiss 0xd87(%rip),%xmm2
ja     12ad <main+0x14d>
lea    0xe78(%rip),%rdi
mov    $0x7,%esi
jmp    12b9 <main+0x159>
lea    0xe2e(%rip),%rdi
mov    $0x18,%esi
jmp    12b9 <main+0x159>
lea    0xe39(%rip),%rdi
mov    $0x17,%esi
jmp    12b9 <main+0x159>
lea    0xe43(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"a4.1.out\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [24 x i8] c"Enter the ozone level: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [20 x i8] c"\0Aozone level: %.1f\0A\00"
@.str.5 = [35 x i8] c"Enter the nitrogen dioxide level: \00"
@.str.6 = [30 x i8] c"nitrogen dioxide level: %.1f\0A\00"
@.str.7 = [34 x i8] c"Enter the carbon monoxide level: \00"
@.str.8 = [29 x i8] c"carbon monoxide level: %.1f\0A\00"
@.str.9 = [25 x i8] c"second-stage smog alert\0A\00"
@.str.10 = [24 x i8] c"first-stage smog alert\0A\00"
@.str.11 = [11 x i8] c"unhealthy\0A\00"
@.str.12 = [8 x i8] c"air ok\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%9 = load i32*, i32** %5
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%15 = load i32*, i32** %5
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%21 = load i32*, i32** %5
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %23)
%25 = load float, float* %4
%26 = fcmp ogt float %25, 2.750000e+02
br i1 %26, label %33, label %27
27: ; preds = %0
%28 = load float, float* %3
%29 = fcmp ogt float %28, 2.750000e+02
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load float, float* %2
%32 = fcmp ogt float %31, 2.750000e+02
br i1 %32, label %33, label %36
33: ; preds = %30, %27, %0
%34 = load i32*, i32** %5
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
br label %65
36: ; preds = %30
%37 = load float, float* %4
%38 = fcmp ogt float %37, 2.000000e+02
br i1 %38, label %45, label %39
39: ; preds = %36
%40 = load float, float* %3
%41 = fcmp ogt float %40, 2.000000e+02
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load float, float* %2
%44 = fcmp ogt float %43, 2.000000e+02
br i1 %44, label %45, label %48
45: ; preds = %42, %39, %36
%46 = load i32*, i32** %5
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %64
48: ; preds = %42
%49 = load float, float* %4
%50 = fcmp ogt float %49, 1.000000e+02
br i1 %50, label %57, label %51
51: ; preds = %48
%52 = load float, float* %3
%53 = fcmp ogt float %52, 1.000000e+02
br i1 %53, label %57, label %54
54: ; preds = %51
%55 = load float, float* %2
%56 = fcmp ogt float %55, 1.000000e+02
br i1 %56, label %57, label %60
57: ; preds = %54, %51, %48
%58 = load i32*, i32** %5
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
br label %63
60: ; preds = %54
%61 = load i32*, i32** %5
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
br label %63
63: ; preds = %60, %57
br label %64
64: ; preds = %63, %45
br label %65
65: ; preds = %64, %33
%66 = load i32*, i32** %5
%67 = call i32 @fclose(i32* %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"a4.1.out\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [24 x i8] c"Enter the ozone level: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [20 x i8] c"\0Aozone level: %.1f\0A\00"
@.str.5 = [35 x i8] c"Enter the nitrogen dioxide level: \00"
@.str.6 = [30 x i8] c"nitrogen dioxide level: %.1f\0A\00"
@.str.7 = [34 x i8] c"Enter the carbon monoxide level: \00"
@.str.8 = [29 x i8] c"carbon monoxide level: %.1f\0A\00"
@.str.9 = [25 x i8] c"second-stage smog alert\0A\00"
@.str.10 = [24 x i8] c"first-stage smog alert\0A\00"
@.str.11 = [11 x i8] c"unhealthy\0A\00"
@.str.12 = [8 x i8] c"air ok\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%10 = load float, float* %1
%11 = fpext float %10 to double
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %11)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %16)
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), double %21)
%23 = load float, float* %3
%24 = fcmp ogt float %23, 2.750000e+02
%25 = load float, float* %2
%26 = fcmp ogt float %25, 2.750000e+02
%27 = select i1 %24, i1 true, i1 %26
%28 = load float, float* %1
%29 = fcmp ogt float %28, 2.750000e+02
%30 = select i1 %27, i1 true, i1 %29
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i64 24, i64 1, i32* %7)
br label %51
33: ; preds = %0
%34 = fcmp ogt float %23, 2.000000e+02
%35 = fcmp ogt float %25, 2.000000e+02
%36 = select i1 %34, i1 true, i1 %35
%37 = fcmp ogt float %28, 2.000000e+02
%38 = select i1 %36, i1 true, i1 %37
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i64 23, i64 1, i32* %7)
br label %51
41: ; preds = %33
%42 = fcmp ogt float %23, 1.000000e+02
%43 = fcmp ogt float %25, 1.000000e+02
%44 = select i1 %42, i1 true, i1 %43
%45 = fcmp ogt float %28, 1.000000e+02
%46 = select i1 %44, i1 true, i1 %45
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i64 10, i64 1, i32* %7)
br label %51
49: ; preds = %41
%50 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i64 7, i64 1, i32* %7)
br label %51
51: ; preds = %39, %49, %47, %31
%52 = call i32 @fclose(i32* %7)
ret i32 0
}