#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*/ fpurge(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main() {
  char ch;
  puts("Would you like me to send your password to the bad guys?");
  for (;;) {
    printf("Enter Yes or No (Y or N)?");
    ch = getchar();
    if (ch == 'N' || ch == 'n') {
      puts("Well then, your password is safe!");
      break;
    } else if (ch == 'Y' || ch == 'y') {
      puts("Okay, sending password...");
      break;
    } else {
      puts("You must enter Y or N! \n");
    }
    fpurge(stdin);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
je     118b <main+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
jne    119c <main+0x5c>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
jmp    11eb <main+0xab>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
je     11b6 <main+0x76>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    11c7 <main+0x87>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
jmp    11eb <main+0xab>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
jmp    11d8 <main+0x98>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
call   1060 <fpurge@plt>
jmp    115b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rbx
lea    0xf30(%rip),%r14
mov    0x2e82(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
and    $0xdf,%al
cmp    $0x4e,%al
je     119b <main+0x5b>
cmp    $0x59,%al
je     11a4 <main+0x64>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    (%r15),%edi
call   1060 <fpurge@plt>
jmp    1170 <main+0x30>
lea    0xeb1(%rip),%rdi
jmp    11ab <main+0x6b>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Would you like me to send your password to the bad guys?\00"
@.str.1 = [26 x i8] c"Enter Yes or No (Y or N)?\00"
@.str.2 = [34 x i8] c"Well then, your password is safe!\00"
@.str.3 = [26 x i8] c"Okay, sending password...\00"
@.str.4 = [25 x i8] c"You must enter Y or N! \0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %29, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 78
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 110
br i1 %13, label %14, label %16
14: ; preds = %10, %4
%15 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %32
16: ; preds = %10
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 89
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 121
br i1 %23, label %24, label %26
24: ; preds = %20, %16
%25 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %32
26: ; preds = %20
%27 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26
br label %29
29: ; preds = %28
%30 = load i32, i32* @stdin
%31 = call i32 @fpurge(i32 %30)
br label %4
32: ; preds = %24, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"Would you like me to send your password to the bad guys?\00"
@.str.1 = [26 x i8] c"Enter Yes or No (Y or N)?\00"
@.str.2 = [34 x i8] c"Well then, your password is safe!\00"
@.str.3 = [26 x i8] c"Okay, sending password...\00"
@.str.4 = [25 x i8] c"You must enter Y or N! \0A\00"
@stdin = global i32 0
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %6, %0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
%5 = and i8 %4, -33
switch i8 %5, label %6 [
i8 78, label %11
i8 89, label %10
]
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = tail call i32 @fpurge(i32 %8)
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), %2 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}