#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 EVP_CIPHER_block_size(int /*<<< orphan*/ const *);
int EVP_CIPHER_iv_length(int /*<<< orphan*/ const *);
int EVP_CIPHER_key_length(int /*<<< orphan*/ const *);
int /*<<< orphan*/ EVP_CIPHER_mode(int /*<<< orphan*/ const *);
char *EVP_CIPHER_name(int /*<<< orphan*/ const *);
int EVP_CIPHER_type(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *EVP_get_cipherbyname(char const *);
int /*<<< orphan*/ printf(char *, ...);
void show_cipher(const EVP_CIPHER *cipher, const char *name, const char *data,
                 void *arg) {
  if (cipher == NULL) {
    cipher = EVP_get_cipherbyname(name);
  }
  printf("%d\t", EVP_CIPHER_type(cipher));
  printf("%lx\t", EVP_CIPHER_mode(cipher));
  printf("%d\t", EVP_CIPHER_block_size(cipher));
  printf("%d\t", EVP_CIPHER_key_length(cipher));
  printf("%d\t", EVP_CIPHER_iv_length(cipher));
  printf("%s\t", EVP_CIPHER_name(cipher));
  printf("%s\t", name);
  printf("\n");
}


x86 assembly (clang, -O0):
<show_cipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b0 <show_cipher+0x30>
mov    -0x10(%rbp),%rdi
call   1080 <EVP_get_cipherbyname@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <EVP_CIPHER_type@plt>
mov    %eax,%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <EVP_CIPHER_mode@plt>
mov    %eax,%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <EVP_CIPHER_block_size@plt>
mov    %eax,%esi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   10a0 <EVP_CIPHER_key_length@plt>
mov    %eax,%esi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <EVP_CIPHER_iv_length@plt>
mov    %eax,%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <EVP_CIPHER_name@plt>
mov    %rax,%rsi
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_cipher>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
jne    11ab <show_cipher+0x1b>
mov    %r14,%rdi
call   1090 <EVP_get_cipherbyname@plt>
mov    %rax,%rbx
mov    %rbx,%rdi
call   1050 <EVP_CIPHER_type@plt>
lea    0xe46(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1040 <EVP_CIPHER_mode@plt>
lea    0xe2f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10a0 <EVP_CIPHER_block_size@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10b0 <EVP_CIPHER_key_length@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1080 <EVP_CIPHER_iv_length@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1060 <EVP_CIPHER_name@plt>
lea    0xde0(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [5 x i8] c"%lx\09\00"
@.str.2 = [4 x i8] c"%s\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @show_cipher(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = call i32* @EVP_get_cipherbyname(i8* %12)
store i32* %13, i32** %5
br label %14
14: ; preds = %11, %4
%15 = load i32*, i32** %5
%16 = call i32 @EVP_CIPHER_type(i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %5
%19 = call i32 @EVP_CIPHER_mode(i32* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %5
%22 = call i32 @EVP_CIPHER_block_size(i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32*, i32** %5
%25 = call i32 @EVP_CIPHER_key_length(i32* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32*, i32** %5
%28 = call i32 @EVP_CIPHER_iv_length(i32* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32*, i32** %5
%31 = call i8* @EVP_CIPHER_name(i32* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = load i8*, i8** %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [5 x i8] c"%lx\09\00"
@.str.2 = [4 x i8] c"%s\09\00"
define void @show_cipher(i32* %0, i8* %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32* @EVP_get_cipherbyname(i8* %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32* [ %7, %6 ], [ %0, %4 ]
%10 = tail call i32 @EVP_CIPHER_type(i32* %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @EVP_CIPHER_mode(i32* %9)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @EVP_CIPHER_block_size(i32* %9)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32 @EVP_CIPHER_key_length(i32* %9)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = tail call i32 @EVP_CIPHER_iv_length(i32* %9)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = tail call i8* @EVP_CIPHER_name(i32* %9)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%23 = tail call i32 @putchar(i32 10)
ret void
}