#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*/ OCSP_SINGLERESP;
typedef int /*<<< orphan*/ OCSP_CERTID;
typedef int /*<<< orphan*/ OCSP_BASICRESP;
typedef int /*<<< orphan*/ ASN1_GENERALIZEDTIME;

/* Variables and functions */
int OCSP_resp_find(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *OCSP_resp_get0(int /*<<< orphan*/ *, int);
int OCSP_single_get0_status(int /*<<< orphan*/ *, int *, int /*<<< orphan*/ **,
                            int /*<<< orphan*/ **, int /*<<< orphan*/ **);
int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
                          int *reason, ASN1_GENERALIZEDTIME **revtime,
                          ASN1_GENERALIZEDTIME **thisupd,
                          ASN1_GENERALIZEDTIME **nextupd) {
  int i;
  OCSP_SINGLERESP *single;
  i = OCSP_resp_find(bs, id, -1);
  if (i < 0)
    return 0;
  single = OCSP_resp_get0(bs, i);
  i = OCSP_single_get0_status(single, reason, revtime, thisupd, nextupd);
  if (status)
    *status = i;
  return 1;
}


x86 assembly (clang, -O0):
<OCSP_resp_find_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0xffffffff,%edx
call   1050 <OCSP_resp_find@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    117f <OCSP_resp_find_status+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    11c6 <OCSP_resp_find_status+0x96>
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1030 <OCSP_resp_get0@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1040 <OCSP_single_get0_status@plt>
mov    %eax,-0x3c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11bf <OCSP_resp_find_status+0x8f>
mov    -0x3c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OCSP_resp_find_status>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rdi,%rbx
mov    $0xffffffff,%edx
call   1050 <OCSP_resp_find@plt>
test   %eax,%eax
js     118d <OCSP_resp_find_status+0x5d>
mov    0x40(%rsp),%rbp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <OCSP_resp_get0@plt>
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rbp,%r8
call   1040 <OCSP_single_get0_status@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %r13,%r13
je     118f <OCSP_resp_find_status+0x5f>
mov    %ecx,0x0(%r13)
jmp    118f <OCSP_resp_find_status+0x5f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @OCSP_resp_find_status(i32* %0, i32* %1, i32* %2, i32* %3, i32** %4, i32** %5, i32** %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32**
%14 = alloca i32**
%15 = alloca i32**
%16 = alloca i32
%17 = alloca i32*
store i32* %0, i32** %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i32** %4, i32*** %13
store i32** %5, i32*** %14
store i32** %6, i32*** %15
%18 = load i32*, i32** %9
%19 = load i32*, i32** %10
%20 = call i32 @OCSP_resp_find(i32* %18, i32* %19, i32 -1)
store i32 %20, i32* %16
%21 = load i32, i32* %16
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %7
store i32 0, i32* %8
br label %40
24: ; preds = %7
%25 = load i32*, i32** %9
%26 = load i32, i32* %16
%27 = call i32* @OCSP_resp_get0(i32* %25, i32 %26)
store i32* %27, i32** %17
%28 = load i32*, i32** %17
%29 = load i32*, i32** %12
%30 = load i32**, i32*** %13
%31 = load i32**, i32*** %14
%32 = load i32**, i32*** %15
%33 = call i32 @OCSP_single_get0_status(i32* %28, i32* %29, i32** %30, i32** %31, i32** %32)
store i32 %33, i32* %16
%34 = load i32*, i32** %11
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %39
36: ; preds = %24
%37 = load i32, i32* %16
%38 = load i32*, i32** %11
store i32 %37, i32* %38
br label %39
39: ; preds = %36, %24
store i32 1, i32* %8
br label %40
40: ; preds = %39, %23
%41 = load i32, i32* %8
ret i32 %41
}

LLVM IR (-O2):
define i32 @OCSP_resp_find_status(i32* %0, i32* %1, i32* writeonly %2, i32* %3, i32** %4, i32** %5, i32** %6) {
%8 = tail call i32 @OCSP_resp_find(i32* %0, i32* %1, i32 -1)
%9 = icmp slt i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = tail call i32* @OCSP_resp_get0(i32* %0, i32 %8)
%12 = tail call i32 @OCSP_single_get0_status(i32* %11, i32* %3, i32** %4, i32** %5, i32** %6)
%13 = icmp eq i32* %2, null
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 %12, i32* %2
br label %15
15: ; preds = %10, %14, %7
%16 = phi i32 [ 0, %7 ], [ 1, %14 ], [ 1, %10 ]
ret i32 %16
}