#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 /*<<< orphan*/ putchar(char);
int get_response(char *question) {
  int input;
  printf("%s (y/n)? ", question);
  while (1) {
    switch (input = getchar()) {
    case 'y':
    case 'Y':
      putchar('\n');
      return 0;
    case 'n':
    case 'N':
    case EOF:
      putchar('\n');
      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    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
sub    $0x4e,%eax
je     11c5 <get_response+0x95>
jmp    1169 <get_response+0x39>
mov    -0x18(%rbp),%eax
sub    $0x59,%eax
je     11af <get_response+0x7f>
jmp    117a <get_response+0x4a>
mov    -0x18(%rbp),%eax
sub    $0x6e,%eax
je     11c5 <get_response+0x95>
jmp    118b <get_response+0x5b>
mov    -0x18(%rbp),%eax
sub    $0x79,%eax
je     11af <get_response+0x7f>
jmp    119c <get_response+0x6c>
mov    -0x18(%rbp),%eax
sub    $0x80,%eax
je     11c5 <get_response+0x95>
jmp    11db <get_response+0xab>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e0 <get_response+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <get_response+0xb0>
jmp    114c <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    0xf65(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rbx
jmp    1155 <get_response+0x25>
nopl   0x0(%rax)
cmp    $0x4e,%eax
je     1171 <get_response+0x41>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    -0x59(%rax),%ecx
cmp    $0x27,%ecx
ja     1150 <get_response+0x20>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %ebx,%ebx
jmp    1176 <get_response+0x46>
mov    $0x1,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %1, %13
%8 = call i32 (...) @getchar()
store i32 %8, i32* %4
switch i32 %8, label %13 [
i32 121, label %9
i32 89, label %9
i32 110, label %11
i32 78, label %11
i32 128, label %11
]
9: ; preds = %7, %7
%10 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %2
br label %14
11: ; preds = %7, %7, %7
%12 = call i32 @putchar(i8 signext 10)
store i32 1, i32* %2
br label %14
13: ; preds = %7
br label %7
14: ; preds = %11, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s (y/n)? \00"
define i32 @get_response(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 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 %6
i32 89, label %6
i32 110, label %5
i32 78, label %5
i32 128, label %5
]
5: ; preds = %3, %3, %3
br label %6
6: ; preds = %3, %3, %5
%7 = phi i32 [ 1, %5 ], [ 0, %3 ], [ 0, %3 ]
%8 = tail call i32 @putchar(i8 signext 10)
ret i32 %7
}