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

/* Variables and functions */
int /*<<< orphan*/ EVP_CIPHER_CTX_ctrl(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int *);
int /*<<< orphan*/ EVP_CTRL_GET_RC2_KEY_BITS;
int rc2_meth_to_magic(EVP_CIPHER_CTX *e) {
  int i;
  EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i);
  if (i == 128)
    return (0x3a);
  else if (i == 64)
    return (0x78);
  else if (i == 40)
    return (0xa0);
  else
    return (0);
}


x86 assembly (clang, -O0):
<rc2_meth_to_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
lea    -0x14(%rbp),%rcx
call   1030 <EVP_CIPHER_CTX_ctrl@plt>
cmpl   $0x80,-0x14(%rbp)
jne    114d <rc2_meth_to_magic+0x3d>
movl   $0x3a,-0x4(%rbp)
jmp    1180 <rc2_meth_to_magic+0x70>
cmpl   $0x40,-0x14(%rbp)
jne    1163 <rc2_meth_to_magic+0x53>
movl   $0x78,-0x4(%rbp)
jmp    1180 <rc2_meth_to_magic+0x70>
cmpl   $0x28,-0x14(%rbp)
jne    1179 <rc2_meth_to_magic+0x69>
movl   $0xa0,-0x4(%rbp)
jmp    1180 <rc2_meth_to_magic+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc2_meth_to_magic>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rcx
xor    %edx,%edx
call   1030 <EVP_CIPHER_CTX_ctrl@plt>
mov    0x4(%rsp),%eax
cmp    $0x28,%eax
je     1142 <rc2_meth_to_magic+0x32>
cmp    $0x80,%eax
je     1149 <rc2_meth_to_magic+0x39>
cmp    $0x40,%eax
jne    1150 <rc2_meth_to_magic+0x40>
mov    $0x78,%eax
pop    %rcx
ret
mov    $0xa0,%eax
pop    %rcx
ret
mov    $0x3a,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EVP_CTRL_GET_RC2_KEY_BITS = global i32 0
define i32 @rc2_meth_to_magic(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* @EVP_CTRL_GET_RC2_KEY_BITS
%7 = call i32 @EVP_CIPHER_CTX_ctrl(i32* %5, i32 %6, i32 0, i32* %4)
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 128
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 58, i32* %2
br label %20
11: ; preds = %1
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 64
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 120, i32* %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 40
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 160, i32* %2
br label %20
19: ; preds = %15
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %14, %10
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@EVP_CTRL_GET_RC2_KEY_BITS = global i32 0
define i32 @rc2_meth_to_magic(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @EVP_CTRL_GET_RC2_KEY_BITS
%5 = call i32 @EVP_CIPHER_CTX_ctrl(i32* %0, i32 %4, i32 0, i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %9 [
i32 128, label %10
i32 64, label %7
i32 40, label %8
]
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7
%11 = phi i32 [ 120, %7 ], [ 160, %8 ], [ 0, %9 ], [ 58, %1 ]
ret i32 %11
}