#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 *, int *);
int main() {
  int m, e, mt, che, phy;
  int ms, es, mts, ches, phys;
  int ps = 0, fs = 0, ds = 0;
  printf("enter m ");
  scanf("%d", &m);
  printf("enter e ");
  scanf("%d", &e);
  printf("enter mt ");
  scanf("%d", &mt);
  printf("enter che ");
  scanf("%d", &che);
  printf("enter phy");
  scanf("%d", &phy);
  if (m >= 0 && m < 40)
    ms = 0;
  if (m >= 40 && m < 80)
    ms = 1;
  if (m >= 80 && m < 100)
    ms = 2;
  if (m < 0 && m > 100)
    ms = 3;
  switch (ms) {
  case 0:
    fs++;
    break;
  case 1:
    ps++;
    break;
  case 2:
    ds++;
    break;
  case 3:
    printf("error");
    break;
  default:
    printf("error");
    break;
  }
  printf("fail %d\n", fs);
  printf("pass total %d\n", ps + ds);
  printf("pass only %d\n", ps);
  printf("d %d", ds);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11f5 <main+0xd5>
cmpl   $0x28,-0x8(%rbp)
jge    11f5 <main+0xd5>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x28,-0x8(%rbp)
jl     1210 <main+0xf0>
cmpl   $0x50,-0x8(%rbp)
jge    1210 <main+0xf0>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x50,-0x8(%rbp)
jl     122b <main+0x10b>
cmpl   $0x64,-0x8(%rbp)
jge    122b <main+0x10b>
movl   $0x2,-0x1c(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1246 <main+0x126>
cmpl   $0x64,-0x8(%rbp)
jle    1246 <main+0x126>
movl   $0x3,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x40(%rbp)
sub    $0x3,%rax
ja     12a8 <main+0x188>
mov    -0x40(%rbp),%rax
lea    0xd9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12b6 <main+0x196>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12b6 <main+0x196>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12b6 <main+0x196>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b6 <main+0x196>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
add    -0x38(%rbp),%esi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1d(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x28(%rax),%ecx
xor    %edx,%edx
cmp    $0x28,%ecx
setb   %dl
add    $0xffffffb0,%eax
cmp    $0x14,%eax
mov    $0x2,%eax
cmovae %edx,%eax
lea    0xe83(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
lea    0xe85(%rip),%rcx
mov    (%rcx,%rax,4),%esi
lea    0xe87(%rip),%rcx
mov    (%rcx,%rax,4),%r14d
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    (%r14,%rbx,1),%esi
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"enter m \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"enter e \00"
@.str.3 = [10 x i8] c"enter mt \00"
@.str.4 = [11 x i8] c"enter che \00"
@.str.5 = [10 x i8] c"enter phy\00"
@.str.6 = [6 x i8] c"error\00"
@.str.7 = [9 x i8] c"fail %d\0A\00"
@.str.8 = [15 x i8] c"pass total %d\0A\00"
@.str.9 = [14 x i8] c"pass only %d\0A\00"
@.str.10 = [5 x i8] c"d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %0
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 40
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 0, i32* %7
br label %31
31: ; preds = %30, %27, %0
%32 = load i32, i32* %2
%33 = icmp sge i32 %32, 40
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 80
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 1, i32* %7
br label %38
38: ; preds = %37, %34, %31
%39 = load i32, i32* %2
%40 = icmp sge i32 %39, 80
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i32, i32* %2
%43 = icmp slt i32 %42, 100
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 2, i32* %7
br label %45
45: ; preds = %44, %41, %38
%46 = load i32, i32* %2
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* %2
%50 = icmp sgt i32 %49, 100
br i1 %50, label %51, label %52
51: ; preds = %48
store i32 3, i32* %7
br label %52
52: ; preds = %51, %48, %45
%53 = load i32, i32* %7
switch i32 %53, label %65 [
i32 0, label %54
i32 1, label %57
i32 2, label %60
i32 3, label %63
]
54: ; preds = %52
%55 = load i32, i32* %13
%56 = add nsw i32 %55, 1
store i32 %56, i32* %13
br label %67
57: ; preds = %52
%58 = load i32, i32* %12
%59 = add nsw i32 %58, 1
store i32 %59, i32* %12
br label %67
60: ; preds = %52
%61 = load i32, i32* %14
%62 = add nsw i32 %61, 1
store i32 %62, i32* %14
br label %67
63: ; preds = %52
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %67
65: ; preds = %52
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %65, %63, %60, %57, %54
%68 = load i32, i32* %13
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %12
%71 = load i32, i32* %14
%72 = add nsw i32 %70, %71
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %12
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %14
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %76)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"enter m \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"enter e \00"
@.str.3 = [10 x i8] c"enter mt \00"
@.str.4 = [11 x i8] c"enter che \00"
@.str.5 = [10 x i8] c"enter phy\00"
@.str.7 = [9 x i8] c"fail %d\0A\00"
@.str.8 = [15 x i8] c"pass total %d\0A\00"
@.str.9 = [14 x i8] c"pass only %d\0A\00"
@.str.10 = [5 x i8] c"d %d\00"
@switch.table.main = [3 x i32] [i32 0, i32 1, i32 0]
@switch.table.main.11 = [3 x i32] [i32 1, i32 0, i32 0]
@switch.table.main.12 = [3 x i32] [i32 0, i32 0, i32 1]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%21 = load i32, i32* %1
%22 = add i32 %21, -40
%23 = icmp ult i32 %22, 40
%24 = zext i1 %23 to i32
%25 = add i32 %21, -80
%26 = icmp ult i32 %25, 20
%27 = select i1 %26, i32 2, i32 %24
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = zext i32 %27 to i64
%32 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main.11, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = zext i32 %27 to i64
%35 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.main.12, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%38 = add nuw nsw i32 %36, %30
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %36)
ret i32 0
}