#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 *decodeMatrix(char *, int);
int /*<<< orphan*/ encodeMatrix(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  srand(time(NULL));
  int key = (int)strtol(argv[2], NULL, 10);
  char encoded[256];
  strcpy(encoded, encodeMatrix(argv[1], key));
  puts(encoded);
  puts(decodeMatrix(encoded, key));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x14(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1040 <encodeMatrix@plt>
mov    -0x128(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
call   1050 <puts@plt>
lea    -0x120(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <decodeMatrix@plt>
mov    %rax,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    0x10(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %rax,%rbx
mov    0x8(%r14),%rdi
mov    %ebx,%esi
call   1040 <encodeMatrix@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <decodeMatrix@plt>
mov    %rax,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [256 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 2
%11 = load i8*, i8** %10
%12 = call i64 @strtol(i8* %11, i32* null, i32 10)
%13 = trunc i64 %12 to i32
store i32 %13, i32* %5
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* %5
%19 = call i32 @encodeMatrix(i8* %17, i32 %18)
%20 = call i32 @strcpy(i8* %14, i32 %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* %5
%25 = call i8* @decodeMatrix(i8* %23, i32 %24)
%26 = call i32 @puts(i8* %25)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i64 @strtol(i8* nocapture %7, i32* null, i32 10)
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @encodeMatrix(i8* %12, i32 %9)
%14 = call i32 @strcpy(i8* %10, i32 %13)
%15 = call i32 @puts(i8* %10)
%16 = call i8* @decodeMatrix(i8* %10, i32 %9)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}