#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(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
void main() {
  char str[] = "asbkkkkkkkk55vs";
  int len = strlen(str);
  char out[len];
  printf("%s\n", str);
  encode(str, out, len);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movaps 0xec1(%rip),%xmm0
movaps %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
call   1030 <encode@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movaps 0xeba(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %rsp,%r12
mov    %eax,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe9a(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <encode@plt>
mov    %r12,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.str = [16 x i8] c"asbkkkkkkkk55vs\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [16 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast [16 x i8]* %1 to i8*
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%15 = load i32, i32* %2
%16 = call i32 @encode(i8* %14, i8* %11, i32 %15)
%17 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@__const.main.str = [16 x i8] c"asbkkkkkkkk55vs\00"
@.str = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = zext i32 %3 to i64
%5 = call i8* @llvm.stacksave()
%6 = alloca i8, i64 %4
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = call i32 @encode(i8* %2, i8* %6, i32 %3)
ret void
}