#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 getline(char **, size_t *, int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strip(char *, int);
int main(void) {
  char *buffer = malloc(50);
  char continuer = 1;
  int size = 0, msize = 100;
  while (continuer) {
    continuer = (size = getline(&buffer, (size_t *)&msize, stdin)) + 1;
    strip(buffer, size);
    puts(buffer);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x32,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movb   $0x1,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     11b2 <main+0x72>
lea    -0x1c(%rbp),%rsi
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
call   1060 <getline@plt>
mov    %eax,-0x18(%rbp)
add    $0x1,%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <strip@plt>
mov    -0x10(%rbp),%rdi
call   1030 <puts@plt>
jmp    116f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x32,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rsp)
movl   $0x64,0x14(%rsp)
mov    0x2e80(%rip),%r15
lea    0x8(%rsp),%r14
lea    0x14(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <getline@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%rdi
mov    %eax,%esi
call   1040 <strip@plt>
mov    0x8(%rsp),%rdi
call   1030 <puts@plt>
cmp    $0xff,%bpl
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i8* @malloc(i32 50)
store i8* %6, i8** %2
store i8 1, i8* %3
store i32 0, i32* %4
store i32 100, i32* %5
br label %7
7: ; preds = %10, %0
%8 = load i8, i8* %3
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = bitcast i32* %5 to i64*
%12 = load i32, i32* @stdin
%13 = call i32 @getline(i8** %2, i64* %11, i32 %12)
store i32 %13, i32* %4
%14 = add nsw i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
%16 = load i8*, i8** %2
%17 = load i32, i32* %4
%18 = call i32 @strip(i8* %16, i32 %17)
%19 = load i8*, i8** %2
%20 = call i32 @puts(i8* %19)
br label %7
21: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i8*
%4 = tail call dereferenceable_or_null(50) i8* @malloc(i32 50)
store i8* %4, i8** %1
%5 = bitcast i32* %2 to i8*
store i32 100, i32* %2
%6 = bitcast i32* %2 to i64*
br label %7
7: ; preds = %0, %7
%8 = load i32, i32* @stdin
%9 = call i32 @getline(i8** %1, i64* %6, i32 %8)
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %1
%12 = call i32 @strip(i8* %11, i32 %9)
%13 = load i8*, i8** %1
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = icmp eq i8 %10, -1
br i1 %15, label %16, label %7
16: ; preds = %7
ret i32 0
}