#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 */

/* Variables and functions */
int /*<<< orphan*/ create(unsigned long long, int, char const *, int);
int /*<<< orphan*/ evt_activation(int, int, unsigned long long);
int /*<<< orphan*/ evt_deactivation(int, int, unsigned long long);
int /*<<< orphan*/ evt_dispatch(int, int, int, unsigned long long);
scalar_t__ strcmp(char *, char *);
void trace(unsigned long long int time, int current_pid, const char *name,
           int cpu, char *event) {
  if (strcmp(event, "00000009") == 0) {
    create(time, current_pid, name, cpu);
    evt_activation(current_pid, cpu, time);
  } else if (strcmp(event, "00000000") == 0) {
    evt_activation(current_pid, cpu, time);
  } else if (strcmp(event, "00000001") == 0) {
    evt_dispatch(0, current_pid, cpu, time);
  } else if (strcmp(event, "00000002") == 0) {
    evt_dispatch(current_pid, 0, cpu, time);
  } else if (strcmp(event, "00000003") == 0) {
    evt_deactivation(current_pid, cpu, time);
  } else {
    ;
  }
}


x86 assembly (clang, -O0):
<trace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <trace+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1060 <create@plt>
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <evt_activation@plt>
jmp    1280 <trace+0x130>
mov    -0x28(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11d9 <trace+0x89>
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <evt_activation@plt>
jmp    127b <trace+0x12b>
mov    -0x28(%rbp),%rdi
lea    0xe2e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1209 <trace+0xb9>
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rcx
xor    %edi,%edi
call   1070 <evt_dispatch@plt>
jmp    1276 <trace+0x126>
mov    -0x28(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1239 <trace+0xe9>
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rcx
xor    %esi,%esi
call   1070 <evt_dispatch@plt>
jmp    1271 <trace+0x121>
mov    -0x28(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1267 <trace+0x117>
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1040 <evt_deactivation@plt>
jmp    126c <trace+0x11c>
jmp    126c <trace+0x11c>
jmp    1271 <trace+0x121>
jmp    1276 <trace+0x126>
jmp    127b <trace+0x12b>
jmp    1280 <trace+0x130>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%rbp
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %rdi,%r14
lea    0xe92(%rip),%rsi
mov    %r8,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d4 <trace+0x84>
lea    0xe87(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e5 <trace+0x95>
lea    0xe7c(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11fb <trace+0xab>
lea    0xe71(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1202 <trace+0xb2>
lea    0xe66(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121a <trace+0xca>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1060 <create@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <evt_activation@plt>
xor    %edi,%edi
mov    %r12d,%esi
jmp    1207 <trace+0xb7>
mov    %r12d,%edi
xor    %esi,%esi
mov    %r15d,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <evt_dispatch@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <evt_deactivation@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"00000009\00"
@.str.1 = [9 x i8] c"00000000\00"
@.str.2 = [9 x i8] c"00000001\00"
@.str.3 = [9 x i8] c"00000002\00"
@.str.4 = [9 x i8] c"00000003\00"
define void @trace(i64 %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i64 %0, i64* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %5
%15 = load i64, i64* %6
%16 = load i32, i32* %7
%17 = load i8*, i8** %8
%18 = load i32, i32* %9
%19 = call i32 @create(i64 %15, i32 %16, i8* %17, i32 %18)
%20 = load i32, i32* %7
%21 = load i32, i32* %9
%22 = load i64, i64* %6
%23 = call i32 @evt_activation(i32 %20, i32 %21, i64 %22)
br label %65
24: ; preds = %5
%25 = load i8*, i8** %10
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = load i64, i64* %6
%32 = call i32 @evt_activation(i32 %29, i32 %30, i64 %31)
br label %64
33: ; preds = %24
%34 = load i8*, i8** %10
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = load i32, i32* %7
%39 = load i32, i32* %9
%40 = load i64, i64* %6
%41 = call i32 @evt_dispatch(i32 0, i32 %38, i32 %39, i64 %40)
br label %63
42: ; preds = %33
%43 = load i8*, i8** %10
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %51
46: ; preds = %42
%47 = load i32, i32* %7
%48 = load i32, i32* %9
%49 = load i64, i64* %6
%50 = call i32 @evt_dispatch(i32 %47, i32 0, i32 %48, i64 %49)
br label %62
51: ; preds = %42
%52 = load i8*, i8** %10
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %51
%56 = load i32, i32* %7
%57 = load i32, i32* %9
%58 = load i64, i64* %6
%59 = call i32 @evt_deactivation(i32 %56, i32 %57, i64 %58)
br label %61
60: ; preds = %51
br label %61
61: ; preds = %60, %55
br label %62
62: ; preds = %61, %46
br label %63
63: ; preds = %62, %37
br label %64
64: ; preds = %63, %28
br label %65
65: ; preds = %64, %14
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"00000009\00"
@.str.1 = [9 x i8] c"00000000\00"
@.str.2 = [9 x i8] c"00000001\00"
@.str.3 = [9 x i8] c"00000002\00"
@.str.4 = [9 x i8] c"00000003\00"
define void @trace(i64 %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @create(i64 %0, i32 %1, i8* %2, i32 %3)
%10 = tail call i32 @evt_activation(i32 %1, i32 %3, i64 %0)
br label %31
11: ; preds = %5
%12 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @evt_activation(i32 %1, i32 %3, i64 %0)
br label %31
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @evt_dispatch(i32 0, i32 %1, i32 %3, i64 %0)
br label %31
21: ; preds = %16
%22 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @evt_dispatch(i32 %1, i32 0, i32 %3, i64 %0)
br label %31
26: ; preds = %21
%27 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @evt_deactivation(i32 %1, i32 %3, i64 %0)
br label %31
31: ; preds = %14, %24, %26, %29, %19, %8
ret void
}