#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*/ uid_t;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct passwd {
  char const *pw_name;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void dag_to_dax_header(const char *name, FILE *output) {
  fprintf(output, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  time_t current_raw_time;
  struct tm *time_info;
  char buffer[64];
  time(&current_raw_time);
  time_info = localtime(&current_raw_time);
  strftime(buffer, 64, "%Y-%m-%d %T", time_info);
  fprintf(output, "<!-- generated: %s -->\n", buffer);
  uid_t uid = getuid();
  struct passwd *current_user_info;
  current_user_info = getpwuid(uid);
  fprintf(output, "<!-- generated by: %s -->\n", current_user_info->pw_name);
  fprintf(output, "<!-- generator: Makeflow -->\n");
  fprintf(output, "<adag ");
  fprintf(output, "xmlns=\"http://pegasus.isi.edu/schema/DAX\" ");
  fprintf(output, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ");
  fprintf(output, "xsi:schemaLocation=\"http://pegasus.isi.edu/schema/DAX "
                  "http://pegasus.isi.edu/schema/dax-3.4.xsd\" ");
  fprintf(output, "version=\"3.4\" ");
  fprintf(output, "name=\"%s\">\n", name);
}


x86 assembly (clang, -O0):
<dag_to_dax_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    -0x14(%rbp),%rdi
call   1070 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x40,%esi
lea    0xe7c(%rip),%rdx
call   1080 <strftime@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <getuid@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
call   1040 <getpwuid@plt>
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x70(%rbp),%rax
mov    (%rax),%rdx
lea    0xe5d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xef5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeee(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dag_to_dax_header>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe7a(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1070 <time@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
lea    0xe74(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1050 <getuid@plt>
mov    %eax,%edi
call   1040 <getpwuid@plt>
mov    (%rax),%rdx
lea    0xe57(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fprintf@plt>
lea    0xe61(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe66(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe54(%rip),%rdi
mov    $0x2a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe66(%rip),%rdi
mov    $0x36,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe84(%rip),%rdi
mov    $0x61,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xecd(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
%struct.passwd = type { i8* }
@.str = [40 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A\00"
@.str.1 = [12 x i8] c"%Y-%m-%d %T\00"
@.str.2 = [24 x i8] c"<!-- generated: %s -->\0A\00"
@.str.3 = [27 x i8] c"<!-- generated by: %s -->\0A\00"
@.str.4 = [30 x i8] c"<!-- generator: Makeflow -->\0A\00"
@.str.5 = [7 x i8] c"<adag \00"
@.str.6 = [43 x i8] c"xmlns=\22http://pegasus.isi.edu/schema/DAX\22 \00"
@.str.7 = [55 x i8] c"xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22 \00"
@.str.8 = [98 x i8] c"xsi:schemaLocation=\22http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-3.4.xsd\22 \00"
@.str.9 = [15 x i8] c"version=\223.4\22 \00"
@.str.10 = [12 x i8] c"name=\22%s\22>\0A\00"
define void @dag_to_dax_header(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.tm*
%7 = alloca [64 x i8]
%8 = alloca i32
%9 = alloca %struct.passwd*
store i8* %0, i8** %3
store i32* %1, i32** %4
%10 = load i32*, i32** %4
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @time(i32* %5)
%13 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %13, %struct.tm** %6
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%15 = load %struct.tm*, %struct.tm** %6
%16 = call i32 @strftime(i8* %14, i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %15)
%17 = load i32*, i32** %4
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = call i32 (...) @getuid()
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = call %struct.passwd* @getpwuid(i32 %21)
store %struct.passwd* %22, %struct.passwd** %9
%23 = load i32*, i32** %4
%24 = load %struct.passwd*, %struct.passwd** %9
%25 = getelementptr inbounds %struct.passwd, %struct.passwd* %24, i32 0, i32 0
%26 = load i8*, i8** %25
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%28 = load i32*, i32** %4
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32*, i32** %4
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32*, i32** %4
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32*, i32** %4
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%36 = load i32*, i32** %4
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.8, i64 0, i64 0))
%38 = load i32*, i32** %4
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%40 = load i32*, i32** %4
%41 = load i8*, i8** %3
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %41)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
%struct.passwd = type { i8* }
@.str = [40 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22?>\0A\00"
@.str.1 = [12 x i8] c"%Y-%m-%d %T\00"
@.str.2 = [24 x i8] c"<!-- generated: %s -->\0A\00"
@.str.3 = [27 x i8] c"<!-- generated by: %s -->\0A\00"
@.str.4 = [30 x i8] c"<!-- generator: Makeflow -->\0A\00"
@.str.5 = [7 x i8] c"<adag \00"
@.str.6 = [43 x i8] c"xmlns=\22http://pegasus.isi.edu/schema/DAX\22 \00"
@.str.7 = [55 x i8] c"xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22 \00"
@.str.8 = [98 x i8] c"xsi:schemaLocation=\22http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-3.4.xsd\22 \00"
@.str.9 = [15 x i8] c"version=\223.4\22 \00"
@.str.10 = [12 x i8] c"name=\22%s\22>\0A\00"
define void @dag_to_dax_header(i8* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = alloca [64 x i8]
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i64 39, i64 1, i32* %1)
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%8 = call i32 @time(i32* %3)
%9 = call %struct.tm* @localtime(i32* %3)
%10 = call i32 @strftime(i8* %7, i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %9)
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%12 = call i32 (...) @getuid()
%13 = call %struct.passwd* @getpwuid(i32 %12)
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %13, i64 0, i32 0
%15 = load i8*, i8** %14
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i64 29, i64 1, i32* %1)
%18 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64 6, i64 1, i32* %1)
%19 = call i64 @fwrite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i64 42, i64 1, i32* %1)
%20 = call i64 @fwrite(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0), i64 54, i64 1, i32* %1)
%21 = call i64 @fwrite(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.8, i64 0, i64 0), i64 97, i64 1, i32* %1)
%22 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i64 14, i64 1, i32* %1)
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %0)
ret void
}