#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*/ TS_TST_INFO;
typedef int /*<<< orphan*/ ASN1_OBJECT;

/* Variables and functions */
scalar_t__ OBJ_cmp(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ TS_F_TS_CHECK_POLICY;
int /*<<< orphan*/ TS_R_POLICY_MISMATCH;
int /*<<< orphan*/ *TS_TST_INFO_get_policy_id(int /*<<< orphan*/ *);
int /*<<< orphan*/ TSerr(int /*<<< orphan*/, int /*<<< orphan*/);
int TS_check_policy(ASN1_OBJECT *req_oid, TS_TST_INFO *tst_info) {
  ASN1_OBJECT *resp_oid = TS_TST_INFO_get_policy_id(tst_info);
  if (OBJ_cmp(req_oid, resp_oid) != 0) {
    TSerr(TS_F_TS_CHECK_POLICY, TS_R_POLICY_MISMATCH);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<TS_check_policy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <TS_TST_INFO_get_policy_id@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <OBJ_cmp@plt>
cmp    $0x0,%rax
je     1187 <TS_check_policy+0x57>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
call   1030 <TSerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    118e <TS_check_policy+0x5e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_check_policy>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <TS_TST_INFO_get_policy_id@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <OBJ_cmp@plt>
test   %rax,%rax
je     1167 <TS_check_policy+0x37>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
call   1030 <TSerr@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@TS_F_TS_CHECK_POLICY = global i32 0
@TS_R_POLICY_MISMATCH = global i32 0
define i32 @TS_check_policy(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%7 = load i32*, i32** %5
%8 = call i32* @TS_TST_INFO_get_policy_id(i32* %7)
store i32* %8, i32** %6
%9 = load i32*, i32** %4
%10 = load i32*, i32** %6
%11 = call i64 @OBJ_cmp(i32* %9, i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i32, i32* @TS_F_TS_CHECK_POLICY
%15 = load i32, i32* @TS_R_POLICY_MISMATCH
%16 = call i32 @TSerr(i32 %14, i32 %15)
store i32 0, i32* %3
br label %18
17: ; preds = %2
store i32 1, i32* %3
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@TS_F_TS_CHECK_POLICY = global i32 0
@TS_R_POLICY_MISMATCH = global i32 0
define i32 @TS_check_policy(i32* %0, i32* %1) {
%3 = tail call i32* @TS_TST_INFO_get_policy_id(i32* %1)
%4 = tail call i64 @OBJ_cmp(i32* %0, i32* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @TS_F_TS_CHECK_POLICY
%8 = load i32, i32* @TS_R_POLICY_MISMATCH
%9 = tail call i32 @TSerr(i32 %7, i32 %8)
br label %10
10: ; preds = %2, %6
%11 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %11
}