#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*/ BIO_printf(void *, char *, char const *, ...);
int /*<<< orphan*/ EVP_CIPHER_name(int /*<<< orphan*/ const *);
void list_cipher_fn(const EVP_CIPHER *c, const char *from, const char *to,
                    void *arg) {
  if (c)
    BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
  else {
    if (!from)
      from = "<undefined>";
    if (!to)
      to = "<undefined>";
    BIO_printf(arg, "%s => %s\n", from, to);
  }
}


x86 assembly (clang, -O0):
<list_cipher_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116e <list_cipher_fn+0x4e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <EVP_CIPHER_name@plt>
mov    -0x28(%rbp),%rdi
movslq %eax,%rdx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <BIO_printf@plt>
jmp    11b4 <list_cipher_fn+0x94>
cmpq   $0x0,-0x10(%rbp)
jne    1184 <list_cipher_fn+0x64>
lea    0xe80(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    119a <list_cipher_fn+0x7a>
lea    0xe6a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1040 <BIO_printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_cipher_fn>:
push   %rbx
mov    %rcx,%rbx
test   %rdi,%rdi
je     1143 <list_cipher_fn+0x23>
call   1030 <EVP_CIPHER_name@plt>
movslq %eax,%rdx
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <BIO_printf@plt>
mov    %rdx,%rcx
mov    %rsi,%rdx
test   %rsi,%rsi
lea    0xead(%rip),%rax
cmove  %rax,%rdx
test   %rcx,%rcx
cmove  %rax,%rcx
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <BIO_printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"<undefined>\00"
@.str.2 = [10 x i8] c"%s => %s\0A\00"
define void @list_cipher_fn(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 ne i32* %9, null
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load i8*, i8** %8
%13 = load i32*, i32** %5
%14 = call i32 @EVP_CIPHER_name(i32* %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
%17 = call i32 (i8*, i8*, i8*, ...) @BIO_printf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %31
18: ; preds = %4
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %22, label %21
21: ; preds = %18
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %22
22: ; preds = %21, %18
%23 = load i8*, i8** %7
%24 = icmp ne i8* %23, null
br i1 %24, label %26, label %25
25: ; preds = %22
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %26
26: ; preds = %25, %22
%27 = load i8*, i8** %8
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = call i32 (i8*, i8*, i8*, ...) @BIO_printf(i8* %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29)
br label %31
31: ; preds = %26, %11
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"<undefined>\00"
@.str.2 = [10 x i8] c"%s => %s\0A\00"
define void @list_cipher_fn(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = tail call i32 @EVP_CIPHER_name(i32* %0)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = tail call i32 (i8*, i8*, i8*, ...) @BIO_printf(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %17
11: ; preds = %4
%12 = icmp eq i8* %1, null
%13 = select i1 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %1
%14 = icmp eq i8* %2, null
%15 = select i1 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %2
%16 = tail call i32 (i8*, i8*, i8*, ...) @BIO_printf(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %15)
br label %17
17: ; preds = %11, %6
ret void
}