#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*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc < 2) {
    return 1;
  }
  char *word = argv[1];
  int index = 0;
  short seen[256] = {0};
  char c;
  while (c = word[index]) {
    printf("%c\n", c);
    if (seen[c]) {
      printf("Not unique - saw two of '%c'.\n", c);
      return 0;
    }
    seen[c] = 1;
    index += 1;
  }
  printf("Word has no duplicate chars.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    114f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1210 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x221(%rbp)
cmp    $0x0,%al
je     11fb <main+0xdb>
movsbl -0x221(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbq -0x221(%rbp),%rax
ff
cmpw   $0x0,-0x220(%rbp,%rax,2)
je     11db <main+0xbb>
movsbl -0x221(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1210 <main+0xf0>
movsbq -0x221(%rbp),%rax
ff
movw   $0x1,-0x220(%rbp,%rax,2)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <main+0x55>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     11c6 <main+0x96>
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    0x8(%rsi),%rbx
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    (%rbx),%al
test   %al,%al
je     119b <main+0x6b>
add    $0x1,%rbx
lea    0xe93(%rip),%r14
nopl   (%rax)
movsbl %al,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbq %bpl,%rax
cmpw   $0x0,(%rsp,%rax,2)
jne    11a9 <main+0x79>
movw   $0x1,(%rsp,%rax,2)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <main+0x40>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
jmp    11b9 <main+0x89>
lea    0xe54(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [31 x i8] c"Not unique - saw two of '%c'.\0A\00"
@.str.2 = [30 x i8] c"Word has no duplicate chars.\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 [256 x i16]
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %46
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
store i32 0, i32* %7
%17 = bitcast [256 x i16]* %8 to i8*
br label %18
18: ; preds = %38, %13
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
store i8 %23, i8* %9
%24 = icmp ne i8 %23, 0
br i1 %24, label %25, label %44
25: ; preds = %18
%26 = load i8, i8* %9
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i8, i8* %9
%30 = sext i8 %29 to i64
%31 = getelementptr inbounds [256 x i16], [256 x i16]* %8, i64 0, i64 %30
%32 = load i16, i16* %31
%33 = icmp ne i16 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %25
%35 = load i8, i8* %9
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %36)
store i32 0, i32* %3
br label %46
38: ; preds = %25
%39 = load i8, i8* %9
%40 = sext i8 %39 to i64
%41 = getelementptr inbounds [256 x i16], [256 x i16]* %8, i64 0, i64 %40
store i16 1, i16* %41
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %18
44: ; preds = %18
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %46
46: ; preds = %44, %34, %12
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [31 x i8] c"Not unique - saw two of '%c'.\0A\00"
@str = [29 x i8] c"Word has no duplicate chars.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i16]
%4 = icmp slt i32 %0, 2
br i1 %4, label %30, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = bitcast [256 x i16]* %3 to i8*
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %5, %22
%12 = phi i64 [ %23, %22 ], [ 0, %5 ]
%13 = phi i8 [ %25, %22 ], [ %9, %5 ]
%14 = sext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = sext i8 %13 to i64
%17 = getelementptr inbounds [256 x i16], [256 x i16]* %3, i64 0, i64 %16
%18 = load i16, i16* %17
%19 = icmp eq i16 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %11
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %29
22: ; preds = %11
store i16 1, i16* %17
%23 = add nuw i64 %12, 1
%24 = getelementptr inbounds i8, i8* %7, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %11
27: ; preds = %22, %5
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %29
29: ; preds = %27, %20
br label %30
30: ; preds = %2, %29
%31 = phi i32 [ 0, %29 ], [ 1, %2 ]
ret i32 %31
}