#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 */
typedef int /*<<< orphan*/ text;

/* Variables and functions */
int /*<<< orphan*/ checkAllUniqueChars(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int main_1(int argc, const char *argv[]) {
  char text[60];
  printf("\nthis program detects whether all caracters in a string are all "
         "unique.");
  printf("\nlet's start, write something:");
  if (fgets(text, sizeof(text), stdin) == NULL) {
    perror("No input specified.\n");
    exit(1);
  }
  if (!checkAllUniqueChars(text)) {
    printf("\nyou have repeated characters in your text\n");
  } else
    printf("\nthe caracteres in you text are all unique\n");
  return 0;
}


x86 assembly (clang, -O0):
<main_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e66(%rip),%rax
mov    (%rax),%edx
mov    $0x3c,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    11ae <main_1+0x5e>
lea    0xec8(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x50(%rbp),%rdi
call   1060 <checkAllUniqueChars@plt>
cmp    $0x0,%eax
jne    11d1 <main_1+0x81>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    11dd <main_1+0x8d>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_1>:
sub    $0x48,%rsp
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x3c,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11bf <main_1+0x5f>
mov    %rsp,%rdi
call   1070 <checkAllUniqueChars@plt>
test   %eax,%eax
lea    0xed4(%rip),%rax
lea    0xef8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret
lea    0xea1(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [72 x i8] c"\0Athis program detects whether all caracters in a string are all unique.\00"
@.str.1 = [31 x i8] c"\0Alet's start, write something:\00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"No input specified.\0A\00"
@.str.3 = [44 x i8] c"\0Ayou have repeated characters in your text\0A\00"
@.str.4 = [44 x i8] c"\0Athe caracteres in you text are all unique\0A\00"
define i32 @main_1(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [60 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [60 x i8], [60 x i8]* %5, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 60, i32 %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds [60 x i8], [60 x i8]* %5, i64 0, i64 0
%17 = call i32 @checkAllUniqueChars(i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %23
21: ; preds = %15
%22 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
ret i32 0
}

LLVM IR (-O2):
@.str = [72 x i8] c"\0Athis program detects whether all caracters in a string are all unique.\00"
@.str.1 = [31 x i8] c"\0Alet's start, write something:\00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"No input specified.\0A\00"
@str = [43 x i8] c"\0Ayou have repeated characters in your text\00"
@str.5 = [43 x i8] c"\0Athe caracteres in you text are all unique\00"
define i32 @main_1(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [60 x i8]
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %4, i32 60, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = call i32 @checkAllUniqueChars(i8* %4)
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @str.5, i64 0, i64 0)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}