int main(int argc, char **argv) {
  unsigned char out[2048], *password = "just for test";
  if (argc > 1) {
    rc4(out, argv[1], strlen(argv[1]), password, strlen(password));
    out[strlen(argv[1])] = 0;
    int i;
    for (i = 0; i < strlen(argv[1]); i++)
      printf("%c", out[i]);
  } else {
    assert(0 == test("just for testXXXXXXXXXXX",
                     sizeof("just for testXXXXXXXXXXX") - 1, password,
                     "d3c39861ec64855bce92f121713c8ce706f233cdb581b029"));
    assert(
        0 ==
        test("just for "
             "testXXXXXXXXXXXsdajdhajskadhsjkaduiiiii3444444444hj99230030jdfkdl"
             "s nm,mv cxvxc  "
             "fsjdljiohiohhfiohweihfphopiwehfifhheihefeiohfewihfeewJJJJJJJJJJJa"
             "aaaaaaaaaaaSDDOWERUFDDSSSSSSSSSSSSSSFFFFFFFFFFFFFFFFFFFFFFFFFEEEE"
             "RTYYYYYYYYYYYRddddddddddUiopooooooooooooSSSSSSYttttt3454567377755"
             "47754775454754754754745754754754",
             sizeof("just for "
                    "testXXXXXXXXXXXsdajdhajskadhsjkaduiiiii3444444444hj9923003"
                    "0jdfkdls nm,mv cxvxc  "
                    "fsjdljiohiohhfiohweihfphopiwehfifhheihefeiohfewihfeewJJJJJ"
                    "JJJJJJaaaaaaaaaaaaSDDOWERUFDDSSSSSSSSSSSSSSFFFFFFFFFFFFFFF"
                    "FFFFFFFFFFEEEERTYYYYYYYYYYYRddddddddddUiopooooooooooooSSSS"
                    "SSYttttt345456737775547754775454754754754745754754754") -
                 1,
             password,
             "d3c39861ec64855bce92f121713c8ce706f233cdb581b0293e83b3405fa56ac5c"
             "26123486a244d2e0d8e4a0a0fa2e6312fa20f847cd6a5e56985d42c179652e9c6"
             "a5fc89395810c9d1a8c2d56c597f576fa2f33fb00abba1a8f101f8299469b2f52"
             "9b65f087863a238fbcd6b7a767c2b4b5c86632b2a7e9c0e9fea25f55802f65696"
             "207fae309221b81b4379055539607b790b9dd1dcefeec2cfec5720e9a3afbbfff"
             "8137c0d3070ade5703569483bfd088dbdab9b8de769c786307fd9690f51e1e42f"
             "9a4324f0b9aff83f22b229db28847c95622afb2544df4eb097b596d7142873b04"
             "d05afd9ffb0006cf12a6d55746b7bf212c248a20aa7325fcae658e3ba364dec9d"
             "7b6b38c551ade4a64b07032659ce25d0b4faebc2831ad337ca01323a2c436632e"
             "c74e35c3d0d2fc8799da9272ed64a162aa4dd467da84885"));
  }
  ciphersaber_1_test();
  ciphersaber_2_test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe70(%rip),%rax
mov    %rax,-0x818(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1295 <main+0x125>
lea    -0x810(%rbp),%rax
mov    %rax,-0x840(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x838(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x830(%rbp)
mov    -0x818(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x818(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x840(%rbp),%rdi
mov    -0x838(%rbp),%rsi
mov    -0x830(%rbp),%rdx
mov    -0x828(%rbp),%rcx
mov    %rax,%r8
mov    $0x0,%al
call   1060 <rc4@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
movb   $0x0,-0x810(%rbp,%rax,1)
movl   $0x0,-0x81c(%rbp)
movslq -0x81c(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x848(%rbp),%rax
cmp    %rcx,%rax
jae    1290 <main+0x120>
movslq -0x81c(%rbp),%rax
movzbl -0x810(%rbp,%rax,1),%esi
ff
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x81c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x81c(%rbp)
jmp    1231 <main+0xc1>
jmp    1301 <main+0x191>
mov    -0x818(%rbp),%rdx
lea    0xd6e(%rip),%rdi
mov    $0x18,%esi
lea    0xd7b(%rip),%rcx
mov    $0x0,%al
call   1090 <test@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1070 <assert@plt>
mov    -0x818(%rbp),%rdx
lea    0xd82(%rip),%rdi
mov    $0x13c,%esi
lea    0xeb3(%rip),%rcx
mov    $0x0,%al
call   1090 <test@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1070 <assert@plt>
mov    $0x0,%al
call   1050 <ciphersaber_1_test@plt>
mov    $0x0,%al
call   1080 <ciphersaber_2_test@plt>
xor    %eax,%eax
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
cmp    $0x2,%edi
jl     11ed <main+0x7d>
mov    %rsi,%r15
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xe69(%rip),%rcx
mov    %rsp,%rdi
mov    $0xd,%r8d
mov    %r14,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <rc4@plt>
mov    0x8(%r15),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
movb   $0x0,(%rsp,%rax,1)
cmpb   $0x0,(%r14)
je     124c <main+0xdc>
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
mov    0x8(%r15),%rdi
call   1040 <strlen@plt>
cmp    %rbx,%rax
ja     11d0 <main+0x60>
jmp    124c <main+0xdc>
lea    0xe1a(%rip),%rdi
lea    0xe05(%rip),%rbx
lea    0xe25(%rip),%rcx
mov    $0x18,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <test@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1070 <assert@plt>
lea    0xe31(%rip),%rdi
lea    0xf67(%rip),%rcx
mov    $0x13c,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <test@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
xor    %eax,%eax
call   1070 <assert@plt>
xor    %eax,%eax
call   1050 <ciphersaber_1_test@plt>
xor    %eax,%eax
call   1080 <ciphersaber_2_test@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"just for test\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [25 x i8] c"just for testXXXXXXXXXXX\00"
@.str.3 = [49 x i8] c"d3c39861ec64855bce92f121713c8ce706f233cdb581b029\00"
@.str.4 = [317 x i8] c"just for testXXXXXXXXXXXsdajdhajskadhsjkaduiiiii3444444444hj99230030jdfkdls nm,mv cxvxc fsjdljiohiohhfiohweihfphopiwehfifhheihefeiohfewihfeewJJJJJJJJJJJaaaaaaaaaaaaSDDOWERUFDDSSSSSSSSSSSSSSFFFFFFFFFFFFFFFFFFFFFFFFFEEEERTYYYYYYYYYYYRddddddddddUiopooooooooooooSSSSSSYttttt345456737775547754775454754754754745754754754\00"
@.str.5 = [633 x i8] c"d3c39861ec64855bce92f121713c8ce706f233cdb581b0293e83b3405fa56ac5c26123486a244d2e0d8e4a0a0fa2e6312fa20f847cd6a5e56985d42c179652e9c6a5fc89395810c9d1a8c2d56c597f576fa2f33fb00abba1a8f101f8299469b2f529b65f087863a238fbcd6b7a767c2b4b5c86632b2a7e9c0e9fea25f55802f65696207fae309221b81b4379055539607b790b9dd1dcefeec2cfec5720e9a3afbbfff8137c0d3070ade5703569483bfd088dbdab9b8de769c786307fd9690f51e1e42f9a4324f0b9aff83f22b229db28847c95622afb2544df4eb097b596d7142873b04d05afd9ffb0006cf12a6d55746b7bf212c248a20aa7325fcae658e3ba364dec9d7b6b38c551ade4a64b07032659ce25d0b4faebc2831ad337ca01323a2c436632ec74e35c3d0d2fc8799da9272ed64a162aa4dd467da84885\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %7
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %48
11: ; preds = %2
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i64 @strlen(i8* %18)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %7
%22 = call i64 @strlen(i8* %21)
%23 = call i32 (i8*, i8*, i64, i8*, i64, ...) bitcast (i32 (...)* @rc4 to i32 (i8*, i8*, i64, i8*, i64, ...)*)(i8* %12, i8* %15, i64 %19, i8* %20, i64 %22)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strlen(i8* %26)
%28 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 %27
store i8 0, i8* %28
store i32 0, i32* %8
br label %29
29: ; preds = %44, %11
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i64 @strlen(i8* %34)
%36 = icmp ult i64 %31, %35
br i1 %36, label %37, label %47
37: ; preds = %29
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %37
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %29
47: ; preds = %29
br label %59
48: ; preds = %2
%49 = load i8*, i8** %7
%50 = call i32 (i8*, i64, i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i64, i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 24, i8* %49, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i32 0, %50
%52 = zext i1 %51 to i32
%53 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %52)
%54 = load i8*, i8** %7
%55 = call i32 (i8*, i64, i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i64, i8*, i8*, ...)*)(i8* getelementptr inbounds ([317 x i8], [317 x i8]* @.str.4, i64 0, i64 0), i64 316, i8* %54, i8* getelementptr inbounds ([633 x i8], [633 x i8]* @.str.5, i64 0, i64 0))
%56 = icmp eq i32 0, %55
%57 = zext i1 %56 to i32
%58 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %57)
br label %59
59: ; preds = %48, %47
%60 = call i32 (...) @ciphersaber_1_test()
%61 = call i32 (...) @ciphersaber_2_test()
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"just for test\00"
@.str.2 = [25 x i8] c"just for testXXXXXXXXXXX\00"
@.str.3 = [49 x i8] c"d3c39861ec64855bce92f121713c8ce706f233cdb581b029\00"
@.str.4 = [317 x i8] c"just for testXXXXXXXXXXXsdajdhajskadhsjkaduiiiii3444444444hj99230030jdfkdls nm,mv cxvxc fsjdljiohiohhfiohweihfphopiwehfifhheihefeiohfewihfeewJJJJJJJJJJJaaaaaaaaaaaaSDDOWERUFDDSSSSSSSSSSSSSSFFFFFFFFFFFFFFFFFFFFFFFFFEEEERTYYYYYYYYYYYRddddddddddUiopooooooooooooSSSSSSYttttt345456737775547754775454754754754745754754754\00"
@.str.5 = [633 x i8] c"d3c39861ec64855bce92f121713c8ce706f233cdb581b0293e83b3405fa56ac5c26123486a244d2e0d8e4a0a0fa2e6312fa20f847cd6a5e56985d42c179652e9c6a5fc89395810c9d1a8c2d56c597f576fa2f33fb00abba1a8f101f8299469b2f529b65f087863a238fbcd6b7a767c2b4b5c86632b2a7e9c0e9fea25f55802f65696207fae309221b81b4379055539607b790b9dd1dcefeec2cfec5720e9a3afbbfff8137c0d3070ade5703569483bfd088dbdab9b8de769c786307fd9690f51e1e42f9a4324f0b9aff83f22b229db28847c95622afb2544df4eb097b596d7142873b04d05afd9ffb0006cf12a6d55746b7bf212c248a20aa7325fcae658e3ba364dec9d7b6b38c551ade4a64b07032659ce25d0b4faebc2831ad337ca01323a2c436632ec74e35c3d0d2fc8799da9272ed64a162aa4dd467da84885\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%10 = call i32 (i8*, i8*, i64, i8*, i64, ...) bitcast (i32 (...)* @rc4 to i32 (i8*, i8*, i64, i8*, i64, ...)*)(i8* %4, i8* %8, i64 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 13)
%11 = load i8*, i8** %7
%12 = call i64 @strlen(i8* dereferenceable(1) %11)
%13 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 %12
store i8 0, i8* %13
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %35, label %16
16: ; preds = %6, %16
%17 = phi i64 [ %22, %16 ], [ 0, %6 ]
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = call i32 @putchar(i32 %20)
%22 = add nuw i64 %17, 1
%23 = load i8*, i8** %7
%24 = call i64 @strlen(i8* dereferenceable(1) %23)
%25 = icmp ugt i64 %24, %22
br i1 %25, label %16, label %35
26: ; preds = %2
%27 = tail call i32 (i8*, i64, i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i64, i8*, i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %29)
%31 = tail call i32 (i8*, i64, i8*, i8*, ...) bitcast (i32 (...)* @test to i32 (i8*, i64, i8*, i8*, ...)*)(i8* getelementptr inbounds ([317 x i8], [317 x i8]* @.str.4, i64 0, i64 0), i64 316, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([633 x i8], [633 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
%33 = zext i1 %32 to i32
%34 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %33)
br label %35
35: ; preds = %16, %6, %26
%36 = call i32 (...) @ciphersaber_1_test()
%37 = call i32 (...) @ciphersaber_2_test()
ret i32 0
}