#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int i = 0;
  char c = 0;
  printf("NUMBER = %c;\n", '0');
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '0':
      printf("NUMBER = %c;\n", c);
      break;
    default:
      printf("Not NUMBER.\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x30,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e8e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     119f <main+0x7f>
mov    -0x5(%rbp),%al
sub    $0x30,%al
jne    118c <main+0x6c>
jmp    1175 <main+0x55>
movsbl -0x5(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119a <main+0x7a>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1146 <main+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xec4(%rip),%rdi
mov    $0x30,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e92(%rip),%rbx
cmp    (%rbx),%al
jne    1160 <main+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe99(%rip),%r14
lea    0xea0(%rip),%r15
jmp    1183 <main+0x53>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
je     115a <main+0x2a>
cmp    $0x30,%al
jne    1170 <main+0x40>
mov    %r14,%rdi
mov    $0x30,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1178 <main+0x48>

LLVM IR (-O0):
@.str = [14 x i8] c"NUMBER = %c;\0A\00"
@EOF = global i8 0
@.str.1 = [13 x i8] c"Not NUMBER.\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 48)
br label %4
4: ; preds = %19, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %20
10: ; preds = %4
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
switch i32 %12, label %17 [
i32 48, label %13
]
13: ; preds = %10
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %19
17: ; preds = %10
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
br label %4
20: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"NUMBER = %c;\0A\00"
@EOF = global i8 0
@str = [12 x i8] c"Not NUMBER.\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 48)
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %16, label %5
5: ; preds = %0, %12
%6 = phi i8 [ %13, %12 ], [ %2, %0 ]
%7 = icmp eq i8 %6, 48
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 48)
br label %12
10: ; preds = %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = tail call signext i8 (...) @getchar()
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %16, label %5
16: ; preds = %12, %0
ret void
}