#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*/ encode_space(char *, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  char s[50];
  int i;
  for (i = 0; i < 17; i++) {
    if (i == 16)
      s[i] = '\0';
    else if (i % 5 == 0)
      s[i] = ' ';
    else
      s[i] = 'a' + i;
  }
  printf("%s\n", s);
  encode_space(s, 15);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x11,-0x44(%rbp)
jge    11a2 <main+0x82>
cmpl   $0x10,-0x44(%rbp)
jne    1158 <main+0x38>
movslq -0x44(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
jmp    118f <main+0x6f>
mov    -0x44(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117a <main+0x5a>
movslq -0x44(%rbp),%rax
movb   $0x20,-0x40(%rbp,%rax,1)
jmp    118a <main+0x6a>
mov    -0x44(%rbp),%eax
add    $0x61,%eax
mov    %al,%cl
movslq -0x44(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
jmp    118f <main+0x6f>
jmp    1194 <main+0x74>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1136 <main+0x16>
lea    -0x40(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xf,%esi
call   1040 <encode_space@plt>
lea    -0x40(%rbp),%rsi
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xed2(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1040 <encode_space@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = bitcast [50 x i8]* %1 to <16 x i8>*
store <16 x i8> <i8 32, i8 98, i8 99, i8 100, i8 101, i8 32, i8 103, i8 104, i8 105, i8 106, i8 32, i8 108, i8 109, i8 110, i8 111, i8 32>, <16 x i8>* %3
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 16
store i8 0, i8* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = call i32 @encode_space(i8* %2, i32 15)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}