#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 *);
void printConsole(char *op) {
  printf("Task 13!\nPlease input 'a' or 'b'!\n");
  scanf("%c", op);
  while (*op != 'a' && *op != 'b') {
    printf("Not valid!\nPlease input 'a' or 'b'!");
    scanf("%c", op);
  }
}


x86 assembly (clang, -O0):
<printConsole>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xee0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x9(%rbp)
je     116d <printConsole+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x62,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    117d <printConsole+0x5d>
jmp    119e <printConsole+0x7e>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1040 <scanf@plt>
jmp    1148 <printConsole+0x28>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printConsole>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%al
add    $0x9f,%al
cmp    $0x2,%al
jb     118c <printConsole+0x5c>
lea    0xea1(%rip),%r14
lea    0xe97(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl (%rbx),%eax
add    $0x9f,%al
cmp    $0x1,%al
ja     1170 <printConsole+0x40>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Task 13!\0APlease input 'a' or 'b'!\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [36 x i8] c"Not valid!\0APlease input 'a' or 'b'!\00"
define void @printConsole(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 97
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 98
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ false, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%20 = load i8*, i8** %2
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %6
22: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [36 x i8] c"Not valid!\0APlease input 'a' or 'b'!\00"
@str = [34 x i8] c"Task 13!\0APlease input 'a' or 'b'!\00"
define void @printConsole(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = load i8, i8* %0
%5 = add i8 %4, -97
%6 = icmp ult i8 %5, 2
br i1 %6, label %13, label %7
7: ; preds = %1, %7
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = load i8, i8* %0
%11 = add i8 %10, -97
%12 = icmp ult i8 %11, 2
br i1 %12, label %13, label %7
13: ; preds = %7, %1
ret void
}