#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 */
scalar_t__ checkForUnique(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strlen(char *);
int main() {
  char word[300];
  printf("Enter the String");
  gets(word);
  printf("%d\n", strlen(word));
  if (strlen(word) > 0) {
    if (checkForUnique(word))
      printf("Contains UNIQUE");
    else
      printf("contains Duplicate");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x130(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x130(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x130(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    11db <main+0x9b>
lea    -0x130(%rbp),%rdi
call   1060 <checkForUnique@plt>
cmp    $0x0,%rax
je     11c8 <main+0x88>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <main+0x96>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11db <main+0x9b>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x130,%rsp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xea1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    11ab <main+0x6b>
mov    %rsp,%rdi
call   1060 <checkForUnique@plt>
test   %rax,%rax
lea    0xe8c(%rip),%rax
lea    0xe75(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter the String\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [16 x i8] c"Contains UNIQUE\00"
@.str.3 = [19 x i8] c"contains Duplicate\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [300 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%7 = call i64 @strlen(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %7)
%9 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%10 = call i64 @strlen(i8* %9)
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %0
%13 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%14 = call i64 @checkForUnique(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter the String\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [16 x i8] c"Contains UNIQUE\00"
@.str.3 = [19 x i8] c"contains Duplicate\00"
define i32 @main() {
%1 = alloca [300 x i8]
%2 = getelementptr inbounds [300 x i8], [300 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @strlen(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %5)
%7 = call i64 @strlen(i8* %2)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = call i64 @checkForUnique(i8* %2)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %9, %0
ret i32 0
}