#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf_s(char *, ...);
int main(void) {
  char userChar = 0;
  int check = 0;
  printf("1 to start, -1 to quit: ");
  scanf_s("%d", &check, 1);
  getchar();
  while (check != -1) {
    printf("\nenter character: ");
    scanf_s("%c", &userChar, 1);
    if (userChar >= 'A' && userChar <= 'Z') {
      printf("1\n");
      break;
    } else if (userChar >= 'a' && userChar <= 'z') {
      printf("2\n");
      break;
    } else if (userChar >= 48 && userChar <= 57) {
      printf("3\n");
      break;
    } else if (userChar > -1 && userChar < 128) {
      printf("0\n");
      break;
    }
    check = -1;
  }
  printf("ÇÁ·Î±×·¥À» Á¾·áÇÕ´Ï´Ù.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1050 <scanf_s@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     126a <main+0x13a>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1050 <scanf_s@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     11cc <main+0x9c>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     11cc <main+0x9c>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x13a>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     11f7 <main+0xc7>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     11f7 <main+0xc7>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x13a>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1222 <main+0xf2>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1222 <main+0xf2>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x13a>
movsbl -0x5(%rbp),%eax
cmp    $0xffffffff,%eax
jle    124f <main+0x11f>
movsbl -0x5(%rbp),%eax
cmp    $0x80,%eax
jge    124f <main+0x11f>
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x13a>
jmp    1254 <main+0x124>
jmp    1259 <main+0x129>
jmp    125e <main+0x12e>
movl   $0xffffffff,-0xc(%rbp)
jmp    1174 <main+0x44>
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x3(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1060 <scanf_s@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmpl   $0xffffffff,0x4(%rsp)
je     1208 <main+0xc8>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
lea    0x3(%rsp),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1060 <scanf_s@plt>
mov    0x3(%rsp),%al
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     11c2 <main+0x82>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
jmp    1208 <main+0xc8>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     11d8 <main+0x98>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
jmp    1208 <main+0xc8>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     11ee <main+0xae>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
jmp    1208 <main+0xc8>
test   %al,%al
js     1200 <main+0xc0>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
jmp    1208 <main+0xc8>
movl   $0xffffffff,0x4(%rsp)
ff
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"1 to start, -1 to quit: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\0Aenter character: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c"1\0A\00"
@.str.5 = [3 x i8] c"2\0A\00"
@.str.6 = [3 x i8] c"3\0A\00"
@.str.7 = [3 x i8] c"0\0A\00"
@.str.8 = [45 x i8] c"\C3\87\C3\81\C2\B7\C3\8E\C2\B1\C3\97\C2\B7\C2\A5\C3\80\C2\BB \C3\81\C2\BE\C2\B7\C3\A1\C3\87\C3\95\C2\B4\C3\8F\C2\B4\C3\99.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32 1)
%6 = call i32 (...) @getchar()
br label %7
7: ; preds = %55, %0
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %56
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2, i32 1)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 90
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %56
22: ; preds = %16, %10
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 97
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 122
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %56
32: ; preds = %26, %22
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp sge i32 %34, 48
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp sle i32 %38, 57
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %56
42: ; preds = %36, %32
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = icmp sgt i32 %44, -1
br i1 %45, label %46, label %52
46: ; preds = %42
%47 = load i8, i8* %2
%48 = sext i8 %47 to i32
%49 = icmp slt i32 %48, 128
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %56
52: ; preds = %46, %42
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
store i32 -1, i32* %3
br label %7
56: ; preds = %50, %40, %30, %20, %7
%57 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"1 to start, -1 to quit: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"\0Aenter character: \00"
@.str.3 = [3 x i8] c"%c\00"
@str = [44 x i8] c"\C3\87\C3\81\C2\B7\C3\8E\C2\B1\C3\97\C2\B7\C2\A5\C3\80\C2\BB \C3\81\C2\BE\C2\B7\C3\A1\C3\87\C3\95\C2\B4\C3\8F\C2\B4\C3\99.\0A\00"
@str.9 = [2 x i8] c"0\00"
@str.10 = [2 x i8] c"3\00"
@str.11 = [2 x i8] c"2\00"
@str.12 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
store i8 0, i8* %1
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32 1)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, -1
br i1 %8, label %32, label %9
9: ; preds = %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %1, i32 1)
%12 = load i8, i8* %1
%13 = add i8 %12, -65
%14 = icmp ult i8 %13, 26
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
br label %32
17: ; preds = %9
%18 = add i8 %12, -97
%19 = icmp ult i8 %18, 26
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
br label %32
22: ; preds = %17
%23 = add i8 %12, -48
%24 = icmp ult i8 %23, 10
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
br label %32
27: ; preds = %22
%28 = icmp sgt i8 %12, -1
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %32
31: ; preds = %27
store i32 -1, i32* %2
br label %32
32: ; preds = %31, %29, %25, %20, %15, %0
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret i32 0
}