int yes(x, y, z)
int x, y, z;
{
  register int result = -1;
  register char ch;
  for (;;) {
    rspeak(x);
    if ((ch = getchar()) == 'y')
      result = 1;
    else if (ch == 'n')
      result = 0;
    while (getchar() != '\n')
      ;
    if (ch == 'y' || ch == 'n')
      break;
    printf("Please answer the question.\n");
  }
  if (result == 1)
    rspeak(y);
  if (result == 0)
    rspeak(z);
  return (result);
}


x86 assembly (clang, -O0):
<yes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <rspeak@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x79,%eax
jne    1174 <yes+0x44>
movl   $0x1,-0x10(%rbp)
jmp    118d <yes+0x5d>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
jne    1188 <yes+0x58>
movl   $0x0,-0x10(%rbp)
jmp    118d <yes+0x5d>
jmp    1192 <yes+0x62>
mov    $0x0,%al
call   1050 <getchar@plt>
cmp    $0xa,%eax
je     11a7 <yes+0x77>
jmp    1192 <yes+0x62>
movsbl -0x11(%rbp),%eax
cmp    $0x79,%eax
je     11c1 <yes+0x91>
movsbl -0x11(%rbp),%eax
cmp    $0x6e,%eax
jne    11c6 <yes+0x96>
jmp    11d9 <yes+0xa9>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1148 <yes+0x18>
cmpl   $0x1,-0x10(%rbp)
jne    11ed <yes+0xbd>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <rspeak@plt>
cmpl   $0x0,-0x10(%rbp)
jne    1201 <yes+0xd1>
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1030 <rspeak@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
mov    %esi,(%rsp)
mov    %edi,%r13d
mov    $0xffffffff,%ebx
xor    %r14d,%r14d
mov    $0x1,%r15d
lea    0xea6(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
xor    %eax,%eax
call   1030 <rspeak@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
shl    $0x18,%ebp
cmp    $0x6e000000,%ebp
cmove  %r14d,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    1180 <yes+0x50>
cmp    $0x79000000,%ebp
cmove  %r15d,%ebx
cmp    $0x6e000000,%ebp
je     11b0 <yes+0x80>
cmp    $0x79000000,%ebp
je     11b0 <yes+0x80>
mov    %r12,%rdi
call   1040 <puts@plt>
jmp    1160 <yes+0x30>
cmp    $0x1,%ebx
je     11c0 <yes+0x90>
test   %ebx,%ebx
jne    11ca <yes+0x9a>
mov    0x4(%rsp),%eax
mov    %eax,(%rsp)
mov    (%rsp),%edi
xor    %eax,%eax
call   1030 <rspeak@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Please answer the question.\0A\00"
define i32 @yes(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 -1, i32* %7
br label %9
9: ; preds = %37, %3
%10 = load i32, i32* %4
%11 = call i32 (i32, ...) bitcast (i32 (...)* @rspeak to i32 (i32, ...)*)(i32 %10)
%12 = call i32 (...) @getchar()
%13 = trunc i32 %12 to i8
store i8 %13, i8* %8
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 121
br i1 %15, label %16, label %17
16: ; preds = %9
store i32 1, i32* %7
br label %23
17: ; preds = %9
%18 = load i8, i8* %8
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 110
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %7
br label %22
22: ; preds = %21, %17
br label %23
23: ; preds = %22, %16
br label %24
24: ; preds = %27, %23
%25 = call i32 (...) @getchar()
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %28
27: ; preds = %24
br label %24
28: ; preds = %24
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 121
br i1 %31, label %36, label %32
32: ; preds = %28
%33 = load i8, i8* %8
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 110
br i1 %35, label %36, label %37
36: ; preds = %32, %28
br label %39
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %9
39: ; preds = %36
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* %5
%44 = call i32 (i32, ...) bitcast (i32 (...)* @rspeak to i32 (i32, ...)*)(i32 %43)
br label %45
45: ; preds = %42, %39
%46 = load i32, i32* %7
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* %6
%50 = call i32 (i32, ...) bitcast (i32 (...)* @rspeak to i32 (i32, ...)*)(i32 %49)
br label %51
51: ; preds = %48, %45
%52 = load i32, i32* %7
ret i32 %52
}

LLVM IR (-O2):
@str = [28 x i8] c"Please answer the question.\00"
define i32 @yes(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %17, %3
%5 = phi i32 [ -1, %3 ], [ %16, %17 ]
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @rspeak to i32 (i32, ...)*)(i32 %0)
%7 = tail call i32 (...) @getchar()
%8 = shl i32 %7, 24
%9 = icmp eq i32 %8, 1845493760
%10 = select i1 %9, i32 0, i32 %5
br label %11
11: ; preds = %11, %4
%12 = tail call i32 (...) @getchar()
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %11
14: ; preds = %11
%15 = icmp eq i32 %8, 2030043136
%16 = select i1 %15, i32 1, i32 %10
switch i32 %8, label %17 [
i32 2030043136, label %19
i32 1845493760, label %19
]
17: ; preds = %14
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %4
19: ; preds = %14, %14
switch i32 %16, label %24 [
i32 1, label %21
i32 0, label %20
]
20: ; preds = %19
br label %21
21: ; preds = %19, %20
%22 = phi i32 [ %2, %20 ], [ %1, %19 ]
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @rspeak to i32 (i32, ...)*)(i32 %22)
br label %24
24: ; preds = %21, %19
ret i32 %16
}