#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int i = 0;
  int c = 0;
  while ((c = getchar()) != EOF) {
    switch (c) {
    case '0':
      printf("c == NUMBER == %c;\n", c);
    case 'w':
      printf("c == w == %c;\n", c);
    }
    if (c == '0')
      printf("c == NUMBER;\n");
    else {
      if (c == '\n')
        printf("c == \\n;\n");
      else
        printf("c is NOT NUMBER;\n");
    }
    switch (c) {
    case '0':
      printf("1. c == NUMBER;\n");
      break;
    case 'q':
      printf("2. c == q;\n");
      break;
    }
  }
  for (i = 0; i < 100; ++i) {
    printf("i = %d in digit and = %c in char;\n", i, i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     122e <main+0x10e>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x30,%eax
je     1174 <main+0x54>
jmp    1163 <main+0x43>
mov    -0xc(%rbp),%eax
sub    $0x77,%eax
je     1185 <main+0x65>
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x30,-0x8(%rbp)
jne    11b3 <main+0x93>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
cmpl   $0xa,-0x8(%rbp)
jne    11d0 <main+0xb0>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11de <main+0xbe>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x30,%eax
je     1208 <main+0xe8>
jmp    11f7 <main+0xd7>
mov    -0x10(%rbp),%eax
sub    $0x71,%eax
je     121b <main+0xfb>
jmp    1229 <main+0x109>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <main+0x109>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1261 <main+0x141>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1235 <main+0x115>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9f(%rip),%rbx
cmp    (%rbx),%eax
jne    1185 <main+0x55>
lea    0xecf(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    1160 <main+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xee4(%rip),%r14
lea    0xe7f(%rip),%r12
lea    0xeaa(%rip),%r13
lea    0xeb4(%rip),%r15
jmp    11fb <main+0xcb>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe49(%rip),%rdi
mov    $0x30,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x30,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%rbx),%eax
je     114d <main+0x1d>
mov    %r14,%rdi
cmp    $0xa,%ebp
je     11e5 <main+0xb5>
cmp    $0x30,%ebp
je     11b0 <main+0x80>
cmp    $0x77,%ebp
jne    1230 <main+0x100>
mov    %r12,%rdi
mov    $0x77,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
jmp    11e5 <main+0xb5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
cmp    $0x71,%ebp
je     11e5 <main+0xb5>
jmp    11ea <main+0xba>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [20 x i8] c"c == NUMBER == %c;\0A\00"
@.str.1 = [15 x i8] c"c == w == %c;\0A\00"
@.str.2 = [14 x i8] c"c == NUMBER;\0A\00"
@.str.3 = [10 x i8] c"c == \\n;\0A\00"
@.str.4 = [18 x i8] c"c is NOT NUMBER;\0A\00"
@.str.5 = [17 x i8] c"1. c == NUMBER;\0A\00"
@.str.6 = [12 x i8] c"2. c == q;\0A\00"
@.str.7 = [35 x i8] c"i = %d in digit and = %c in char;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %34, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %35
7: ; preds = %3
%8 = load i32, i32* %2
switch i32 %8, label %15 [
i32 48, label %9
i32 119, label %12
]
9: ; preds = %7
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %7, %9
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %7
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 48
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %28
20: ; preds = %15
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27, %18
%29 = load i32, i32* %2
switch i32 %29, label %34 [
i32 48, label %30
i32 113, label %32
]
30: ; preds = %28
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %34
34: ; preds = %28, %32, %30
br label %3
35: ; preds = %3
store i32 0, i32* %1
br label %36
36: ; preds = %43, %35
%37 = load i32, i32* %1
%38 = icmp slt i32 %37, 100
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load i32, i32* %1
%41 = load i32, i32* %1
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %40, i32 %41)
br label %43
43: ; preds = %39
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
store i32 %45, i32* %1
br label %36
46: ; preds = %36
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [20 x i8] c"c == NUMBER == %c;\0A\00"
@.str.1 = [15 x i8] c"c == w == %c;\0A\00"
@.str.7 = [35 x i8] c"i = %d in digit and = %c in char;\0A\00"
@str = [17 x i8] c"c is NOT NUMBER;\00"
@str.8 = [11 x i8] c"2. c == q;\00"
@str.9 = [16 x i8] c"1. c == NUMBER;\00"
@str.10 = [9 x i8] c"c == \\n;\00"
@str.11 = [13 x i8] c"c == NUMBER;\00"
define void @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %22, label %4
4: ; preds = %0, %18
%5 = phi i32 [ %19, %18 ], [ %1, %0 ]
switch i32 %5, label %12 [
i32 48, label %8
i32 119, label %6
i32 10, label %15
]
6: ; preds = %4
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 119)
br label %15
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 48)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 48)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.11, i64 0, i64 0))
br label %15
12: ; preds = %4
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%14 = icmp eq i32 %5, 113
br i1 %14, label %15, label %18
15: ; preds = %12, %4, %8, %6
%16 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0), %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0), %12 ]
%17 = tail call i32 @puts(i8* dereferenceable(1) %16)
br label %18
18: ; preds = %15, %12
%19 = tail call i32 (...) @getchar()
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %4
22: ; preds = %18, %0
br label %23
23: ; preds = %22, %23
%24 = phi i32 [ %26, %23 ], [ 0, %22 ]
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %24, i32 %24)
%26 = add nuw nsw i32 %24, 1
%27 = icmp eq i32 %26, 100
br i1 %27, label %28, label %23
28: ; preds = %23
ret void
}