#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 */

/* Variables and functions */
int /*<<< orphan*/ hmac_sha512(unsigned char const *, unsigned int,
                               unsigned char const *, int, unsigned char *,
                               int);
scalar_t__ strlen(char *);
char *hmac_sha512_str(char dest[(512 / 8) * 2 + 1], char *key,
                      unsigned int key_size, char *message) {
  int init_hexbytes_noT(char *hexbytes, unsigned char *message, long len);
  unsigned char mac[(512 / 8)];
  hmac_sha512((const unsigned char *)key, key_size,
              (const unsigned char *)message, (int)strlen(message), mac,
              (512 / 8));
  init_hexbytes_noT(dest, mac, (512 / 8));
  return (dest);
}


x86 assembly (clang, -O0):
<hmac_sha512_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    -0x6c(%rbp),%esi
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
lea    -0x60(%rbp),%r8
mov    $0x40,%r9d
call   1050 <hmac_sha512@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x40,%edx
call   1040 <init_hexbytes_noT@plt>
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hmac_sha512_str>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    %rcx,%rdi
call   1030 <strlen@plt>
mov    %rsp,%r12
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %r12,%r8
mov    $0x40,%r9d
call   1050 <hmac_sha512@plt>
mov    $0x40,%edx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1040 <init_hexbytes_noT@plt>
mov    %rbp,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @hmac_sha512_str(i8* %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [64 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i8*, i8** %8
%13 = load i8*, i8** %8
%14 = call i64 @strlen(i8* %13)
%15 = trunc i64 %14 to i32
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%17 = call i32 @hmac_sha512(i8* %10, i32 %11, i8* %12, i32 %15, i8* %16, i32 64)
%18 = load i8*, i8** %5
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%20 = call i32 @init_hexbytes_noT(i8* %18, i8* %19, i64 64)
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @hmac_sha512_str(i8* returned %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca [64 x i8]
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%8 = trunc i64 %7 to i32
%9 = call i32 @hmac_sha512(i8* %1, i32 %2, i8* %3, i32 %8, i8* %6, i32 64)
%10 = call i32 @init_hexbytes_noT(i8* %0, i8* %6, i64 64)
ret i8* %0
}