#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int ch;
  fprintf(stdout, "Hello word!\nHit '9' key to continue.\n");
  do {
    ch = getc(stdin);
    fprintf(stdout, "You pressed '%c'\n", ch);
  } while (ch != '9');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1040 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x39,-0x14(%rbp)
jne    114d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eaa(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%r15
lea    0xed9(%rip),%rbx
nopl   (%rax)
mov    (%r15),%edi
call   1040 <getc@plt>
mov    %eax,%ebp
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x39,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [38 x i8] c"Hello word!\0AHit '9' key to continue.\0A\00"
@stdin = global i32 0
@.str.1 = [18 x i8] c"You pressed '%c'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdout
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %15, %2
%10 = load i32, i32* @stdin
%11 = call i32 @getc(i32 %10)
store i32 %11, i32* %6
%12 = load i32, i32* @stdout
%13 = load i32, i32* %6
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 57
br i1 %17, label %9, label %18
18: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [38 x i8] c"Hello word!\0AHit '9' key to continue.\0A\00"
@stdin = global i32 0
@.str.1 = [18 x i8] c"You pressed '%c'\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %5, %2
%6 = load i32, i32* @stdin
%7 = tail call i32 @getc(i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%10 = icmp eq i32 %7, 57
br i1 %10, label %11, label %5
11: ; preds = %5
ret i32 0
}