#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 *);
int checkIfUnique(char *s) {
  char val;
  if (strlen(s) > 255)
    return 0;
  int compare = 0;
  for (int i = 0; i < strlen(s); i++) {
    val = s[i] - 'a';
    if (compare & (1 << val))
      return 0;
    else
      compare |= 1 << val;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkIfUnique>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xff,%eax
jle    113c <checkIfUnique+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    11ca <checkIfUnique+0xba>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11c3 <checkIfUnique+0xb3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x61,%eax
mov    %al,-0x11(%rbp)
mov    -0x18(%rbp),%eax
movsbl -0x11(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     119f <checkIfUnique+0x8f>
movl   $0x0,-0x4(%rbp)
jmp    11ca <checkIfUnique+0xba>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11b5 <checkIfUnique+0xa5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <checkIfUnique+0x3a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfUnique>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <strlen@plt>
xor    %r14d,%r14d
cmp    $0xff,%eax
jg     1172 <checkIfUnique+0x62>
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    116c <checkIfUnique+0x5c>
xor    %r14d,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl (%r15,%rbx,1),%ecx
add    $0x9f,%cl
mov    $0x1,%eax
shl    %cl,%eax
movzbl %cl,%ecx
bt     %ecx,%ebp
jb     1172 <checkIfUnique+0x62>
or     %eax,%ebp
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <checkIfUnique+0x30>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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