#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*/ const uint8_t;

/* Variables and functions */
int /*<<< orphan*/ SHA512(int /*<<< orphan*/ const *, int,
                          int /*<<< orphan*/ const *);
int /*<<< orphan*/ key_descriptor_to_hex(int /*<<< orphan*/ const *, char *);
int /*<<< orphan*/ secure_wipe(int /*<<< orphan*/ const *, int);
void compute_descriptor(const uint8_t key[64], char descriptor[((2 * 8) + 1)]) {
  uint8_t digest1[64];
  SHA512(key, 64, digest1);
  uint8_t digest2[64];
  SHA512(digest1, 64, digest2);
  key_descriptor_to_hex(digest2, descriptor);
  secure_wipe(digest1, 64);
  secure_wipe(digest2, 64);
}


x86 assembly (clang, -O0):
<compute_descriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rdx
mov    $0x40,%esi
call   1040 <SHA512@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rdx
mov    $0x40,%esi
call   1040 <SHA512@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <key_descriptor_to_hex@plt>
lea    -0x110(%rbp),%rdi
mov    $0x40,%esi
call   1050 <secure_wipe@plt>
lea    -0x210(%rbp),%rdi
mov    $0x40,%esi
call   1050 <secure_wipe@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_descriptor>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r15
lea    0x100(%rsp),%r14
mov    $0x40,%esi
mov    %r14,%rdx
call   1040 <SHA512@plt>
mov    %rsp,%rbx
mov    %r14,%rdi
mov    $0x40,%esi
mov    %rbx,%rdx
call   1040 <SHA512@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <key_descriptor_to_hex@plt>
mov    %r14,%rdi
mov    $0x40,%esi
call   1050 <secure_wipe@plt>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1050 <secure_wipe@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @compute_descriptor(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [64 x i32]
%6 = alloca [64 x i32]
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 0
%9 = call i32 @SHA512(i32* %7, i32 64, i32* %8)
%10 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 0
%11 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%12 = call i32 @SHA512(i32* %10, i32 64, i32* %11)
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32 @key_descriptor_to_hex(i32* %13, i8* %14)
%16 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 0
%17 = call i32 @secure_wipe(i32* %16, i32 64)
%18 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%19 = call i32 @secure_wipe(i32* %18, i32 64)
ret void
}

LLVM IR (-O2):
define void @compute_descriptor(i32* %0, i8* %1) {
%3 = alloca [64 x i32]
%4 = alloca [64 x i32]
%5 = bitcast [64 x i32]* %3 to i8*
%6 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%7 = call i32 @SHA512(i32* %0, i32 64, i32* %6)
%8 = bitcast [64 x i32]* %4 to i8*
%9 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%10 = call i32 @SHA512(i32* %6, i32 64, i32* %9)
%11 = call i32 @key_descriptor_to_hex(i32* %9, i8* %1)
%12 = call i32 @secure_wipe(i32* %6, i32 64)
%13 = call i32 @secure_wipe(i32* %9, i32 64)
ret void
}