#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ getstr(char *, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char prompt_for_yes_no(char *title, char *prompt) {
  char line[80];
  char lin2[80];
  fprintf(stdout, "\n%s\n", title);
  strcpy(line, prompt);
  strcat(line, "(y/n) ? [y]");
  getstr(line, lin2);
  if ((*lin2 != 'n') && (*lin2 != 'N'))
    return ('y');
  else
    return ('n');
}


x86 assembly (clang, -O0):
<prompt_for_yes_no>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe99(%rip),%rsi
call   1050 <fprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1040 <getstr@plt>
movsbl -0xc0(%rbp),%eax
cmp    $0x6e,%eax
je     11c2 <prompt_for_yes_no+0x82>
movsbl -0xc0(%rbp),%eax
cmp    $0x4e,%eax
je     11c2 <prompt_for_yes_no+0x82>
movb   $0x79,-0x1(%rbp)
jmp    11c6 <prompt_for_yes_no+0x86>
movb   $0x6e,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_for_yes_no>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
mov    %rsi,%r14
mov    %rdi,%rdx
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1050 <fprintf@plt>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <getstr@plt>
mov    (%rsp),%al
and    $0xdf,%al
cmp    $0x4e,%al
mov    $0x6e,%ecx
mov    $0x79,%eax
cmove  %ecx,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [12 x i8] c"(y/n) ? [y]\00"
define signext i8 @prompt_for_yes_no(i8* %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i32, i32* @stdout
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%18 = call i32 @getstr(i8* %16, i8* %17)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 110
br i1 %22, label %23, label %29
23: ; preds = %2
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 78
br i1 %27, label %28, label %29
28: ; preds = %23
store i8 121, i8* %3
br label %30
29: ; preds = %23, %2
store i8 110, i8* %3
br label %30
30: ; preds = %29, %28
%31 = load i8, i8* %3
ret i8 %31
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [12 x i8] c"(y/n) ? [y]\00"
define signext i8 @prompt_for_yes_no(i8* %0, i8* %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @stdout
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = call i32 @strcpy(i8* %5, i8* %1)
%10 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @getstr(i8* %5, i8* %6)
%12 = load i8, i8* %6
%13 = and i8 %12, -33
%14 = icmp eq i8 %13, 78
%15 = select i1 %14, i8 110, i8 121
ret i8 %15
}