#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 *, ...);
int xmlDeclaration_function(const char *_tag_, int _type_, const char *version,
                            const char *encoding) {
  printf("<?%s", _tag_);
  if (version)
    printf(" version=\"%s\"", ParseXML_Encode_Safe_XML(version));
  if (encoding)
    printf(" encoding=\"%s\"", ParseXML_Encode_Safe_XML(encoding));
  printf(" ?>\n");
  return (0);
}


x86 assembly (clang, -O0):
<xmlDeclaration_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    -0x8(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     116e <xmlDeclaration_function+0x4e>
mov    -0x18(%rbp),%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
mov    %rax,%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1193 <xmlDeclaration_function+0x73>
mov    -0x20(%rbp),%rdi
call   1040 <ParseXML_Encode_Safe_XML@plt>
mov    %rax,%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlDeclaration_function>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rdi,%rsi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     1169 <xmlDeclaration_function+0x39>
mov    %rbx,%rdi
call   1050 <ParseXML_Encode_Safe_XML@plt>
lea    0xea6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14,%r14
je     1187 <xmlDeclaration_function+0x57>
mov    %r14,%rdi
call   1050 <ParseXML_Encode_Safe_XML@plt>
lea    0xe96(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"<?%s\00"
@.str.1 = [14 x i8] c" version=\22%s\22\00"
@.str.2 = [15 x i8] c" encoding=\22%s\22\00"
@.str.3 = [5 x i8] c" ?>\0A\00"
define i32 @xmlDeclaration_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 i8*, i8** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %4
%14 = load i8*, i8** %7
%15 = call i8* @ParseXML_Encode_Safe_XML(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %13, %4
%18 = load i8*, i8** %8
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i8*, i8** %8
%22 = call i8* @ParseXML_Encode_Safe_XML(i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %20, %17
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"<?%s\00"
@.str.1 = [14 x i8] c" version=\22%s\22\00"
@.str.2 = [15 x i8] c" encoding=\22%s\22\00"
@str = [4 x i8] c" ?>\00"
define i32 @xmlDeclaration_function(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = icmp eq i8* %2, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i8* @ParseXML_Encode_Safe_XML(i8* %2)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %4
%11 = icmp eq i8* %3, null
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = tail call i8* @ParseXML_Encode_Safe_XML(i8* %3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %10
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}