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

/* Variables and functions */
int /*<<< orphan*/ base58_encode_check(int *, int, char *, int);
int /*<<< orphan*/ memcpy(int *, int const *, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
void ecdsa_get_wif(const uint8_t *priv_key, uint8_t version, char *wif,
                   int wifsize) {
  uint8_t data[34];
  data[0] = version;
  memcpy(data + 1, priv_key, 32);
  data[33] = 0x01;
  base58_encode_check(data, 34, wif, wifsize);
  memset((data), 0, (sizeof(data)));
}


x86 assembly (clang, -O0):
<ecdsa_get_wif>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xb0(%rbp)
lea    -0xb0(%rbp),%rdi
add    $0x4,%rdi
mov    -0x8(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
movl   $0x1,-0x2c(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x22,%esi
call   1050 <base58_encode_check@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x88,%edx
call   1030 <memset@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecdsa_get_wif>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rdi,%rax
mov    %esi,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rax,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
movl   $0x1,0x84(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x22,%esi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1050 <base58_encode_check@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x88,%edx
call   1030 <memset@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ecdsa_get_wif(i32* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [34 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* %6
%11 = getelementptr inbounds [34 x i32], [34 x i32]* %9, i64 0, i64 0
store i32 %10, i32* %11
%12 = getelementptr inbounds [34 x i32], [34 x i32]* %9, i64 0, i64 0
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32*, i32** %5
%15 = call i32 @memcpy(i32* %13, i32* %14, i32 32)
%16 = getelementptr inbounds [34 x i32], [34 x i32]* %9, i64 0, i64 33
store i32 1, i32* %16
%17 = getelementptr inbounds [34 x i32], [34 x i32]* %9, i64 0, i64 0
%18 = load i8*, i8** %7
%19 = load i32, i32* %8
%20 = call i32 @base58_encode_check(i32* %17, i32 34, i8* %18, i32 %19)
%21 = getelementptr inbounds [34 x i32], [34 x i32]* %9, i64 0, i64 0
%22 = call i32 @memset(i32* %21, i32 0, i32 136)
ret void
}

LLVM IR (-O2):
define void @ecdsa_get_wif(i32* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca [34 x i32]
%6 = bitcast [34 x i32]* %5 to i8*
%7 = getelementptr inbounds [34 x i32], [34 x i32]* %5, i64 0, i64 0
store i32 %1, i32* %7
%8 = getelementptr inbounds [34 x i32], [34 x i32]* %5, i64 0, i64 1
%9 = call i32 @memcpy(i32* %8, i32* %0, i32 32)
%10 = getelementptr inbounds [34 x i32], [34 x i32]* %5, i64 0, i64 33
store i32 1, i32* %10
%11 = call i32 @base58_encode_check(i32* %7, i32 34, i8* %2, i32 %3)
%12 = call i32 @memset(i32* %7, i32 0, i32 136)
ret void
}