#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 */
double clock();
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char a[10240], b[3 * 10240];
  int i, j;
  freopen("input.txt", "r", stdin);
  double start, end;
  start = clock();
  while (fgets(a, 10240, stdin) != NULL) {
    printf("%s\n", a);
    for (i = j = 0; a[i]; i++) {
      if (a[i] == ' ') {
        b[j++] = '%';
        b[j++] = '2';
        b[j++] = '0';
      } else {
        b[j++] = a[i];
      }
    }
    b[j] = '\0';
    printf("%s\n", b);
  }
  end = clock();
  printf("%.3lf MS\n", (end - start) / 1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
lea    0xe9f(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1050 <freopen@plt>
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0xa020(%rbp)
ff
lea    -0x2810(%rbp),%rdi
mov    0x2e56(%rip),%rax
mov    (%rax),%edx
mov    $0x2800,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     12be <main+0x17e>
lea    -0x2810(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xa018(%rbp)
movl   $0x0,-0xa014(%rbp)
movslq -0xa014(%rbp),%rax
cmpb   $0x0,-0x2810(%rbp,%rax,1)
je     1295 <main+0x155>
movslq -0xa014(%rbp),%rax
movsbl -0x2810(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    1254 <main+0x114>
mov    -0xa018(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xa018(%rbp)
cltq
movb   $0x25,-0xa010(%rbp,%rax,1)
25
mov    -0xa018(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xa018(%rbp)
cltq
movb   $0x32,-0xa010(%rbp,%rax,1)
32
mov    -0xa018(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xa018(%rbp)
cltq
movb   $0x30,-0xa010(%rbp,%rax,1)
30
jmp    127c <main+0x13c>
movslq -0xa014(%rbp),%rax
mov    -0x2810(%rbp,%rax,1),%cl
mov    -0xa018(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xa018(%rbp)
cltq
mov    %cl,-0xa010(%rbp,%rax,1)
jmp    1281 <main+0x141>
mov    -0xa014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa014(%rbp)
jmp    11d1 <main+0x91>
movslq -0xa018(%rbp),%rax
movb   $0x0,-0xa010(%rbp,%rax,1)
lea    -0xa010(%rbp),%rsi
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1184 <main+0x44>
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0xa028(%rbp)
ff
movsd  -0xa028(%rbp),%xmm0
ff
subsd  -0xa020(%rbp),%xmm0
ff
movsd  0xd1b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd28(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa010,%rsp
mov    0x2e85(%rip),%r15
mov    (%r15),%edx
lea    0xe9b(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1060 <freopen@plt>
xor    %eax,%eax
call   1040 <clock@plt>
movsd  %xmm0,0x8(%rsp)
mov    (%r15),%edx
lea    0x7810(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     120b <main+0xbb>
lea    0x10(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
mov    %rbx,%rcx
jmp    11db <main+0x8b>
nop
cltq
movw   $0x3225,0x10(%rsp,%rax,1)
add    $0x2,%eax
mov    $0x30,%dl
cltq
mov    %dl,0x10(%rsp,%rax,1)
add    $0x1,%eax
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x20,%dl
je     11c0 <main+0x70>
test   %dl,%dl
jne    11ce <main+0x7e>
cltq
movb   $0x0,0x10(%rsp,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1070 <fgets@plt>
test   %rax,%rax
jne    11b0 <main+0x60>
xor    %eax,%eax
call   1040 <clock@plt>
subsd  0x8(%rsp),%xmm0
divsd  0xde0(%rip),%xmm0
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa010,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [10 x i8] c"%.3lf MS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10240 x i8]
%7 = alloca [30720 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @stdin
%13 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call double (...) @clock()
store double %14, double* %10
br label %15
15: ; preds = %62, %2
%16 = getelementptr inbounds [10240 x i8], [10240 x i8]* %6, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i32* @fgets(i8* %16, i32 10240, i32 %17)
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %68
20: ; preds = %15
%21 = getelementptr inbounds [10240 x i8], [10240 x i8]* %6, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %21)
store i32 0, i32* %9
store i32 0, i32* %8
br label %23
23: ; preds = %59, %20
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10240 x i8], [10240 x i8]* %6, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %62
29: ; preds = %23
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10240 x i8], [10240 x i8]* %6, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 32
br i1 %35, label %36, label %49
36: ; preds = %29
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 %39
store i8 37, i8* %40
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 %43
store i8 50, i8* %44
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 %47
store i8 48, i8* %48
br label %58
49: ; preds = %29
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10240 x i8], [10240 x i8]* %6, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 %56
store i8 %53, i8* %57
br label %58
58: ; preds = %49, %36
br label %59
59: ; preds = %58
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %23
62: ; preds = %23
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 %64
store i8 0, i8* %65
%66 = getelementptr inbounds [30720 x i8], [30720 x i8]* %7, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %66)
br label %15
68: ; preds = %15
%69 = call double (...) @clock()
store double %69, double* %11
%70 = load double, double* %11
%71 = load double, double* %10
%72 = fsub double %70, %71
%73 = fdiv double %72, 1.000000e+03
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.3 = [10 x i8] c"%.3lf MS\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10240 x i8]
%4 = alloca [30720 x i8]
%5 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [30720 x i8], [30720 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call double (...) @clock()
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %5, i32 10240, i32 %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %41, label %13
13: ; preds = %2, %34
%14 = call i32 @puts(i8* %5)
br label %15
15: ; preds = %27, %13
%16 = phi i64 [ %33, %27 ], [ 0, %13 ]
%17 = phi i32 [ %32, %27 ], [ 0, %13 ]
%18 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 %16
%19 = load i8, i8* %18
switch i8 %19, label %27 [
i8 0, label %34
i8 32, label %20
]
20: ; preds = %15
%21 = add nsw i32 %17, 1
%22 = sext i32 %17 to i64
%23 = getelementptr inbounds [30720 x i8], [30720 x i8]* %4, i64 0, i64 %22
store i8 37, i8* %23
%24 = add nsw i32 %17, 2
%25 = sext i32 %21 to i64
%26 = getelementptr inbounds [30720 x i8], [30720 x i8]* %4, i64 0, i64 %25
store i8 50, i8* %26
br label %27
27: ; preds = %15, %20
%28 = phi i32 [ %24, %20 ], [ %17, %15 ]
%29 = phi i8 [ 48, %20 ], [ %19, %15 ]
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds [30720 x i8], [30720 x i8]* %4, i64 0, i64 %30
store i8 %29, i8* %31
%32 = add nsw i32 %28, 1
%33 = add nuw i64 %16, 1
br label %15
34: ; preds = %15
%35 = sext i32 %17 to i64
%36 = getelementptr inbounds [30720 x i8], [30720 x i8]* %4, i64 0, i64 %35
store i8 0, i8* %36
%37 = call i32 @puts(i8* %6)
%38 = load i32, i32* @stdin
%39 = call i32* @fgets(i8* %5, i32 10240, i32 %38)
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %13
41: ; preds = %34, %2
%42 = call double (...) @clock()
%43 = fsub double %42, %9
%44 = fdiv double %43, 1.000000e+03
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %44)
ret i32 0
}