#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 strlen(char *);
int processString(char *string) {
  int length = strlen(string);
  int i = 0, position = 0;
  int flags[128];
  if (128 < length) {
    printf("\nERROR : duplicate characters present\n");
    return 1;
  }
  for (i = 0; i < length; i++) {
    position = string[i];
    if (flags[position] == 1) {
      printf("\nDuplicate!!\n");
      return 1;
    }
    flags[position] = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<processString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    $0x80,%eax
cmp    -0x14(%rbp),%eax
jge    116f <processString+0x4f>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11df <processString+0xbf>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d8 <processString+0xb8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmpl   $0x1,-0x220(%rbp,%rax,4)
01
jne    11bb <processString+0x9b>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11df <processString+0xbf>
movslq -0x1c(%rbp),%rax
movl   $0x1,-0x220(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1176 <processString+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processString>:
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x80,%eax
jle    114a <processString+0x2a>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    117d <processString+0x5d>
test   %eax,%eax
jle    117b <processString+0x5b>
mov    %eax,%eax
xor    %ecx,%ecx
lea    0xea7(%rip),%rdi
nopl   0x0(%rax)
movsbq (%rbx,%rcx,1),%rdx
cmpl   $0x1,(%rsp,%rdx,4)
je     113e <processString+0x1e>
movl   $0x1,(%rsp,%rdx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1160 <processString+0x40>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0AERROR : duplicate characters present\0A\00"
@.str.1 = [14 x i8] c"\0ADuplicate!!\0A\00"
define i32 @processString(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [128 x i32]
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 128, %10
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %41
14: ; preds = %1
store i32 0, i32* %5
br label %15
15: ; preds = %37, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %40
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [128 x i32], [128 x i32]* %7, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %19
%32 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %41
33: ; preds = %19
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [128 x i32], [128 x i32]* %7, i64 0, i64 %35
store i32 1, i32* %36
br label %37
37: ; preds = %33
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %15
40: ; preds = %15
store i32 0, i32* %2
br label %41
41: ; preds = %40, %31, %12
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@str = [13 x i8] c"\0ADuplicate!!\00"
@str.2 = [38 x i8] c"\0AERROR : duplicate characters present\00"
define i32 @processString(i8* %0) {
%2 = alloca [128 x i32]
%3 = tail call i32 @strlen(i8* %0)
%4 = bitcast [128 x i32]* %2 to i8*
%5 = icmp sgt i32 %3, 128
br i1 %5, label %21, label %6
6: ; preds = %1
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %24
8: ; preds = %6
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %8, %18
%11 = phi i64 [ 0, %8 ], [ %19, %18 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i64
%15 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %10
store i32 1, i32* %15
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %9
br i1 %20, label %24, label %10
21: ; preds = %10, %1
%22 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.2, i64 0, i64 0), %1 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %10 ]
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
br label %24
24: ; preds = %18, %21, %6
%25 = phi i32 [ 0, %6 ], [ 1, %21 ], [ 0, %18 ]
ret i32 %25
}