#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*/ EVP_PKEY;
typedef int /*<<< orphan*/ ASN1_OCTET_STRING;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_OCTET_STRING_new();
int /*<<< orphan*/ ASN1_OCTET_STRING_set(int /*<<< orphan*/ *,
                                         unsigned char const *, int);
int /*<<< orphan*/ EVP_PKEY_HMAC;
int /*<<< orphan*/ EVP_PKEY_assign(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *);
int old_hmac_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) {
  ASN1_OCTET_STRING *os;
  os = ASN1_OCTET_STRING_new();
  if (!os || !ASN1_OCTET_STRING_set(os, *pder, derlen))
    return 0;
  EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os);
  return 1;
}


x86 assembly (clang, -O0):
<old_hmac_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <ASN1_OCTET_STRING_new@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1175 <old_hmac_decode+0x45>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <ASN1_OCTET_STRING_set@plt>
cmp    $0x0,%eax
jne    1181 <old_hmac_decode+0x51>
movl   $0x0,-0x4(%rbp)
jmp    119e <old_hmac_decode+0x6e>
mov    -0x10(%rbp),%rdi
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rdx
call   1050 <EVP_PKEY_assign@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_hmac_decode>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <ASN1_OCTET_STRING_new@plt>
test   %rax,%rax
je     117e <old_hmac_decode+0x4e>
mov    %rax,%rbx
mov    (%r12),%rsi
mov    %rax,%rdi
mov    %r15d,%edx
call   1040 <ASN1_OCTET_STRING_set@plt>
test   %eax,%eax
je     117e <old_hmac_decode+0x4e>
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <EVP_PKEY_assign@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EVP_PKEY_HMAC = global i32 0
define i32 @old_hmac_decode(i32* %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32*
store i32* %0, i32** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%9 = call i32* (...) @ASN1_OCTET_STRING_new()
store i32* %9, i32** %8
%10 = load i32*, i32** %8
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load i32*, i32** %8
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = load i32, i32* %7
%17 = call i32 @ASN1_OCTET_STRING_set(i32* %13, i8* %15, i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %12, %3
store i32 0, i32* %4
br label %25
20: ; preds = %12
%21 = load i32*, i32** %5
%22 = load i32, i32* @EVP_PKEY_HMAC
%23 = load i32*, i32** %8
%24 = call i32 @EVP_PKEY_assign(i32* %21, i32 %22, i32* %23)
store i32 1, i32* %4
br label %25
25: ; preds = %20, %19
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@EVP_PKEY_HMAC = global i32 0
define i32 @old_hmac_decode(i32* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i32* (...) @ASN1_OCTET_STRING_new()
%5 = icmp eq i32* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = load i8*, i8** %1
%8 = tail call i32 @ASN1_OCTET_STRING_set(i32* %4, i8* %7, i32 %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load i32, i32* @EVP_PKEY_HMAC
%12 = tail call i32 @EVP_PKEY_assign(i32* %0, i32 %11, i32* %4)
br label %13
13: ; preds = %3, %6, %10
%14 = phi i32 [ 1, %10 ], [ 0, %6 ], [ 0, %3 ]
ret i32 %14
}