#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_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ type;
};
typedef TYPE_1__ ASN1_INTEGER;

/* Variables and functions */
long ASN1_INTEGER_get(TYPE_1__ *);
scalar_t__ V_ASN1_NEG_INTEGER;
int policy_cache_set_int(long *out, ASN1_INTEGER *value) {
  if (value == NULL)
    return 1;
  if (value->type == V_ASN1_NEG_INTEGER)
    return 0;
  *out = ASN1_INTEGER_get(value);
  return 1;
}


x86 assembly (clang, -O0):
<policy_cache_set_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1137 <policy_cache_set_int+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1174 <policy_cache_set_int+0x64>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%rax
jne    115a <policy_cache_set_int+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1174 <policy_cache_set_int+0x64>
mov    -0x18(%rbp),%rdi
call   1030 <ASN1_INTEGER_get@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<policy_cache_set_int>:
push   %rbx
mov    $0x1,%eax
test   %rsi,%rsi
je     113f <policy_cache_set_int+0x2f>
mov    (%rsi),%rcx
mov    0x2ebb(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
je     113f <policy_cache_set_int+0x2f>
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <ASN1_INTEGER_get@plt>
mov    %rax,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

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

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