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

/* Variables and functions */
int /*<<< orphan*/ BF_ENCRYPT;
int /*<<< orphan*/ BF_set_key(int /*<<< orphan*/ *, int, unsigned char *);
int /*<<< orphan*/ cfb64_encrypt(unsigned char const *, unsigned char *,
                                 unsigned int, int /*<<< orphan*/ *,
                                 unsigned char *, int *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(unsigned char *, char, int);
void bfencrypt(unsigned char *keydata, int keydatalen, const unsigned char *in,
               unsigned char *out, unsigned int inlen) {
  BF_KEY key;
  unsigned char ivec[32];
  int num = 0;
  BF_set_key(&key, keydatalen, keydata);
  memset(ivec, '\0', 32);
  cfb64_encrypt(in, out, inlen, &key, ivec, &num, BF_ENCRYPT);
}


x86 assembly (clang, -O0):
<bfencrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    -0x28(%rbp),%rdi
call   1030 <BF_set_key@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    -0x50(%rbp),%r8
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rcx
lea    -0x54(%rbp),%r9
mov    %eax,(%rsp)
call   1050 <cfb64_encrypt@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfencrypt>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %r8d,%r14d
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rdi,%rdx
movl   $0x0,0x8(%rsp)
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1030 <BF_set_key@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
lea    0x8(%rsp),%r9
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    %r15,%rcx
mov    %r12,%r8
call   1050 <cfb64_encrypt@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@BF_ENCRYPT = global i32 0
define void @bfencrypt(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [32 x i8]
%13 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
store i32 0, i32* %13
%14 = load i32, i32* %7
%15 = load i8*, i8** %6
%16 = call i32 @BF_set_key(i32* %11, i32 %14, i8* %15)
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%18 = call i32 @memset(i8* %17, i8 signext 0, i32 32)
%19 = load i8*, i8** %8
%20 = load i8*, i8** %9
%21 = load i32, i32* %10
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %12, i64 0, i64 0
%23 = load i32, i32* @BF_ENCRYPT
%24 = call i32 @cfb64_encrypt(i8* %19, i8* %20, i32 %21, i32* %11, i8* %22, i32* %13, i32 %23)
ret void
}

LLVM IR (-O2):
@BF_ENCRYPT = global i32 0
define void @bfencrypt(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca [32 x i8]
%8 = alloca i32
%9 = bitcast i32* %6 to i8*
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%11 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%12 = call i32 @BF_set_key(i32* %6, i32 %1, i8* %0)
%13 = call i32 @memset(i8* %10, i8 signext 0, i32 32)
%14 = load i32, i32* @BF_ENCRYPT
%15 = call i32 @cfb64_encrypt(i8* %2, i8* %3, i32 %4, i32* %6, i8* %10, i32* %8, i32 %14)
ret void
}