#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 getchar();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
scalar_t__ processParam(int, char **);
unsigned int unique(unsigned char *, unsigned char *, unsigned int);
int main(int argc, char *argv[]) {
  static unsigned char buf[64];
  static unsigned char outBuf[64];
  unsigned char *pBuf = buf;
  int c;
  unsigned int numElements = 0;
  unsigned int outputElements;
  unsigned int i;
  if (processParam(argc, argv)) {
    return 1;
  }
  while ((c = getchar()) != EOF) {
    if ((c != '\r') && (c != '\n')) {
      *pBuf++ = (unsigned char)c;
      numElements++;
      if (numElements >= 64) {
        break;
      }
    }
  }
  outputElements = unique(&buf[0], &outBuf[0], numElements);
  pBuf = outBuf;
  for (i = 0; i < outputElements; i++) {
    printf("%c\n", *pBuf++);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0x2ef3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <processParam@plt>
cmp    $0x0,%rax
je     118a <main+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    125e <main+0x11e>
jmp    118f <main+0x4f>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e48(%rip),%rcx
cmp    (%rcx),%eax
je     11f4 <main+0xb4>
cmpl   $0xd,-0x1c(%rbp)
je     11ef <main+0xaf>
cmpl   $0xa,-0x1c(%rbp)
je     11ef <main+0xaf>
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x40,-0x20(%rbp)
jb     11ea <main+0xaa>
jmp    11f4 <main+0xb4>
jmp    11ef <main+0xaf>
jmp    118f <main+0x4f>
mov    -0x20(%rbp),%edx
lea    0x2e52(%rip),%rdi
lea    0x2e8b(%rip),%rsi
call   1040 <unique@plt>
mov    %eax,-0x24(%rbp)
lea    0x2e7c(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jae    1257 <main+0x117>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%esi
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    121f <main+0xdf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
call   1060 <processParam@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    11c6 <main+0x86>
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e7f(%rip),%r15
mov    $0x0,%ebp
cmp    (%r15),%eax
jne    11d2 <main+0x92>
lea    0x2ed6(%rip),%rdi
lea    0x2f0f(%rip),%r15
mov    %r15,%rsi
mov    %ebp,%edx
call   1040 <unique@plt>
test   %eax,%eax
je     11c6 <main+0x86>
mov    %eax,%ebp
add    $0xffffffff,%ebp
add    $0x1,%rbp
xor    %r14d,%r14d
lea    0xe5e(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx,%r15,1),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <main+0x70>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x2e77(%rip),%rbx
xor    %ebp,%ebp
jmp    11ec <main+0xac>
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%eax
je     1173 <main+0x33>
cmp    $0xa,%eax
je     11e0 <main+0xa0>
cmp    $0xd,%eax
je     11e0 <main+0xa0>
mov    %al,(%rbx)
add    $0x1,%ebp
cmp    $0x3f,%ebp
ja     1173 <main+0x33>
add    $0x1,%rbx
jmp    11e0 <main+0xa0>

LLVM IR (-O0):
@main.buf = internal global [64 x i8] zeroinitializer
@main.outBuf = internal global [64 x i8] zeroinitializer
@EOF = global i32 0
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.buf, i64 0, i64 0), i8** %6
store i32 0, i32* %8
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i64 @processParam(i32 %11, i8** %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 1, i32* %3
br label %56
16: ; preds = %2
br label %17
17: ; preds = %38, %16
%18 = call i32 (...) @getchar()
store i32 %18, i32* %7
%19 = load i32, i32* @EOF
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %39
21: ; preds = %17
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 13
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i32, i32* %7
%29 = trunc i32 %28 to i8
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %6
store i8 %29, i8* %30
%32 = load i32, i32* %8
%33 = add i32 %32, 1
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = icmp uge i32 %34, 64
br i1 %35, label %36, label %37
36: ; preds = %27
br label %39
37: ; preds = %27
br label %38
38: ; preds = %37, %24, %21
br label %17
39: ; preds = %36, %17
%40 = load i32, i32* %8
%41 = call i32 @unique(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.outBuf, i64 0, i64 0), i32 %40)
store i32 %41, i32* %9
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.outBuf, i64 0, i64 0), i8** %6
store i32 0, i32* %10
br label %42
42: ; preds = %52, %39
%43 = load i32, i32* %10
%44 = load i32, i32* %9
%45 = icmp ult i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i8*, i8** %6
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %6
%49 = load i8, i8* %47
%50 = zext i8 %49 to i32
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %10
%54 = add i32 %53, 1
store i32 %54, i32* %10
br label %42
55: ; preds = %42
store i32 0, i32* %3
br label %56
56: ; preds = %55, %15
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@main.buf = internal global [64 x i8] zeroinitializer
@main.outBuf = internal global [64 x i8] zeroinitializer
@EOF = global i32 0
@.str = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @processParam(i32 %0, i8** %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %39
5: ; preds = %2
%6 = tail call i32 (...) @getchar()
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %24, label %9
9: ; preds = %5, %18
%10 = phi i32 [ %21, %18 ], [ %6, %5 ]
%11 = phi i32 [ %20, %18 ], [ 0, %5 ]
%12 = phi i8* [ %19, %18 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @main.buf, i64 0, i64 0), %5 ]
switch i32 %10, label %13 [
i32 13, label %18
i32 10, label %18
]
13: ; preds = %9
%14 = trunc i32 %10 to i8
%15 = getelementptr inbounds i8, i8* %12, i64 1
store i8 %14, i8* %12
%16 = add i32 %11, 1
%17 = icmp ugt i32 %16, 63
br i1 %17, label %24, label %18
18: ; preds = %9, %9, %13
%19 = phi i8* [ %15, %13 ], [ %12, %9 ], [ %12, %9 ]
%20 = phi i32 [ %16, %13 ], [ %11, %9 ], [ %11, %9 ]
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %9
24: ; preds = %18, %13, %5
%25 = phi i32 [ 0, %5 ], [ %16, %13 ], [ %20, %18 ]
%26 = tail call i32 @unique(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @main.outBuf, i64 0, i64 0), i32 %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %39, label %28
28: ; preds = %24
%29 = add i32 %26, -1
%30 = zext i32 %29 to i64
%31 = getelementptr [64 x i8], [64 x i8]* @main.outBuf, i64 0, i64 %30
br label %32
32: ; preds = %28, %32
%33 = phi i8* [ %34, %32 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @main.outBuf, i64 0, i64 0), %28 ]
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %33
%36 = zext i8 %35 to i32
%37 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = icmp eq i8* %33, %31
br i1 %38, label %39, label %32
39: ; preds = %32, %24, %2
%40 = phi i32 [ 1, %2 ], [ 0, %24 ], [ 0, %32 ]
ret i32 %40
}