#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*/ deblank(char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char string[100] = {0};
  int temp = 0;
  printf("Please make sure the string length below 100 !\n\n");
  while ((string[temp] = getchar()) != '\n' && temp < 100) {
    temp++;
  }
  string[temp] = '\0';
  deblank(string);
  printf("The string which was processed : %s", string);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x74(%rbp),%rcx
mov    %al,-0x70(%rbp,%rcx,1)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x75(%rbp)
je     11a1 <main+0x61>
cmpl   $0x64,-0x74(%rbp)
setl   %al
mov    %al,-0x75(%rbp)
mov    -0x75(%rbp),%al
test   $0x1,%al
jne    11b1 <main+0x71>
jmp    11bf <main+0x7f>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1177 <main+0x37>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rdi
call   1060 <deblank@plt>
lea    -0x70(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,(%rsp,%rbx,1)
lea    0x1(%rbx),%rcx
cmp    $0xa,%al
je     119b <main+0x5b>
cmp    $0x64,%rbx
mov    %rcx,%rbx
jb     1180 <main+0x40>
movb   $0x0,-0x1(%rsp,%rcx,1)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <deblank@plt>
lea    0xe4e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Please make sure the string length below 100 !\0A\0A\00"
@.str.1 = [36 x i8] c"The string which was processed : %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [100 x i8]* %2 to i8*
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %18, %0
%7 = call signext i8 (...) @getchar()
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %9
store i8 %7, i8* %10
%11 = sext i8 %7 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %6
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 100
br label %16
16: ; preds = %13, %6
%17 = phi i1 [ false, %6 ], [ %15, %13 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %6
21: ; preds = %16
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%26 = call i32 @deblank(i8* %25)
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = call signext i8 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"The string which was processed : %s\00"
@str = [48 x i8] c"Please make sure the string length below 100 !\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %11, %4 ], [ 0, %0 ]
%6 = tail call signext i8 (...) @getchar()
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %5
store i8 %6, i8* %7
%8 = icmp ne i8 %6, 10
%9 = icmp ult i64 %5, 100
%10 = select i1 %8, i1 %9, i1 false
%11 = add nuw nsw i64 %5, 1
br i1 %10, label %4, label %12
12: ; preds = %4
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %5
store i8 0, i8* %13
%14 = call i32 @deblank(i8* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%16 = call signext i8 (...) @getchar()
ret i32 0
}