#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 strlen(char *);
bool isUnique(char *str) {
  if (strlen(str) > 128)
    return false;
  bool characters[128];
  for (int i = 0; i < 128; i++)
    characters[i] = false;
  for (int i = 0; i < strlen(str); i++) {
    int value = str[i];
    if (characters[value]) {
      return false;
    }
    characters[value] = true;
  }
  return true;
}


x86 assembly (clang, -O0):
<isUnique>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x80,%eax
jle    113f <isUnique+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1211 <isUnique+0x101>
movl   $0x0,-0x214(%rbp)
cmpl   $0x80,-0x214(%rbp)
jge    117f <isUnique+0x6f>
movslq -0x214(%rbp),%rax
movl   $0x0,-0x210(%rbp,%rax,4)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    1149 <isUnique+0x39>
movl   $0x0,-0x218(%rbp)
mov    -0x218(%rbp),%eax
mov    %eax,-0x220(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x220(%rbp),%eax
cmp    %ecx,%eax
jge    120a <isUnique+0xfa>
mov    -0x10(%rbp),%rax
movslq -0x218(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x21c(%rbp)
movslq -0x21c(%rbp),%rax
cmpl   $0x0,-0x210(%rbp,%rax,4)
je     11e4 <isUnique+0xd4>
movl   $0x0,-0x4(%rbp)
jmp    1211 <isUnique+0x101>
movslq -0x21c(%rbp),%rax
movl   $0x1,-0x210(%rbp,%rax,4)
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1189 <isUnique+0x79>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isUnique>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x80,%eax
jg     118a <isUnique+0x6a>
mov    %rsp,%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    118a <isUnique+0x6a>
xor    %ebp,%ebp
movsbq (%rbx,%rbp,1),%rax
cmpl   $0x0,(%rsp,%rax,4)
jne    1187 <isUnique+0x67>
movl   $0x1,(%rsp,%rax,4)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1160 <isUnique+0x40>
jmp    118a <isUnique+0x6a>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isUnique(i8* %0) {
%2 = alloca [128 x i32]
%3 = bitcast [128 x i32]* %2 to i8*
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp sgt i32 %4, 128
br i1 %5, label %24, label %6
6: ; preds = %1
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %6, %17
%10 = phi i64 [ %18, %17 ], [ 0, %6 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i64
%14 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %9
store i32 1, i32* %14
%18 = add nuw nsw i64 %10, 1
%19 = tail call i32 @strlen(i8* %0)
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %9, label %22
22: ; preds = %17, %9, %6
%23 = phi i32 [ 1, %6 ], [ 0, %9 ], [ 1, %17 ]
br label %24
24: ; preds = %1, %22
%25 = phi i32 [ %23, %22 ], [ 0, %1 ]
ret i32 %25
}