#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*/ chars();
int /*<<< orphan*/ delays();
char getchar();
int /*<<< orphan*/ ints();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char ch;
  puts("\nWould you like to create a dinamically allocated");
  printf("array for chars[C] or for ints[I] ?: ");
  ch = getchar();
  if (ch > 'a' && ch < 'z')
    ch += 'A' - 'a';
  switch (ch) {
  case 'C':
    printf("\nOk\nHere it comes\n\t");
    delays();
    chars();
    break;
  case 'I':
    printf("\nOk\nHere it comes\n\t");
    delays();
    ints();
    break;
  default:
    puts("Guess you wanna exit..\n\t Bye!\n");
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jle    11b5 <main+0x55>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jge    11b5 <main+0x55>
movsbl -0x5(%rbp),%eax
add    $0xffffffe0,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x43,%eax
je     11db <main+0x7b>
jmp    11ca <main+0x6a>
mov    -0xc(%rbp),%eax
sub    $0x49,%eax
je     11fa <main+0x9a>
jmp    1219 <main+0xb9>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <delays@plt>
mov    $0x0,%al
call   1080 <chars@plt>
jmp    1225 <main+0xc5>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <delays@plt>
mov    $0x0,%al
call   1060 <ints@plt>
jmp    1225 <main+0xc5>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x62(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0x18,%cl
movzbl %al,%eax
movzbl %dl,%ecx
cmovae %eax,%ecx
movsbl %cl,%eax
cmp    $0x49,%eax
je     11bb <main+0x5b>
cmp    $0x43,%eax
jne    11d7 <main+0x77>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <delays@plt>
xor    %eax,%eax
call   1080 <chars@plt>
jmp    11e3 <main+0x83>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <delays@plt>
xor    %eax,%eax
call   1060 <ints@plt>
jmp    11e3 <main+0x83>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"\0AWould you like to create a dinamically allocated\00"
@.str.1 = [38 x i8] c"array for chars[C] or for ints[I] ?: \00"
@.str.2 = [20 x i8] c"\0AOk\0AHere it comes\0A\09\00"
@.str.3 = [31 x i8] c"Guess you wanna exit..\0A\09 Bye!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp sgt i32 %7, 97
br i1 %8, label %9, label %18
9: ; preds = %0
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp slt i32 %11, 122
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = add nsw i32 %15, -32
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
br label %18
18: ; preds = %13, %9, %0
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
switch i32 %20, label %29 [
i32 67, label %21
i32 73, label %25
]
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (...) @delays()
%24 = call i32 (...) @chars()
br label %31
25: ; preds = %18
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 (...) @delays()
%28 = call i32 (...) @ints()
br label %31
29: ; preds = %18
%30 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %25, %21
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@.str = [50 x i8] c"\0AWould you like to create a dinamically allocated\00"
@.str.1 = [38 x i8] c"array for chars[C] or for ints[I] ?: \00"
@.str.2 = [20 x i8] c"\0AOk\0AHere it comes\0A\09\00"
@.str.3 = [31 x i8] c"Guess you wanna exit..\0A\09 Bye!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call signext i8 (...) @getchar()
%4 = add i8 %3, -98
%5 = icmp ult i8 %4, 24
%6 = add i8 %3, -32
%7 = select i1 %5, i8 %6, i8 %3
%8 = sext i8 %7 to i32
switch i32 %8, label %17 [
i32 67, label %9
i32 73, label %13
]
9: ; preds = %0
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (...) @delays()
%12 = tail call i32 (...) @chars()
br label %19
13: ; preds = %0
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (...) @delays()
%16 = tail call i32 (...) @ints()
br label %19
17: ; preds = %0
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %13, %9
ret i32 0
}