#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*/ uint8_t;
typedef int /*<<< orphan*/ raw;

/* Variables and functions */
int /*<<< orphan*/ base58_encode_check(int /*<<< orphan*/ *, int, char *, int);
int /*<<< orphan*/ ecdsa_get_address_raw(int /*<<< orphan*/ const *,
                                         int /*<<< orphan*/,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void ecdsa_get_address(const uint8_t *pub_key, uint8_t version, char *addr,
                       int addrsize) {
  uint8_t raw[21];
  ecdsa_get_address_raw(pub_key, version, raw);
  base58_encode_check(raw, 21, addr, addrsize);
  memset((raw), 0, (sizeof(raw)));
}


x86 assembly (clang, -O0):
<ecdsa_get_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x70(%rbp),%rdx
call   1050 <ecdsa_get_address_raw@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x15,%esi
call   1040 <base58_encode_check@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x54,%edx
call   1030 <memset@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecdsa_get_address>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsp,%r14
mov    %r14,%rdx
call   1050 <ecdsa_get_address_raw@plt>
mov    %r14,%rdi
mov    $0x15,%esi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1040 <base58_encode_check@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x54,%edx
call   1030 <memset@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ecdsa_get_address(i32* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [21 x i32]
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = getelementptr inbounds [21 x i32], [21 x i32]* %9, i64 0, i64 0
%13 = call i32 @ecdsa_get_address_raw(i32* %10, i32 %11, i32* %12)
%14 = getelementptr inbounds [21 x i32], [21 x i32]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i32, i32* %8
%17 = call i32 @base58_encode_check(i32* %14, i32 21, i8* %15, i32 %16)
%18 = getelementptr inbounds [21 x i32], [21 x i32]* %9, i64 0, i64 0
%19 = call i32 @memset(i32* %18, i32 0, i32 84)
ret void
}

LLVM IR (-O2):
define void @ecdsa_get_address(i32* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [21 x i32]
%6 = bitcast [21 x i32]* %5 to i8*
%7 = getelementptr inbounds [21 x i32], [21 x i32]* %5, i64 0, i64 0
%8 = call i32 @ecdsa_get_address_raw(i32* %0, i32 %1, i32* %7)
%9 = call i32 @base58_encode_check(i32* %7, i32 21, i8* %2, i32 %3)
%10 = call i32 @memset(i32* %7, i32 0, i32 84)
ret void
}