#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
char tolower(int /*<<< orphan*/);
int main() {
  int x, done;
  char ch;
  done = 0;
  printf("Would you like me to send your password to the bad guys?\n");
  while (!done) {
    printf("\nEnter Y or N (Y/N) %c ", 16);
    ch = tolower(getchar());
    switch (ch) {
    case 'n':
      printf("\nWell, then your password is safe...\n\t... for now %c\n\n\n",
             1);
      done = !0;
      break;
    case 'y': {
      printf("\nSending your password to the bad guys... %c", 2);
      for (x = 10; x >= 1; x--) {
        printf("\n\t..%2d...", x);
      }
      putchar('\n');
      putchar('\n');
      printf("Your beloved %c password is now at the mercy of the bad guys... "
             "\n\t..ready to be abused... %c%c%c\n\t\t..repeteadly %c\n\n\n\n",
             3, 16, 18, 17, 1);
      done = !0;
      break;
    }
    default:
      printf("\nYou must enter Y or N !!!");
      fflush(stdin);
    }
  }
  fflush(stdin);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118a <main+0x3a>
jmp    12a4 <main+0x154>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
mov    $0x10,%esi
call   1040 <printf@plt>
mov    -0x15(%rbp),%al
call   1050 <getchar@plt>
mov    %eax,%edi
call   1060 <tolower@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x6e,%eax
je     11d8 <main+0x88>
jmp    11c7 <main+0x77>
mov    -0x14(%rbp),%eax
sub    $0x79,%eax
je     11f7 <main+0xa7>
jmp    1283 <main+0x133>
lea    0xe73(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    129f <main+0x14f>
lea    0xe8c(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xa,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     123a <main+0xea>
mov    -0x8(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1211 <main+0xc1>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6d(%rip),%rdi
mov    $0x3,%esi
mov    $0x10,%edx
mov    $0x12,%ecx
mov    $0x11,%r8d
mov    $0x1,%r9d
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    129f <main+0x14f>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
jmp    1174 <main+0x24>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xfae(%rip),%rdi
call   1040 <puts@plt>
lea    0xe88(%rip),%rbx
lea    0xf80(%rip),%r14
mov    0x2e62(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%edi
call   1070 <tolower@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     11d2 <main+0x72>
cmp    $0x6e,%eax
je     12c1 <main+0x161>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%edi
call   1080 <fflush@plt>
jmp    1190 <main+0x30>
lea    0xe77(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdeb(%rip),%rdi
mov    $0x3,%esi
mov    $0x10,%edx
mov    $0x12,%ecx
mov    $0x11,%r8d
mov    $0x1,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12d4 <main+0x174>
lea    0xd50(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%edi
call   1080 <fflush@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Would you like me to send your password to the bad guys?\0A\00"
@.str.1 = [24 x i8] c"\0AEnter Y or N (Y/N) %c \00"
@.str.2 = [56 x i8] c"\0AWell, then your password is safe...\0A\09... for now %c\0A\0A\0A\00"
@.str.3 = [45 x i8] c"\0ASending your password to the bad guys... %c\00"
@.str.4 = [11 x i8] c"\0A\09..%2d...\00"
@.str.5 = [119 x i8] c"Your beloved %c password is now at the mercy of the bad guys... \0A\09..ready to be abused... %c%c%c\0A\09\09..repeteadly %c\0A\0A\0A\0A\00"
@.str.6 = [27 x i8] c"\0AYou must enter Y or N !!!\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %38
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 16)
%12 = call i32 (...) @getchar()
%13 = call signext i8 @tolower(i32 %12)
store i8 %13, i8* %4
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
switch i32 %15, label %33 [
i32 110, label %16
i32 121, label %18
]
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i32 1, i32* %3
br label %37
18: ; preds = %10
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 2)
store i32 10, i32* %2
br label %20
20: ; preds = %26, %18
%21 = load i32, i32* %2
%22 = icmp sge i32 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = add nsw i32 %27, -1
store i32 %28, i32* %2
br label %20
29: ; preds = %20
%30 = call i32 @putchar(i8 signext 10)
%31 = call i32 @putchar(i8 signext 10)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.5, i64 0, i64 0), i32 3, i32 16, i32 18, i32 17, i32 1)
store i32 1, i32* %3
br label %37
33: ; preds = %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%35 = load i32, i32* @stdin
%36 = call i32 @fflush(i32 %35)
br label %37
37: ; preds = %33, %29, %16
br label %6
38: ; preds = %6
%39 = load i32, i32* @stdin
%40 = call i32 @fflush(i32 %39)
%41 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"\0AEnter Y or N (Y/N) %c \00"
@.str.2 = [56 x i8] c"\0AWell, then your password is safe...\0A\09... for now %c\0A\0A\0A\00"
@.str.3 = [45 x i8] c"\0ASending your password to the bad guys... %c\00"
@.str.4 = [11 x i8] c"\0A\09..%2d...\00"
@.str.5 = [119 x i8] c"Your beloved %c password is now at the mercy of the bad guys... \0A\09..ready to be abused... %c%c%c\0A\09\09..repeteadly %c\0A\0A\0A\0A\00"
@.str.6 = [27 x i8] c"\0AYou must enter Y or N !!!\00"
@stdin = global i32 0
@str = [57 x i8] c"Would you like me to send your password to the bad guys?\00"
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 = %24, %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 16)
%4 = tail call i32 (...) @getchar()
%5 = tail call signext i8 @tolower(i32 %4)
%6 = sext i8 %5 to i32
switch i32 %6, label %24 [
i32 110, label %7
i32 121, label %9
]
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %28
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 2)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 9)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 8)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 7)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 6)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 5)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 4)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 3)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 2)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 1)
%21 = tail call i32 @putchar(i8 signext 10)
%22 = tail call i32 @putchar(i8 signext 10)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @.str.5, i64 0, i64 0), i32 3, i32 16, i32 18, i32 17, i32 1)
br label %28
24: ; preds = %2
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32, i32* @stdin
%27 = tail call i32 @fflush(i32 %26)
br label %2
28: ; preds = %9, %7
%29 = load i32, i32* @stdin
%30 = tail call i32 @fflush(i32 %29)
%31 = tail call i32 (...) @getchar()
ret i32 0
}