#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;
};

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


x86 assembly (clang, -O0):
<print_xml_restart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
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     1159 <print_xml_restart+0x49>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    %edi,%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1196 <print_xml_restart+0x86>
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
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <xprintf@plt>
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11be <print_xml_restart+0xae>
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_restart>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r12d
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
test   $0x1,%bpl
jne    1141 <print_xml_restart+0x31>
test   $0x2,%bpl
jne    115c <print_xml_restart+0x4c>
test   $0x4,%bpl
jne    1182 <print_xml_restart+0x72>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%edi
lea    0x1(%rdi),%eax
mov    %eax,(%rbx)
lea    0xeb1(%rip),%rsi
xor    %eax,%eax
call   1030 <xprintf@plt>
test   $0x2,%bpl
je     1132 <print_xml_restart+0x22>
mov    (%rbx),%edi
xor    %r8d,%r8d
test   %r12d,%r12d
setne  %r8b
lea    0xe9c(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <xprintf@plt>
test   $0x4,%bpl
je     1138 <print_xml_restart+0x28>
mov    (%rbx),%edi
add    $0xffffffff,%edi
mov    %edi,(%rbx)
lea    0xea0(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <xprintf@plt>

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

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