#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*/ assert(int);
int /*<<< orphan*/ replaceDups(char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char str1[] = "This is a test string";
  char str1_expected[] = "This aterng";
  replaceDups(str1);
  assert(strcmp(str1, str1_expected) == 0);
  char str2[] = "  ";
  char str2_expected[] = " ";
  replaceDups(str2);
  assert(strcmp(str2, str2_expected) == 0);
  char str3[] = "aaaaabbbcccccccc";
  char str3_expected[] = "abc";
  replaceDups(str3);
  assert(strcmp(str3, str3_expected) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeaf(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <replaceDups@plt>
lea    -0x20(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe92(%rip),%ax
mov    %ax,-0x2f(%rbp)
mov    0xe8a(%rip),%al
mov    %al,-0x2d(%rbp)
mov    0xe7f(%rip),%ax
mov    %ax,-0x31(%rbp)
lea    -0x2f(%rbp),%rdi
call   1050 <replaceDups@plt>
lea    -0x2f(%rbp),%rdi
lea    -0x31(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0xe2f(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe2c(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe2a(%rip),%al
mov    %al,-0x40(%rbp)
mov    0xe31(%rip),%eax
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <replaceDups@plt>
lea    -0x50(%rbp),%rdi
lea    -0x54(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movabs $0x676e6972747320,%rax
mov    %rax,0x4e(%rsp)
movabs $0x6574612073696854,%rax
61 74 65
mov    %rax,0x10(%rsp)
movl   $0x676e72,0x18(%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <replaceDups@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
movb   $0x0,0xa(%rsp)
movw   $0x2020,0x8(%rsp)
movw   $0x20,0x6(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <replaceDups@plt>
lea    0x6(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
movaps 0xe4f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x30(%rsp)
movl   $0x636261,0xc(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <replaceDups@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str1 = [22 x i8] c"This is a test string\00"
@__const.main.str1_expected = [12 x i8] c"This aterng\00"
@__const.main.str2 = [3 x i8] c" \00"
@__const.main.str2_expected = [2 x i8] c" \00"
@__const.main.str3 = [17 x i8] c"aaaaabbbcccccccc\00"
@__const.main.str3_expected = [4 x i8] c"abc\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [22 x i8]
%3 = alloca [12 x i8]
%4 = alloca [3 x i8]
%5 = alloca [2 x i8]
%6 = alloca [17 x i8]
%7 = alloca [4 x i8]
store i32 0, i32* %1
%8 = bitcast [22 x i8]* %2 to i8*
%9 = bitcast [12 x i8]* %3 to i8*
%10 = getelementptr inbounds [22 x i8], [22 x i8]* %2, i64 0, i64 0
%11 = call i32 @replaceDups(i8* %10)
%12 = getelementptr inbounds [22 x i8], [22 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = bitcast [3 x i8]* %4 to i8*
%19 = bitcast [2 x i8]* %5 to i8*
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%21 = call i32 @replaceDups(i8* %20)
%22 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = bitcast [17 x i8]* %6 to i8*
%29 = bitcast [4 x i8]* %7 to i8*
%30 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%31 = call i32 @replaceDups(i8* %30)
%32 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%34 = call i64 @strcmp(i8* %32, i8* %33)
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [22 x i8] c"This is a test string\00"
@__const.main.str1_expected = [12 x i8] c"This aterng\00"
@__const.main.str2 = [3 x i8] c" \00"
@__const.main.str3 = [17 x i8] c"aaaaabbbcccccccc\00"
define i32 @main() {
%1 = alloca [22 x i8]
%2 = alloca [12 x i8]
%3 = alloca [3 x i8]
%4 = alloca i16
%5 = alloca [17 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%9 = call i32 @replaceDups(i8* %7)
%10 = call i64 @strcmp(i8* %7, i8* %8)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%15 = bitcast i16* %4 to i8*
store i16 32, i16* %4
%16 = call i32 @replaceDups(i8* %14)
%17 = call i64 @strcmp(i8* %14, i8* %15)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 0
%22 = bitcast i32* %6 to i8*
store i32 6513249, i32* %6
%23 = call i32 @replaceDups(i8* %21)
%24 = call i64 @strcmp(i8* %21, i8* %22)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
ret i32 0
}