#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 */
typedef char uint8_t;

/* Variables and functions */
char getkey();
int /*<<< orphan*/ moveto(int /*<<< orphan*/, int /*<<< orphan*/);
int strlen(char const *);
int /*<<< orphan*/ wipe_line();
int /*<<< orphan*/ write(int, char const *, int);
uint8_t notifier(const char *p) {
  uint8_t c;
  moveto(0, 0);
  write(1, "Do you want to ", 15);
  write(1, p, strlen(p));
  write(1, " (Y/N)", 6);
  c = getkey();
  moveto(0, 0);
  wipe_line();
  return c == 'Y';
}


x86 assembly (clang, -O0):
<notifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1070 <moveto@plt>
mov    $0x1,%edi
lea    0xe8f(%rip),%rsi
mov    $0xf,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
lea    0xe68(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
mov    $0x0,%al
call   1060 <getkey@plt>
mov    %al,-0x9(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1070 <moveto@plt>
mov    $0x0,%al
call   1050 <wipe_line@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x59,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<notifier>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1070 <moveto@plt>
lea    0xe9c(%rip),%rsi
mov    $0x1,%edi
mov    $0xf,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xe7f(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
call   1030 <write@plt>
xor    %eax,%eax
call   1060 <getkey@plt>
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1070 <moveto@plt>
xor    %eax,%eax
call   1050 <wipe_line@plt>
cmp    $0x59,%bl
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Do you want to \00"
@.str.1 = [7 x i8] c" (Y/N)\00"
define signext i8 @notifier(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = call i32 @moveto(i32 0, i32 0)
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @write(i32 1, i8* %6, i32 %8)
%10 = call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%11 = call signext i8 (...) @getkey()
store i8 %11, i8* %3
%12 = call i32 @moveto(i32 0, i32 0)
%13 = call i32 (...) @wipe_line()
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 89
%17 = zext i1 %16 to i32
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
@.str = [16 x i8] c"Do you want to \00"
@.str.1 = [7 x i8] c" (Y/N)\00"
define signext i8 @notifier(i8* %0) {
%2 = tail call i32 @moveto(i32 0, i32 0)
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @write(i32 1, i8* %0, i32 %4)
%6 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%7 = tail call signext i8 (...) @getkey()
%8 = tail call i32 @moveto(i32 0, i32 0)
%9 = tail call i32 (...) @wipe_line()
%10 = icmp eq i8 %7, 89
%11 = zext i1 %10 to i8
ret i8 %11
}