#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 */
char *ParseXML_Encode_Safe_XML(char const *);
int /*<<< orphan*/ printf(char *, char *, ...);
int boundType_function(const char *_tag_, int _type_, const char *box,
                       const char *origin) {
  printf("  <%s%s", (_type_ == 2) ? "/" : "", _tag_);
  if (box)
    printf(" box=\"%s\"", ParseXML_Encode_Safe_XML(box));
  if (origin)
    printf(" origin=\"%s\"", ParseXML_Encode_Safe_XML(origin));
  printf("%s>\n", (_type_ == (1 | 2)) ? " /" : "");
  return (0);
}


x86 assembly (clang, -O0):
<boundType_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xee2(%rip),%rsi
lea    0xedd(%rip),%rax
cmp    $0x2,%ecx
cmove  %rax,%rsi
mov    -0x8(%rbp),%rdx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1186 <boundType_function+0x66>
mov    -0x18(%rbp),%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
mov    %rax,%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     11ab <boundType_function+0x8b>
mov    -0x20(%rbp),%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
mov    %rax,%rsi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
lea    0xe6e(%rip),%rsi
lea    0xe68(%rip),%rax
cmp    $0x3,%ecx
cmove  %rax,%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundType_function>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%rdx
cmp    $0x2,%esi
lea    0xee8(%rip),%rsi
lea    0xedf(%rip),%rbx
cmovne %rbx,%rsi
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %rbp,%rbp
je     1174 <boundType_function+0x54>
mov    %rbp,%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
lea    0xe9e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15,%r15
je     1192 <boundType_function+0x72>
mov    %r15,%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
lea    0xe8a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x3,%r14d
lea    0xe87(%rip),%rax
cmove  %rax,%rbx
lea    0xe77(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c" <%s%s\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c" box=\22%s\22\00"
@.str.4 = [13 x i8] c" origin=\22%s\22\00"
@.str.5 = [5 x i8] c"%s>\0A\00"
@.str.6 = [3 x i8] c" /\00"
define i32 @boundType_function(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 2
%11 = zext i1 %10 to i64
%12 = select i1 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%13 = load i8*, i8** %5
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %4
%18 = load i8*, i8** %7
%19 = call i8* @ParseXML_Encode_Safe_XML(i8* %18)
%20 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %4
%22 = load i8*, i8** %8
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i8*, i8** %8
%26 = call i8* @ParseXML_Encode_Safe_XML(i8* %25)
%27 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %24, %21
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 3
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%33 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c" <%s%s\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c" box=\22%s\22\00"
@.str.4 = [13 x i8] c" origin=\22%s\22\00"
@.str.5 = [5 x i8] c"%s>\0A\00"
@.str.6 = [3 x i8] c" /\00"
define i32 @boundType_function(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i32 %1, 2
%6 = select i1 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %0)
%8 = icmp eq i8* %2, null
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = tail call i8* @ParseXML_Encode_Safe_XML(i8* %2)
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %4
%13 = icmp eq i8* %3, null
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = tail call i8* @ParseXML_Encode_Safe_XML(i8* %3)
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %12
%18 = icmp eq i32 %1, 3
%19 = select i1 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%20 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %19)
ret i32 0
}