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

/* Variables and functions */
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ BIO_write(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ TS_ASN1_INTEGER_print_bio(int /*<<< orphan*/ *,
                                             int /*<<< orphan*/ const *);
int /*<<< orphan*/ TS_MSG_IMPRINT_print_bio(int /*<<< orphan*/ *,
                                            int /*<<< orphan*/);
int /*<<< orphan*/ TS_OBJ_print_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ TS_REQ_get_cert_req(int /*<<< orphan*/ *);
int /*<<< orphan*/ TS_REQ_get_exts(int /*<<< orphan*/ *);
int /*<<< orphan*/ TS_REQ_get_msg_imprint(int /*<<< orphan*/ *);
int /*<<< orphan*/ *TS_REQ_get_nonce(int /*<<< orphan*/ *);
int /*<<< orphan*/ *TS_REQ_get_policy_id(int /*<<< orphan*/ *);
int TS_REQ_get_version(int /*<<< orphan*/ *);
int /*<<< orphan*/ TS_ext_print_bio(int /*<<< orphan*/ *, int /*<<< orphan*/);
int TS_REQ_print_bio(BIO *bio, TS_REQ *a) {
  int v;
  ASN1_OBJECT *policy_id;
  const ASN1_INTEGER *nonce;
  if (a == NULL)
    return 0;
  v = TS_REQ_get_version(a);
  BIO_printf(bio, "Version: %d\n", v);
  TS_MSG_IMPRINT_print_bio(bio, TS_REQ_get_msg_imprint(a));
  BIO_printf(bio, "Policy OID: ");
  policy_id = TS_REQ_get_policy_id(a);
  if (policy_id == NULL)
    BIO_printf(bio, "unspecified\n");
  else
    TS_OBJ_print_bio(bio, policy_id);
  BIO_printf(bio, "Nonce: ");
  nonce = TS_REQ_get_nonce(a);
  if (nonce == NULL)
    BIO_printf(bio, "unspecified");
  else
    TS_ASN1_INTEGER_print_bio(bio, nonce);
  BIO_write(bio, "\n", 1);
  BIO_printf(bio, "Certificate required: %s\n",
             TS_REQ_get_cert_req(a) ? "yes" : "no");
  TS_ext_print_bio(bio, TS_REQ_get_exts(a));
  return 1;
}


x86 assembly (clang, -O0):
<TS_REQ_print_bio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e7 <TS_REQ_print_bio+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1334 <TS_REQ_print_bio+0x174>
mov    -0x18(%rbp),%rdi
call   1040 <TS_REQ_get_version@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xdff(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   10d0 <TS_REQ_get_msg_imprint@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   10a0 <TS_MSG_IMPRINT_print_bio@plt>
mov    -0x10(%rbp),%rdi
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <TS_REQ_get_policy_id@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1265 <TS_REQ_print_bio+0xa5>
mov    -0x10(%rbp),%rdi
lea    0xdc1(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
jmp    1272 <TS_REQ_print_bio+0xb2>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10e0 <TS_OBJ_print_bio@plt>
mov    -0x10(%rbp),%rdi
lea    0xdaa(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <TS_REQ_get_nonce@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12b3 <TS_REQ_print_bio+0xf3>
mov    -0x10(%rbp),%rdi
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
jmp    12c0 <TS_REQ_print_bio+0x100>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <TS_ASN1_INTEGER_print_bio@plt>
mov    -0x10(%rbp),%rdi
lea    0xd40(%rip),%rsi
mov    $0x1,%edx
call   10c0 <BIO_write@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <TS_REQ_get_cert_req@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rcx
lea    0xd65(%rip),%rdx
lea    0xd5a(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1070 <BIO_printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <TS_REQ_get_exts@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
call   1060 <TS_ext_print_bio@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_REQ_print_bio>:
push   %rbp
push   %r14
push   %rbx
test   %rsi,%rsi
je     1227 <TS_REQ_print_bio+0x67>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <TS_REQ_get_version@plt>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <BIO_printf@plt>
mov    %r14,%rdi
call   10d0 <TS_REQ_get_msg_imprint@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   10a0 <TS_MSG_IMPRINT_print_bio@plt>
lea    0xe0a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <BIO_printf@plt>
mov    %r14,%rdi
call   1030 <TS_REQ_get_policy_id@plt>
test   %rax,%rax
je     122e <TS_REQ_print_bio+0x6e>
mov    %rbx,%rdi
mov    %rax,%rsi
call   10e0 <TS_OBJ_print_bio@plt>
jmp    123f <TS_REQ_print_bio+0x7f>
xor    %ebp,%ebp
jmp    12d4 <TS_REQ_print_bio+0x114>
lea    0xde5(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <BIO_printf@plt>
lea    0xde1(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <BIO_printf@plt>
mov    %r14,%rdi
call   1050 <TS_REQ_get_nonce@plt>
test   %rax,%rax
je     126a <TS_REQ_print_bio+0xaa>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1080 <TS_ASN1_INTEGER_print_bio@plt>
jmp    127b <TS_REQ_print_bio+0xbb>
lea    0xdbe(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <BIO_printf@plt>
lea    0xd89(%rip),%rsi
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%edx
call   10c0 <BIO_write@plt>
mov    %r14,%rdi
call   1090 <TS_REQ_get_cert_req@plt>
test   %rax,%rax
lea    0xdb3(%rip),%rax
lea    0xda8(%rip),%rdx
cmove  %rax,%rdx
lea    0xd83(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <BIO_printf@plt>
mov    %r14,%rdi
call   10b0 <TS_REQ_get_exts@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <TS_ext_print_bio@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Version: %d\0A\00"
@.str.1 = [13 x i8] c"Policy OID: \00"
@.str.2 = [13 x i8] c"unspecified\0A\00"
@.str.3 = [8 x i8] c"Nonce: \00"
@.str.4 = [12 x i8] c"unspecified\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [26 x i8] c"Certificate required: %s\0A\00"
@.str.7 = [4 x i8] c"yes\00"
@.str.8 = [3 x i8] c"no\00"
define i32 @TS_REQ_print_bio(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %63
12: ; preds = %2
%13 = load i32*, i32** %5
%14 = call i32 @TS_REQ_get_version(i32* %13)
store i32 %14, i32* %6
%15 = load i32*, i32** %4
%16 = load i32, i32* %6
%17 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %4
%19 = load i32*, i32** %5
%20 = call i32 @TS_REQ_get_msg_imprint(i32* %19)
%21 = call i32 @TS_MSG_IMPRINT_print_bio(i32* %18, i32 %20)
%22 = load i32*, i32** %4
%23 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32*, i32** %5
%25 = call i32* @TS_REQ_get_policy_id(i32* %24)
store i32* %25, i32** %7
%26 = load i32*, i32** %7
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %12
%29 = load i32*, i32** %4
%30 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %35
31: ; preds = %12
%32 = load i32*, i32** %4
%33 = load i32*, i32** %7
%34 = call i32 @TS_OBJ_print_bio(i32* %32, i32* %33)
br label %35
35: ; preds = %31, %28
%36 = load i32*, i32** %4
%37 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%38 = load i32*, i32** %5
%39 = call i32* @TS_REQ_get_nonce(i32* %38)
store i32* %39, i32** %8
%40 = load i32*, i32** %8
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = load i32*, i32** %4
%44 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %43, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %49
45: ; preds = %35
%46 = load i32*, i32** %4
%47 = load i32*, i32** %8
%48 = call i32 @TS_ASN1_INTEGER_print_bio(i32* %46, i32* %47)
br label %49
49: ; preds = %45, %42
%50 = load i32*, i32** %4
%51 = call i32 @BIO_write(i32* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%52 = load i32*, i32** %4
%53 = load i32*, i32** %5
%54 = call i64 @TS_REQ_get_cert_req(i32* %53)
%55 = icmp ne i64 %54, 0
%56 = zext i1 %55 to i64
%57 = select i1 %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0)
%58 = call i32 (i32*, i8*, ...) @BIO_printf(i32* %52, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %57)
%59 = load i32*, i32** %4
%60 = load i32*, i32** %5
%61 = call i32 @TS_REQ_get_exts(i32* %60)
%62 = call i32 @TS_ext_print_bio(i32* %59, i32 %61)
store i32 1, i32* %3
br label %63
63: ; preds = %49, %11
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [13 x i8] c"Version: %d\0A\00"
@.str.1 = [13 x i8] c"Policy OID: \00"
@.str.2 = [13 x i8] c"unspecified\0A\00"
@.str.3 = [8 x i8] c"Nonce: \00"
@.str.4 = [12 x i8] c"unspecified\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [26 x i8] c"Certificate required: %s\0A\00"
@.str.7 = [4 x i8] c"yes\00"
@.str.8 = [3 x i8] c"no\00"
define i32 @TS_REQ_print_bio(i32* %0, i32* %1) {
%3 = icmp eq i32* %1, null
br i1 %3, label %32, label %4
4: ; preds = %2
%5 = tail call i32 @TS_REQ_get_version(i32* %1)
%6 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @TS_REQ_get_msg_imprint(i32* %1)
%8 = tail call i32 @TS_MSG_IMPRINT_print_bio(i32* %0, i32 %7)
%9 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @TS_REQ_get_policy_id(i32* %1)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %4
%15 = tail call i32 @TS_OBJ_print_bio(i32* %0, i32* %10)
br label %16
16: ; preds = %14, %12
%17 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32* @TS_REQ_get_nonce(i32* %1)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %24
22: ; preds = %16
%23 = tail call i32 @TS_ASN1_INTEGER_print_bio(i32* %0, i32* %18)
br label %24
24: ; preds = %22, %20
%25 = tail call i32 @BIO_write(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%26 = tail call i64 @TS_REQ_get_cert_req(i32* %1)
%27 = icmp eq i64 %26, 0
%28 = select i1 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%29 = tail call i32 (i32*, i8*, ...) @BIO_printf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %28)
%30 = tail call i32 @TS_REQ_get_exts(i32* %1)
%31 = tail call i32 @TS_ext_print_bio(i32* %0, i32 %30)
br label %32
32: ; preds = %2, %24
%33 = phi i32 [ 1, %24 ], [ 0, %2 ]
ret i32 %33
}