#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
void main() {
  char str[50];
  int i = 0, j, hash[26] = {0};
  gets(str);
  while (str[i] != '\0') {
    hash[str[i] - 'a']++;
    i++;
  }
  for (i = 0; i < 26; i++) {
    if (hash[i] > 0) {
      printf("%c", i + 'a');
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x44(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1040 <memset@plt>
lea    -0x40(%rbp),%rdi
call   1050 <gets@plt>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     119d <main+0x6d>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
sub    $0x61,%eax
cltq
mov    -0xb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    115e <main+0x2e>
movl   $0x0,-0x44(%rbp)
cmpl   $0x1a,-0x44(%rbp)
jge    11e5 <main+0xb5>
movslq -0x44(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
jle    11d2 <main+0xa2>
mov    -0x44(%rbp),%esi
add    $0x61,%esi
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <main+0xa7>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11a4 <main+0x74>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x60(%rsp)
lea    0x70(%rsp),%rdi
call   1040 <gets@plt>
mov    0x70(%rsp),%al
test   %al,%al
je     1187 <main+0x67>
lea    0x71(%rsp),%rcx
nopw   0x0(%rax,%rax,1)
movsbq %al,%rax
addl   $0x1,-0x184(%rsp,%rax,4)
01
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1170 <main+0x50>
xor    %ebx,%ebx
lea    0xe70(%rip),%r14
jmp    11aa <main+0x8a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x1a,%rbx
je     11bd <main+0x9d>
cmpl   $0x0,(%rsp,%rbx,4)
jle    11a0 <main+0x80>
lea    0x61(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    11a0 <main+0x80>
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [26 x i32]
store i32 0, i32* %2
%5 = bitcast [26 x i32]* %4 to i8*
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %8
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 97
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %8
28: ; preds = %8
store i32 0, i32* %2
br label %29
29: ; preds = %43, %28
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 26
br i1 %31, label %32, label %46
32: ; preds = %29
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 97
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %38, %32
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %29
46: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @main() {
%1 = alloca [50 x i8]
%2 = alloca [26 x i32]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = bitcast [26 x i32]* %2 to i8*
%5 = call i32 @gets(i8* %3)
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %0, %8
%9 = phi i64 [ %16, %8 ], [ 0, %0 ]
%10 = phi i8 [ %18, %8 ], [ %6, %0 ]
%11 = sext i8 %10 to i64
%12 = add nsw i64 %11, -97
%13 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = add nuw nsw i64 %9, 1
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %8
20: ; preds = %8, %0
br label %21
21: ; preds = %20, %30
%22 = phi i64 [ %31, %30 ], [ 0, %20 ]
%23 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = trunc i64 %22 to i32
%28 = add i32 %27, 97
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %21, %26
%31 = add nuw nsw i64 %22, 1
%32 = icmp eq i64 %31, 26
br i1 %32, label %33, label %21
33: ; preds = %30
ret void
}