#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*/ uint64_t;
typedef int /*<<< orphan*/ keybytes;
typedef int /*<<< orphan*/ X509_NAME;
typedef int /*<<< orphan*/ OCSP_CERTID;
typedef int /*<<< orphan*/ OCSP_BASICRESP;
typedef int /*<<< orphan*/ ASN1_TIME;
typedef int /*<<< orphan*/ ASN1_INTEGER;
typedef int /*<<< orphan*/ ASN1_BIT_STRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_BIT_STRING_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ASN1_BIT_STRING_new();
int /*<<< orphan*/ ASN1_BIT_STRING_set(int /*<<< orphan*/ *, unsigned char *,
                                       int);
int /*<<< orphan*/ ASN1_INTEGER_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ASN1_INTEGER_new();
int /*<<< orphan*/ ASN1_INTEGER_set_uint64(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/);
int /*<<< orphan*/ ASN1_TIME_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *ASN1_TIME_set(int /*<<< orphan*/ *, scalar_t__);
int /*<<< orphan*/ EVP_sha256();
int /*<<< orphan*/ MBSTRING_ASC;
int /*<<< orphan*/ NID_commonName;
int /*<<< orphan*/ OCSP_BASICRESP_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *OCSP_BASICRESP_new();
int /*<<< orphan*/ OCSP_CERTID_free(int /*<<< orphan*/ *);
int /*<<< orphan*/
OCSP_basic_add1_status(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
int /*<<< orphan*/ *OCSP_cert_id_new(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ V_OCSP_CERTSTATUS_UNKNOWN;
int /*<<< orphan*/ X509_NAME_add_entry_by_NID(int /*<<< orphan*/ *,
                                              int /*<<< orphan*/,
                                              int /*<<< orphan*/,
                                              unsigned char const *, int, int,
                                              int);
int /*<<< orphan*/ X509_NAME_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_NAME_new();
scalar_t__ time(int /*<<< orphan*/ *);
OCSP_BASICRESP *make_dummy_resp(void) {
  const unsigned char namestr[] = "openssl.example.com";
  unsigned char keybytes[128] = {7};
  OCSP_BASICRESP *bs = OCSP_BASICRESP_new();
  OCSP_BASICRESP *bs_out = NULL;
  OCSP_CERTID *cid = NULL;
  ASN1_TIME *thisupd = ASN1_TIME_set(NULL, time(NULL));
  ASN1_TIME *nextupd = ASN1_TIME_set(NULL, time(NULL) + 200);
  X509_NAME *name = X509_NAME_new();
  ASN1_BIT_STRING *key = ASN1_BIT_STRING_new();
  ASN1_INTEGER *serial = ASN1_INTEGER_new();
  if (!X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC, namestr,
                                  -1, -1, 1) ||
      !ASN1_BIT_STRING_set(key, keybytes, sizeof(keybytes)) ||
      !ASN1_INTEGER_set_uint64(serial, (uint64_t)1))
    goto err;
  cid = OCSP_cert_id_new(EVP_sha256(), name, key, serial);
  if (bs == NULL || thisupd == NULL || nextupd == NULL || cid == NULL ||
      !OCSP_basic_add1_status(bs, cid, V_OCSP_CERTSTATUS_UNKNOWN, 0, NULL,
                              thisupd, nextupd))
    goto err;
  bs_out = bs;
  bs = NULL;
err:
  ASN1_TIME_free(thisupd);
  ASN1_TIME_free(nextupd);
  ASN1_BIT_STRING_free(key);
  ASN1_INTEGER_free(serial);
  OCSP_CERTID_free(cid);
  OCSP_BASICRESP_free(bs);
  X509_NAME_free(name);
  return bs_out;
}


x86 assembly (clang, -O0):
<make_dummy_resp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    0xdbe(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xdbb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xdb9(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1080 <memset@plt>
movb   $0x7,-0xa0(%rbp)
mov    $0x0,%al
call   10f0 <OCSP_BASICRESP_new@plt>
mov    %rax,-0xa8(%rbp)
movq   $0x0,-0xb0(%rbp)
movq   $0x0,-0xb8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1090 <ASN1_TIME_set@plt>
mov    %rax,-0xc0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <time@plt>
mov    %rax,%rsi
add    $0xc8,%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1090 <ASN1_TIME_set@plt>
mov    %rax,-0xc8(%rbp)
mov    $0x0,%al
call   10e0 <X509_NAME_new@plt>
mov    %rax,-0xd0(%rbp)
mov    $0x0,%al
call   1070 <ASN1_BIT_STRING_new@plt>
mov    %rax,-0xd8(%rbp)
mov    $0x0,%al
call   1060 <ASN1_INTEGER_new@plt>
mov    %rax,-0xe0(%rbp)
mov    -0xd0(%rbp),%rdi
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
mov    0x2cd0(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0xffffffff,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
call   1050 <X509_NAME_add_entry_by_NID@plt>
cmp    $0x0,%eax
je     1377 <make_dummy_resp+0x147>
mov    -0xd8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x80,%edx
call   1130 <ASN1_BIT_STRING_set@plt>
cmp    $0x0,%eax
je     1377 <make_dummy_resp+0x147>
mov    -0xe0(%rbp),%rdi
mov    $0x1,%esi
call   1100 <ASN1_INTEGER_set_uint64@plt>
cmp    $0x0,%eax
jne    137c <make_dummy_resp+0x14c>
jmp    1438 <make_dummy_resp+0x208>
mov    $0x0,%al
call   1140 <EVP_sha256@plt>
mov    %eax,%edi
mov    -0xd0(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
mov    -0xe0(%rbp),%rcx
call   10a0 <OCSP_cert_id_new@plt>
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
je     141a <make_dummy_resp+0x1ea>
cmpq   $0x0,-0xc0(%rbp)
je     141a <make_dummy_resp+0x1ea>
cmpq   $0x0,-0xc8(%rbp)
je     141a <make_dummy_resp+0x1ea>
cmpq   $0x0,-0xb8(%rbp)
je     141a <make_dummy_resp+0x1ea>
mov    -0xa8(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
mov    0x2be5(%rip),%rax
mov    (%rax),%edx
mov    -0xc0(%rbp),%r9
mov    -0xc8(%rbp),%rax
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rax,(%rsp)
call   10b0 <OCSP_basic_add1_status@plt>
cmp    $0x0,%eax
jne    141f <make_dummy_resp+0x1ef>
jmp    1438 <make_dummy_resp+0x208>
mov    -0xa8(%rbp),%rax
mov    %rax,-0xb0(%rbp)
movq   $0x0,-0xa8(%rbp)
mov    -0xc0(%rbp),%rdi
call   1110 <ASN1_TIME_free@plt>
mov    -0xc8(%rbp),%rdi
call   1110 <ASN1_TIME_free@plt>
mov    -0xd8(%rbp),%rdi
call   10c0 <ASN1_BIT_STRING_free@plt>
mov    -0xe0(%rbp),%rdi
call   1120 <ASN1_INTEGER_free@plt>
mov    -0xb8(%rbp),%rdi
call   1030 <OCSP_CERTID_free@plt>
mov    -0xa8(%rbp),%rdi
call   1040 <OCSP_BASICRESP_free@plt>
mov    -0xd0(%rbp),%rdi
call   1150 <X509_NAME_free@plt>
mov    -0xb0(%rbp),%rax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dummy_resp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
movaps 0xdc8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x6d6f63,0x30(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movb   $0x7,0x40(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
call   10e0 <OCSP_BASICRESP_new@plt>
mov    %rax,0x8(%rsp)
xor    %edi,%edi
call   10c0 <time@plt>
xor    %edi,%edi
mov    %rax,%rsi
call   1080 <ASN1_TIME_set@plt>
mov    %rax,%r13
xor    %edi,%edi
call   10c0 <time@plt>
lea    0xc8(%rax),%rsi
xor    %edi,%edi
call   1080 <ASN1_TIME_set@plt>
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   10d0 <X509_NAME_new@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <ASN1_BIT_STRING_new@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1060 <ASN1_INTEGER_new@plt>
mov    %rax,%r14
mov    0x2ced(%rip),%rax
mov    (%rax),%esi
mov    0x2cfc(%rip),%rax
mov    (%rax),%edx
movl   $0x1,(%rsp)
lea    0x20(%rsp),%rcx
mov    %rbx,%rdi
mov    $0xffffffff,%r8d
mov    $0xffffffff,%r9d
call   1050 <X509_NAME_add_entry_by_NID@plt>
test   %eax,%eax
je     13ce <make_dummy_resp+0x1ae>
lea    0x40(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x80,%edx
call   1120 <ASN1_BIT_STRING_set@plt>
test   %eax,%eax
je     13cb <make_dummy_resp+0x1ab>
mov    %r14,%rdi
mov    $0x1,%esi
call   10f0 <ASN1_INTEGER_set_uint64@plt>
test   %eax,%eax
je     13cb <make_dummy_resp+0x1ab>
xor    %r15d,%r15d
xor    %eax,%eax
call   1130 <EVP_sha256@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1090 <OCSP_cert_id_new@plt>
mov    %rax,%r12
cmpq   $0x0,0x8(%rsp)
je     13d1 <make_dummy_resp+0x1b1>
test   %r13,%r13
je     13d1 <make_dummy_resp+0x1b1>
cmpq   $0x0,0x10(%rsp)
je     13d1 <make_dummy_resp+0x1b1>
test   %r12,%r12
je     13d1 <make_dummy_resp+0x1b1>
mov    0x2c55(%rip),%rax
mov    (%rax),%edx
mov    0x10(%rsp),%rax
mov    %rax,(%rsp)
mov    %r13,0x18(%rsp)
mov    0x8(%rsp),%r13
mov    %r13,%rdi
mov    %r12,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    0x18(%rsp),%r9
call   10a0 <OCSP_basic_add1_status@plt>
test   %eax,%eax
mov    %r13,%r15
mov    $0x0,%eax
cmove  %rax,%r15
cmovne %rax,%r13
mov    %r13,0x8(%rsp)
mov    0x18(%rsp),%r13
jmp    13d1 <make_dummy_resp+0x1b1>
xor    %r12d,%r12d
xor    %r15d,%r15d
mov    %r13,%rdi
call   1100 <ASN1_TIME_free@plt>
mov    0x10(%rsp),%rdi
call   1100 <ASN1_TIME_free@plt>
mov    %rbp,%rdi
call   10b0 <ASN1_BIT_STRING_free@plt>
mov    %r14,%rdi
call   1110 <ASN1_INTEGER_free@plt>
mov    %r12,%rdi
call   1030 <OCSP_CERTID_free@plt>
mov    0x8(%rsp),%rdi
call   1040 <OCSP_BASICRESP_free@plt>
mov    %rbx,%rdi
call   1140 <X509_NAME_free@plt>
mov    %r15,%rax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.make_dummy_resp.namestr = [20 x i8] c"openssl.example.com\00"
@NID_commonName = global i32 0
@MBSTRING_ASC = global i32 0
@V_OCSP_CERTSTATUS_UNKNOWN = global i32 0
define i32* @make_dummy_resp() {
%1 = alloca [20 x i8]
%2 = alloca [128 x i8]
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = bitcast [20 x i8]* %1 to i8*
%12 = bitcast [128 x i8]* %2 to i8*
%13 = bitcast i8* %12 to <{ i8, [127 x i8] }>*
%14 = getelementptr inbounds <{ i8, [127 x i8] }>, <{ i8, [127 x i8] }>* %13, i32 0, i32 0
store i8 7, i8* %14
%15 = call i32* (...) @OCSP_BASICRESP_new()
store i32* %15, i32** %3
store i32* null, i32** %4
store i32* null, i32** %5
%16 = call i64 @time(i32* null)
%17 = call i32* @ASN1_TIME_set(i32* null, i64 %16)
store i32* %17, i32** %6
%18 = call i64 @time(i32* null)
%19 = add nsw i64 %18, 200
%20 = call i32* @ASN1_TIME_set(i32* null, i64 %19)
store i32* %20, i32** %7
%21 = call i32* (...) @X509_NAME_new()
store i32* %21, i32** %8
%22 = call i32* (...) @ASN1_BIT_STRING_new()
store i32* %22, i32** %9
%23 = call i32* (...) @ASN1_INTEGER_new()
store i32* %23, i32** %10
%24 = load i32*, i32** %8
%25 = load i32, i32* @NID_commonName
%26 = load i32, i32* @MBSTRING_ASC
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%28 = call i32 @X509_NAME_add_entry_by_NID(i32* %24, i32 %25, i32 %26, i8* %27, i32 -1, i32 -1, i32 1)
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %0
%31 = load i32*, i32** %9
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%33 = call i32 @ASN1_BIT_STRING_set(i32* %31, i8* %32, i32 128)
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = load i32*, i32** %10
%37 = call i32 @ASN1_INTEGER_set_uint64(i32* %36, i32 1)
%38 = icmp ne i32 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %35, %30, %0
br label %68
40: ; preds = %35
%41 = call i32 (...) @EVP_sha256()
%42 = load i32*, i32** %8
%43 = load i32*, i32** %9
%44 = load i32*, i32** %10
%45 = call i32* @OCSP_cert_id_new(i32 %41, i32* %42, i32* %43, i32* %44)
store i32* %45, i32** %5
%46 = load i32*, i32** %3
%47 = icmp eq i32* %46, null
br i1 %47, label %65, label %48
48: ; preds = %40
%49 = load i32*, i32** %6
%50 = icmp eq i32* %49, null
br i1 %50, label %65, label %51
51: ; preds = %48
%52 = load i32*, i32** %7
%53 = icmp eq i32* %52, null
br i1 %53, label %65, label %54
54: ; preds = %51
%55 = load i32*, i32** %5
%56 = icmp eq i32* %55, null
br i1 %56, label %65, label %57
57: ; preds = %54
%58 = load i32*, i32** %3
%59 = load i32*, i32** %5
%60 = load i32, i32* @V_OCSP_CERTSTATUS_UNKNOWN
%61 = load i32*, i32** %6
%62 = load i32*, i32** %7
%63 = call i32 @OCSP_basic_add1_status(i32* %58, i32* %59, i32 %60, i32 0, i32* null, i32* %61, i32* %62)
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %57, %54, %51, %48, %40
br label %68
66: ; preds = %57
%67 = load i32*, i32** %3
store i32* %67, i32** %4
store i32* null, i32** %3
br label %68
68: ; preds = %66, %65, %39
%69 = load i32*, i32** %6
%70 = call i32 @ASN1_TIME_free(i32* %69)
%71 = load i32*, i32** %7
%72 = call i32 @ASN1_TIME_free(i32* %71)
%73 = load i32*, i32** %9
%74 = call i32 @ASN1_BIT_STRING_free(i32* %73)
%75 = load i32*, i32** %10
%76 = call i32 @ASN1_INTEGER_free(i32* %75)
%77 = load i32*, i32** %5
%78 = call i32 @OCSP_CERTID_free(i32* %77)
%79 = load i32*, i32** %3
%80 = call i32 @OCSP_BASICRESP_free(i32* %79)
%81 = load i32*, i32** %8
%82 = call i32 @X509_NAME_free(i32* %81)
%83 = load i32*, i32** %4
ret i32* %83
}

LLVM IR (-O2):
@__const.make_dummy_resp.namestr = [20 x i8] c"openssl.example.com\00"
@NID_commonName = global i32 0
@MBSTRING_ASC = global i32 0
@V_OCSP_CERTSTATUS_UNKNOWN = global i32 0
define i32* @make_dummy_resp() {
%1 = alloca [20 x i8]
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
store i8 7, i8* %4
%5 = tail call i32* (...) @OCSP_BASICRESP_new()
%6 = tail call i64 @time(i32* null)
%7 = tail call i32* @ASN1_TIME_set(i32* null, i64 %6)
%8 = tail call i64 @time(i32* null)
%9 = add nsw i64 %8, 200
%10 = tail call i32* @ASN1_TIME_set(i32* null, i64 %9)
%11 = tail call i32* (...) @X509_NAME_new()
%12 = tail call i32* (...) @ASN1_BIT_STRING_new()
%13 = tail call i32* (...) @ASN1_INTEGER_new()
%14 = load i32, i32* @NID_commonName
%15 = load i32, i32* @MBSTRING_ASC
%16 = call i32 @X509_NAME_add_entry_by_NID(i32* %11, i32 %14, i32 %15, i8* %3, i32 -1, i32 -1, i32 1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %0
%19 = call i32 @ASN1_BIT_STRING_set(i32* %12, i8* %4, i32 128)
%20 = icmp eq i32 %19, 0
br i1 %20, label %40, label %21
21: ; preds = %18
%22 = call i32 @ASN1_INTEGER_set_uint64(i32* %13, i32 1)
%23 = icmp eq i32 %22, 0
br i1 %23, label %40, label %24
24: ; preds = %21
%25 = call i32 (...) @EVP_sha256()
%26 = call i32* @OCSP_cert_id_new(i32 %25, i32* %11, i32* %12, i32* %13)
%27 = icmp eq i32* %5, null
%28 = icmp eq i32* %7, null
%29 = select i1 %27, i1 true, i1 %28
%30 = icmp eq i32* %10, null
%31 = select i1 %29, i1 true, i1 %30
%32 = icmp eq i32* %26, null
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %40, label %34
34: ; preds = %24
%35 = load i32, i32* @V_OCSP_CERTSTATUS_UNKNOWN
%36 = call i32 @OCSP_basic_add1_status(i32* %5, i32* %26, i32 %35, i32 0, i32* null, i32* %7, i32* %10)
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i32* null, i32* %5
%39 = select i1 %37, i32* %5, i32* null
br label %40
40: ; preds = %34, %24, %0, %18, %21
%41 = phi i32* [ %26, %24 ], [ null, %21 ], [ null, %18 ], [ null, %0 ], [ %26, %34 ]
%42 = phi i32* [ null, %24 ], [ null, %21 ], [ null, %18 ], [ null, %0 ], [ %38, %34 ]
%43 = phi i32* [ %5, %24 ], [ %5, %21 ], [ %5, %18 ], [ %5, %0 ], [ %39, %34 ]
%44 = call i32 @ASN1_TIME_free(i32* %7)
%45 = call i32 @ASN1_TIME_free(i32* %10)
%46 = call i32 @ASN1_BIT_STRING_free(i32* %12)
%47 = call i32 @ASN1_INTEGER_free(i32* %13)
%48 = call i32 @OCSP_CERTID_free(i32* %41)
%49 = call i32 @OCSP_BASICRESP_free(i32* %43)
%50 = call i32 @X509_NAME_free(i32* %11)
ret i32* %42
}