#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 /*<<< orphan*/ key;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ rijndaelDecrypt(unsigned long *, int, char const *, char *);
int rijndaelSetupDecrypt(unsigned long *, unsigned char *, int);
int strlen(char const *);
char *snippet_decrypt(const char *cipher_text, const char *password) {
  unsigned long rk[((256) / 8 + 28)];
  unsigned char key[((256) / 8)];
  int i;
  int nrounds;
  for (i = 0; i < sizeof(key); i++) {
    key[i] = *password != 0 ? *password++ : 0;
  }
  nrounds = rijndaelSetupDecrypt(rk, key, 256);
  char *plain_text = (char *)malloc(sizeof(char) * strlen(cipher_text));
  rijndaelDecrypt(rk, nrounds, cipher_text, plain_text);
  return plain_text;
}


x86 assembly (clang, -O0):
<snippet_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x214(%rbp)
movslq -0x214(%rbp),%rax
cmp    $0x20,%rax
jae    11d2 <snippet_decrypt+0x92>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119b <snippet_decrypt+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x224(%rbp)
jmp    11a8 <snippet_decrypt+0x68>
xor    %eax,%eax
mov    %eax,-0x224(%rbp)
jmp    11a8 <snippet_decrypt+0x68>
mov    -0x224(%rbp),%eax
mov    %al,%cl
movslq -0x214(%rbp),%rax
mov    %cl,-0x210(%rbp,%rax,1)
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    115d <snippet_decrypt+0x1d>
lea    -0x1f0(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x100,%edx
call   1030 <rijndaelSetupDecrypt@plt>
mov    %eax,-0x218(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x220(%rbp)
lea    -0x1f0(%rbp),%rdi
mov    -0x218(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x220(%rbp),%rcx
call   1060 <rijndaelDecrypt@plt>
mov    -0x220(%rbp),%rax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snippet_decrypt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%r15
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi),%ecx
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rsi
mov    %cl,(%rsp,%rax,1)
movzbl (%rsi),%ecx
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rsi
mov    %cl,0x1(%rsp,%rax,1)
movzbl (%rsi),%ecx
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rsi
mov    %cl,0x2(%rsp,%rax,1)
movzbl (%rsi),%ecx
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rsi
mov    %cl,0x3(%rsp,%rax,1)
add    $0x4,%rax
cmp    $0x20,%rax
jne    1160 <snippet_decrypt+0x20>
lea    0x20(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x100,%edx
call   1030 <rijndaelSetupDecrypt@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %rax,%rcx
call   1060 <rijndaelDecrypt@plt>
mov    %rbx,%rax
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @snippet_decrypt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [60 x i64]
%6 = alloca [32 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %7
br label %10
10: ; preds = %31, %2
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 32
br i1 %13, label %14, label %34
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %4
%22 = load i8, i8* %20
%23 = sext i8 %22 to i32
br label %25
24: ; preds = %14
br label %25
25: ; preds = %24, %19
%26 = phi i32 [ %23, %19 ], [ 0, %24 ]
%27 = trunc i32 %26 to i8
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 %29
store i8 %27, i8* %30
br label %31
31: ; preds = %25
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %10
34: ; preds = %10
%35 = getelementptr inbounds [60 x i64], [60 x i64]* %5, i64 0, i64 0
%36 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%37 = call i32 @rijndaelSetupDecrypt(i64* %35, i8* %36, i32 256)
store i32 %37, i32* %8
%38 = load i8*, i8** %3
%39 = call i32 @strlen(i8* %38)
%40 = sext i32 %39 to i64
%41 = mul i64 1, %40
%42 = trunc i64 %41 to i32
%43 = call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %9
%45 = getelementptr inbounds [60 x i64], [60 x i64]* %5, i64 0, i64 0
%46 = load i32, i32* %8
%47 = load i8*, i8** %3
%48 = load i8*, i8** %9
%49 = call i32 @rijndaelDecrypt(i64* %45, i32 %46, i8* %47, i8* %48)
%50 = load i8*, i8** %9
ret i8* %50
}

LLVM IR (-O2):
define i8* @snippet_decrypt(i8* %0, i8* nocapture %1) {
%3 = alloca [60 x i64]
%4 = alloca [32 x i8]
%5 = bitcast [60 x i64]* %3 to i8*
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %7, %2
%8 = phi i64 [ 0, %2 ], [ %33, %7 ]
%9 = phi i8* [ %1, %2 ], [ %31, %7 ]
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = zext i1 %11 to i64
%13 = getelementptr i8, i8* %9, i64 %12
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %8
store i8 %10, i8* %14
%15 = or i64 %8, 1
%16 = load i8, i8* %13
%17 = icmp ne i8 %16, 0
%18 = zext i1 %17 to i64
%19 = getelementptr i8, i8* %13, i64 %18
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %15
store i8 %16, i8* %20
%21 = or i64 %8, 2
%22 = load i8, i8* %19
%23 = icmp ne i8 %22, 0
%24 = zext i1 %23 to i64
%25 = getelementptr i8, i8* %19, i64 %24
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %21
store i8 %22, i8* %26
%27 = or i64 %8, 3
%28 = load i8, i8* %25
%29 = icmp ne i8 %28, 0
%30 = zext i1 %29 to i64
%31 = getelementptr i8, i8* %25, i64 %30
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %27
store i8 %28, i8* %32
%33 = add nuw nsw i64 %8, 4
%34 = icmp eq i64 %33, 32
br i1 %34, label %35, label %7
35: ; preds = %7
%36 = getelementptr inbounds [60 x i64], [60 x i64]* %3, i64 0, i64 0
%37 = call i32 @rijndaelSetupDecrypt(i64* %36, i8* %6, i32 256)
%38 = call i32 @strlen(i8* %0)
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to i8*
%41 = call i32 @rijndaelDecrypt(i64* %36, i32 %37, i8* %0, i8* %40)
ret i8* %40
}