#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 */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  TYPE_1__ *spkac;
};
struct TYPE_4__ {
  int /*<<< orphan*/ pubkey;
};
typedef TYPE_2__ NETSCAPE_SPKI;
typedef int /*<<< orphan*/ EVP_PKEY;

/* Variables and functions */
int X509_PUBKEY_set(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey) {
  if ((x == NULL) || (x->spkac == NULL))
    return (0);
  return (X509_PUBKEY_set(&(x->spkac->pubkey), pkey));
}


x86 assembly (clang, -O0):
<NETSCAPE_SPKI_set_pubkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <NETSCAPE_SPKI_set_pubkey+0x29>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1145 <NETSCAPE_SPKI_set_pubkey+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1158 <NETSCAPE_SPKI_set_pubkey+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <X509_PUBKEY_set@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NETSCAPE_SPKI_set_pubkey>:
test   %rdi,%rdi
je     1122 <NETSCAPE_SPKI_set_pubkey+0x12>
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1122 <NETSCAPE_SPKI_set_pubkey+0x12>
jmp    1030 <X509_PUBKEY_set@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__* }
%struct.TYPE_4__ = type { i32 }
define i32 @NETSCAPE_SPKI_set_pubkey(%struct.TYPE_5__* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32* %1, i32** %5
%6 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%7 = icmp eq %struct.TYPE_5__* %6, null
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %9, i32 0, i32 0
%11 = load %struct.TYPE_4__*, %struct.TYPE_4__** %10
%12 = icmp eq %struct.TYPE_4__* %11, null
br i1 %12, label %13, label %14
13: ; preds = %8, %2
store i32 0, i32* %3
br label %21
14: ; preds = %8
%15 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
%17 = load %struct.TYPE_4__*, %struct.TYPE_4__** %16
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %17, i32 0, i32 0
%19 = load i32*, i32** %5
%20 = call i32 @X509_PUBKEY_set(i32* %18, i32* %19)
store i32 %20, i32* %3
br label %21
21: ; preds = %14, %13
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__* }
%struct.TYPE_4__ = type { i32 }
define i32 @NETSCAPE_SPKI_set_pubkey(%struct.TYPE_5__* %0, i32* %1) {
%3 = icmp eq %struct.TYPE_5__* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%6 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%7 = icmp eq %struct.TYPE_4__* %6, null
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i64 0, i32 0
%10 = tail call i32 @X509_PUBKEY_set(i32* %9, i32* %1)
br label %11
11: ; preds = %2, %4, %8
%12 = phi i32 [ %10, %8 ], [ 0, %4 ], [ 0, %2 ]
ret i32 %12
}