#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 */

/* Variables and functions */
int ASN1_object_size(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ ASN1_put_object(unsigned char **, int /*<<< orphan*/, int,
                                   int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ V_ASN1_BOOLEAN;
int /*<<< orphan*/ V_ASN1_UNIVERSAL;
int i2d_ASN1_BOOLEAN(int a, unsigned char **pp) {
  int r;
  unsigned char *p;
  r = ASN1_object_size(0, 1, V_ASN1_BOOLEAN);
  if (pp == NULL)
    return (r);
  p = *pp;
  ASN1_put_object(&p, 0, 1, V_ASN1_BOOLEAN, V_ASN1_UNIVERSAL);
  *(p++) = (unsigned char)a;
  *pp = p;
  return (r);
}


x86 assembly (clang, -O0):
<i2d_ASN1_BOOLEAN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <ASN1_object_size@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <i2d_ASN1_BOOLEAN+0x3d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <i2d_ASN1_BOOLEAN+0x92>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e69(%rip),%rax
mov    (%rax),%ecx
mov    0x2e68(%rip),%rax
mov    (%rax),%r8d
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <ASN1_put_object@plt>
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2d_ASN1_BOOLEAN>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
mov    0x2ea4(%rip),%r15
mov    (%r15),%edx
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <ASN1_object_size@plt>
mov    %eax,%ebp
test   %rbx,%rbx
je     1183 <i2d_ASN1_BOOLEAN+0x63>
mov    (%rbx),%rax
mov    %rax,(%rsp)
mov    (%r15),%ecx
mov    0x2e85(%rip),%rax
mov    (%rax),%r8d
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <ASN1_put_object@plt>
mov    (%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rsp)
mov    %r14b,(%rax)
mov    (%rsp),%rax
mov    %rax,(%rbx)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@V_ASN1_BOOLEAN = global i32 0
@V_ASN1_UNIVERSAL = global i32 0
define i32 @i2d_ASN1_BOOLEAN(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @V_ASN1_BOOLEAN
%9 = call i32 @ASN1_object_size(i32 0, i32 1, i32 %8)
store i32 %9, i32* %6
%10 = load i8**, i8*** %5
%11 = icmp eq i8** %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %6
store i32 %13, i32* %3
br label %27
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
store i8* %16, i8** %7
%17 = load i32, i32* @V_ASN1_BOOLEAN
%18 = load i32, i32* @V_ASN1_UNIVERSAL
%19 = call i32 @ASN1_put_object(i8** %7, i32 0, i32 1, i32 %17, i32 %18)
%20 = load i32, i32* %4
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %7
store i8 %21, i8* %22
%24 = load i8*, i8** %7
%25 = load i8**, i8*** %5
store i8* %24, i8** %25
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %27
27: ; preds = %14, %12
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@V_ASN1_BOOLEAN = global i32 0
@V_ASN1_UNIVERSAL = global i32 0
define i32 @i2d_ASN1_BOOLEAN(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i32, i32* @V_ASN1_BOOLEAN
%6 = tail call i32 @ASN1_object_size(i32 0, i32 1, i32 %5)
%7 = icmp eq i8** %1, null
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
store i8* %9, i8** %3
%10 = load i32, i32* @V_ASN1_BOOLEAN
%11 = load i32, i32* @V_ASN1_UNIVERSAL
%12 = call i32 @ASN1_put_object(i8** %3, i32 0, i32 1, i32 %10, i32 %11)
%13 = trunc i32 %0 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %3
store i8 %13, i8* %14
%16 = load i8*, i8** %3
store i8* %16, i8** %1
br label %17
17: ; preds = %2, %8
ret i32 %6
}