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

/* Variables and functions */
int B64_write_ASN1(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, int, int /*<<< orphan*/ const *);
int /*<<< orphan*/ BIO_printf(int /*<<< orphan*/ *, char *, char const *);
int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
                              const char *hdr, const ASN1_ITEM *it) {
  int r;
  BIO_printf(out, "-----BEGIN %s-----\n", hdr);
  r = B64_write_ASN1(out, val, in, flags, it);
  BIO_printf(out, "-----END %s-----\n", hdr);
  return r;
}


x86 assembly (clang, -O0):
<PEM_write_bio_ASN1_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xeb2(%rip),%rsi
call   1040 <BIO_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x30(%rbp),%r8
call   1030 <B64_write_ASN1@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe97(%rip),%rsi
call   1040 <BIO_printf@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_write_bio_ASN1_stream>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0xebc(%rip),%rsi
mov    %r8,%rdx
call   1040 <BIO_printf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %rbx,%r8
call   1030 <B64_write_ASN1@plt>
mov    %eax,%ebx
lea    0xeab(%rip),%rsi
mov    %rbp,%rdi
mov    %r14,%rdx
call   1040 <BIO_printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"-----BEGIN %s-----\0A\00"
@.str.1 = [18 x i8] c"-----END %s-----\0A\00"
define i32 @PEM_write_bio_ASN1_stream(i32* %0, i32* %1, i32* %2, i32 %3, i8* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32* %5, i32** %12
%14 = load i32*, i32** %7
%15 = load i8*, i8** %11
%16 = call i32 @BIO_printf(i32* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32*, i32** %7
%18 = load i32*, i32** %8
%19 = load i32*, i32** %9
%20 = load i32, i32* %10
%21 = load i32*, i32** %12
%22 = call i32 @B64_write_ASN1(i32* %17, i32* %18, i32* %19, i32 %20, i32* %21)
store i32 %22, i32* %13
%23 = load i32*, i32** %7
%24 = load i8*, i8** %11
%25 = call i32 @BIO_printf(i32* %23, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = load i32, i32* %13
ret i32 %26
}

LLVM IR (-O2):
@.str = [20 x i8] c"-----BEGIN %s-----\0A\00"
@.str.1 = [18 x i8] c"-----END %s-----\0A\00"
define i32 @PEM_write_bio_ASN1_stream(i32* %0, i32* %1, i32* %2, i32 %3, i8* %4, i32* %5) {
%7 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = tail call i32 @B64_write_ASN1(i32* %0, i32* %1, i32* %2, i32 %3, i32* %5)
%9 = tail call i32 @BIO_printf(i32* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 %8
}