#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 atoi(char *);
char getchar();
int isCorrect(int *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  int arr[10] = {0};
  bool pass = 0;
  int i = 0;
  int j = 0;
  char check;
  puts("Enter ten characters...");
  do {
    check = getchar();
    if (isdigit(check) && i < 10) {
      arr[i] = atoi(&check);
      i++;
    }
    if (i >= 10) {
      for (j = 0; j < 10; j++) {
        switch (arr[j]) {
        case 0:
          printf("MCA-");
          break;
        case 1:
          printf("B");
          break;
        case 2:
          printf("C");
          break;
        case 3:
          printf("0");
          break;
        case 4:
          printf("5");
          break;
        case 5:
          printf("F");
          break;
        case 6:
          printf("1");
          break;
        case 7:
          printf("3");
          break;
        case 8:
          printf("7");
          break;
        case 9:
          printf(" Done\n");
          pass = isCorrect(arr);
          break;
        default:
          printf("What?");
          break;
        }
        i = 0;
      }
    }
  } while (pass == 0);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xe7d(%rip),%rdi
call   1050 <puts@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %al,-0x3d(%rbp)
movsbl -0x3d(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     11f3 <main+0x83>
cmpl   $0xa,-0x38(%rbp)
jge    11f3 <main+0x83>
lea    -0x3d(%rbp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jl     1314 <main+0x1a4>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    130f <main+0x19f>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %rax,-0x48(%rbp)
sub    $0x9,%rax
ja     12ee <main+0x17e>
mov    -0x48(%rbp),%rax
lea    0xdd1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe01(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xdf5(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xde6(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xdd7(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xdc8(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xdb9(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xdaa(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xd9b(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xd8c(%rip),%rdi
call   1060 <printf@plt>
jmp    12fa <main+0x18a>
lea    0xd7d(%rip),%rdi
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <isCorrect@plt>
mov    %eax,-0x34(%rbp)
jmp    12fa <main+0x18a>
lea    0xd67(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1204 <main+0x94>
jmp    1314 <main+0x1a4>
jmp    1319 <main+0x1a9>
cmpl   $0x0,-0x34(%rbp)
je     11b0 <main+0x40>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xe8d(%rip),%rdi
call   1060 <puts@plt>
lea    0xf(%rsp),%r13
lea    0xe54(%rip),%r14
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
jmp    11cd <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
xor    %ebp,%ebp
test   %ebp,%ebp
jne    12ca <main+0x15a>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %al,0xf(%rsp)
movsbl %al,%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     11c3 <main+0x53>
mov    %r13,%rdi
call   1090 <atoi@plt>
movslq %ebx,%rcx
mov    %eax,0x10(%rsp,%rcx,4)
cmp    $0x9,%ebx
jl     11c0 <main+0x50>
xor    %r15d,%r15d
xor    %ebp,%ebp
lea    0xe40(%rip),%rbx
jmp    121e <main+0xae>
mov    %rbx,%rdi
call   1070 <printf@plt>
nop
add    $0x1,%r15
cmp    $0xa,%r15
je     12c0 <main+0x150>
mov    0x10(%rsp,%r15,4),%eax
cmp    $0x9,%rax
ja     1207 <main+0x97>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
lea    0xe07(%rip),%rdi
jmp    120a <main+0x9a>
mov    $0x42,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x43,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x30,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x35,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x46,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x31,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x33,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
mov    $0x37,%edi
call   1040 <putchar@plt>
jmp    1210 <main+0xa0>
lea    0xda6(%rip),%rdi
call   1060 <puts@plt>
mov    %r12,%rdi
call   1030 <isCorrect@plt>
mov    %eax,%ebp
jmp    1210 <main+0xa0>
nopl   0x0(%rax)
xor    %ebx,%ebx
test   %ebp,%ebp
je     11cd <main+0x5d>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter ten characters...\00"
@.str.1 = [5 x i8] c"MCA-\00"
@.str.2 = [2 x i8] c"B\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"F\00"
@.str.7 = [2 x i8] c"1\00"
@.str.8 = [2 x i8] c"3\00"
@.str.9 = [2 x i8] c"7\00"
@.str.10 = [7 x i8] c" Done\0A\00"
@.str.11 = [6 x i8] c"What?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %66, %0
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = load i8, i8* %6
%12 = call i64 @isdigit(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = call i32 @atoi(i8* %6)
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
store i32 %18, i32* %21
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %17, %14, %9
%25 = load i32, i32* %4
%26 = icmp sge i32 %25, 10
br i1 %26, label %27, label %65
27: ; preds = %24
store i32 0, i32* %5
br label %28
28: ; preds = %61, %27
%29 = load i32, i32* %5
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %64
31: ; preds = %28
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
switch i32 %35, label %58 [
i32 0, label %36
i32 1, label %38
i32 2, label %40
i32 3, label %42
i32 4, label %44
i32 5, label %46
i32 6, label %48
i32 7, label %50
i32 8, label %52
i32 9, label %54
]
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %60
38: ; preds = %31
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %60
40: ; preds = %31
%41 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %60
42: ; preds = %31
%43 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %60
44: ; preds = %31
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
46: ; preds = %31
%47 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %60
48: ; preds = %31
%49 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %60
50: ; preds = %31
%51 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %60
52: ; preds = %31
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %60
54: ; preds = %31
%55 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%56 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%57 = call i32 @isCorrect(i32* %56)
store i32 %57, i32* %3
br label %60
58: ; preds = %31
%59 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %60
60: ; preds = %58, %54, %52, %50, %48, %46, %44, %42, %40, %38, %36
store i32 0, i32* %4
br label %61
61: ; preds = %60
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
br label %28
64: ; preds = %28
br label %65
65: ; preds = %64, %24
br label %66
66: ; preds = %65
%67 = load i32, i32* %3
%68 = icmp eq i32 %67, 0
br i1 %68, label %9, label %69
69: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter ten characters...\00"
@.str.1 = [5 x i8] c"MCA-\00"
@.str.11 = [6 x i8] c"What?\00"
@str = [6 x i8] c" Done\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i8
%3 = bitcast [10 x i32]* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
br label %6
6: ; preds = %49, %0
%7 = phi i32 [ 0, %0 ], [ %51, %49 ]
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %2
%9 = call i64 @isdigit(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %49, label %11
11: ; preds = %6
%12 = call i32 @atoi(i8* %2)
%13 = sext i32 %7 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %13
store i32 %12, i32* %14
%15 = add nsw i32 %7, 1
%16 = icmp sgt i32 %7, 8
br i1 %16, label %17, label %49
17: ; preds = %11, %45
%18 = phi i64 [ %47, %45 ], [ 0, %11 ]
%19 = phi i32 [ %46, %45 ], [ 0, %11 ]
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18
%21 = load i32, i32* %20
switch i32 %21, label %43 [
i32 0, label %22
i32 1, label %24
i32 2, label %26
i32 3, label %28
i32 4, label %30
i32 5, label %32
i32 6, label %34
i32 7, label %36
i32 8, label %38
i32 9, label %40
]
22: ; preds = %17
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %45
24: ; preds = %17
%25 = call i32 @putchar(i32 66)
br label %45
26: ; preds = %17
%27 = call i32 @putchar(i32 67)
br label %45
28: ; preds = %17
%29 = call i32 @putchar(i32 48)
br label %45
30: ; preds = %17
%31 = call i32 @putchar(i32 53)
br label %45
32: ; preds = %17
%33 = call i32 @putchar(i32 70)
br label %45
34: ; preds = %17
%35 = call i32 @putchar(i32 49)
br label %45
36: ; preds = %17
%37 = call i32 @putchar(i32 51)
br label %45
38: ; preds = %17
%39 = call i32 @putchar(i32 55)
br label %45
40: ; preds = %17
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%42 = call i32 @isCorrect(i32* %5)
br label %45
43: ; preds = %17
%44 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
br label %45
45: ; preds = %43, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22
%46 = phi i32 [ %19, %43 ], [ %42, %40 ], [ %19, %38 ], [ %19, %36 ], [ %19, %34 ], [ %19, %32 ], [ %19, %30 ], [ %19, %28 ], [ %19, %26 ], [ %19, %24 ], [ %19, %22 ]
%47 = add nuw nsw i64 %18, 1
%48 = icmp eq i64 %47, 10
br i1 %48, label %49, label %17
49: ; preds = %45, %6, %11
%50 = phi i32 [ 0, %11 ], [ 0, %6 ], [ %46, %45 ]
%51 = phi i32 [ %15, %11 ], [ %7, %6 ], [ 0, %45 ]
%52 = icmp eq i32 %50, 0
br i1 %52, label %6, label %53
53: ; preds = %49
ret i32 0
}