#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 trace_seq {
  int dummy;
};
struct record {
  int dummy;
};
struct event_format {
  int dummy;
};

/* Variables and functions */
int pevent_print_num_field(struct trace_seq *, char *, struct event_format *,
                           char *, struct record *, int);
int /*<<< orphan*/ trace_seq_printf(struct trace_seq *, char *);
int timer_expire_handler(struct trace_seq *s, struct record *record,
                         struct event_format *event, void *context) {
  trace_seq_printf(s, "hrtimer=");
  if (pevent_print_num_field(s, "0x%llx", event, "timer", record, 0) == -1)
    pevent_print_num_field(s, "0x%llx", event, "hrtimer", record, 1);
  trace_seq_printf(s, " now=");
  pevent_print_num_field(s, "%llu", event, "now", record, 1);
  return 0;
}


x86 assembly (clang, -O0):
<timer_expire_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <trace_seq_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xeae(%rip),%rsi
lea    0xeb0(%rip),%rcx
xor    %r9d,%r9d
call   1040 <pevent_print_num_field@plt>
cmp    $0xffffffff,%eax
jne    1198 <timer_expire_handler+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe83(%rip),%rsi
lea    0xe83(%rip),%rcx
mov    $0x1,%r9d
call   1040 <pevent_print_num_field@plt>
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <trace_seq_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe63(%rip),%rsi
lea    0xe61(%rip),%rcx
mov    $0x1,%r9d
call   1040 <pevent_print_num_field@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_expire_handler>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
call   1030 <trace_seq_printf@plt>
lea    0xec8(%rip),%rsi
lea    0xeca(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
xor    %r9d,%r9d
call   1040 <pevent_print_num_field@plt>
cmp    $0xffffffff,%eax
jne    1180 <timer_expire_handler+0x60>
lea    0xea4(%rip),%rsi
lea    0xea4(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
mov    $0x1,%r9d
call   1040 <pevent_print_num_field@plt>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1030 <trace_seq_printf@plt>
lea    0xe88(%rip),%rsi
lea    0xe86(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
mov    $0x1,%r9d
call   1040 <pevent_print_num_field@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.trace_seq = type { i32 }
%struct.record = type { i32 }
%struct.event_format = type { i32 }
@.str = [9 x i8] c"hrtimer=\00"
@.str.1 = [7 x i8] c"0x%llx\00"
@.str.2 = [6 x i8] c"timer\00"
@.str.3 = [8 x i8] c"hrtimer\00"
@.str.4 = [6 x i8] c" now=\00"
@.str.5 = [5 x i8] c"%llu\00"
@.str.6 = [4 x i8] c"now\00"
define i32 @timer_expire_handler(%struct.trace_seq* %0, %struct.record* %1, %struct.event_format* %2, i8* %3) {
%5 = alloca %struct.trace_seq*
%6 = alloca %struct.record*
%7 = alloca %struct.event_format*
%8 = alloca i8*
store %struct.trace_seq* %0, %struct.trace_seq** %5
store %struct.record* %1, %struct.record** %6
store %struct.event_format* %2, %struct.event_format** %7
store i8* %3, i8** %8
%9 = load %struct.trace_seq*, %struct.trace_seq** %5
%10 = call i32 @trace_seq_printf(%struct.trace_seq* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = load %struct.trace_seq*, %struct.trace_seq** %5
%12 = load %struct.event_format*, %struct.event_format** %7
%13 = load %struct.record*, %struct.record** %6
%14 = call i32 @pevent_print_num_field(%struct.trace_seq* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.event_format* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.record* %13, i32 0)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %21
16: ; preds = %4
%17 = load %struct.trace_seq*, %struct.trace_seq** %5
%18 = load %struct.event_format*, %struct.event_format** %7
%19 = load %struct.record*, %struct.record** %6
%20 = call i32 @pevent_print_num_field(%struct.trace_seq* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.event_format* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %struct.record* %19, i32 1)
br label %21
21: ; preds = %16, %4
%22 = load %struct.trace_seq*, %struct.trace_seq** %5
%23 = call i32 @trace_seq_printf(%struct.trace_seq* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%24 = load %struct.trace_seq*, %struct.trace_seq** %5
%25 = load %struct.event_format*, %struct.event_format** %7
%26 = load %struct.record*, %struct.record** %6
%27 = call i32 @pevent_print_num_field(%struct.trace_seq* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %struct.event_format* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), %struct.record* %26, i32 1)
ret i32 0
}

LLVM IR (-O2):
%struct.trace_seq = type { i32 }
%struct.record = type { i32 }
%struct.event_format = type { i32 }
@.str = [9 x i8] c"hrtimer=\00"
@.str.1 = [7 x i8] c"0x%llx\00"
@.str.2 = [6 x i8] c"timer\00"
@.str.3 = [8 x i8] c"hrtimer\00"
@.str.4 = [6 x i8] c" now=\00"
@.str.5 = [5 x i8] c"%llu\00"
@.str.6 = [4 x i8] c"now\00"
define i32 @timer_expire_handler(%struct.trace_seq* %0, %struct.record* %1, %struct.event_format* %2, i8* nocapture readnone %3) {
%5 = tail call i32 @trace_seq_printf(%struct.trace_seq* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @pevent_print_num_field(%struct.trace_seq* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.event_format* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %struct.record* %1, i32 0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @pevent_print_num_field(%struct.trace_seq* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.event_format* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %struct.record* %1, i32 1)
br label %10
10: ; preds = %8, %4
%11 = tail call i32 @trace_seq_printf(%struct.trace_seq* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @pevent_print_num_field(%struct.trace_seq* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %struct.event_format* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), %struct.record* %1, i32 1)
ret i32 0
}