#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;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
int /*<<< orphan*/ PEM_write_bio_X509(int /*<<< orphan*/ *,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ i2d_X509_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext) {
  if (output_der) {
    (void)i2d_X509_bio(bp, x);
    return;
  }
  if (!notext)
    X509_print(bp, x);
  PEM_write_bio_X509(bp, x);
}


x86 assembly (clang, -O0):
<write_new_certificate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1162 <write_new_certificate+0x32>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <i2d_X509_bio@plt>
jmp    1186 <write_new_certificate+0x56>
cmpl   $0x0,-0x18(%rbp)
jne    1179 <write_new_certificate+0x49>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <X509_print@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <PEM_write_bio_X509@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_new_certificate>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %edx,%edx
je     1150 <write_new_certificate+0x20>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <i2d_X509_bio@plt>
test   %ecx,%ecx
jne    115f <write_new_certificate+0x2f>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <X509_print@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <PEM_write_bio_X509@plt>

LLVM IR (-O0):
define void @write_new_certificate(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32*, i32** %5
%13 = load i32*, i32** %6
%14 = call i32 @i2d_X509_bio(i32* %12, i32* %13)
br label %26
15: ; preds = %4
%16 = load i32, i32* %8
%17 = icmp ne i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i32*, i32** %5
%20 = load i32*, i32** %6
%21 = call i32 @X509_print(i32* %19, i32* %20)
br label %22
22: ; preds = %18, %15
%23 = load i32*, i32** %5
%24 = load i32*, i32** %6
%25 = call i32 @PEM_write_bio_X509(i32* %23, i32* %24)
br label %26
26: ; preds = %22, %11
ret void
}

LLVM IR (-O2):
define void @write_new_certificate(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @i2d_X509_bio(i32* %0, i32* %1)
br label %14
8: ; preds = %4
%9 = icmp eq i32 %3, 0
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @X509_print(i32* %0, i32* %1)
br label %12
12: ; preds = %10, %8
%13 = tail call i32 @PEM_write_bio_X509(i32* %0, i32* %1)
br label %14
14: ; preds = %12, %6
ret void
}