#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_LOOKUP;

/* Variables and functions */
long X509_FILETYPE_PEM;
int X509_L_FILE_LOAD;
scalar_t__ X509_load_cert_crl_mem(int /*<<< orphan*/ *, char const *, long);
int by_mem_ctrl(X509_LOOKUP *ctx, int cmd, const char *str, long argl,
                char **ret) {
  int status = 0;
  if (cmd == X509_L_FILE_LOAD) {
    if (argl == X509_FILETYPE_PEM)
      return X509_load_cert_crl_mem(ctx, str, X509_FILETYPE_PEM) != 0;
  }
  return status;
}


x86 assembly (clang, -O0):
<by_mem_ctrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%eax
jne    1188 <by_mem_ctrl+0x78>
mov    -0x28(%rbp),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
jne    1183 <by_mem_ctrl+0x73>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x2e89(%rip),%rax
mov    (%rax),%rdx
call   1030 <X509_load_cert_crl_mem@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <by_mem_ctrl+0x7e>
jmp    1188 <by_mem_ctrl+0x78>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<by_mem_ctrl>:
push   %rax
mov    0x2ec8(%rip),%r8
xor    %eax,%eax
cmp    %esi,(%r8)
jne    1141 <by_mem_ctrl+0x31>
mov    0x2eca(%rip),%rsi
cmp    %rcx,(%rsi)
jne    1141 <by_mem_ctrl+0x31>
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <X509_load_cert_crl_mem@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@X509_L_FILE_LOAD = global i32 0
@X509_FILETYPE_PEM = global i64 0
define i32 @by_mem_ctrl(i32* %0, i32 %1, i8* %2, i64 %3, i8** %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8**
%12 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8** %4, i8*** %11
store i32 0, i32* %12
%13 = load i32, i32* %8
%14 = load i32, i32* @X509_L_FILE_LOAD
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %5
%17 = load i64, i64* %10
%18 = load i64, i64* @X509_FILETYPE_PEM
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %27
20: ; preds = %16
%21 = load i32*, i32** %7
%22 = load i8*, i8** %9
%23 = load i64, i64* @X509_FILETYPE_PEM
%24 = call i64 @X509_load_cert_crl_mem(i32* %21, i8* %22, i64 %23)
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
store i32 %26, i32* %6
br label %30
27: ; preds = %16
br label %28
28: ; preds = %27, %5
%29 = load i32, i32* %12
store i32 %29, i32* %6
br label %30
30: ; preds = %28, %20
%31 = load i32, i32* %6
ret i32 %31
}

LLVM IR (-O2):
@X509_L_FILE_LOAD = global i32 0
@X509_FILETYPE_PEM = global i64 0
define i32 @by_mem_ctrl(i32* %0, i32 %1, i8* %2, i64 %3, i8** nocapture readnone %4) {
%6 = load i32, i32* @X509_L_FILE_LOAD
%7 = icmp eq i32 %6, %1
%8 = load i64, i64* @X509_FILETYPE_PEM
%9 = icmp eq i64 %8, %3
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = tail call i64 @X509_load_cert_crl_mem(i32* %0, i8* %2, i64 %3)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %5, %11
%16 = phi i32 [ %14, %11 ], [ 0, %5 ]
ret i32 %16
}