#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 */
struct key_info {
  int dummy;
};
struct cert_info {
  int dummy;
};
typedef int /*<<< orphan*/ bin_cert;

/* Variables and functions */
int /*<<< orphan*/ RIPEMD160(unsigned char *, int, unsigned char *);
int cert_to_bin(unsigned char *, int, struct key_info *, struct key_info *,
                struct cert_info *);
void cert_to_digest(unsigned char *digest, struct key_info *issuer,
                    struct key_info *subject, struct cert_info *ci) {
  unsigned char bin_cert[1000];
  int len = cert_to_bin(bin_cert, sizeof(bin_cert), issuer, subject, ci);
  RIPEMD160(bin_cert, len, digest);
  return;
}


x86 assembly (clang, -O0):
<cert_to_digest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x3e8,%esi
call   1040 <cert_to_bin@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x414(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <RIPEMD160@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cert_to_digest>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1040 <cert_to_bin@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <RIPEMD160@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.key_info = type { i32 }
%struct.cert_info = type { i32 }
define void @cert_to_digest(i8* %0, %struct.key_info* %1, %struct.key_info* %2, %struct.cert_info* %3) {
%5 = alloca i8*
%6 = alloca %struct.key_info*
%7 = alloca %struct.key_info*
%8 = alloca %struct.cert_info*
%9 = alloca [1000 x i8]
%10 = alloca i32
store i8* %0, i8** %5
store %struct.key_info* %1, %struct.key_info** %6
store %struct.key_info* %2, %struct.key_info** %7
store %struct.cert_info* %3, %struct.cert_info** %8
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%12 = load %struct.key_info*, %struct.key_info** %6
%13 = load %struct.key_info*, %struct.key_info** %7
%14 = load %struct.cert_info*, %struct.cert_info** %8
%15 = call i32 @cert_to_bin(i8* %11, i32 1000, %struct.key_info* %12, %struct.key_info* %13, %struct.cert_info* %14)
store i32 %15, i32* %10
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%17 = load i32, i32* %10
%18 = load i8*, i8** %5
%19 = call i32 @RIPEMD160(i8* %16, i32 %17, i8* %18)
ret void
}

LLVM IR (-O2):
%struct.key_info = type { i32 }
%struct.cert_info = type { i32 }
define void @cert_to_digest(i8* %0, %struct.key_info* %1, %struct.key_info* %2, %struct.cert_info* %3) {
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%7 = call i32 @cert_to_bin(i8* %6, i32 1000, %struct.key_info* %1, %struct.key_info* %2, %struct.cert_info* %3)
%8 = call i32 @RIPEMD160(i8* %6, i32 %7, i8* %0)
ret void
}