#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 strlen(char *);
char *strtok(char *, char *);
int main(int argc, char **argv) {
  char line[1048576];
  while (fgets(line, 1048576 - 1, stdin) != NULL) {
    int i;
    for (i = strlen(line); i >= 0; i--) {
      if (line[i] == '\n' || line[i] == '\r') {
        line[i] = '\0';
      }
    }
    char *token = strtok(line, " \t");
    while (token != NULL) {
      printf("%s\t1\n", token);
      token = strtok(NULL, " \t");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x100010(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
mov    $0xfffff,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1250 <main+0x110>
lea    -0x100010(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x100014(%rbp)
cmpl   $0x0,-0x100014(%rbp)
jl     11f4 <main+0xb4>
movslq -0x100014(%rbp),%rax
movsbl -0x100010(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     11cc <main+0x8c>
movslq -0x100014(%rbp),%rax
movsbl -0x100010(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
jne    11db <main+0x9b>
movslq -0x100014(%rbp),%rax
movb   $0x0,-0x100010(%rbp,%rax,1)
jmp    11e0 <main+0xa0>
mov    -0x100014(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x100014(%rbp)
jmp    118f <main+0x4f>
lea    -0x100010(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x100020(%rbp)
cmpq   $0x0,-0x100020(%rbp)
je     124b <main+0x10b>
mov    -0x100020(%rbp),%rsi
lea    0xdd9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdc6(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x100020(%rbp)
jmp    120e <main+0xce>
jmp    1159 <main+0x19>
xor    %eax,%eax
add    $0x100020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100000,%rsp
mov    0x2e91(%rip),%r12
mov    (%r12),%edx
mov    %rsp,%rdi
mov    $0xfffff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1274 <main+0x134>
mov    %rsp,%r14
lea    0xe85(%rip),%r13
lea    0xe81(%rip),%r15
jmp    11aa <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12),%edx
mov    %r14,%rdi
mov    $0xfffff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1274 <main+0x134>
mov    %r14,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     11c6 <main+0x86>
mov    %eax,%ecx
lea    0x1(%rax),%edx
and    $0x3,%rdx
jne    11fe <main+0xbe>
cmp    $0x3,%eax
jae    1210 <main+0xd0>
mov    %r14,%rdi
nopl   0x0(%rax)
mov    %r13,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     1190 <main+0x50>
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
jmp    11d0 <main+0x90>
nopl   0x0(%rax)
movb   $0x0,(%rsp,%rcx,1)
add    $0xffffffffffffffff,%rcx
add    $0xffffffffffffffff,%rdx
je     11c1 <main+0x81>
movzbl (%rsp,%rcx,1),%ebx
cmp    $0xd,%bl
je     11f0 <main+0xb0>
cmp    $0xa,%bl
je     11f0 <main+0xb0>
jmp    11f4 <main+0xb4>
xchg   %ax,%ax
add    $0x4,%rcx
jmp    122f <main+0xef>
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,-0x7(%rsp,%rcx,1)
add    $0xfffffffffffffffc,%rcx
cmp    $0x3,%rcx
jle    11c6 <main+0x86>
movzbl -0x4(%rsp,%rcx,1),%eax
cmp    $0xd,%al
je     123c <main+0xfc>
cmp    $0xa,%al
jne    1241 <main+0x101>
movb   $0x0,-0x4(%rsp,%rcx,1)
movzbl -0x5(%rsp,%rcx,1),%eax
cmp    $0xd,%al
je     124e <main+0x10e>
cmp    $0xa,%al
jne    1253 <main+0x113>
movb   $0x0,-0x5(%rsp,%rcx,1)
movzbl -0x6(%rsp,%rcx,1),%eax
cmp    $0xd,%al
je     1260 <main+0x120>
cmp    $0xa,%al
jne    1265 <main+0x125>
movb   $0x0,-0x6(%rsp,%rcx,1)
movzbl -0x7(%rsp,%rcx,1),%eax
cmp    $0xd,%al
je     1220 <main+0xe0>
cmp    $0xa,%al
je     1220 <main+0xe0>
jmp    1225 <main+0xe5>
xor    %eax,%eax
add    $0x100000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c" \09\00"
@.str.1 = [6 x i8] c"%s\091\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1048576 x i8]
%4 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %4, i32 1048575, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %64, label %12
8: ; preds = %59, %56
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %4, i32 1048575, i32 %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %64, label %12
12: ; preds = %2, %8
%13 = call i32 @strlen(i8* %4)
%14 = icmp sgt i32 %13, -1
br i1 %14, label %15, label %56
15: ; preds = %12
%16 = zext i32 %13 to i64
%17 = add nuw nsw i64 %16, 1
%18 = and i64 %17, 3
%19 = icmp eq i64 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %15, %26
%21 = phi i64 [ %27, %26 ], [ %16, %15 ]
%22 = phi i64 [ %28, %26 ], [ 0, %15 ]
%23 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 %21
%24 = load i8, i8* %23
switch i8 %24, label %26 [
i8 10, label %25
i8 13, label %25
]
25: ; preds = %20, %20
store i8 0, i8* %23
br label %26
26: ; preds = %25, %20
%27 = add nsw i64 %21, -1
%28 = add i64 %22, 1
%29 = icmp eq i64 %28, %18
br i1 %29, label %30, label %20
30: ; preds = %26, %15
%31 = phi i64 [ %16, %15 ], [ %27, %26 ]
%32 = icmp ult i32 %13, 3
br i1 %32, label %56, label %33
33: ; preds = %30, %53
%34 = phi i64 [ %54, %53 ], [ %31, %30 ]
%35 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 %34
%36 = load i8, i8* %35
switch i8 %36, label %38 [
i8 10, label %37
i8 13, label %37
]
37: ; preds = %33, %33
store i8 0, i8* %35
br label %38
38: ; preds = %33, %37
%39 = add nsw i64 %34, -1
%40 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 %39
%41 = load i8, i8* %40
switch i8 %41, label %43 [
i8 10, label %42
i8 13, label %42
]
42: ; preds = %38, %38
store i8 0, i8* %40
br label %43
43: ; preds = %42, %38
%44 = add nsw i64 %34, -2
%45 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 %44
%46 = load i8, i8* %45
switch i8 %46, label %48 [
i8 10, label %47
i8 13, label %47
]
47: ; preds = %43, %43
store i8 0, i8* %45
br label %48
48: ; preds = %47, %43
%49 = add nsw i64 %34, -3
%50 = getelementptr inbounds [1048576 x i8], [1048576 x i8]* %3, i64 0, i64 %49
%51 = load i8, i8* %50
switch i8 %51, label %53 [
i8 10, label %52
i8 13, label %52
]
52: ; preds = %48, %48
store i8 0, i8* %50
br label %53
53: ; preds = %52, %48
%54 = add nsw i64 %34, -4
%55 = icmp sgt i64 %34, 3
br i1 %55, label %33, label %56
56: ; preds = %30, %53, %12
%57 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%58 = icmp eq i8* %57, null
br i1 %58, label %8, label %59
59: ; preds = %56, %59
%60 = phi i8* [ %62, %59 ], [ %57, %56 ]
%61 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %60)
%62 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%63 = icmp eq i8* %62, null
br i1 %63, label %8, label %59
64: ; preds = %8, %2
ret i32 0
}