#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*/ getinp(char *, int);
int /*<<< orphan*/ rspeak(short);
char tolower(char);
int /*<<< orphan*/ writes(char *);
short yes(short msg1, short msg2, short msg3) {
  char answer[80];
  if (msg1)
    rspeak(msg1);
  writes(">");
  getinp(answer, 79);
  if (tolower(answer[0]) == 'n') {
    if (msg3)
      rspeak(msg3);
    return (0);
  }
  if (msg2)
    rspeak(msg2);
  return (1);
}


x86 assembly (clang, -O0):
<yes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x4(%rbp)
mov    %cx,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
cmpw   $0x0,-0x4(%rbp)
je     1171 <yes+0x31>
movswl -0x4(%rbp),%edi
call   1030 <rspeak@plt>
lea    0xe88(%rip),%rdi
call   1050 <writes@plt>
lea    -0x60(%rbp),%rdi
mov    $0x4f,%esi
call   1040 <getinp@plt>
movsbl -0x60(%rbp),%edi
call   1060 <tolower@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
jne    11bf <yes+0x7f>
cmpw   $0x0,-0x8(%rbp)
je     11b4 <yes+0x74>
movswl -0x8(%rbp),%edi
call   1030 <rspeak@plt>
movw   $0x0,-0x2(%rbp)
jmp    11d9 <yes+0x99>
cmpw   $0x0,-0x6(%rbp)
je     11d3 <yes+0x93>
movswl -0x6(%rbp),%edi
call   1030 <rspeak@plt>
movw   $0x1,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
test   %di,%di
je     115a <yes+0x1a>
movswl %di,%edi
call   1030 <rspeak@plt>
lea    0xe9f(%rip),%rdi
call   1050 <writes@plt>
mov    %rsp,%rdi
mov    $0x4f,%esi
call   1040 <getinp@plt>
movsbl (%rsp),%edi
call   1060 <tolower@plt>
cmp    $0x6e,%al
jne    118e <yes+0x4e>
xor    %ebp,%ebp
mov    $0x0,%eax
test   %bx,%bx
jne    119f <yes+0x5f>
jmp    11a9 <yes+0x69>
mov    $0x1,%bp
mov    %r14d,%ebx
mov    $0x1,%ax
test   %r14w,%r14w
je     11a9 <yes+0x69>
movswl %bx,%edi
call   1030 <rspeak@plt>
mov    %ebp,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c">\00"
define signext i16 @yes(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = alloca i16
%8 = alloca [80 x i8]
store i16 %0, i16* %5
store i16 %1, i16* %6
store i16 %2, i16* %7
%9 = load i16, i16* %5
%10 = icmp ne i16 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i16, i16* %5
%13 = call i32 @rspeak(i16 signext %12)
br label %14
14: ; preds = %11, %3
%15 = call i32 @writes(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%17 = call i32 @getinp(i8* %16, i32 79)
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%19 = load i8, i8* %18
%20 = call signext i8 @tolower(i8 signext %19)
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 110
br i1 %22, label %23, label %30
23: ; preds = %14
%24 = load i16, i16* %7
%25 = icmp ne i16 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i16, i16* %7
%28 = call i32 @rspeak(i16 signext %27)
br label %29
29: ; preds = %26, %23
store i16 0, i16* %4
br label %37
30: ; preds = %14
%31 = load i16, i16* %6
%32 = icmp ne i16 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i16, i16* %6
%35 = call i32 @rspeak(i16 signext %34)
br label %36
36: ; preds = %33, %30
store i16 1, i16* %4
br label %37
37: ; preds = %36, %29
%38 = load i16, i16* %4
ret i16 %38
}

LLVM IR (-O2):
@.str = [2 x i8] c">\00"
define signext i16 @yes(i16 signext %0, i16 signext %1, i16 signext %2) {
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%6 = icmp eq i16 %0, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @rspeak(i16 signext %0)
br label %9
9: ; preds = %7, %3
%10 = tail call i32 @writes(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @getinp(i8* %5, i32 79)
%12 = load i8, i8* %5
%13 = call signext i8 @tolower(i8 signext %12)
%14 = icmp eq i8 %13, 110
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = icmp eq i16 %2, 0
br i1 %16, label %23, label %19
17: ; preds = %9
%18 = icmp eq i16 %1, 0
br i1 %18, label %23, label %19
19: ; preds = %17, %15
%20 = phi i16 [ %2, %15 ], [ %1, %17 ]
%21 = phi i16 [ 0, %15 ], [ 1, %17 ]
%22 = call i32 @rspeak(i16 signext %20)
br label %23
23: ; preds = %19, %17, %15
%24 = phi i16 [ 0, %15 ], [ 1, %17 ], [ %21, %19 ]
ret i16 %24
}