#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;

/* Variables and functions */
int /*<<< orphan*/ *EVP_get_cipherbyname(char const *);
int /*<<< orphan*/ test1(int /*<<< orphan*/ const *, unsigned char const *, int,
                         unsigned char const *, int, unsigned char const *, int,
                         unsigned char const *, int, int);
int test_cipher(const char *cipher, const unsigned char *key, int kn,
                const unsigned char *iv, int in, const unsigned char *plaintext,
                int pn, const unsigned char *ciphertext, int cn, int encdec) {
  const EVP_CIPHER *c;
  c = EVP_get_cipherbyname(cipher);
  if (!c)
    return 0;
  test1(c, key, kn, iv, in, plaintext, pn, ciphertext, cn, encdec);
  return 1;
}


x86 assembly (clang, -O0):
<test_cipher>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <EVP_get_cipherbyname@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1171 <test_cipher+0x51>
movl   $0x0,-0xc(%rbp)
jmp    11b3 <test_cipher+0x93>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%r8d
mov    -0x40(%rbp),%r9
mov    0x10(%rbp),%ebx
mov    0x18(%rbp),%r11
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1030 <test1@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_cipher>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <EVP_get_cipherbyname@plt>
test   %rax,%rax
je     117d <test_cipher+0x5d>
mov    0x58(%rsp),%r10d
mov    0x50(%rsp),%r11d
mov    0x40(%rsp),%r13d
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %r14,%r9
push   %r10
push   %r11
push   0x58(%rsp)
push   %r13
call   1030 <test1@plt>
add    $0x20,%rsp
mov    $0x1,%eax
jmp    117f <test_cipher+0x5f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_cipher(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4, i8* %5, i32 %6, i8* %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32*
store i8* %0, i8** %12
store i8* %1, i8** %13
store i32 %2, i32* %14
store i8* %3, i8** %15
store i32 %4, i32* %16
store i8* %5, i8** %17
store i32 %6, i32* %18
store i8* %7, i8** %19
store i32 %8, i32* %20
store i32 %9, i32* %21
%23 = load i8*, i8** %12
%24 = call i32* @EVP_get_cipherbyname(i8* %23)
store i32* %24, i32** %22
%25 = load i32*, i32** %22
%26 = icmp ne i32* %25, null
br i1 %26, label %28, label %27
27: ; preds = %10
store i32 0, i32* %11
br label %40
28: ; preds = %10
%29 = load i32*, i32** %22
%30 = load i8*, i8** %13
%31 = load i32, i32* %14
%32 = load i8*, i8** %15
%33 = load i32, i32* %16
%34 = load i8*, i8** %17
%35 = load i32, i32* %18
%36 = load i8*, i8** %19
%37 = load i32, i32* %20
%38 = load i32, i32* %21
%39 = call i32 @test1(i32* %29, i8* %30, i32 %31, i8* %32, i32 %33, i8* %34, i32 %35, i8* %36, i32 %37, i32 %38)
store i32 1, i32* %11
br label %40
40: ; preds = %28, %27
%41 = load i32, i32* %11
ret i32 %41
}

LLVM IR (-O2):
define i32 @test_cipher(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4, i8* %5, i32 %6, i8* %7, i32 %8, i32 %9) {
%11 = tail call i32* @EVP_get_cipherbyname(i8* %0)
%12 = icmp eq i32* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @test1(i32* %11, i8* %1, i32 %2, i8* %3, i32 %4, i8* %5, i32 %6, i8* %7, i32 %8, i32 %9)
br label %15
15: ; preds = %10, %13
%16 = phi i32 [ 1, %13 ], [ 0, %10 ]
ret i32 %16
}