#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 */
char *decode_string(unsigned int, int /*<<< orphan*/, int *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(void) {
  char str[] = "ro^soril4tena.Gfarl1ly";
  int mix[] = {0, 6, 0, 5, 4, 0,  8, 0, 0, 0, 8,
               2, 0, 1, 0, 0, 10, 3, 0, 0, 5, 0};
  unsigned int bitmask = 0x22E;
  printf("Encoded string = %s \n", str);
  printf("Deocded string = %s \n",
         decode_string(bitmask, strlen(str), mix, str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea2(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xe9c(%rip),%ax
mov    %ax,-0xc(%rbp)
mov    0xe94(%rip),%al
mov    %al,-0xa(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x58,%edx
call   1050 <memcpy@plt>
movl   $0x22e,-0x84(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x84(%rbp),%eax
mov    %eax,-0x88(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x88(%rbp),%edi
mov    %eax,%esi
lea    -0x80(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1060 <decode_string@plt>
mov    %rax,%rsi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x796c316c726166,%rax
mov    %rax,0xf(%rsp)
mov    0xf17(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xed7(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x20(%rsp),%rdx
mov    $0x22e,%edi
mov    %eax,%esi
mov    %rbx,%rcx
call   1050 <decode_string@plt>
lea    0xebf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [23 x i8] c"ro^soril4tena.Gfarl1ly\00"
@__const.main.mix = [22 x i32] [i32 0, i32 6, i32 0, i32 5, i32 4, i32 0, i32 8, i32 0, i32 0, i32 0, i32 8, i32 2, i32 0, i32 1, i32 0, i32 0, i32 10, i32 3, i32 0, i32 0, i32 5, i32 0]
@.str = [22 x i8] c"Encoded string = %s \0A\00"
@.str.1 = [22 x i8] c"Deocded string = %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [23 x i8]
%3 = alloca [22 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [23 x i8]* %2 to i8*
%6 = bitcast [22 x i32]* %3 to i8*
store i32 558, i32* %4
%7 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %4
%10 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 0
%13 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%14 = call i8* @decode_string(i32 %9, i32 %11, i32* %12, i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [23 x i8] c"ro^soril4tena.Gfarl1ly\00"
@__const.main.mix = [22 x i32] [i32 0, i32 6, i32 0, i32 5, i32 4, i32 0, i32 8, i32 0, i32 0, i32 0, i32 8, i32 2, i32 0, i32 1, i32 0, i32 0, i32 10, i32 3, i32 0, i32 0, i32 5, i32 0]
@.str = [22 x i8] c"Encoded string = %s \0A\00"
@.str.1 = [22 x i8] c"Deocded string = %s \0A\00"
define i32 @main() {
%1 = alloca [23 x i8]
%2 = alloca [22 x i32]
%3 = getelementptr inbounds [23 x i8], [23 x i8]* %1, i64 0, i64 0
%4 = bitcast [22 x i32]* %2 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @strlen(i8* %3)
%7 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 0
%8 = call i8* @decode_string(i32 558, i32 %6, i32* %7, i8* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}