#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ util_sha256(char *, int, char *);
int /*<<< orphan*/ util_tohex(char *, int, char *);
void ILibStun_ComputeIntegrityKey(char *user, char *secret, char *key) {
  char buf[40];
  char result[32];
  memcpy(buf, user, 8);
  memcpy(buf + 8, secret, 32);
  util_sha256(buf, 40, result);
  util_tohex(result, 16, key);
}


x86 assembly (clang, -O0):
<ILibStun_ComputeIntegrityKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    $0x28,%esi
call   1050 <util_sha256@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x10,%esi
call   1030 <util_tohex@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILibStun_ComputeIntegrityKey>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    0x30(%rsp),%rbx
mov    %r15,%rdi
mov    $0x28,%esi
mov    %rbx,%rdx
call   1050 <util_sha256@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
mov    %r14,%rdx
call   1030 <util_tohex@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ILibStun_ComputeIntegrityKey(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [40 x i8]
%8 = alloca [32 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @memcpy(i8* %9, i8* %10, i32 8)
%12 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds i8, i8* %12, i64 8
%14 = load i8*, i8** %5
%15 = call i32 @memcpy(i8* %13, i8* %14, i32 32)
%16 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%18 = call i32 @util_sha256(i8* %16, i32 40, i8* %17)
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%20 = load i8*, i8** %6
%21 = call i32 @util_tohex(i8* %19, i32 16, i8* %20)
ret void
}

LLVM IR (-O2):
define void @ILibStun_ComputeIntegrityKey(i8* %0, i8* %1, i8* %2) {
%4 = alloca [40 x i8]
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%8 = call i32 @memcpy(i8* %6, i8* %0, i32 8)
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 8
%10 = call i32 @memcpy(i8* %9, i8* %1, i32 32)
%11 = call i32 @util_sha256(i8* %6, i32 40, i8* %7)
%12 = call i32 @util_tohex(i8* %7, i32 16, i8* %2)
ret void
}