#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 /*<<< orphan*/ scanf(char *, char *);
scalar_t__ unique_chars(char *);
scalar_t__ unique_chars2(char *);
int main() {
  char str[2000];
  printf("enter a word : ");
  scanf("%s", str);
  printf(" Entered Word :: %s \n", str);
  if (unique_chars(str))
    printf("Unique_chars :: The given string has all unique characters \n");
  else
    printf("Unique_chars :: The given string has duplicate characters \n");
  if (unique_chars2(str))
    printf("Unique_chars2 :: The given string has all unique characters \n");
  else
    printf("Unique_chars2 :: The given string has duplicate characters \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rdi
call   1050 <unique_chars@plt>
cmp    $0x0,%rax
je     11b1 <main+0x71>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <main+0x7f>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rdi
call   1060 <unique_chars2@plt>
cmp    $0x0,%rax
je     11e8 <main+0xa8>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <main+0xb6>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x7d0,%rsp
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe94(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <unique_chars@plt>
test   %rax,%rax
lea    0xe8e(%rip),%rax
lea    0xf3b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <unique_chars2@plt>
test   %rax,%rax
lea    0xea7(%rip),%rax
lea    0xedc(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x7d0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"enter a word : \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c" Entered Word :: %s \0A\00"
@.str.3 = [61 x i8] c"Unique_chars :: The given string has all unique characters \0A\00"
@.str.4 = [60 x i8] c"Unique_chars :: The given string has duplicate characters \0A\00"
@.str.5 = [62 x i8] c"Unique_chars2 :: The given string has all unique characters \0A\00"
@.str.6 = [61 x i8] c"Unique_chars2 :: The given string has duplicate characters \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2000 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%9 = call i64 @unique_chars(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0))
br label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
%16 = getelementptr inbounds [2000 x i8], [2000 x i8]* %2, i64 0, i64 0
%17 = call i64 @unique_chars2(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
br label %23
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"enter a word : \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c" Entered Word :: %s \0A\00"
@str = [59 x i8] c"Unique_chars :: The given string has duplicate characters \00"
@str.7 = [60 x i8] c"Unique_chars2 :: The given string has duplicate characters \00"
@str.8 = [61 x i8] c"Unique_chars2 :: The given string has all unique characters \00"
@str.9 = [60 x i8] c"Unique_chars :: The given string has all unique characters \00"
define i32 @main() {
%1 = alloca [2000 x i8]
%2 = getelementptr inbounds [2000 x i8], [2000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i64 @unique_chars(i8* %2)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @str.9, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
%10 = call i64 @unique_chars2(i8* %2)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([61 x i8], [61 x i8]* @str.8, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}