#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 */
#define EOF 128
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int get_response(char *question) {
  printf("%s (y/n)?", question);
  while (1) {
    switch (getchar()) {
    case 'Y':
    case 'y':
      return 0;
    case 'N':
    case 'n':
    case EOF:
      return 1;
    }
  }
}


x86 assembly (clang, -O0):
<get_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x4e,%eax
je     11a8 <get_response+0x88>
jmp    1156 <get_response+0x36>
mov    -0x14(%rbp),%eax
sub    $0x59,%eax
je     119c <get_response+0x7c>
jmp    1167 <get_response+0x47>
mov    -0x14(%rbp),%eax
sub    $0x6e,%eax
je     11a8 <get_response+0x88>
jmp    1178 <get_response+0x58>
mov    -0x14(%rbp),%eax
sub    $0x79,%eax
je     119c <get_response+0x7c>
jmp    1189 <get_response+0x69>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     11a8 <get_response+0x88>
jmp    11b4 <get_response+0x94>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <get_response+0x99>
movl   $0x1,-0x4(%rbp)
jmp    11b9 <get_response+0x99>
jmp    113c <get_response+0x1c>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_response>:
push   %rbx
mov    %rdi,%rsi
lea    0xf75(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rbx
jmp    1145 <get_response+0x25>
nopl   0x0(%rax)
cmp    $0x4e,%eax
je     1161 <get_response+0x41>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x59(%rax),%ecx
cmp    $0x27,%ecx
ja     1140 <get_response+0x20>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s (y/n)?\00"
define i32 @get_response(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %1, %10
%7 = call i32 (...) @getchar()
switch i32 %7, label %10 [
i32 89, label %8
i32 121, label %8
i32 78, label %9
i32 110, label %9
i32 128, label %9
]
8: ; preds = %6, %6
store i32 0, i32* %2
br label %11
9: ; preds = %6, %6, %6
store i32 1, i32* %2
br label %11
10: ; preds = %6
br label %6
11: ; preds = %9, %8
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s (y/n)?\00"
define i32 @get_response(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %3
3: ; preds = %3, %1
%4 = tail call i32 (...) @getchar()
switch i32 %4, label %3 [
i32 89, label %5
i32 121, label %5
i32 78, label %6
i32 110, label %6
i32 128, label %6
]
5: ; preds = %3, %3
br label %6
6: ; preds = %3, %3, %3, %5
%7 = phi i32 [ 0, %5 ], [ 1, %3 ], [ 1, %3 ], [ 1, %3 ]
ret i32 %7
}