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

/* Variables and functions */
int /*<<< orphan*/ cgiBooleanShadowPrefix();
int /*<<< orphan*/ cgiMakeHiddenVarWithExtra(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ safef(char *, int, char *, char *, ...);
void cgiMakeCheckBox2Bool(char *name, int checked, int enabled, char *id,
                          char *moreHtml) {
  char buf[256], idBuf[256];
  if (id)
    safef(idBuf, sizeof(idBuf), " id=\"%s\"", id);
  else
    idBuf[0] = 0;
  printf("<INPUT TYPE=CHECKBOX NAME=\"%s\"%s VALUE=on %s%s%s>", name, idBuf,
         (moreHtml ? moreHtml : ""), (checked ? " CHECKED" : ""),
         (enabled ? "" : " DISABLED"));
  safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name);
  cgiMakeHiddenVarWithExtra(buf, (enabled ? "0" : (checked ? "-1" : "-2")),
                            "class='cbShadow'");
}


x86 assembly (clang, -O0):
<cgiMakeCheckBox2Bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118b <cgiMakeCheckBox2Bool+0x4b>
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x100,%esi
lea    0xe81(%rip),%rdx
mov    $0x0,%al
call   1060 <safef@plt>
jmp    1192 <cgiMakeCheckBox2Bool+0x52>
movb   $0x0,-0x220(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x230(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11c6 <cgiMakeCheckBox2Bool+0x86>
mov    -0x20(%rbp),%rax
mov    %rax,-0x238(%rbp)
jmp    11d9 <cgiMakeCheckBox2Bool+0x99>
lea    0xe3b(%rip),%rax
mov    %rax,-0x238(%rbp)
jmp    11d9 <cgiMakeCheckBox2Bool+0x99>
mov    -0x228(%rbp),%rdx
mov    -0x230(%rbp),%rsi
mov    -0x238(%rbp),%rcx
mov    -0xc(%rbp),%edi
lea    0xe10(%rip),%r8
lea    0xe3c(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
mov    -0x10(%rbp),%edi
lea    0xe34(%rip),%r9
lea    0xdf1(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r9
lea    0xde4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x248(%rbp)
mov    $0x0,%al
call   1050 <cgiBooleanShadowPrefix@plt>
mov    -0x248(%rbp),%rdi
movslq %eax,%rcx
mov    -0x8(%rbp),%r8
mov    $0x100,%esi
lea    0xdf5(%rip),%rdx
mov    $0x0,%al
call   1060 <safef@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x240(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     128b <cgiMakeCheckBox2Bool+0x14b>
lea    0xdd4(%rip),%rax
mov    %rax,-0x250(%rbp)
jmp    12aa <cgiMakeCheckBox2Bool+0x16a>
mov    -0xc(%rbp),%edx
lea    0xdc3(%rip),%rax
lea    0xdb9(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x250(%rbp)
mov    -0x240(%rbp),%rdi
mov    -0x250(%rbp),%rsi
lea    0xd9c(%rip),%rdx
call   1030 <cgiMakeHiddenVarWithExtra@plt>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiMakeCheckBox2Bool>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %r8,%rbx
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
test   %rcx,%rcx
je     1175 <cgiMakeCheckBox2Bool+0x35>
lea    0xe9c(%rip),%rdx
mov    %rsp,%rdi
mov    $0x100,%esi
xor    %eax,%eax
call   1060 <safef@plt>
jmp    1179 <cgiMakeCheckBox2Bool+0x39>
movb   $0x0,(%rsp)
test   %rbx,%rbx
lea    0xe85(%rip),%rax
cmove  %rax,%rbx
test   %ebp,%ebp
lea    0xeab(%rip),%r8
cmove  %rax,%r8
lea    0xebd(%rip),%rcx
lea    0xeb3(%rip),%rdx
cmove  %rcx,%rdx
test   %r15d,%r15d
lea    0xe94(%rip),%r9
cmovne %rax,%r9
lea    0xe4e(%rip),%rdi
lea    0xe91(%rip),%rbp
cmove  %rdx,%rbp
mov    %rsp,%rdx
mov    %r14,%rsi
mov    %rbx,%rcx
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <cgiBooleanShadowPrefix@plt>
movslq %eax,%rcx
lea    0xe69(%rip),%rdx
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%r8
xor    %eax,%eax
call   1060 <safef@plt>
lea    0xe55(%rip),%rdx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <cgiMakeHiddenVarWithExtra@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c" id=\22%s\22\00"
@.str.1 = [50 x i8] c"<INPUT TYPE=CHECKBOX NAME=\22%s\22%s VALUE=on %s%s%s>\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c" CHECKED\00"
@.str.4 = [10 x i8] c" DISABLED\00"
@.str.5 = [5 x i8] c"%s%s\00"
@.str.6 = [2 x i8] c"0\00"
@.str.7 = [3 x i8] c"-1\00"
@.str.8 = [3 x i8] c"-2\00"
@.str.9 = [17 x i8] c"class='cbShadow'\00"
define void @cgiMakeCheckBox2Bool(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca [256 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%13 = load i8*, i8** %9
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %5
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%17 = load i8*, i8** %9
%18 = call i32 (i8*, i32, i8*, i8*, ...) @safef(i8* %16, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %5
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8 0, i8* %20
br label %21
21: ; preds = %19, %15
%22 = load i8*, i8** %6
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%24 = load i8*, i8** %10
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = load i8*, i8** %10
br label %29
28: ; preds = %21
br label %29
29: ; preds = %28, %26
%30 = phi i8* [ %27, %26 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %28 ]
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
%37 = zext i1 %36 to i64
%38 = select i1 %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0)
%39 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23, i8* %30, i8* %34, i8* %38)
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%41 = call i32 (...) @cgiBooleanShadowPrefix()
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i8*
%44 = load i8*, i8** %6
%45 = call i32 (i8*, i32, i8*, i8*, ...) @safef(i8* %40, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %43, i8* %44)
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%47 = load i32, i32* %8
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %29
br label %55
50: ; preds = %29
%51 = load i32, i32* %7
%52 = icmp ne i32 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0)
br label %55
55: ; preds = %50, %49
%56 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), %49 ], [ %54, %50 ]
%57 = call i32 @cgiMakeHiddenVarWithExtra(i8* %46, i8* %56, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c" id=\22%s\22\00"
@.str.1 = [50 x i8] c"<INPUT TYPE=CHECKBOX NAME=\22%s\22%s VALUE=on %s%s%s>\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [9 x i8] c" CHECKED\00"
@.str.4 = [10 x i8] c" DISABLED\00"
@.str.5 = [5 x i8] c"%s%s\00"
@.str.6 = [2 x i8] c"0\00"
@.str.7 = [3 x i8] c"-1\00"
@.str.8 = [3 x i8] c"-2\00"
@.str.9 = [17 x i8] c"class='cbShadow'\00"
define void @cgiMakeCheckBox2Bool(i8* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%10 = icmp eq i8* %3, null
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = call i32 (i8*, i32, i8*, i8*, ...) @safef(i8* %9, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %14
13: ; preds = %5
store i8 0, i8* %9
br label %14
14: ; preds = %13, %11
%15 = icmp eq i8* %4, null
%16 = select i1 %15, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %4
%17 = icmp eq i32 %1, 0
%18 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%19 = icmp eq i32 %2, 0
%20 = select i1 %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%21 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %9, i8* %16, i8* %18, i8* %20)
%22 = call i32 (...) @cgiBooleanShadowPrefix()
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i8*
%25 = call i32 (i8*, i32, i8*, i8*, ...) @safef(i8* %8, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %24, i8* %0)
%26 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%27 = select i1 %19, i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%28 = call i32 @cgiMakeHiddenVarWithExtra(i8* %8, i8* %27, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
ret void
}