int main() {
  char str1[50];
  char toRemove[50];
  printf("Input length : %d\n", getLine(str1));
  printf("Input length : %d\n", getLine(toRemove));
  printf("Before: %s\n", str1);
  printf("Length after squeeze : %d\n", squeeze(str1, toRemove));
  printf("After: %s\n", str1);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1050 <getLine@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x0,%al
call   1050 <getLine@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1030 <squeeze@plt>
mov    %eax,%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0x40(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <getLine@plt>
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <getLine@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <squeeze@plt>
lea    0xe83(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Input length : %d\0A\00"
@.str.1 = [12 x i8] c"Before: %s\0A\00"
@.str.2 = [27 x i8] c"Length after squeeze : %d\0A\00"
@.str.3 = [11 x i8] c"After: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @getLine to i32 (i8*, ...)*)(i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @getLine to i32 (i8*, ...)*)(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @squeeze to i32 (i8*, i8*, ...)*)(i8* %12, i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %16)
ret i32 1
}

LLVM IR (-O2):
@.str = [19 x i8] c"Input length : %d\0A\00"
@.str.1 = [12 x i8] c"Before: %s\0A\00"
@.str.2 = [27 x i8] c"Length after squeeze : %d\0A\00"
@.str.3 = [11 x i8] c"After: %s\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @getLine to i32 (i8*, ...)*)(i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @getLine to i32 (i8*, ...)*)(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%10 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @squeeze to i32 (i8*, i8*, ...)*)(i8* %3, i8* %4)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 1
}