#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*/);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
char toupper(char);
char ask(void) {
  char c;
  printf("\n\nJust say it man, Yes or No? %c ", 16);
  fflush(stdin);
  c = toupper(getchar());
  while (getchar() != '\n')
    continue;
  printf("\n\n");
  if (c == 'Y')
    return (c);
  else
    return ('N');
}


x86 assembly (clang, -O0):
<ask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x2(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1193 <ask+0x53>
jmp    117b <ask+0x3b>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x2(%rbp),%eax
cmp    $0x59,%eax
jne    11b9 <ask+0x79>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    11bd <ask+0x7d>
movb   $0x4e,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask>:
push   %rbx
lea    0xea8(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1190 <ask+0x40>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x59,%bl
mov    $0x59,%ecx
mov    $0x4e,%eax
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0A\0AJust say it man, Yes or No? %c \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"\0A\0A\00"
define signext i8 @ask() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = load i32, i32* @stdin
%5 = call i32 @fflush(i32 %4)
%6 = call signext i8 (...) @getchar()
%7 = call signext i8 @toupper(i8 signext %6)
store i8 %7, i8* %2
br label %8
8: ; preds = %12, %0
%9 = call signext i8 (...) @getchar()
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %8
br label %8
13: ; preds = %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 89
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = load i8, i8* %2
store i8 %19, i8* %1
br label %21
20: ; preds = %13
store i8 78, i8* %1
br label %21
21: ; preds = %20, %18
%22 = load i8, i8* %1
ret i8 %22
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0A\0AJust say it man, Yes or No? %c \00"
@stdin = global i32 0
@str = [2 x i8] c"\0A\00"
define signext i8 @ask() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 16)
%2 = load i32, i32* @stdin
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call signext i8 (...) @getchar()
%5 = tail call signext i8 @toupper(i8 signext %4)
br label %6
6: ; preds = %6, %0
%7 = tail call signext i8 (...) @getchar()
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %6
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%11 = icmp eq i8 %5, 89
%12 = select i1 %11, i8 89, i8 78
ret i8 %12
}