#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*/ printf(char *, char *);
char *simpleSubCrack(char *, int);
int /*<<< orphan*/ simplesubEncipher(char *, char *, char *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  char ctext[] = "HPHYJTYOPGYJJMGVJTRMRMTZTRPJZHEPMJCITHEPJUPHYZJCITRJQVHPMPMJR"
                 "GZZJYCGEQHEWIJPPJZHEPMJRHCMJZTICMTSJP";
  char ptext[] = "qqqqqqqqqq                                                   "
                 "                                     ";
  char *key = simpleSubCrack(ctext, 2000);
  simplesubEncipher(key, ctext, ptext, strlen(ctext));
  printf("ptext: %s\n", ptext);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x63,%edx
call   1060 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x63,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    $0x7d0,%esi
call   1030 <simpleSubCrack@plt>
mov    %rax,-0xf8(%rbp)
mov    -0xf8(%rbp),%rax
mov    %rax,-0x110(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    -0xf0(%rbp),%rax
mov    %rax,-0x100(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x110(%rbp),%rdi
mov    -0x108(%rbp),%rsi
mov    -0x100(%rbp),%rdx
mov    %eax,%ecx
call   1070 <simplesubEncipher@plt>
lea    -0xf0(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xe81(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe62(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movl   $0x504a53,0xcf(%rsp)
movaps 0xf0b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeef(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7f(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x202020,0x5f(%rsp)
lea    0x70(%rsp),%r14
mov    %r14,%rdi
mov    $0x7d0,%esi
call   1030 <simpleSubCrack@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
call   1060 <simplesubEncipher@plt>
lea    0xe9f(%rip),%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.ctext = [99 x i8] c"HPHYJTYOPGYJJMGVJTRMRMTZTRPJZHEPMJCITHEPJUPHYZJCITRJQVHPMPMJRGZZJYCGEQHEWIJPPJZHEPMJRHCMJZTICMTSJP\00"
@__const.main.ptext = [99 x i8] c"qqqqqqqqqq \00"
@.str = [11 x i8] c"ptext: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [99 x i8]
%7 = alloca [99 x i8]
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [99 x i8]* %6 to i8*
%10 = bitcast [99 x i8]* %7 to i8*
%11 = getelementptr inbounds [99 x i8], [99 x i8]* %6, i64 0, i64 0
%12 = call i8* @simpleSubCrack(i8* %11, i32 2000)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = getelementptr inbounds [99 x i8], [99 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [99 x i8], [99 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [99 x i8], [99 x i8]* %6, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @simplesubEncipher(i8* %13, i8* %14, i8* %15, i32 %17)
%19 = getelementptr inbounds [99 x i8], [99 x i8]* %7, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ctext = [99 x i8] c"HPHYJTYOPGYJJMGVJTRMRMTZTRPJZHEPMJCITHEPJUPHYZJCITRJQVHPMPMJRGZZJYCGEQHEWIJPPJZHEPMJRHCMJZTICMTSJP\00"
@__const.main.ptext = [99 x i8] c"qqqqqqqqqq \00"
@.str = [11 x i8] c"ptext: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [99 x i8]
%4 = alloca [99 x i8]
%5 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [99 x i8], [99 x i8]* %4, i64 0, i64 0
%7 = call i8* @simpleSubCrack(i8* %5, i32 2000)
%8 = call i32 @strlen(i8* %5)
%9 = call i32 @simplesubEncipher(i8* %7, i8* %5, i8* %6, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}