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

/* Variables and functions */
int /*<<< orphan*/ pevent_print_func_field(struct trace_seq *, char *,
                                           struct event_format *, char *,
                                           struct pevent_record *,
                                           int /*<<< orphan*/);
int pevent_print_num_field(struct trace_seq *, char *, struct event_format *,
                           char *, struct pevent_record *, int);
int /*<<< orphan*/ trace_seq_printf(struct trace_seq *, char *);
int timer_expire_handler(struct trace_seq *s, struct pevent_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);
  pevent_print_func_field(s, " function=%s", event, "function", record, 0);
  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    0xead(%rip),%rsi
call   1040 <trace_seq_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe9e(%rip),%rsi
lea    0xea0(%rip),%rcx
xor    %r9d,%r9d
call   1050 <pevent_print_num_field@plt>
cmp    $0xffffffff,%eax
jne    11a8 <timer_expire_handler+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe73(%rip),%rsi
lea    0xe73(%rip),%rcx
mov    $0x1,%r9d
call   1050 <pevent_print_num_field@plt>
mov    -0x8(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1040 <trace_seq_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe53(%rip),%rsi
lea    0xe51(%rip),%rcx
mov    $0x1,%r9d
call   1050 <pevent_print_num_field@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xe37(%rip),%rsi
lea    0xe3d(%rip),%rcx
xor    %r9d,%r9d
call   1030 <pevent_print_func_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    0xebb(%rip),%rsi
call   1040 <trace_seq_printf@plt>
lea    0xeb8(%rip),%rsi
lea    0xeba(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
xor    %r9d,%r9d
call   1050 <pevent_print_num_field@plt>
cmp    $0xffffffff,%eax
jne    1190 <timer_expire_handler+0x60>
lea    0xe94(%rip),%rsi
lea    0xe94(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
mov    $0x1,%r9d
call   1050 <pevent_print_num_field@plt>
lea    0xe81(%rip),%rsi
mov    %rbx,%rdi
call   1040 <trace_seq_printf@plt>
lea    0xe78(%rip),%rsi
lea    0xe76(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
mov    $0x1,%r9d
call   1050 <pevent_print_num_field@plt>
lea    0xe5f(%rip),%rsi
lea    0xe65(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%r8
xor    %r9d,%r9d
call   1030 <pevent_print_func_field@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.trace_seq = type { i32 }
%struct.pevent_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"
@.str.7 = [13 x i8] c" function=%s\00"
@.str.8 = [9 x i8] c"function\00"
define i32 @timer_expire_handler(%struct.trace_seq* %0, %struct.pevent_record* %1, %struct.event_format* %2, i8* %3) {
%5 = alloca %struct.trace_seq*
%6 = alloca %struct.pevent_record*
%7 = alloca %struct.event_format*
%8 = alloca i8*
store %struct.trace_seq* %0, %struct.trace_seq** %5
store %struct.pevent_record* %1, %struct.pevent_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.pevent_record*, %struct.pevent_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.pevent_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.pevent_record*, %struct.pevent_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.pevent_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.pevent_record*, %struct.pevent_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.pevent_record* %26, i32 1)
%28 = load %struct.trace_seq*, %struct.trace_seq** %5
%29 = load %struct.event_format*, %struct.event_format** %7
%30 = load %struct.pevent_record*, %struct.pevent_record** %6
%31 = call i32 @pevent_print_func_field(%struct.trace_seq* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), %struct.event_format* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %struct.pevent_record* %30, i32 0)
ret i32 0
}

LLVM IR (-O2):
%struct.trace_seq = type { i32 }
%struct.pevent_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"
@.str.7 = [13 x i8] c" function=%s\00"
@.str.8 = [9 x i8] c"function\00"
define i32 @timer_expire_handler(%struct.trace_seq* %0, %struct.pevent_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.pevent_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.pevent_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.pevent_record* %1, i32 1)
%13 = tail call i32 @pevent_print_func_field(%struct.trace_seq* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), %struct.event_format* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %struct.pevent_record* %1, i32 0)
ret i32 0
}