#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 */
struct file_header {
  int dummy;
};
typedef int flags;

/* Variables and functions */
int /*<<< orphan*/ xprintf(int, char *, ...);
char *print_xml_timestamp(void *parm, int action, char *cur_date,
                          char *cur_time, unsigned long long itv,
                          struct file_header *file_hdr, unsigned int flags) {
  int utc = !(((flags)&0x00004000) == 0x00004000) &&
            !(((flags)&0x00000020) == 0x00000020);
  int *tab = (int *)parm;
  if (action & 0x01) {
    xprintf((*tab)++,
            "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
            cur_date, cur_time, utc ? 1 : 0, itv);
  }
  if (action & 0x04) {
    xprintf(--(*tab), "</timestamp>");
  }
  return NULL;
}


x86 assembly (clang, -O0):
<print_xml_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x10(%rbp),%ecx
and    $0x4000,%ecx
xor    %eax,%eax
cmp    $0x4000,%ecx
mov    %al,-0x41(%rbp)
je     115d <print_xml_timestamp+0x4d>
mov    0x10(%rbp),%eax
and    $0x20,%eax
cmp    $0x20,%eax
sete   %al
xor    $0xff,%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11b8 <print_xml_timestamp+0xa8>
mov    -0x40(%rbp),%rax
mov    (%rax),%edi
mov    %edi,%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x34(%rbp),%esi
xor    %r8d,%r8d
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%r8d
mov    -0x28(%rbp),%r9
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11e0 <print_xml_timestamp+0xd0>
mov    -0x40(%rbp),%rax
mov    (%rax),%edi
add    $0xffffffff,%edi
mov    %edi,(%rax)
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_xml_timestamp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
test   $0x1,%bpl
je     1145 <print_xml_timestamp+0x35>
mov    %r8,%r9
xor    %r8d,%r8d
testl  $0x4020,0x20(%rsp)
sete   %r8b
mov    (%rbx),%edi
lea    0x1(%rdi),%eax
mov    %eax,(%rbx)
lea    0xec2(%rip),%rsi
xor    %eax,%eax
call   1030 <xprintf@plt>
test   $0x4,%bpl
je     1160 <print_xml_timestamp+0x50>
mov    (%rbx),%edi
add    $0xffffffff,%edi
mov    %edi,(%rbx)
lea    0xee0(%rip),%rsi
xor    %eax,%eax
call   1030 <xprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.file_header = type { i32 }
@.str = [57 x i8] c"<timestamp date=\22%s\22 time=\22%s\22 utc=\22%d\22 interval=\22%llu\22>\00"
@.str.1 = [13 x i8] c"</timestamp>\00"
define i8* @print_xml_timestamp(i8* %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca %struct.file_header*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i64 %4, i64* %12
store %struct.file_header* %5, %struct.file_header** %13
store i32 %6, i32* %14
%17 = load i32, i32* %14
%18 = and i32 %17, 16384
%19 = icmp eq i32 %18, 16384
br i1 %19, label %25, label %20
20: ; preds = %7
%21 = load i32, i32* %14
%22 = and i32 %21, 32
%23 = icmp eq i32 %22, 32
%24 = xor i1 %23, true
br label %25
25: ; preds = %20, %7
%26 = phi i1 [ false, %7 ], [ %24, %20 ]
%27 = zext i1 %26 to i32
store i32 %27, i32* %15
%28 = load i8*, i8** %8
%29 = bitcast i8* %28 to i32*
store i32* %29, i32** %16
%30 = load i32, i32* %9
%31 = and i32 %30, 1
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %45
33: ; preds = %25
%34 = load i32*, i32** %16
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
%37 = load i8*, i8** %10
%38 = load i8*, i8** %11
%39 = load i32, i32* %15
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 1, i32 0
%43 = load i64, i64* %12
%44 = call i32 (i32, i8*, ...) @xprintf(i32 %35, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %37, i8* %38, i32 %42, i64 %43)
br label %45
45: ; preds = %33, %25
%46 = load i32, i32* %9
%47 = and i32 %46, 4
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = load i32*, i32** %16
%51 = load i32, i32* %50
%52 = add nsw i32 %51, -1
store i32 %52, i32* %50
%53 = call i32 (i32, i8*, ...) @xprintf(i32 %52, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %49, %45
ret i8* null
}

LLVM IR (-O2):
%struct.file_header = type { i32 }
@.str = [57 x i8] c"<timestamp date=\22%s\22 time=\22%s\22 utc=\22%d\22 interval=\22%llu\22>\00"
@.str.1 = [13 x i8] c"</timestamp>\00"
define noalias i8* @print_xml_timestamp(i8* nocapture %0, i32 %1, i8* %2, i8* %3, i64 %4, %struct.file_header* nocapture readnone %5, i32 %6) {
%8 = bitcast i8* %0 to i32*
%9 = and i32 %1, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %7
%12 = and i32 %6, 16416
%13 = icmp eq i32 %12, 0
%14 = load i32, i32* %8
%15 = add nsw i32 %14, 1
store i32 %15, i32* %8
%16 = zext i1 %13 to i32
%17 = tail call i32 (i32, i8*, ...) @xprintf(i32 %14, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i32 %16, i64 %4)
br label %18
18: ; preds = %11, %7
%19 = and i32 %1, 4
%20 = icmp eq i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = load i32, i32* %8
%23 = add nsw i32 %22, -1
store i32 %23, i32* %8
%24 = tail call i32 (i32, i8*, ...) @xprintf(i32 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %21, %18
ret i8* null
}