#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
int main() {
  char a[20], r[20];
  int l, i, j;
  gets(a);
  l = strlen(a);
  for (i = 0, j = 0; j < l - 1; i++) {
    if (a[i] != ' ')
      r[j] = a[i];
    else {
      r[j] = '%';
      r[j + 1] = '2';
      r[j + 2] = '0';
      j += 2;
    }
    j++;
  }
  printf("%s\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11dd <main+0xad>
movslq -0x48(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x20,%eax
je     119a <main+0x6a>
movslq -0x48(%rbp),%rax
mov    -0x20(%rbp,%rax,1),%cl
movslq -0x4c(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
jmp    11c6 <main+0x96>
movslq -0x4c(%rbp),%rax
movb   $0x25,-0x40(%rbp,%rax,1)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x32,-0x40(%rbp,%rax,1)
mov    -0x4c(%rbp),%eax
add    $0x2,%eax
cltq
movb   $0x30,-0x40(%rbp,%rax,1)
mov    -0x4c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1162 <main+0x32>
lea    -0x40(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     118b <main+0x5b>
add    $0xffffffff,%eax
xor    %edx,%edx
mov    %rsp,%rdi
jmp    117b <main+0x4b>
nopl   0x0(%rax)
movb   $0x25,(%rsp,%rsi,1)
movw   $0x3032,0x1(%rsi,%rdi,1)
add    $0x2,%esi
mov    %esi,%edx
add    $0x1,%edx
add    $0x1,%rbx
cmp    %eax,%edx
jge    118b <main+0x5b>
movzbl (%rbx),%ecx
movslq %edx,%rsi
cmp    $0x20,%cl
je     1160 <main+0x30>
mov    %cl,(%rsp,%rsi,1)
jmp    1170 <main+0x40>
lea    0xe6e(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

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