#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 EOF;
int encode_character(int, int);
int getchar();
scalar_t__ isalpha(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int c;
  while ((c = getchar()) != EOF) {
    if (isalpha(c))
      printf("%c", encode_character(c, 3));
    else
      printf("%c", c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
je     11ae <main+0x6e>
mov    -0x8(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     119a <main+0x5a>
mov    -0x8(%rbp),%edi
mov    $0x3,%esi
call   1030 <encode_character@plt>
mov    %eax,%esi
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
jmp    11a9 <main+0x69>
mov    -0x8(%rbp),%esi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e96(%rip),%r14
cmp    (%r14),%eax
jne    115e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe99(%rip),%rbx
jmp    1188 <main+0x48>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     1157 <main+0x17>
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     1170 <main+0x30>
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <encode_character@plt>
mov    %eax,%ebp
jmp    1170 <main+0x30>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %18, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i64 @isalpha(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 @encode_character(i32 %12, i32 3)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %18
15: ; preds = %7
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %11
br label %3
19: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %10
%5 = phi i32 [ %13, %10 ], [ %1, %0 ]
%6 = tail call i64 @isalpha(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @encode_character(i32 %5, i32 3)
br label %10
10: ; preds = %4, %8
%11 = phi i32 [ %9, %8 ], [ %5, %4 ]
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 (...) @getchar()
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %10, %0
ret i32 0
}