#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int main() {
  char sent[4096];
  int i = 8;
  while (i > 0) {
    fgets(sent, 100, stdin);
    if (sent[strlen(sent) - 1] == '\n')
      sent[strlen(sent) - 1] = '\0';
    if (!strcmp(sent, "stop")) {
      break;
    } else
      printf("%s\n", sent);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x1014(%rbp)
cmpl   $0x0,-0x1014(%rbp)
jle    11f7 <main+0xb7>
lea    -0x1010(%rbp),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
lea    -0x1010(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x1010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    11be <main+0x7e>
lea    -0x1010(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x1010(%rbp,%rax,1)
lea    -0x1010(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11df <main+0x9f>
jmp    11f7 <main+0xb7>
lea    -0x1010(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
jmp    115c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    0x2ea4(%rip),%r15
mov    %rsp,%rbx
mov    $0x706f7473,%ebp
lea    0xeb2(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1190 <main+0x60>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    (%rsp),%eax
xor    %ebp,%eax
movzbl 0x4(%rsp),%ecx
or     %eax,%ecx
je     11ab <main+0x7b>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"stop\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %3
br label %4
4: ; preds = %33, %0
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %34
7: ; preds = %4
%8 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 100, i32 %9)
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %25
19: ; preds = %7
%20 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
br label %25
25: ; preds = %19, %7
%26 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %25
br label %34
30: ; preds = %25
%31 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30
br label %4
34: ; preds = %29, %4
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"stop\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %20, %0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 100, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 10
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = call i32 @strlen(i8* %2)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %12, %3
%18 = call i32 @bcmp(i8* dereferenceable(5) %2, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5)
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %3
22: ; preds = %17
ret i32 0
}