#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char s1[5];
  char s2[5];
  fgets(s1, 5, stdin);
  if (s1[strlen(s1) - 1] == '\n') {
    s1[strlen(s1) - 1] = '\0';
  }
  fflush(stdin);
  fgets(s2, 5, stdin);
  if (s2[strlen(s2) - 1] == '\n') {
    s2[strlen(s2) - 1] = '\0';
  }
  printf("\n%s %s\n", s1, s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x9(%rbp),%rdi
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1050 <fgets@plt>
lea    -0x9(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x9(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    1195 <main+0x55>
lea    -0x9(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x9(%rbp,%rax,1)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    -0xe(%rbp),%rdi
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1050 <fgets@plt>
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11e9 <main+0xa9>
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0xe(%rbp,%rax,1)
lea    -0x9(%rbp),%rsi
lea    -0xe(%rbp),%rdx
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e9a(%rip),%r14
mov    (%r14),%edx
lea    0x13(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1183 <main+0x43>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    (%r14),%edx
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    11c0 <main+0x80>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe39(%rip),%rdi
lea    0x13(%rsp),%rsi
lea    0xe(%rsp),%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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