#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 */
typedef int time_t;
typedef int /*<<< orphan*/ password;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int clock();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getchar();
void *malloc(size_t);
scalar_t__ memcmp(char *, char *, size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rc4_c(char *, void *, size_t, char *, int);
int /*<<< orphan*/ rc4_x86(void *, void *, size_t, char *, int);
char *string_repeat(int, char *);
int main(int argc, char *argv[]) {
  char password[] = "password";
  char data[] = "This is the data that needs to be encrypted";
  size_t datalen = sizeof(data);
  char *data_long;
  void *encryptedData = malloc(datalen);
  void *decryptedData = malloc(datalen);
  const int TRIALS = 10000;
  int i;
  time_t start;
  time_t t_c;
  time_t t_x86;
  printf("For short data (size %d)\n", datalen);
  start = clock();
  for (i = 0; i < TRIALS; i++)
    rc4_c(data, encryptedData, datalen, password, sizeof(password));
  t_c = clock() - start;
  printf("C code time consumed: %d ms.\n", t_c);
  start = clock();
  for (i = 0; i < TRIALS; i++)
    rc4_x86(encryptedData, decryptedData, datalen, password, sizeof(password));
  t_x86 = clock() - start;
  printf("Assembly code time consumed: %d ms.\n", t_x86);
  printf("The Assembly version is %.2fx faster than the c version.\n\n",
         (double)t_c / t_x86);
  if (memcmp(data, (char *)decryptedData, datalen) != 0)
    printf("Raw data does not match decrypted data! Data damaged!\n\n");
  data_long =
      string_repeat(1000, "This is the data that needs to be encrypted");
  datalen *= 1000;
  encryptedData = malloc(datalen);
  decryptedData = malloc(datalen);
  printf("For long data (size %d):\n", datalen);
  start = clock();
  for (i = 0; i < TRIALS; i++)
    rc4_c(data_long, encryptedData, datalen, password, sizeof(password));
  t_c = clock() - start;
  printf("C code time consumed: %d ms.\n", t_c);
  start = clock();
  for (i = 0; i < TRIALS; i++)
    rc4_x86(encryptedData, decryptedData, datalen, password, sizeof(password));
  t_x86 = clock() - start;
  printf("Assembly code time consumed: %d ms.\n", t_x86);
  printf("The Assembly version is %.2fx faster than the c version.\n\n",
         (double)t_c / t_x86);
  if (memcmp(data_long, (char *)decryptedData, datalen) != 0)
    printf("Raw data does not match decrypted data! Data damaged!\n\n");
  free(data_long);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe40(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xe3e(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xf48(%rip),%rsi
mov    $0x2c,%edx
call   1090 <memcpy@plt>
movq   $0x2c,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x70(%rbp)
movl   $0x2710,-0x74(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x2710,-0x78(%rbp)
jge    1264 <main+0xc4>
lea    -0x50(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x58(%rbp),%rdx
lea    -0x19(%rbp),%rcx
mov    $0x9,%r8d
call   10b0 <rc4_c@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    122e <main+0x8e>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%esi
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x2710,-0x78(%rbp)
jge    12c9 <main+0x129>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x58(%rbp),%rdx
lea    -0x19(%rbp),%rcx
mov    $0x9,%r8d
call   1060 <rc4_x86@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1293 <main+0xf3>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%esi
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cvtsi2sdl -0x80(%rbp),%xmm0
cvtsi2sdl -0x84(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
lea    0xd61(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     1335 <main+0x195>
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3e8,%edi
lea    0xd98(%rip),%rsi
call   10c0 <string_repeat@plt>
mov    %rax,-0x60(%rbp)
imul   $0x3e8,-0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x58(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x2710,-0x78(%rbp)
jge    13c9 <main+0x229>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x58(%rbp),%rdx
lea    -0x19(%rbp),%rcx
mov    $0x9,%r8d
call   10b0 <rc4_c@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1393 <main+0x1f3>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%esi
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
cmpl   $0x2710,-0x78(%rbp)
jge    142e <main+0x28e>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x58(%rbp),%rdx
lea    -0x19(%rbp),%rcx
mov    $0x9,%r8d
call   1060 <rc4_x86@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    13f8 <main+0x258>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x7c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%esi
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cvtsi2sdl -0x80(%rbp),%xmm0
cvtsi2sdl -0x84(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
lea    0xbfc(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     149a <main+0x2fa>
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movabs $0x64726f7773736170,%rax
6f 72 64
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
movups 0xf54(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xf3c(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xf20(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0x2c,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    $0x2c,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
lea    0xe03(%rip),%rdi
mov    $0x2c,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r15d
mov    $0x2710,%ebp
lea    0x10(%rsp),%r12
mov    %rsp,%r13
nopl   0x0(%rax)
mov    $0x2c,%edx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rcx
mov    $0x9,%r8d
call   10b0 <rc4_c@plt>
add    $0xffffffff,%ebp
jne    1230 <main+0x90>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r12d
sub    %r15d,%r12d
lea    0xdc1(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r15d
mov    $0x2710,%ebp
mov    %rsp,%r13
xchg   %ax,%ax
mov    $0x2c,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rcx
mov    $0x9,%r8d
call   1070 <rc4_x86@plt>
add    $0xffffffff,%ebp
jne    1280 <main+0xe0>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%ebx
sub    %r15d,%ebx
lea    0xd90(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
lea    0xd95(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0x10(%rsp),%rdi
mov    $0x2c,%edx
mov    %r14,%rsi
call   1080 <memcmp@plt>
test   %rax,%rax
je     12fb <main+0x15b>
lea    0xdc5(%rip),%rdi
call   1040 <puts@plt>
lea    0xdfe(%rip),%rsi
mov    $0x3e8,%edi
call   10c0 <string_repeat@plt>
mov    %rax,%r14
mov    $0xabe0,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    $0xabe0,%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
lea    0xd71(%rip),%rdi
mov    $0xabe0,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r12d
mov    $0x2710,%ebp
mov    %rsp,%r13
xchg   %ax,%ax
mov    $0xabe0,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rcx
mov    $0x9,%r8d
call   10b0 <rc4_c@plt>
add    $0xffffffff,%ebp
jne    1350 <main+0x1b0>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%r13d
sub    %r12d,%r13d
lea    0xca1(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,0xc(%rsp)
mov    $0x2710,%r12d
mov    %rsp,%rbp
mov    $0xabe0,%edx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rcx
mov    $0x9,%r8d
call   1070 <rc4_x86@plt>
add    $0xffffffff,%r12d
jne    13a0 <main+0x200>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %eax,%ebx
sub    0xc(%rsp),%ebx
lea    0xc6e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cvtsi2sd %r13d,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
lea    0xc76(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xabe0,%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <memcmp@plt>
test   %rax,%rax
je     1418 <main+0x278>
lea    0xca8(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.password = [9 x i8] c"password\00"
@__const.main.data = [44 x i8] c"This is the data that needs to be encrypted\00"
@.str = [26 x i8] c"For short data (size %d)\0A\00"
@.str.1 = [30 x i8] c"C code time consumed: %d ms.\0A\00"
@.str.2 = [37 x i8] c"Assembly code time consumed: %d ms.\0A\00"
@.str.3 = [59 x i8] c"The Assembly version is %.2fx faster than the c version.\0A\0A\00"
@.str.4 = [56 x i8] c"Raw data does not match decrypted data! Data damaged!\0A\0A\00"
@.str.5 = [44 x i8] c"This is the data that needs to be encrypted\00"
@.str.6 = [26 x i8] c"For long data (size %d):\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca [44 x i8]
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [9 x i8]* %6 to i8*
%18 = bitcast [44 x i8]* %7 to i8*
store i64 44, i64* %8
%19 = load i64, i64* %8
%20 = call i8* @malloc(i64 %19)
store i8* %20, i8** %10
%21 = load i64, i64* %8
%22 = call i8* @malloc(i64 %21)
store i8* %22, i8** %11
store i32 10000, i32* %12
%23 = load i64, i64* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %23)
%25 = call i32 (...) @clock()
store i32 %25, i32* %14
store i32 0, i32* %13
br label %26
26: ; preds = %35, %2
%27 = load i32, i32* %13
%28 = icmp slt i32 %27, 10000
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = getelementptr inbounds [44 x i8], [44 x i8]* %7, i64 0, i64 0
%31 = load i8*, i8** %10
%32 = load i64, i64* %8
%33 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%34 = call i32 @rc4_c(i8* %30, i8* %31, i64 %32, i8* %33, i32 9)
br label %35
35: ; preds = %29
%36 = load i32, i32* %13
%37 = add nsw i32 %36, 1
store i32 %37, i32* %13
br label %26
38: ; preds = %26
%39 = call i32 (...) @clock()
%40 = load i32, i32* %14
%41 = sub nsw i32 %39, %40
store i32 %41, i32* %15
%42 = load i32, i32* %15
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = call i32 (...) @clock()
store i32 %44, i32* %14
store i32 0, i32* %13
br label %45
45: ; preds = %54, %38
%46 = load i32, i32* %13
%47 = icmp slt i32 %46, 10000
br i1 %47, label %48, label %57
48: ; preds = %45
%49 = load i8*, i8** %10
%50 = load i8*, i8** %11
%51 = load i64, i64* %8
%52 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%53 = call i32 @rc4_x86(i8* %49, i8* %50, i64 %51, i8* %52, i32 9)
br label %54
54: ; preds = %48
%55 = load i32, i32* %13
%56 = add nsw i32 %55, 1
store i32 %56, i32* %13
br label %45
57: ; preds = %45
%58 = call i32 (...) @clock()
%59 = load i32, i32* %14
%60 = sub nsw i32 %58, %59
store i32 %60, i32* %16
%61 = load i32, i32* %16
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %15
%64 = sitofp i32 %63 to double
%65 = load i32, i32* %16
%66 = sitofp i32 %65 to double
%67 = fdiv double %64, %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %67)
%69 = getelementptr inbounds [44 x i8], [44 x i8]* %7, i64 0, i64 0
%70 = load i8*, i8** %11
%71 = load i64, i64* %8
%72 = call i64 @memcmp(i8* %69, i8* %70, i64 %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %57
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
br label %76
76: ; preds = %74, %57
%77 = call i8* @string_repeat(i32 1000, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
store i8* %77, i8** %9
%78 = load i64, i64* %8
%79 = mul i64 %78, 1000
store i64 %79, i64* %8
%80 = load i64, i64* %8
%81 = call i8* @malloc(i64 %80)
store i8* %81, i8** %10
%82 = load i64, i64* %8
%83 = call i8* @malloc(i64 %82)
store i8* %83, i8** %11
%84 = load i64, i64* %8
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 %84)
%86 = call i32 (...) @clock()
store i32 %86, i32* %14
store i32 0, i32* %13
br label %87
87: ; preds = %96, %76
%88 = load i32, i32* %13
%89 = icmp slt i32 %88, 10000
br i1 %89, label %90, label %99
90: ; preds = %87
%91 = load i8*, i8** %9
%92 = load i8*, i8** %10
%93 = load i64, i64* %8
%94 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%95 = call i32 @rc4_c(i8* %91, i8* %92, i64 %93, i8* %94, i32 9)
br label %96
96: ; preds = %90
%97 = load i32, i32* %13
%98 = add nsw i32 %97, 1
store i32 %98, i32* %13
br label %87
99: ; preds = %87
%100 = call i32 (...) @clock()
%101 = load i32, i32* %14
%102 = sub nsw i32 %100, %101
store i32 %102, i32* %15
%103 = load i32, i32* %15
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %103)
%105 = call i32 (...) @clock()
store i32 %105, i32* %14
store i32 0, i32* %13
br label %106
106: ; preds = %115, %99
%107 = load i32, i32* %13
%108 = icmp slt i32 %107, 10000
br i1 %108, label %109, label %118
109: ; preds = %106
%110 = load i8*, i8** %10
%111 = load i8*, i8** %11
%112 = load i64, i64* %8
%113 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%114 = call i32 @rc4_x86(i8* %110, i8* %111, i64 %112, i8* %113, i32 9)
br label %115
115: ; preds = %109
%116 = load i32, i32* %13
%117 = add nsw i32 %116, 1
store i32 %117, i32* %13
br label %106
118: ; preds = %106
%119 = call i32 (...) @clock()
%120 = load i32, i32* %14
%121 = sub nsw i32 %119, %120
store i32 %121, i32* %16
%122 = load i32, i32* %16
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %122)
%124 = load i32, i32* %15
%125 = sitofp i32 %124 to double
%126 = load i32, i32* %16
%127 = sitofp i32 %126 to double
%128 = fdiv double %125, %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %128)
%130 = load i8*, i8** %9
%131 = load i8*, i8** %11
%132 = load i64, i64* %8
%133 = call i64 @memcmp(i8* %130, i8* %131, i64 %132)
%134 = icmp ne i64 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %118
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0))
br label %137
137: ; preds = %135, %118
%138 = load i8*, i8** %9
%139 = call i32 @free(i8* %138)
%140 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.password = [9 x i8] c"password\00"
@.str = [26 x i8] c"For short data (size %d)\0A\00"
@.str.1 = [30 x i8] c"C code time consumed: %d ms.\0A\00"
@.str.2 = [37 x i8] c"Assembly code time consumed: %d ms.\0A\00"
@.str.3 = [59 x i8] c"The Assembly version is %.2fx faster than the c version.\0A\0A\00"
@.str.5 = [44 x i8] c"This is the data that needs to be encrypted\00"
@.str.6 = [26 x i8] c"For long data (size %d):\0A\00"
@str.7 = [55 x i8] c"Raw data does not match decrypted data! Data damaged!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x i8]
%4 = alloca [44 x i8]
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [44 x i8], [44 x i8]* %4, i64 0, i64 0
%7 = tail call dereferenceable_or_null(44) i8* @malloc(i64 44)
%8 = tail call dereferenceable_or_null(44) i8* @malloc(i64 44)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 44)
%10 = tail call i32 (...) @clock()
br label %11
11: ; preds = %2, %11
%12 = phi i32 [ 0, %2 ], [ %14, %11 ]
%13 = call i32 @rc4_c(i8* %6, i8* %7, i64 44, i8* %5, i32 9)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 10000
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = call i32 (...) @clock()
%18 = sub nsw i32 %17, %10
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @clock()
br label %21
21: ; preds = %16, %21
%22 = phi i32 [ 0, %16 ], [ %24, %21 ]
%23 = call i32 @rc4_x86(i8* %7, i8* %8, i64 44, i8* %5, i32 9)
%24 = add nuw nsw i32 %22, 1
%25 = icmp eq i32 %24, 10000
br i1 %25, label %26, label %21
26: ; preds = %21
%27 = call i32 (...) @clock()
%28 = sub nsw i32 %27, %20
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = sitofp i32 %18 to double
%31 = sitofp i32 %28 to double
%32 = fdiv double %30, %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %32)
%34 = call i64 @memcmp(i8* %6, i8* %8, i64 44)
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %26
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
br label %38
38: ; preds = %36, %26
%39 = call i8* @string_repeat(i32 1000, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%40 = call dereferenceable_or_null(44000) i8* @malloc(i64 44000)
%41 = call dereferenceable_or_null(44000) i8* @malloc(i64 44000)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i64 44000)
%43 = call i32 (...) @clock()
br label %44
44: ; preds = %38, %44
%45 = phi i32 [ 0, %38 ], [ %47, %44 ]
%46 = call i32 @rc4_c(i8* %39, i8* %40, i64 44000, i8* %5, i32 9)
%47 = add nuw nsw i32 %45, 1
%48 = icmp eq i32 %47, 10000
br i1 %48, label %49, label %44
49: ; preds = %44
%50 = call i32 (...) @clock()
%51 = sub nsw i32 %50, %43
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = call i32 (...) @clock()
br label %54
54: ; preds = %49, %54
%55 = phi i32 [ 0, %49 ], [ %57, %54 ]
%56 = call i32 @rc4_x86(i8* %40, i8* %41, i64 44000, i8* %5, i32 9)
%57 = add nuw nsw i32 %55, 1
%58 = icmp eq i32 %57, 10000
br i1 %58, label %59, label %54
59: ; preds = %54
%60 = call i32 (...) @clock()
%61 = sub nsw i32 %60, %53
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = sitofp i32 %51 to double
%64 = sitofp i32 %61 to double
%65 = fdiv double %63, %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %65)
%67 = call i64 @memcmp(i8* %39, i8* %41, i64 44000)
%68 = icmp eq i64 %67, 0
br i1 %68, label %71, label %69
69: ; preds = %59
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
br label %71
71: ; preds = %69, %59
%72 = call i32 @free(i8* %39)
%73 = call i32 (...) @getchar()
ret i32 0
}