#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 */
int /*<<< orphan*/ __snippet_encrypt_blocks(unsigned long *, int, char **);
char **__snippet_split_to_blocks(char const *);
int rijndaelSetupEncrypt(unsigned long *, unsigned char *, int);
char *snippet_encrypt(const char *plain_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 = rijndaelSetupEncrypt(rk, key, 256);
  char **blocks = __snippet_split_to_blocks(plain_text);
  __snippet_encrypt_blocks(rk, nrounds, blocks);
  return NULL;
}


x86 assembly (clang, -O0):
<snippet_encrypt>:
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    11c2 <snippet_encrypt+0x92>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118b <snippet_encrypt+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x224(%rbp)
jmp    1198 <snippet_encrypt+0x68>
xor    %eax,%eax
mov    %eax,-0x224(%rbp)
jmp    1198 <snippet_encrypt+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    114d <snippet_encrypt+0x1d>
lea    -0x1f0(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x100,%edx
call   1030 <rijndaelSetupEncrypt@plt>
mov    %eax,-0x218(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__snippet_split_to_blocks@plt>
mov    %rax,-0x220(%rbp)
lea    -0x1f0(%rbp),%rdi
mov    -0x218(%rbp),%esi
mov    -0x220(%rbp),%rdx
call   1050 <__snippet_encrypt_blocks@plt>
xor    %eax,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snippet_encrypt>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%r14
xor    %eax,%eax
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    1140 <snippet_encrypt+0x10>
lea    0x20(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x100,%edx
call   1030 <rijndaelSetupEncrypt@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <__snippet_split_to_blocks@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   1050 <__snippet_encrypt_blocks@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @snippet_encrypt(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 @rijndaelSetupEncrypt(i64* %35, i8* %36, i32 256)
store i32 %37, i32* %8
%38 = load i8*, i8** %3
%39 = call i8** @__snippet_split_to_blocks(i8* %38)
store i8** %39, i8*** %9
%40 = getelementptr inbounds [60 x i64], [60 x i64]* %5, i64 0, i64 0
%41 = load i32, i32* %8
%42 = load i8**, i8*** %9
%43 = call i32 @__snippet_encrypt_blocks(i64* %40, i32 %41, i8** %42)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @snippet_encrypt(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 @rijndaelSetupEncrypt(i64* %36, i8* %6, i32 256)
%38 = call i8** @__snippet_split_to_blocks(i8* %0)
%39 = call i32 @__snippet_encrypt_blocks(i64* %36, i32 %37, i8** %38)
ret i8* null
}