#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, 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,
                const unsigned char *aad, int an, const unsigned char *tag,
                int tn, 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, aad, an, tag, tn,
        encdec);
  return 1;
}


x86 assembly (clang, -O0):
<test_cipher>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %edx,-0x44(%rbp)
mov    %rcx,-0x50(%rbp)
mov    %r8d,-0x54(%rbp)
mov    %r9,-0x60(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <EVP_get_cipherbyname@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    118a <test_cipher+0x6a>
movl   $0x0,-0x2c(%rbp)
jmp    11f0 <test_cipher+0xd0>
mov    -0x68(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x50(%rbp),%rcx
mov    -0x54(%rbp),%r8d
mov    -0x60(%rbp),%r9
mov    0x10(%rbp),%r13d
mov    0x18(%rbp),%r12
mov    0x20(%rbp),%r15d
mov    0x28(%rbp),%r14
mov    0x30(%rbp),%ebx
mov    0x38(%rbp),%r11
mov    0x40(%rbp),%r10d
mov    0x48(%rbp),%eax
mov    %r13d,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15d,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %ebx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10d,0x30(%rsp)
mov    %eax,0x38(%rsp)
call   1030 <test1@plt>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
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     118f <test_cipher+0x6f>
mov    0x78(%rsp),%r10d
mov    0x70(%rsp),%r11d
mov    0x60(%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   0x78(%rsp)
push   %r13
push   0x78(%rsp)
mov    0x78(%rsp),%eax
push   %rax
push   0x78(%rsp)
mov    0x78(%rsp),%eax
push   %rax
call   1030 <test1@plt>
add    $0x40,%rsp
mov    $0x1,%eax
jmp    1191 <test_cipher+0x71>
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, i8* %9, i32 %10, i8* %11, i32 %12, i32 %13) {
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i8*
%26 = alloca i32
%27 = alloca i8*
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32*
store i8* %0, i8** %16
store i8* %1, i8** %17
store i32 %2, i32* %18
store i8* %3, i8** %19
store i32 %4, i32* %20
store i8* %5, i8** %21
store i32 %6, i32* %22
store i8* %7, i8** %23
store i32 %8, i32* %24
store i8* %9, i8** %25
store i32 %10, i32* %26
store i8* %11, i8** %27
store i32 %12, i32* %28
store i32 %13, i32* %29
%31 = load i8*, i8** %16
%32 = call i32* @EVP_get_cipherbyname(i8* %31)
store i32* %32, i32** %30
%33 = load i32*, i32** %30
%34 = icmp ne i32* %33, null
br i1 %34, label %36, label %35
35: ; preds = %14
store i32 0, i32* %15
br label %52
36: ; preds = %14
%37 = load i32*, i32** %30
%38 = load i8*, i8** %17
%39 = load i32, i32* %18
%40 = load i8*, i8** %19
%41 = load i32, i32* %20
%42 = load i8*, i8** %21
%43 = load i32, i32* %22
%44 = load i8*, i8** %23
%45 = load i32, i32* %24
%46 = load i8*, i8** %25
%47 = load i32, i32* %26
%48 = load i8*, i8** %27
%49 = load i32, i32* %28
%50 = load i32, i32* %29
%51 = call i32 @test1(i32* %37, i8* %38, i32 %39, i8* %40, i32 %41, i8* %42, i32 %43, i8* %44, i32 %45, i8* %46, i32 %47, i8* %48, i32 %49, i32 %50)
store i32 1, i32* %15
br label %52
52: ; preds = %36, %35
%53 = load i32, i32* %15
ret i32 %53
}

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, i8* %9, i32 %10, i8* %11, i32 %12, i32 %13) {
%15 = tail call i32* @EVP_get_cipherbyname(i8* %0)
%16 = icmp eq i32* %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @test1(i32* %15, i8* %1, i32 %2, i8* %3, i32 %4, i8* %5, i32 %6, i8* %7, i32 %8, i8* %9, i32 %10, i8* %11, i32 %12, i32 %13)
br label %19
19: ; preds = %14, %17
%20 = phi i32 [ 1, %17 ], [ 0, %14 ]
ret i32 %20
}