#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(void) {
  float a, b, c, d, s;
  char g;
  printf("Enter thresholds for A, B, C, D\nin that order, decreasing "
         "percentages > ");
  scanf("%f%f%f%f", &a, &b, &c, &d);
  printf("Thank you. Now enter student score (percent) >");
  scanf("%f", &s);
  if (s >= a)
    g = 'A';
  else if (s >= b)
    g = 'B';
  else if (s >= c)
    g = 'C';
  else if (s >= d)
    g = 'D';
  else
    printf("Student has failed the course\n");
  if (g == 'A' || g == 'B' || g == 'C' || g == 'D')
    printf("Student has an %c grade\n", g);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf05(%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>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1193 <main+0x73>
movb   $0x41,-0x19(%rbp)
jmp    11f8 <main+0xd8>
movss  -0x18(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11ab <main+0x8b>
movb   $0x42,-0x19(%rbp)
jmp    11f3 <main+0xd3>
movss  -0x18(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     11c3 <main+0xa3>
movb   $0x43,-0x19(%rbp)
jmp    11ee <main+0xce>
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     11db <main+0xbb>
movb   $0x44,-0x19(%rbp)
jmp    11e9 <main+0xc9>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <main+0xce>
jmp    11f3 <main+0xd3>
jmp    11f8 <main+0xd8>
movsbl -0x19(%rbp),%eax
cmp    $0x41,%eax
je     122c <main+0x10c>
movsbl -0x19(%rbp),%eax
cmp    $0x42,%eax
je     122c <main+0x10c>
movsbl -0x19(%rbp),%eax
cmp    $0x43,%eax
je     122c <main+0x10c>
movsbl -0x19(%rbp),%eax
cmp    $0x44,%eax
jne    123e <main+0x11e>
movsbl -0x19(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf00(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
mov    $0x41,%esi
ucomiss 0x14(%rsp),%xmm0
jae    11c9 <main+0x99>
mov    $0x42,%esi
ucomiss 0x10(%rsp),%xmm0
jae    11c9 <main+0x99>
mov    $0x43,%esi
ucomiss 0xc(%rsp),%xmm0
jae    11c9 <main+0x99>
mov    $0x44,%esi
ucomiss 0x8(%rsp),%xmm0
jae    11c9 <main+0x99>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <main+0xa7>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [73 x i8] c"Enter thresholds for A, B, C, D\0Ain that order, decreasing percentages > \00"
@.str.1 = [9 x i8] c"%f%f%f%f\00"
@.str.2 = [47 x i8] c"Thank you. Now enter student score (percent) >\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [31 x i8] c"Student has failed the course\0A\00"
@.str.5 = [25 x i8] c"Student has an %c grade\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4, float* %5)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
%12 = load float, float* %6
%13 = load float, float* %2
%14 = fcmp oge float %12, %13
br i1 %14, label %15, label %16
15: ; preds = %0
store i8 65, i8* %7
br label %36
16: ; preds = %0
%17 = load float, float* %6
%18 = load float, float* %3
%19 = fcmp oge float %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 66, i8* %7
br label %35
21: ; preds = %16
%22 = load float, float* %6
%23 = load float, float* %4
%24 = fcmp oge float %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
store i8 67, i8* %7
br label %34
26: ; preds = %21
%27 = load float, float* %6
%28 = load float, float* %5
%29 = fcmp oge float %27, %28
br i1 %29, label %30, label %31
30: ; preds = %26
store i8 68, i8* %7
br label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %30
br label %34
34: ; preds = %33, %25
br label %35
35: ; preds = %34, %20
br label %36
36: ; preds = %35, %15
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 65
br i1 %39, label %52, label %40
40: ; preds = %36
%41 = load i8, i8* %7
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 66
br i1 %43, label %52, label %44
44: ; preds = %40
%45 = load i8, i8* %7
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 67
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i8, i8* %7
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 68
br i1 %51, label %52, label %56
52: ; preds = %48, %44, %40, %36
%53 = load i8, i8* %7
%54 = sext i8 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %52, %48
ret i32 0
}

LLVM IR (-O2):
@.str = [73 x i8] c"Enter thresholds for A, B, C, D\0Ain that order, decreasing percentages > \00"
@.str.1 = [9 x i8] c"%f%f%f%f\00"
@.str.2 = [47 x i8] c"Thank you. Now enter student score (percent) >\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [25 x i8] c"Student has an %c grade\0A\00"
@str = [30 x i8] c"Student has failed the course\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 = bitcast float* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3, float* %4)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, float*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%15 = load float, float* %5
%16 = load float, float* %1
%17 = fcmp ult float %15, %16
br i1 %17, label %18, label %29
18: ; preds = %0
%19 = load float, float* %2
%20 = fcmp ult float %15, %19
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load float, float* %3
%23 = fcmp ult float %15, %22
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load float, float* %4
%26 = fcmp ult float %15, %25
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %32
29: ; preds = %24, %21, %18, %0
%30 = phi i32 [ 68, %24 ], [ 67, %21 ], [ 66, %18 ], [ 65, %0 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %27, %29
ret i32 0
}