#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 /*<<< orphan*/ close_xml_document_(int);
int /*<<< orphan*/ open_xml_document_(int, unsigned long);
int /*<<< orphan*/ write_XML_Element_(int, char *, char *);
int /*<<< orphan*/ write_XML_Element_Size(int, char *, char *, size_t);
void write_doc_toxml(int xml_fd, unsigned long int docID_CRC32, char *text,
                     size_t size_text, char *fileName, char *fileLenBuff) {
  open_xml_document_(xml_fd, docID_CRC32);
  write_XML_Element_Size(xml_fd, "CONTENT_FIELD", text, size_text);
  write_XML_Element_(xml_fd, "PATH_INFO_FIELD", fileName);
  write_XML_Element_(xml_fd, "PATH_INFO", fileName);
  write_XML_Element_(xml_fd, "TIMESTAMP", "");
  write_XML_Element_(xml_fd, "CONTENT_LENGTH", fileLenBuff);
  close_xml_document_(xml_fd);
  return;
}


x86 assembly (clang, -O0):
<write_doc_toxml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <open_xml_document_@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe83(%rip),%rsi
call   1040 <write_XML_Element_Size@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rdx
lea    0xe7e(%rip),%rsi
call   1030 <write_XML_Element_@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1030 <write_XML_Element_@plt>
mov    -0x4(%rbp),%edi
lea    0xe76(%rip),%rsi
lea    0xe64(%rip),%rdx
call   1030 <write_XML_Element_@plt>
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%rdx
lea    0xe66(%rip),%rsi
call   1030 <write_XML_Element_@plt>
mov    -0x4(%rbp),%edi
call   1060 <close_xml_document_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_doc_toxml>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rdx,%r12
mov    %edi,%ebp
call   1050 <open_xml_document_@plt>
lea    0xe9e(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %r15,%rcx
call   1040 <write_XML_Element_Size@plt>
lea    0xe98(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1030 <write_XML_Element_@plt>
lea    0xe97(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
call   1030 <write_XML_Element_@plt>
lea    0xe90(%rip),%rsi
lea    0xe7e(%rip),%rdx
mov    %ebp,%edi
call   1030 <write_XML_Element_@plt>
lea    0xe85(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
call   1030 <write_XML_Element_@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <close_xml_document_@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"CONTENT_FIELD\00"
@.str.1 = [16 x i8] c"PATH_INFO_FIELD\00"
@.str.2 = [10 x i8] c"PATH_INFO\00"
@.str.3 = [10 x i8] c"TIMESTAMP\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [15 x i8] c"CONTENT_LENGTH\00"
define void @write_doc_toxml(i32 %0, i64 %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i32 %0, i32* %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i32, i32* %7
%14 = load i64, i64* %8
%15 = call i32 @open_xml_document_(i32 %13, i64 %14)
%16 = load i32, i32* %7
%17 = load i8*, i8** %9
%18 = load i64, i64* %10
%19 = call i32 @write_XML_Element_Size(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %17, i64 %18)
%20 = load i32, i32* %7
%21 = load i8*, i8** %11
%22 = call i32 @write_XML_Element_(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %7
%24 = load i8*, i8** %11
%25 = call i32 @write_XML_Element_(i32 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = load i32, i32* %7
%27 = call i32 @write_XML_Element_(i32 %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* %7
%29 = load i8*, i8** %12
%30 = call i32 @write_XML_Element_(i32 %28, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %7
%32 = call i32 @close_xml_document_(i32 %31)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"CONTENT_FIELD\00"
@.str.1 = [16 x i8] c"PATH_INFO_FIELD\00"
@.str.2 = [10 x i8] c"PATH_INFO\00"
@.str.3 = [10 x i8] c"TIMESTAMP\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [15 x i8] c"CONTENT_LENGTH\00"
define void @write_doc_toxml(i32 %0, i64 %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = tail call i32 @open_xml_document_(i32 %0, i64 %1)
%8 = tail call i32 @write_XML_Element_Size(i32 %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %2, i64 %3)
%9 = tail call i32 @write_XML_Element_(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%10 = tail call i32 @write_XML_Element_(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%11 = tail call i32 @write_XML_Element_(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @write_XML_Element_(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%13 = tail call i32 @close_xml_document_(i32 %0)
ret void
}