#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_PCTX;

/* Variables and functions */
scalar_t__ BIO_puts(int /*<<< orphan*/ *, char const *);
int asn1_print_boolean_ctx(BIO *out, int boolval, const ASN1_PCTX *pctx) {
  const char *str;
  switch (boolval) {
  case -1:
    str = "BOOL ABSENT";
    break;
  case 0:
    str = "FALSE";
    break;
  default:
    str = "TRUE";
    break;
  }
  if (BIO_puts(out, str) <= 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<asn1_print_boolean_ctx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0xffffffff,%eax
je     1147 <asn1_print_boolean_ctx+0x37>
jmp    1137 <asn1_print_boolean_ctx+0x27>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
je     1157 <asn1_print_boolean_ctx+0x47>
jmp    1167 <asn1_print_boolean_ctx+0x57>
lea    0xeb2(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1172 <asn1_print_boolean_ctx+0x62>
lea    0xeae(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1172 <asn1_print_boolean_ctx+0x62>
lea    0xea4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <BIO_puts@plt>
cmp    $0x0,%rax
jg     1195 <asn1_print_boolean_ctx+0x85>
movl   $0x0,-0x4(%rbp)
jmp    119c <asn1_print_boolean_ctx+0x8c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_print_boolean_ctx>:
push   %rax
test   %esi,%esi
lea    0xef2(%rip),%rax
lea    0xef1(%rip),%rcx
cmove  %rax,%rcx
cmp    $0xffffffff,%esi
lea    0xed1(%rip),%rsi
cmovne %rcx,%rsi
call   1030 <BIO_puts@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"BOOL ABSENT\00"
@.str.1 = [6 x i8] c"FALSE\00"
@.str.2 = [5 x i8] c"TRUE\00"
define i32 @asn1_print_boolean_ctx(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32, i32* %6
switch i32 %9, label %12 [
i32 -1, label %10
i32 0, label %11
]
10: ; preds = %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %8
br label %13
11: ; preds = %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %13
12: ; preds = %3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %8
br label %13
13: ; preds = %12, %11, %10
%14 = load i32*, i32** %5
%15 = load i8*, i8** %8
%16 = call i64 @BIO_puts(i32* %14, i8* %15)
%17 = icmp sle i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %4
br label %20
19: ; preds = %13
store i32 1, i32* %4
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
@.str = [12 x i8] c"BOOL ABSENT\00"
@.str.1 = [6 x i8] c"FALSE\00"
@.str.2 = [5 x i8] c"TRUE\00"
define i32 @asn1_print_boolean_ctx(i32* %0, i32 %1, i32* nocapture readnone %2) {
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%6 = icmp eq i32 %1, -1
%7 = select i1 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5
%8 = tail call i64 @BIO_puts(i32* %0, i8* %7)
%9 = icmp sgt i64 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}