#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*/ X509_STORE_CTX;

/* Variables and functions */
int X509_STORE_CTX_get_error(int /*<<< orphan*/ *);
int X509_V_ERR_NO_EXPLICIT_POLICY;
int X509_V_OK;
int /*<<< orphan*/ policies_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int cms_cb(int ok, X509_STORE_CTX *ctx) {
  int error;
  error = X509_STORE_CTX_get_error(ctx);
  if ((error != X509_V_ERR_NO_EXPLICIT_POLICY) &&
      ((error != X509_V_OK) || (ok != 2)))
    return ok;
  policies_print(NULL, ctx);
  return ok;
}


x86 assembly (clang, -O0):
<cms_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <X509_STORE_CTX_get_error@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%eax
je     1174 <cms_cb+0x54>
mov    -0x14(%rbp),%eax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
jne    1169 <cms_cb+0x49>
cmpl   $0x2,-0x8(%rbp)
je     1174 <cms_cb+0x54>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1187 <cms_cb+0x67>
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <policies_print@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cms_cb>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <X509_STORE_CTX_get_error@plt>
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%eax
je     114b <cms_cb+0x2b>
cmp    $0x2,%ebp
jne    1155 <cms_cb+0x35>
mov    0x2eb1(%rip),%rcx
cmp    (%rcx),%eax
jne    1155 <cms_cb+0x35>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <policies_print@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@X509_V_ERR_NO_EXPLICIT_POLICY = global i32 0
@X509_V_OK = global i32 0
define i32 @cms_cb(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 @X509_STORE_CTX_get_error(i32* %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* @X509_V_ERR_NO_EXPLICIT_POLICY
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %2
%13 = load i32, i32* %6
%14 = load i32, i32* @X509_V_OK
%15 = icmp ne i32 %13, %14
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 2
br i1 %18, label %19, label %21
19: ; preds = %16, %12
%20 = load i32, i32* %4
store i32 %20, i32* %3
br label %25
21: ; preds = %16, %2
%22 = load i32*, i32** %5
%23 = call i32 @policies_print(i32* null, i32* %22)
%24 = load i32, i32* %4
store i32 %24, i32* %3
br label %25
25: ; preds = %21, %19
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@X509_V_ERR_NO_EXPLICIT_POLICY = global i32 0
@X509_V_OK = global i32 0
define i32 @cms_cb(i32 returned %0, i32* %1) {
%3 = tail call i32 @X509_STORE_CTX_get_error(i32* %1)
%4 = load i32, i32* @X509_V_ERR_NO_EXPLICIT_POLICY
%5 = icmp eq i32 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @X509_V_OK
%8 = icmp ne i32 %3, %7
%9 = icmp ne i32 %0, 2
%10 = or i1 %9, %8
br i1 %10, label %13, label %11
11: ; preds = %6, %2
%12 = tail call i32 @policies_print(i32* null, i32* %1)
br label %13
13: ; preds = %6, %11
ret i32 %0
}