#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 *, float *, ...);
int main() {
  float a, b, c, d;
  printf("Enter threshold for grades A,B,C,D\n");
  printf("in this order, decreasing persentages > ");
  scanf("%f%f%f%f", &a, &b, &c, &d);
  if (a > b && b > c && c > d) {
    printf("Thank you. Now enter student score (percent) > ");
    float num;
    scanf("%f", &num);
    if (num >= a) {
      printf("Student has an A grade\n");
    } else if (num < a && num >= b) {
      printf("Student has a B grade\n");
    } else if (num < b && num >= c) {
      printf("Student has a C grade\n");
    } else if (num < c && num >= d) {
      printf("Student has a D grade\n");
    } else if (num < d) {
      printf("Student has failed the course\n");
    } else {
      printf(
          "there is some missunderstanding in threshold \n Please try again\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    12b2 <main+0x192>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    12b2 <main+0x192>
movss  -0x10(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    12b2 <main+0x192>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11d0 <main+0xb0>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    12ad <main+0x18d>
movss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1203 <main+0xe3>
movss  -0x18(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     1203 <main+0xe3>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    12a8 <main+0x188>
movss  -0x18(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1236 <main+0x116>
movss  -0x18(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     1236 <main+0x116>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    12a3 <main+0x183>
movss  -0x18(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1269 <main+0x149>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     1269 <main+0x149>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
movss  -0x18(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    128d <main+0x16d>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
jmp    1299 <main+0x179>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    129e <main+0x17e>
jmp    12a3 <main+0x183>
jmp    12a8 <main+0x188>
jmp    12ad <main+0x18d>
jmp    12b2 <main+0x192>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm0
ucomiss %xmm0,%xmm1
jbe    11e6 <main+0xb6>
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11e6 <main+0xb6>
ucomiss 0x4(%rsp),%xmm1
jbe    11e6 <main+0xb6>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jae    11da <main+0xaa>
ucomiss %xmm0,%xmm1
movss  0xc(%rsp),%xmm1
jbe    11ed <main+0xbd>
ucomiss %xmm1,%xmm0
jb     11ed <main+0xbd>
lea    0xf37(%rip),%rdi
jmp    11e1 <main+0xb1>
lea    0xf44(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
ucomiss %xmm0,%xmm1
movss  0x8(%rsp),%xmm1
jbe    1206 <main+0xd6>
ucomiss %xmm1,%xmm0
jb     1206 <main+0xd6>
lea    0xef5(%rip),%rdi
jmp    11e1 <main+0xb1>
ucomiss %xmm0,%xmm1
movss  0x4(%rsp),%xmm1
jbe    121f <main+0xef>
ucomiss %xmm1,%xmm0
jb     121f <main+0xef>
lea    0xec6(%rip),%rdi
jmp    11e1 <main+0xb1>
ucomiss %xmm0,%xmm1
lea    0xe9c(%rip),%rax
lea    0xe55(%rip),%rdi
cmova  %rax,%rdi
jmp    11e1 <main+0xb1>

LLVM IR (-O0):
@.str = [36 x i8] c"Enter threshold for grades A,B,C,D\0A\00"
@.str.1 = [41 x i8] c"in this order, decreasing persentages > \00"
@.str.2 = [9 x i8] c"%f%f%f%f\00"
@.str.3 = [48 x i8] c"Thank you. Now enter student score (percent) > \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [24 x i8] c"Student has an A grade\0A\00"
@.str.6 = [23 x i8] c"Student has a B grade\0A\00"
@.str.7 = [23 x i8] c"Student has a C grade\0A\00"
@.str.8 = [23 x i8] c"Student has a D grade\0A\00"
@.str.9 = [31 x i8] c"Student has failed the course\0A\00"
@.str.10 = [65 x i8] c"there is some missunderstanding in threshold \0A Please try again\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fcmp ogt float %10, %11
br i1 %12, label %13, label %72
13: ; preds = %0
%14 = load float, float* %3
%15 = load float, float* %4
%16 = fcmp ogt float %14, %15
br i1 %16, label %17, label %72
17: ; preds = %13
%18 = load float, float* %4
%19 = load float, float* %5
%20 = fcmp ogt float %18, %19
br i1 %20, label %21, label %72
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %6)
%24 = load float, float* %6
%25 = load float, float* %2
%26 = fcmp oge float %24, %25
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %71
29: ; preds = %21
%30 = load float, float* %6
%31 = load float, float* %2
%32 = fcmp olt float %30, %31
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load float, float* %6
%35 = load float, float* %3
%36 = fcmp oge float %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %70
39: ; preds = %33, %29
%40 = load float, float* %6
%41 = load float, float* %3
%42 = fcmp olt float %40, %41
br i1 %42, label %43, label %49
43: ; preds = %39
%44 = load float, float* %6
%45 = load float, float* %4
%46 = fcmp oge float %44, %45
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %69
49: ; preds = %43, %39
%50 = load float, float* %6
%51 = load float, float* %4
%52 = fcmp olt float %50, %51
br i1 %52, label %53, label %59
53: ; preds = %49
%54 = load float, float* %6
%55 = load float, float* %5
%56 = fcmp oge float %54, %55
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %68
59: ; preds = %53, %49
%60 = load float, float* %6
%61 = load float, float* %5
%62 = fcmp olt float %60, %61
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %67
65: ; preds = %59
%66 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.10, i64 0, i64 0))
br label %67
67: ; preds = %65, %63
br label %68
68: ; preds = %67, %57
br label %69
69: ; preds = %68, %47
br label %70
70: ; preds = %69, %37
br label %71
71: ; preds = %70, %27
br label %72
72: ; preds = %71, %17, %13, %0
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c"in this order, decreasing persentages > \00"
@.str.2 = [9 x i8] c"%f%f%f%f\00"
@.str.3 = [48 x i8] c"Thank you. Now enter student score (percent) > \00"
@.str.4 = [3 x i8] c"%f\00"
@str = [35 x i8] c"Enter threshold for grades A,B,C,D\00"
@str.11 = [64 x i8] c"there is some missunderstanding in threshold \0A Please try again\00"
@str.12 = [30 x i8] c"Student has failed the course\00"
@str.13 = [22 x i8] c"Student has a D grade\00"
@str.14 = [22 x i8] c"Student has a C grade\00"
@str.15 = [22 x i8] c"Student has a B grade\00"
@str.16 = [23 x i8] c"Student has an A grade\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast float* %3 to i8*
%9 = bitcast float* %4 to i8*
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), float* %1, float* %2, float* %3, float* %4)
%13 = load float, float* %1
%14 = load float, float* %2
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %50
16: ; preds = %0
%17 = load float, float* %3
%18 = fcmp ogt float %14, %17
%19 = load float, float* %4
%20 = fcmp ogt float %17, %19
%21 = select i1 %18, i1 %20, i1 false
br i1 %21, label %22, label %50
22: ; preds = %16
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
%24 = bitcast float* %5 to i8*
%25 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%26 = load float, float* %5
%27 = load float, float* %1
%28 = fcmp ult float %26, %27
br i1 %28, label %29, label %47
29: ; preds = %22
%30 = fcmp uge float %26, %27
%31 = load float, float* %2
%32 = fcmp ult float %26, %31
%33 = select i1 %30, i1 true, i1 %32
br i1 %33, label %34, label %47
34: ; preds = %29
%35 = fcmp uge float %26, %31
%36 = load float, float* %3
%37 = fcmp ult float %26, %36
%38 = select i1 %35, i1 true, i1 %37
br i1 %38, label %39, label %47
39: ; preds = %34
%40 = fcmp uge float %26, %36
%41 = load float, float* %4
%42 = fcmp ult float %26, %41
%43 = select i1 %40, i1 true, i1 %42
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = fcmp olt float %26, %41
%46 = select i1 %45, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @str.11, i64 0, i64 0)
br label %47
47: ; preds = %44, %39, %34, %29, %22
%48 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.16, i64 0, i64 0), %22 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0), %29 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0), %34 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0), %39 ], [ %46, %44 ]
%49 = call i32 @puts(i8* dereferenceable(1) %48)
br label %50
50: ; preds = %47, %16, %0
ret i32 0
}