#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*/ limparscanf(char);
int /*<<< orphan*/ primoate();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ verificaprimo();
int main() {
  char t = '\n';
  while (1 == 1) {
    printf("\nEnter \"p\" to print prime numbers or \"v\" to verify that a "
           "number is prime \"q\" to quit the application: ");
    limparscanf(t);
    scanf("%c", &t);
    if (t == 'p' || t == 'P') {
      limparscanf(t);
      primoate();
    } else if (t == 'v' || t == 'V') {
      limparscanf(t);
      verificaprimo();
    } else if (t == '\n')
      t = '\n';
    else if (t == 'q' || t == 'Q')
      break;
    else {
      printf("\n::::::::::::< \"%c\" is an invalid option!! >:::::::::::::\n",
             t);
    }
  }
  printf("\n............: See You Later!! :............\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xa,-0x5(%rbp)
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1030 <limparscanf@plt>
lea    0xee7(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1070 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x70,%eax
je     11a4 <main+0x54>
movsbl -0x5(%rbp),%eax
cmp    $0x50,%eax
jne    11b9 <main+0x69>
movsbl -0x5(%rbp),%edi
call   1030 <limparscanf@plt>
mov    $0x0,%al
call   1060 <primoate@plt>
jmp    123e <main+0xee>
movsbl -0x5(%rbp),%eax
cmp    $0x76,%eax
je     11d3 <main+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x56,%eax
jne    11e8 <main+0x98>
movsbl -0x5(%rbp),%edi
call   1030 <limparscanf@plt>
mov    $0x0,%al
call   1050 <verificaprimo@plt>
jmp    1239 <main+0xe9>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11fe <main+0xae>
movb   $0xa,-0x5(%rbp)
jmp    1234 <main+0xe4>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
je     1218 <main+0xc8>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
jne    121d <main+0xcd>
jmp    1243 <main+0xf3>
movsbl -0x5(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1234 <main+0xe4>
jmp    1239 <main+0xe9>
jmp    123e <main+0xee>
jmp    1163 <main+0x13>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0xa,0x7(%rsp)
lea    0xe8c(%rip),%r14
lea    0xeed(%rip),%r15
lea    0x7(%rsp),%rbx
lea    0xee4(%rip),%r12
jmp    119e <main+0x3e>
nopl   0x0(%rax)
mov    %esi,%edi
call   1030 <limparscanf@plt>
xor    %eax,%eax
call   1060 <verificaprimo@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x7(%rsp),%edi
call   1030 <limparscanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
movsbl 0x7(%rsp),%esi
mov    %esi,%eax
and    $0xdf,%al
cmp    $0x56,%al
je     1190 <main+0x30>
cmp    $0x50,%al
jne    11e0 <main+0x80>
mov    %esi,%edi
call   1030 <limparscanf@plt>
xor    %eax,%eax
call   1070 <primoate@plt>
jmp    119e <main+0x3e>
xchg   %ax,%ax
cmp    $0xa,%sil
jne    11ed <main+0x8d>
movb   $0xa,0x7(%rsp)
jmp    119e <main+0x3e>
cmp    $0x51,%al
je     11fd <main+0x9d>
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    119e <main+0x3e>
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [104 x i8] c"\0AEnter \22p\22 to print prime numbers or \22v\22 to verify that a number is prime \22q\22 to quit the application: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [59 x i8] c"\0A::::::::::::< \22%c\22 is an invalid option!! >:::::::::::::\0A\00"
@.str.3 = [47 x i8] c"\0A............: See You Later!! :............\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 10, i8* %2
br label %3
3: ; preds = %0, %52
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %2
%6 = call i32 @limparscanf(i8 signext %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 112
br i1 %10, label %15, label %11
11: ; preds = %3
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 80
br i1 %14, label %15, label %19
15: ; preds = %11, %3
%16 = load i8, i8* %2
%17 = call i32 @limparscanf(i8 signext %16)
%18 = call i32 (...) @primoate()
br label %52
19: ; preds = %11
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 118
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 86
br i1 %26, label %27, label %31
27: ; preds = %23, %19
%28 = load i8, i8* %2
%29 = call i32 @limparscanf(i8 signext %28)
%30 = call i32 (...) @verificaprimo()
br label %51
31: ; preds = %23
%32 = load i8, i8* %2
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 10
br i1 %34, label %35, label %36
35: ; preds = %31
store i8 10, i8* %2
br label %50
36: ; preds = %31
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 113
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = load i8, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 81
br i1 %43, label %44, label %45
44: ; preds = %40, %36
br label %53
45: ; preds = %40
%46 = load i8, i8* %2
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %45
br label %50
50: ; preds = %49, %35
br label %51
51: ; preds = %50, %27
br label %52
52: ; preds = %51, %15
br label %3
53: ; preds = %44
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [104 x i8] c"\0AEnter \22p\22 to print prime numbers or \22v\22 to verify that a number is prime \22q\22 to quit the application: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [59 x i8] c"\0A::::::::::::< \22%c\22 is an invalid option!! >:::::::::::::\0A\00"
@str = [46 x i8] c"\0A............: See You Later!! :............\0A\00"
define i32 @main() {
%1 = alloca i8
store i8 10, i8* %1
br label %2
2: ; preds = %16, %0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %1
%5 = call i32 @limparscanf(i8 signext %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = and i8 %7, -33
switch i8 %9, label %17 [
i8 80, label %10
i8 86, label %13
]
10: ; preds = %2
%11 = call i32 @limparscanf(i8 signext %7)
%12 = call i32 (...) @primoate()
br label %16
13: ; preds = %2
%14 = call i32 @limparscanf(i8 signext %7)
%15 = call i32 (...) @verificaprimo()
br label %16
16: ; preds = %13, %22, %19, %10
br label %2
17: ; preds = %2
%18 = icmp eq i8 %7, 10
br i1 %18, label %19, label %20
19: ; preds = %17
store i8 10, i8* %1
br label %16
20: ; preds = %17
%21 = icmp eq i8 %9, 81
br i1 %21, label %24, label %22
22: ; preds = %20
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %16
24: ; preds = %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret i32 0
}