#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__ EOF;
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ scanf(char *, ...);
int main(int argc, const char *argv[]) {
  int n, i;
  char str[10000];
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    gets(str);
    printf("%s\n\n", str);
  }
  while (scanf("%s", str) != EOF) {
    printf("%s\n\n", str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119b <main+0x6b>
lea    -0x2730(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x2730(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <main+0x32>
jmp    11a0 <main+0x70>
lea    -0x2730(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e2c(%rip),%rcx
cmp    (%rcx),%rax
je     11dd <main+0xad>
lea    -0x2730(%rbp),%rsi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    11a0 <main+0x70>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x2728,%rsp
lea    0xebc(%rip),%rdi
xor    %ebp,%ebp
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    118c <main+0x5c>
lea    0x10(%rsp),%rbx
lea    0xe9f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1170 <main+0x40>
lea    0xe76(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e42(%rip),%rbp
cmp    0x0(%rbp),%rax
je     11de <main+0xae>
lea    0xe51(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe4a(%rip),%r15
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    0x0(%rbp),%rax
jne    11c0 <main+0x90>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %10
10: ; preds = %19, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%16 = call i32 @gets(i8* %15)
%17 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %10
22: ; preds = %10
br label %23
23: ; preds = %28, %22
%24 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%25 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i64, i64* @EOF
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %23
31: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [10000 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%7 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %14, %2
%11 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %26, label %21
14: ; preds = %2, %14
%15 = phi i32 [ %18, %14 ], [ 0, %2 ]
%16 = call i32 @gets(i8* %6)
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%18 = add nuw nsw i32 %15, 1
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %14, label %10
21: ; preds = %10, %21
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%23 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %21
26: ; preds = %21, %10
ret i32 0
}