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

/* Variables and functions */
int EVP_MD_block_size(int /*<<< orphan*/ const *);
int /*<<< orphan*/ EVP_MD_flags(int /*<<< orphan*/ const *);
char *EVP_MD_name(int /*<<< orphan*/ const *);
int EVP_MD_size(int /*<<< orphan*/ const *);
int EVP_MD_type(int /*<<< orphan*/ const *);
int /*<<< orphan*/ *EVP_get_digestbyname(char const *);
int /*<<< orphan*/ printf(char *, ...);
void show_md(const EVP_MD *md, const char *name, const char *data, void *arg) {
  if (md == NULL) {
    md = EVP_get_digestbyname(name);
  }
  printf("%d\t", EVP_MD_type(md));
  printf("%ld\t", EVP_MD_flags(md));
  printf("%d\t", EVP_MD_block_size(md));
  printf("%d\t", EVP_MD_size(md));
  printf("%s\t", EVP_MD_name(md));
  printf("%s\t", name);
  printf("\n");
}


x86 assembly (clang, -O0):
<show_md>:
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    11a0 <show_md+0x30>
mov    -0x10(%rbp),%rdi
call   1050 <EVP_get_digestbyname@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <EVP_MD_type@plt>
mov    %eax,%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1080 <EVP_MD_flags@plt>
mov    %eax,%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <EVP_MD_block_size@plt>
mov    %eax,%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <EVP_MD_size@plt>
mov    %eax,%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <EVP_MD_name@plt>
mov    %rax,%rsi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_md>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
jne    119b <show_md+0x1b>
mov    %r14,%rdi
call   1060 <EVP_get_digestbyname@plt>
mov    %rax,%rbx
mov    %rbx,%rdi
call   1070 <EVP_MD_type@plt>
lea    0xe56(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1090 <EVP_MD_flags@plt>
lea    0xe3f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   10a0 <EVP_MD_block_size@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <EVP_MD_size@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1080 <EVP_MD_name@plt>
lea    0xe04(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <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"%ld\09\00"
@.str.2 = [4 x i8] c"%s\09\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @show_md(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_digestbyname(i8* %12)
store i32* %13, i32** %5
br label %14
14: ; preds = %11, %4
%15 = load i32*, i32** %5
%16 = call i32 @EVP_MD_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_MD_flags(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_MD_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_MD_size(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 i8* @EVP_MD_name(i32* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = load i8*, i8** %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = 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"%ld\09\00"
@.str.2 = [4 x i8] c"%s\09\00"
define void @show_md(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_digestbyname(i8* %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32* [ %7, %6 ], [ %0, %4 ]
%10 = tail call i32 @EVP_MD_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_MD_flags(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_MD_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_MD_size(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 i8* @EVP_MD_name(i32* %9)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%21 = tail call i32 @putchar(i32 10)
ret void
}