#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*/ remove_dupc(char *);
int /*<<< orphan*/ remove_dupc2(char *);
int /*<<< orphan*/ scanf(char *, char *);
char *strdup(char *);
int main() {
  char str[100], *str2;
  printf(" This will remove the duplicate chars .. Enter a Word : ");
  scanf(" %s", str);
  str2 = strdup(str);
  remove_dupc(str);
  remove_dupc2(str2);
  printf("Given word without repeated chars (1) : %s \n", str);
  printf("Given word without repeated chars (2) : %s \n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebe(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1060 <remove_dupc@plt>
mov    -0x78(%rbp),%rdi
call   1040 <remove_dupc2@plt>
lea    -0x70(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1070 <strdup@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1060 <remove_dupc@plt>
mov    %rbx,%rdi
call   1040 <remove_dupc2@plt>
lea    0xea4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [57 x i8] c" This will remove the duplicate chars .. Enter a Word : \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [45 x i8] c"Given word without repeated chars (1) : %s \0A\00"
@.str.3 = [45 x i8] c"Given word without repeated chars (2) : %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i8* @strdup(i8* %7)
store i8* %8, i8** %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @remove_dupc(i8* %9)
%11 = load i8*, i8** %3
%12 = call i32 @remove_dupc2(i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c" This will remove the duplicate chars .. Enter a Word : \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [45 x i8] c"Given word without repeated chars (1) : %s \0A\00"
@.str.3 = [45 x i8] c"Given word without repeated chars (2) : %s \0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i8* @strdup(i8* %2)
%6 = call i32 @remove_dupc(i8* %2)
%7 = call i32 @remove_dupc2(i8* %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %2)
ret i32 0
}