#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 record_header {
  int dummy;
};
struct file_header {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ xprintf(int, char *, ...);
void print_xml_comment(int *tab, int action, char *cur_date, char *cur_time,
                       int utc, char *comment, struct file_header *file_hdr,
                       struct record_header *record_hdr) {
  if (action & 0x01) {
    xprintf((*tab)++, "<comments>");
  }
  if (action & 0x02) {
    xprintf(*tab, "<comment date=\"%s\" time=\"%s\" utc=\"%d\" com=\"%s\"/>",
            cur_date, cur_time, utc ? 1 : 0, comment);
  }
  if (action & 0x04) {
    xprintf(--(*tab), "</comments>");
  }
}


x86 assembly (clang, -O0):
<print_xml_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1161 <print_xml_comment+0x51>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    %edi,%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11a2 <print_xml_comment+0x92>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%esi
xor    %r8d,%r8d
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%r8d
mov    -0x30(%rbp),%r9
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11ca <print_xml_comment+0xba>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
add    $0xffffffff,%edi
mov    %edi,(%rax)
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_xml_comment>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r13d
mov    %rcx,%r15
mov    %rdx,%r12
mov    %esi,%ebp
mov    %rdi,%rbx
test   $0x1,%bpl
jne    114d <print_xml_comment+0x3d>
test   $0x2,%bpl
jne    1168 <print_xml_comment+0x58>
test   $0x4,%bpl
jne    1191 <print_xml_comment+0x81>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%edi
lea    0x1(%rdi),%eax
mov    %eax,(%rbx)
lea    0xea5(%rip),%rsi
xor    %eax,%eax
call   1030 <xprintf@plt>
test   $0x2,%bpl
je     1138 <print_xml_comment+0x28>
mov    (%rbx),%edi
xor    %r8d,%r8d
test   %r13d,%r13d
setne  %r8b
lea    0xe90(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r9
xor    %eax,%eax
call   1030 <xprintf@plt>
test   $0x4,%bpl
je     113e <print_xml_comment+0x2e>
mov    (%rbx),%edi
add    $0xffffffff,%edi
mov    %edi,(%rbx)
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <xprintf@plt>

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

LLVM IR (-O2):
%struct.file_header = type { i32 }
%struct.record_header = type { i32 }
@.str = [11 x i8] c"<comments>\00"
@.str.1 = [49 x i8] c"<comment date=\22%s\22 time=\22%s\22 utc=\22%d\22 com=\22%s\22/>\00"
@.str.2 = [12 x i8] c"</comments>\00"
define void @print_xml_comment(i32* nocapture %0, i32 %1, i8* %2, i8* %3, i32 %4, i8* %5, %struct.file_header* nocapture readnone %6, %struct.record_header* nocapture readnone %7) {
%9 = and i32 %1, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i32, i32* %0
%13 = add nsw i32 %12, 1
store i32 %13, i32* %0
%14 = tail call i32 (i32, i8*, ...) @xprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %8
%16 = and i32 %1, 2
%17 = icmp eq i32 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %15
%19 = load i32, i32* %0
%20 = icmp ne i32 %4, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 (i32, i8*, ...) @xprintf(i32 %19, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3, i32 %21, i8* %5)
br label %23
23: ; preds = %18, %15
%24 = and i32 %1, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i32, i32* %0
%28 = add nsw i32 %27, -1
store i32 %28, i32* %0
%29 = tail call i32 (i32, i8*, ...) @xprintf(i32 %28, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %26, %23
ret void
}