#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*/ free(char *);
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
__attribute__((unused)) bool getConfirmation(void) {
  char *buffer = NULL;
  size_t size = 0;
  if (getline(&buffer, &size, stdin) <= 0)
    return false;
  bool result = (*buffer == 'y' || *buffer == 'Y');
  free(buffer);
  return result;
}


x86 assembly (clang, -O0):
<getConfirmation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <getline@plt>
cmp    $0x0,%rax
jg     1164 <getConfirmation+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <getConfirmation+0x83>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0x1d(%rbp)
je     1189 <getConfirmation+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getConfirmation>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1040 <getline@plt>
test   %rax,%rax
jle    1167 <getConfirmation+0x47>
mov    (%rsp),%rdi
mov    (%rdi),%al
and    $0xdf,%al
xor    %ebx,%ebx
cmp    $0x59,%al
sete   %bl
call   1030 <free@plt>
jmp    1169 <getConfirmation+0x49>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @getConfirmation() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* null, i8** %2
store i64 0, i64* %3
%5 = load i32, i32* @stdin
%6 = call i64 @getline(i8** %2, i64* %3, i32 %5)
%7 = icmp sle i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 0, i32* %1
br label %25
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 121
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 89
br label %19
19: ; preds = %14, %9
%20 = phi i1 [ true, %9 ], [ %18, %14 ]
%21 = zext i1 %20 to i32
store i32 %21, i32* %4
%22 = load i8*, i8** %2
%23 = call i32 @free(i8* %22)
%24 = load i32, i32* %4
store i32 %24, i32* %1
br label %25
25: ; preds = %19, %8
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @getConfirmation() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = load i32, i32* @stdin
%6 = call i64 @getline(i8** %1, i64* %2, i32 %5)
%7 = icmp slt i64 %6, 1
br i1 %7, label %15, label %8
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = load i8, i8* %9
%11 = and i8 %10, -33
%12 = icmp eq i8 %11, 89
%13 = zext i1 %12 to i32
%14 = call i32 @free(i8* %9)
br label %15
15: ; preds = %0, %8
%16 = phi i32 [ %13, %8 ], [ 0, %0 ]
ret i32 %16
}