#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_NAME;
typedef int /*<<< orphan*/ X509;
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ BN_to_ASN1_INTEGER(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ EVP_sha1();
int /*<<< orphan*/ MBSTRING_ASC;
int /*<<< orphan*/ NID_authority_key_identifier;
int /*<<< orphan*/ NID_basic_constraints;
int /*<<< orphan*/ NID_key_usage;
int /*<<< orphan*/ NID_subject_key_identifier;
int /*<<< orphan*/ X509_NAME_add_entry_by_txt(int /*<<< orphan*/ *, char *,
                                              int /*<<< orphan*/,
                                              unsigned char *, int, int,
                                              int /*<<< orphan*/);
int /*<<< orphan*/ X509_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_get_notAfter(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_get_notBefore(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_get_serialNumber(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_get_subject_name(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_gmtime_adj(int /*<<< orphan*/, long);
int /*<<< orphan*/ *X509_new();
int /*<<< orphan*/ X509_set_issuer_name(int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_set_pubkey(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_set_version(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ X509_sign(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/);
int /*<<< orphan*/ _add_ext(int /*<<< orphan*/ *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ *_make_bn_from_string(unsigned char *);
unsigned char *abac_generate_serial();
int /*<<< orphan*/ assert(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
X509 *abac_generate_cert(EVP_PKEY *pkey, char *cn, long validity) {
  assert(pkey);
  X509 *cert = NULL;
  if ((cert = X509_new()) == NULL)
    goto error;
  unsigned char *serial = abac_generate_serial();
  if (validity == 0)
    validity = (long)(60 * 60 * 24 * (365));
  X509_set_version(cert, 2);
  BIGNUM *bn = _make_bn_from_string(serial);
  BN_to_ASN1_INTEGER(bn, X509_get_serialNumber(cert));
  X509_gmtime_adj(X509_get_notBefore(cert), 0);
  X509_gmtime_adj(X509_get_notAfter(cert), validity);
  X509_set_pubkey(cert, pkey);
  X509_NAME *name = X509_get_subject_name(cert);
  if (!name)
    goto error;
  if (!(X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC,
                                   (unsigned char *)cn, -1, -1, 0)))
    goto error;
  if (!(X509_set_issuer_name(cert, name)))
    goto error;
  if (!(_add_ext(cert, NID_basic_constraints, "critical,CA:TRUE")))
    goto error;
  if (!(_add_ext(cert, NID_key_usage, "critical,keyCertSign,cRLSign")))
    goto error;
  if (!(_add_ext(cert, NID_subject_key_identifier, "hash")))
    goto error;
  if (!(_add_ext(cert, NID_authority_key_identifier, "keyid:always")))
    goto error;
  if (!X509_sign(cert, pkey, EVP_sha1()))
    goto error;
  return cert;
error:
  if (cert)
    X509_free(cert);
  if (serial)
    free(serial);
  if (bn)
    BN_free(bn);
  return NULL;
}


x86 assembly (clang, -O0):
<abac_generate_cert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   10e0 <assert@plt>
movq   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1160 <X509_new@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    127f <abac_generate_cert+0x3f>
jmp    145b <abac_generate_cert+0x21b>
mov    $0x0,%al
call   1050 <abac_generate_serial@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    129d <abac_generate_cert+0x5d>
movq   $0x1e13380,-0x20(%rbp)
01
mov    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   1060 <X509_set_version@plt>
mov    -0x30(%rbp),%rdi
call   1150 <_make_bn_from_string@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
call   10b0 <X509_get_serialNumber@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1110 <BN_to_ASN1_INTEGER@plt>
mov    -0x28(%rbp),%rdi
call   10d0 <X509_get_notBefore@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <X509_gmtime_adj@plt>
mov    -0x28(%rbp),%rdi
call   1070 <X509_get_notAfter@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1030 <X509_gmtime_adj@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1130 <X509_set_pubkey@plt>
mov    -0x28(%rbp),%rdi
call   1090 <X509_get_subject_name@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1326 <abac_generate_cert+0xe6>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x40(%rbp),%rdi
mov    0x2ca7(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
lea    0xcc2(%rip),%rsi
mov    $0xffffffff,%r9d
xor    %eax,%eax
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1100 <X509_NAME_add_entry_by_txt@plt>
cmp    $0x0,%eax
jne    1363 <abac_generate_cert+0x123>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <X509_set_issuer_name@plt>
cmp    $0x0,%eax
jne    137e <abac_generate_cert+0x13e>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rdi
mov    0x2c3f(%rip),%rax
mov    (%rax),%esi
lea    0xc71(%rip),%rdx
call   10f0 <_add_ext@plt>
cmp    $0x0,%eax
jne    13a5 <abac_generate_cert+0x165>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rdi
mov    0x2c40(%rip),%rax
mov    (%rax),%esi
lea    0xc5b(%rip),%rdx
call   10f0 <_add_ext@plt>
cmp    $0x0,%eax
jne    13cc <abac_generate_cert+0x18c>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rdi
mov    0x2be1(%rip),%rax
mov    (%rax),%esi
lea    0xc51(%rip),%rdx
call   10f0 <_add_ext@plt>
cmp    $0x0,%eax
jne    13f3 <abac_generate_cert+0x1b3>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rdi
mov    0x2be2(%rip),%rax
mov    (%rax),%esi
lea    0xc2f(%rip),%rdx
call   10f0 <_add_ext@plt>
cmp    $0x0,%eax
jne    141a <abac_generate_cert+0x1da>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    $0x0,%al
call   1080 <EVP_sha1@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
call   1140 <X509_sign@plt>
cmp    $0x0,%eax
jne    144e <abac_generate_cert+0x20e>
jmp    145b <abac_generate_cert+0x21b>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    149f <abac_generate_cert+0x25f>
cmpq   $0x0,-0x28(%rbp)
je     146f <abac_generate_cert+0x22f>
mov    -0x28(%rbp),%rdi
call   1120 <X509_free@plt>
cmpq   $0x0,-0x30(%rbp)
je     1483 <abac_generate_cert+0x243>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
cmpq   $0x0,-0x38(%rbp)
je     1497 <abac_generate_cert+0x257>
mov    -0x38(%rbp),%rdi
call   10c0 <BN_free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abac_generate_cert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,0x10(%rsp)
mov    %rdi,%r15
call   10e0 <assert@plt>
xor    %eax,%eax
call   1160 <X509_new@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1050 <abac_generate_serial@plt>
mov    %rax,%r14
test   %rbx,%rbx
mov    $0x1e13380,%ebp
cmovne %rbx,%rbp
mov    %r13,%rdi
mov    $0x2,%esi
call   1060 <X509_set_version@plt>
mov    %r14,%rdi
call   1150 <_make_bn_from_string@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   10b0 <X509_get_serialNumber@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1110 <BN_to_ASN1_INTEGER@plt>
mov    %r13,%rdi
call   10d0 <X509_get_notBefore@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <X509_gmtime_adj@plt>
mov    %r13,%rdi
call   1070 <X509_get_notAfter@plt>
mov    %eax,%edi
mov    %rbp,%rsi
call   1030 <X509_gmtime_adj@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1130 <X509_set_pubkey@plt>
mov    %r13,%rdi
call   1090 <X509_get_subject_name@plt>
test   %rax,%rax
je     13bd <abac_generate_cert+0x17d>
mov    %rax,%rbp
mov    0x2ce7(%rip),%rax
mov    (%rax),%edx
movl   $0x0,(%rsp)
lea    0xcff(%rip),%rsi
mov    %rbp,%rdi
mov    0x10(%rsp),%rcx
mov    $0xffffffff,%r8d
mov    $0xffffffff,%r9d
call   1100 <X509_NAME_add_entry_by_txt@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10a0 <X509_set_issuer_name@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
mov    0x2c8c(%rip),%rax
mov    (%rax),%esi
lea    0xcbe(%rip),%rdx
mov    %r13,%rdi
call   10f0 <_add_ext@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
lea    0xcb3(%rip),%rdx
mov    %r13,%rdi
call   10f0 <_add_ext@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
mov    0x2c44(%rip),%rax
mov    (%rax),%esi
lea    0xcb4(%rip),%rdx
mov    %r13,%rdi
call   10f0 <_add_ext@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
mov    0x2c50(%rip),%rax
mov    (%rax),%esi
lea    0xc9d(%rip),%rdx
mov    %r13,%rdi
call   10f0 <_add_ext@plt>
test   %eax,%eax
je     13bd <abac_generate_cert+0x17d>
xor    %eax,%eax
call   1080 <EVP_sha1@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1140 <X509_sign@plt>
test   %eax,%eax
jne    13e2 <abac_generate_cert+0x1a2>
mov    %r13,%rdi
call   1120 <X509_free@plt>
test   %r14,%r14
je     13d2 <abac_generate_cert+0x192>
mov    %r14,%rdi
call   1040 <free@plt>
test   %r12,%r12
je     13df <abac_generate_cert+0x19f>
mov    %r12,%rdi
call   10c0 <BN_free@plt>
xor    %r13d,%r13d
mov    %r13,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"CN\00"
@MBSTRING_ASC = global i32 0
@NID_basic_constraints = global i32 0
@.str.1 = [17 x i8] c"critical,CA:TRUE\00"
@NID_key_usage = global i32 0
@.str.2 = [29 x i8] c"critical,keyCertSign,cRLSign\00"
@NID_subject_key_identifier = global i32 0
@.str.3 = [5 x i8] c"hash\00"
@NID_authority_key_identifier = global i32 0
@.str.4 = [13 x i8] c"keyid:always\00"
define i32* @abac_generate_cert(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%12 = load i32*, i32** %5
%13 = call i32 @assert(i32* %12)
store i32* null, i32** %8
%14 = call i32* (...) @X509_new()
store i32* %14, i32** %8
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %17
16: ; preds = %3
br label %92
17: ; preds = %3
%18 = call i8* (...) @abac_generate_serial()
store i8* %18, i8** %9
%19 = load i64, i64* %7
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i64 31536000, i64* %7
br label %22
22: ; preds = %21, %17
%23 = load i32*, i32** %8
%24 = call i32 @X509_set_version(i32* %23, i32 2)
%25 = load i8*, i8** %9
%26 = call i32* @_make_bn_from_string(i8* %25)
store i32* %26, i32** %10
%27 = load i32*, i32** %10
%28 = load i32*, i32** %8
%29 = call i32 @X509_get_serialNumber(i32* %28)
%30 = call i32 @BN_to_ASN1_INTEGER(i32* %27, i32 %29)
%31 = load i32*, i32** %8
%32 = call i32 @X509_get_notBefore(i32* %31)
%33 = call i32 @X509_gmtime_adj(i32 %32, i64 0)
%34 = load i32*, i32** %8
%35 = call i32 @X509_get_notAfter(i32* %34)
%36 = load i64, i64* %7
%37 = call i32 @X509_gmtime_adj(i32 %35, i64 %36)
%38 = load i32*, i32** %8
%39 = load i32*, i32** %5
%40 = call i32 @X509_set_pubkey(i32* %38, i32* %39)
%41 = load i32*, i32** %8
%42 = call i32* @X509_get_subject_name(i32* %41)
store i32* %42, i32** %11
%43 = load i32*, i32** %11
%44 = icmp ne i32* %43, null
br i1 %44, label %46, label %45
45: ; preds = %22
br label %92
46: ; preds = %22
%47 = load i32*, i32** %11
%48 = load i32, i32* @MBSTRING_ASC
%49 = load i8*, i8** %6
%50 = call i32 @X509_NAME_add_entry_by_txt(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %48, i8* %49, i32 -1, i32 -1, i32 0)
%51 = icmp ne i32 %50, 0
br i1 %51, label %53, label %52
52: ; preds = %46
br label %92
53: ; preds = %46
%54 = load i32*, i32** %8
%55 = load i32*, i32** %11
%56 = call i32 @X509_set_issuer_name(i32* %54, i32* %55)
%57 = icmp ne i32 %56, 0
br i1 %57, label %59, label %58
58: ; preds = %53
br label %92
59: ; preds = %53
%60 = load i32*, i32** %8
%61 = load i32, i32* @NID_basic_constraints
%62 = call i32 @_add_ext(i32* %60, i32 %61, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %65, label %64
64: ; preds = %59
br label %92
65: ; preds = %59
%66 = load i32*, i32** %8
%67 = load i32, i32* @NID_key_usage
%68 = call i32 @_add_ext(i32* %66, i32 %67, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %65
br label %92
71: ; preds = %65
%72 = load i32*, i32** %8
%73 = load i32, i32* @NID_subject_key_identifier
%74 = call i32 @_add_ext(i32* %72, i32 %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%75 = icmp ne i32 %74, 0
br i1 %75, label %77, label %76
76: ; preds = %71
br label %92
77: ; preds = %71
%78 = load i32*, i32** %8
%79 = load i32, i32* @NID_authority_key_identifier
%80 = call i32 @_add_ext(i32* %78, i32 %79, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%81 = icmp ne i32 %80, 0
br i1 %81, label %83, label %82
82: ; preds = %77
br label %92
83: ; preds = %77
%84 = load i32*, i32** %8
%85 = load i32*, i32** %5
%86 = call i32 (...) @EVP_sha1()
%87 = call i32 @X509_sign(i32* %84, i32* %85, i32 %86)
%88 = icmp ne i32 %87, 0
br i1 %88, label %90, label %89
89: ; preds = %83
br label %92
90: ; preds = %83
%91 = load i32*, i32** %8
store i32* %91, i32** %4
br label %111
92: ; preds = %89, %82, %76, %70, %64, %58, %52, %45, %16
%93 = load i32*, i32** %8
%94 = icmp ne i32* %93, null
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = load i32*, i32** %8
%97 = call i32 @X509_free(i32* %96)
br label %98
98: ; preds = %95, %92
%99 = load i8*, i8** %9
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %104
101: ; preds = %98
%102 = load i8*, i8** %9
%103 = call i32 @free(i8* %102)
br label %104
104: ; preds = %101, %98
%105 = load i32*, i32** %10
%106 = icmp ne i32* %105, null
br i1 %106, label %107, label %110
107: ; preds = %104
%108 = load i32*, i32** %10
%109 = call i32 @BN_free(i32* %108)
br label %110
110: ; preds = %107, %104
store i32* null, i32** %4
br label %111
111: ; preds = %110, %90
%112 = load i32*, i32** %4
ret i32* %112
}

LLVM IR (-O2):
@.str = [3 x i8] c"CN\00"
@MBSTRING_ASC = global i32 0
@NID_basic_constraints = global i32 0
@.str.1 = [17 x i8] c"critical,CA:TRUE\00"
@NID_key_usage = global i32 0
@.str.2 = [29 x i8] c"critical,keyCertSign,cRLSign\00"
@NID_subject_key_identifier = global i32 0
@.str.3 = [5 x i8] c"hash\00"
@NID_authority_key_identifier = global i32 0
@.str.4 = [13 x i8] c"keyid:always\00"
define i32* @abac_generate_cert(i32* %0, i8* %1, i64 %2) {
%4 = tail call i32 @assert(i32* %0)
%5 = tail call i32* (...) @X509_new()
%6 = icmp ne i32* %5, null
tail call void @llvm.assume(i1 %6)
%7 = tail call i8* (...) @abac_generate_serial()
%8 = icmp eq i64 %2, 0
%9 = select i1 %8, i64 31536000, i64 %2
%10 = tail call i32 @X509_set_version(i32* %5, i32 2)
%11 = tail call i32* @_make_bn_from_string(i8* %7)
%12 = tail call i32 @X509_get_serialNumber(i32* %5)
%13 = tail call i32 @BN_to_ASN1_INTEGER(i32* %11, i32 %12)
%14 = tail call i32 @X509_get_notBefore(i32* %5)
%15 = tail call i32 @X509_gmtime_adj(i32 %14, i64 0)
%16 = tail call i32 @X509_get_notAfter(i32* %5)
%17 = tail call i32 @X509_gmtime_adj(i32 %16, i64 %9)
%18 = tail call i32 @X509_set_pubkey(i32* %5, i32* %0)
%19 = tail call i32* @X509_get_subject_name(i32* %5)
%20 = icmp eq i32* %19, null
br i1 %20, label %48, label %21
21: ; preds = %3
%22 = load i32, i32* @MBSTRING_ASC
%23 = tail call i32 @X509_NAME_add_entry_by_txt(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22, i8* %1, i32 -1, i32 -1, i32 0)
%24 = icmp eq i32 %23, 0
br i1 %24, label %48, label %25
25: ; preds = %21
%26 = tail call i32 @X509_set_issuer_name(i32* %5, i32* %19)
%27 = icmp eq i32 %26, 0
br i1 %27, label %48, label %28
28: ; preds = %25
%29 = load i32, i32* @NID_basic_constraints
%30 = tail call i32 @_add_ext(i32* %5, i32 %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %28
%33 = load i32, i32* @NID_key_usage
%34 = tail call i32 @_add_ext(i32* %5, i32 %33, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %48, label %36
36: ; preds = %32
%37 = load i32, i32* @NID_subject_key_identifier
%38 = tail call i32 @_add_ext(i32* %5, i32 %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %48, label %40
40: ; preds = %36
%41 = load i32, i32* @NID_authority_key_identifier
%42 = tail call i32 @_add_ext(i32* %5, i32 %41, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = tail call i32 (...) @EVP_sha1()
%46 = tail call i32 @X509_sign(i32* %5, i32* %0, i32 %45)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %3, %21, %25, %28, %32, %36, %40, %44
%49 = tail call i32 @X509_free(i32* %5)
%50 = icmp eq i8* %7, null
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = tail call i32 @free(i8* %7)
br label %53
53: ; preds = %51, %48
%54 = icmp eq i32* %11, null
br i1 %54, label %57, label %55
55: ; preds = %53
%56 = tail call i32 @BN_free(i32* %11)
br label %57
57: ; preds = %53, %55, %44
%58 = phi i32* [ %5, %44 ], [ null, %55 ], [ null, %53 ]
ret i32* %58
}