#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 *, char *);
int main(int atgc, char **argv) {
  char ch;
  printf("char value %x\n", ch);
  printf("enter char: ");
  scanf("%c", &ch);
  printf("Number: %c\n", ch);
  switch (ch) {
  case 'c':
    printf("you have entered ten\n");
    break;
  case 'g':
    printf("you have entered eleven\n");
    break;
  case 's':
    printf("you have entered twelve\n");
    break;
  default:
    printf("default value\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x11(%rbp),%esi
lea    0xebf(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x19(%rbp),%al
movsbl -0x11(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x63,%eax
je     11b4 <main+0x94>
jmp    1192 <main+0x72>
mov    -0x18(%rbp),%eax
sub    $0x67,%eax
je     11c7 <main+0xa7>
jmp    11a3 <main+0x83>
mov    -0x18(%rbp),%eax
sub    $0x73,%eax
je     11da <main+0xba>
jmp    11ed <main+0xcd>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fb <main+0xdb>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fb <main+0xdb>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fb <main+0xdb>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%esi
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x63,%eax
je     1190 <main+0x60>
cmp    $0x73,%eax
je     1199 <main+0x69>
cmp    $0x67,%eax
jne    11a2 <main+0x72>
lea    0xeb5(%rip),%rdi
jmp    11a9 <main+0x79>
lea    0xec4(%rip),%rdi
jmp    11a9 <main+0x79>
lea    0xe8b(%rip),%rdi
jmp    11a9 <main+0x79>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"char value %x\0A\00"
@.str.1 = [13 x i8] c"enter char: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [12 x i8] c"Number: %c\0A\00"
@.str.4 = [22 x i8] c"you have entered ten\0A\00"
@.str.5 = [25 x i8] c"you have entered eleven\0A\00"
@.str.6 = [25 x i8] c"you have entered twelve\0A\00"
@.str.7 = [15 x i8] c"default value\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
switch i32 %16, label %23 [
i32 99, label %17
i32 103, label %19
i32 115, label %21
]
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %25
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %25
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %25
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %25
25: ; preds = %23, %21, %19, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"char value %x\0A\00"
@.str.1 = [13 x i8] c"enter char: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [12 x i8] c"Number: %c\0A\00"
@str = [24 x i8] c"you have entered twelve\00"
@str.8 = [24 x i8] c"you have entered eleven\00"
@str.9 = [21 x i8] c"you have entered ten\00"
@str.10 = [14 x i8] c"default value\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
switch i32 %11, label %14 [
i32 99, label %15
i32 103, label %12
i32 115, label %13
]
12: ; preds = %2
br label %15
13: ; preds = %2
br label %15
14: ; preds = %2
br label %15
15: ; preds = %2, %14, %13, %12
%16 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0), %14 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), %13 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0), %12 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0), %2 ]
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}