#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 *);
extern int get_response(char *question) {
  int c;
  printf("%s (y/n)?", question);
  while (true) {
    switch (c = 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,-0x14(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
sub    $0x4e,%eax
je     11ab <get_response+0x8b>
jmp    1159 <get_response+0x39>
mov    -0x18(%rbp),%eax
sub    $0x59,%eax
je     119f <get_response+0x7f>
jmp    116a <get_response+0x4a>
mov    -0x18(%rbp),%eax
sub    $0x6e,%eax
je     11ab <get_response+0x8b>
jmp    117b <get_response+0x5b>
mov    -0x18(%rbp),%eax
sub    $0x79,%eax
je     119f <get_response+0x7f>
jmp    118c <get_response+0x6c>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     11ab <get_response+0x8b>
jmp    11b7 <get_response+0x97>
movl   $0x0,-0x4(%rbp)
jmp    11bc <get_response+0x9c>
movl   $0x1,-0x4(%rbp)
jmp    11bc <get_response+0x9c>
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*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %1, %11
%8 = call i32 (...) @getchar()
store i32 %8, i32* %4
switch i32 %8, label %11 [
i32 121, label %9
i32 89, label %9
i32 110, label %10
i32 78, label %10
i32 128, label %10
]
9: ; preds = %7, %7
store i32 0, i32* %2
br label %12
10: ; preds = %7, %7, %7
store i32 1, i32* %2
br label %12
11: ; preds = %7
br label %7
12: ; preds = %10, %9
%13 = load i32, i32* %2
ret i32 %13
}

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 121, label %5
i32 89, label %5
i32 110, label %6
i32 78, 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
}