#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 */
scalar_t__ get_line(char *);
int /*<<< orphan*/ print_showing_whitespace(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove_trailing_whitespace(char *);
int main() {
  char line[1024];
  while (get_line(line) > 0) {
    printf("Original: ");
    print_showing_whitespace(line);
    remove_trailing_whitespace(line);
    printf("Trimmed: ");
    print_showing_whitespace(line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <get_line@plt>
cmp    $0x0,%rax
jle    11a9 <main+0x69>
lea    0xe91(%rip),%rdi
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <print_showing_whitespace@plt>
lea    -0x410(%rbp),%rdi
call   1050 <remove_trailing_whitespace@plt>
lea    0xe78(%rip),%rdi
call   1060 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <print_showing_whitespace@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jle    11a5 <main+0x65>
lea    0xea0(%rip),%r14
mov    %rsp,%rbx
lea    0xea1(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <print_showing_whitespace@plt>
mov    %rbx,%rdi
call   1050 <remove_trailing_whitespace@plt>
mov    %r15,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <print_showing_whitespace@plt>
mov    %rbx,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jg     1170 <main+0x30>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Original: \00"
@.str.1 = [10 x i8] c"Trimmed: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i64 @get_line(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%10 = call i32 @print_showing_whitespace(i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = call i32 @remove_trailing_whitespace(i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%15 = call i32 @print_showing_whitespace(i8* %14)
br label %3
16: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Original: \00"
@.str.1 = [10 x i8] c"Trimmed: \00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i64 @get_line(i8* %2)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0, %5
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @print_showing_whitespace(i8* %2)
%8 = call i32 @remove_trailing_whitespace(i8* %2)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @print_showing_whitespace(i8* %2)
%11 = call i64 @get_line(i8* %2)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %5, %0
ret i32 0
}