#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 getchar();
int /*<<< orphan*/ myflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
void prompt_and_pause(char *message) {
  int ch;
  printf("%s", message);
  printf(" - Hit <Enter> to continue...");
  ch = getchar();
  if (ch == '\n')
    ungetc(ch, stdin);
  myflush(stdin);
}


x86 assembly (clang, -O0):
<prompt_and_pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1191 <prompt_and_pause+0x51>
mov    -0xc(%rbp),%edi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1060 <ungetc@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1040 <myflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_and_pause>:
push   %rax
mov    %rdi,%rsi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    117f <prompt_and_pause+0x3f>
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1060 <ungetc@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <myflush@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c" - Hit <Enter> to continue...\00"
@stdin = global i32 0
define void @prompt_and_pause(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @getchar()
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* @stdin
%13 = call i32 @ungetc(i32 %11, i32 %12)
br label %14
14: ; preds = %10, %1
%15 = load i32, i32* @stdin
%16 = call i32 @myflush(i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c" - Hit <Enter> to continue...\00"
@stdin = global i32 0
define void @prompt_and_pause(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @stdin
%8 = tail call i32 @ungetc(i32 10, i32 %7)
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* @stdin
%11 = tail call i32 @myflush(i32 %10)
ret void
}