#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int jtrace_common(int /*<<< orphan*/ *, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int trace_read_int(int /*<<< orphan*/ *);
int jtrace_read(FILE *f) {
  int len, type, time, task, cpu, res;
  char name[32];
  int name_len, name_len1, d;
  res = jtrace_common(f, &len, &type, &time, &task);
  if (res < 0) {
    return res;
  }
  printf("Len: %d Type: %d Time: %d Task: %d\n", len, type, time, task);
  switch (type) {
  case 9:
    name_len = len - 4;
    name_len1 = trace_read_int(f);
    if (name_len != name_len1) {
      fprintf(stderr, "Error: name len %d != %d\n", name_len, name_len1);
    }
    fread(name, name_len1, 1, f);
    name[name_len1] = 0;
    printf("Create %s\n", name);
    break;
  case 1:
    if (len != 4) {
      fprintf(stderr, "Error: len = %d != 4 (CPU) - %d\n", len, type);
      return -3;
    }
    cpu = trace_read_int(f);
    printf("Task %d dispatched on CPU %d at time %d\n", task, cpu, time);
    break;
  case 2:
    if (len != 4) {
      fprintf(stderr, "Error: len = %d != 4 (CPU) - %d\n", len, type);
      return -3;
    }
    cpu = trace_read_int(f);
    printf("Task %d preempted on CPU %d at time %d\n", task, cpu, time);
    break;
  case 0:
    if (len != 0) {
      fprintf(stderr, "Error: len = %d != 0 - %d\n", len, type);
      return -3;
    }
    printf("Task %d wakes up at time %d\n", task, time);
    break;
  case 3:
    if (len != 4) {
      fprintf(stderr, "Error: len = %d != 4 (CPU) - %d\n", len, type);
      return -3;
    }
    cpu = trace_read_int(f);
    printf("Task %d blocks on CPU %d at time %d\n", task, cpu, time);
    break;
  case 5:
    if (len != 4) {
      fprintf(stderr, "Error: len = %d != 4 (deadline) - %d\n", len, type);
      return -3;
    }
    d = trace_read_int(f);
    printf("Deadline for task %d se to %d at time %d\n", task, d, time);
    break;
  default:
    printf("Event %d - Len %d\n", type, len);
    return -4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<jtrace_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1070 <jtrace_common@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    118d <jtrace_read+0x3d>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %rax,-0x68(%rbp)
sub    $0x9,%rax
ja     13ec <jtrace_read+0x29c>
mov    -0x68(%rbp),%rax
lea    0xe3c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
je     1209 <jtrace_read+0xb9>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%ecx
lea    0xe48(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
movslq -0x58(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    -0x50(%rbp),%rsi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
cmpl   $0x4,-0x14(%rbp)
je     126f <jtrace_read+0x11f>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe13(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
cmpl   $0x4,-0x14(%rbp)
je     12c8 <jtrace_read+0x178>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xdba(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
cmpl   $0x0,-0x14(%rbp)
je     1321 <jtrace_read+0x1d1>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xdd3(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
cmpl   $0x4,-0x14(%rbp)
je     136b <jtrace_read+0x21b>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xd17(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
cmpl   $0x4,-0x14(%rbp)
je     13c4 <jtrace_read+0x274>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xd8d(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
mov    -0x10(%rbp),%rdi
call   1030 <trace_read_int@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140c <jtrace_read+0x2bc>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1413 <jtrace_read+0x2c3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jtrace_read>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
mov    %rsp,%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1070 <jtrace_common@plt>
test   %eax,%eax
js     11d6 <jtrace_read+0x86>
mov    (%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
cmp    $0x9,%rsi
ja     124f <jtrace_read+0xff>
lea    0xe55(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    (%rsp),%edx
test   %edx,%edx
je     1372 <jtrace_read+0x222>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xf14(%rip),%rsi
xor    %ecx,%ecx
jmp    135b <jtrace_read+0x20b>
mov    %eax,%ebp
jmp    1365 <jtrace_read+0x215>
mov    (%rsp),%edx
cmp    $0x4,%edx
jne    1301 <jtrace_read+0x1b1>
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xe92(%rip),%rdi
jmp    128d <jtrace_read+0x13d>
mov    (%rsp),%edx
cmp    $0x4,%edx
jne    1318 <jtrace_read+0x1c8>
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xe93(%rip),%rdi
jmp    128d <jtrace_read+0x13d>
mov    (%rsp),%edx
cmp    $0x4,%edx
jne    132f <jtrace_read+0x1df>
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xece(%rip),%rdi
jmp    128d <jtrace_read+0x13d>
mov    (%rsp),%edx
lea    0xf37(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xfffffffc,%ebp
jmp    1365 <jtrace_read+0x215>
mov    (%rsp),%edx
cmp    $0x4,%edx
jne    1346 <jtrace_read+0x1f6>
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%ecx
lea    0xed9(%rip),%rdi
xor    %ebp,%ebp
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1365 <jtrace_read+0x215>
mov    (%rsp),%ebp
add    $0xfffffffc,%ebp
mov    %rbx,%rdi
call   1030 <trace_read_int@plt>
mov    %eax,%r14d
cmp    %eax,%ebp
je     12cc <jtrace_read+0x17c>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xd8a(%rip),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1060 <fprintf@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
movslq %r14d,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0xd73(%rip),%rdi
xor    %ebp,%ebp
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1365 <jtrace_read+0x215>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
lea    0xd60(%rip),%rsi
mov    $0x1,%ecx
jmp    135b <jtrace_read+0x20b>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
lea    0xd49(%rip),%rsi
mov    $0x2,%ecx
jmp    135b <jtrace_read+0x20b>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
lea    0xd32(%rip),%rsi
mov    $0x3,%ecx
jmp    135b <jtrace_read+0x20b>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
mov    $0x5,%ecx
call   1060 <fprintf@plt>
mov    $0xfffffffd,%ebp
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xd7d(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1365 <jtrace_read+0x215>

LLVM IR (-O0):
@.str = [36 x i8] c"Len: %d Type: %d Time: %d Task: %d\0A\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"Error: name len %d != %d\0A\00"
@.str.2 = [11 x i8] c"Create %s\0A\00"
@.str.3 = [33 x i8] c"Error: len = %d != 4 (CPU) - %d\0A\00"
@.str.4 = [41 x i8] c"Task %d dispatched on CPU %d at time %d\0A\00"
@.str.5 = [40 x i8] c"Task %d preempted on CPU %d at time %d\0A\00"
@.str.6 = [27 x i8] c"Error: len = %d != 0 - %d\0A\00"
@.str.7 = [29 x i8] c"Task %d wakes up at time %d\0A\00"
@.str.8 = [37 x i8] c"Task %d blocks on CPU %d at time %d\0A\00"
@.str.9 = [38 x i8] c"Error: len = %d != 4 (deadline) - %d\0A\00"
@.str.10 = [42 x i8] c"Deadline for task %d se to %d at time %d\0A\00"
@.str.11 = [19 x i8] c"Event %d - Len %d\0A\00"
define i32 @jtrace_read(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [32 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %3
%14 = load i32*, i32** %3
%15 = call i32 @jtrace_common(i32* %14, i32* %4, i32* %5, i32* %6, i32* %7)
store i32 %15, i32* %9
%16 = load i32, i32* %9
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %1
%19 = load i32, i32* %9
store i32 %19, i32* %2
br label %127
20: ; preds = %1
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %5
switch i32 %26, label %122 [
i32 9, label %27
i32 1, label %50
i32 2, label %65
i32 0, label %80
i32 3, label %92
i32 5, label %107
]
27: ; preds = %20
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 4
store i32 %29, i32* %11
%30 = load i32*, i32** %3
%31 = call i32 @trace_read_int(i32* %30)
store i32 %31, i32* %12
%32 = load i32, i32* %11
%33 = load i32, i32* %12
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = load i32, i32* @stderr
%37 = load i32, i32* %11
%38 = load i32, i32* %12
%39 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38)
br label %40
40: ; preds = %35, %27
%41 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%42 = load i32, i32* %12
%43 = load i32*, i32** %3
%44 = call i32 @fread(i8* %41, i32 %42, i32 1, i32* %43)
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 %46
store i8 0, i8* %47
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %48)
br label %126
50: ; preds = %20
%51 = load i32, i32* %4
%52 = icmp ne i32 %51, 4
br i1 %52, label %53, label %58
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = load i32, i32* %4
%56 = load i32, i32* %5
%57 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56)
store i32 -3, i32* %2
br label %127
58: ; preds = %50
%59 = load i32*, i32** %3
%60 = call i32 @trace_read_int(i32* %59)
store i32 %60, i32* %8
%61 = load i32, i32* %7
%62 = load i32, i32* %8
%63 = load i32, i32* %6
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 %61, i32 %62, i32 %63)
br label %126
65: ; preds = %20
%66 = load i32, i32* %4
%67 = icmp ne i32 %66, 4
br i1 %67, label %68, label %73
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = load i32, i32* %4
%71 = load i32, i32* %5
%72 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %70, i32 %71)
store i32 -3, i32* %2
br label %127
73: ; preds = %65
%74 = load i32*, i32** %3
%75 = call i32 @trace_read_int(i32* %74)
store i32 %75, i32* %8
%76 = load i32, i32* %7
%77 = load i32, i32* %8
%78 = load i32, i32* %6
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %76, i32 %77, i32 %78)
br label %126
80: ; preds = %20
%81 = load i32, i32* %4
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = load i32, i32* @stderr
%85 = load i32, i32* %4
%86 = load i32, i32* %5
%87 = call i32 @fprintf(i32 %84, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %85, i32 %86)
store i32 -3, i32* %2
br label %127
88: ; preds = %80
%89 = load i32, i32* %7
%90 = load i32, i32* %6
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %89, i32 %90)
br label %126
92: ; preds = %20
%93 = load i32, i32* %4
%94 = icmp ne i32 %93, 4
br i1 %94, label %95, label %100
95: ; preds = %92
%96 = load i32, i32* @stderr
%97 = load i32, i32* %4
%98 = load i32, i32* %5
%99 = call i32 @fprintf(i32 %96, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %97, i32 %98)
store i32 -3, i32* %2
br label %127
100: ; preds = %92
%101 = load i32*, i32** %3
%102 = call i32 @trace_read_int(i32* %101)
store i32 %102, i32* %8
%103 = load i32, i32* %7
%104 = load i32, i32* %8
%105 = load i32, i32* %6
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %103, i32 %104, i32 %105)
br label %126
107: ; preds = %20
%108 = load i32, i32* %4
%109 = icmp ne i32 %108, 4
br i1 %109, label %110, label %115
110: ; preds = %107
%111 = load i32, i32* @stderr
%112 = load i32, i32* %4
%113 = load i32, i32* %5
%114 = call i32 @fprintf(i32 %111, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %112, i32 %113)
store i32 -3, i32* %2
br label %127
115: ; preds = %107
%116 = load i32*, i32** %3
%117 = call i32 @trace_read_int(i32* %116)
store i32 %117, i32* %13
%118 = load i32, i32* %7
%119 = load i32, i32* %13
%120 = load i32, i32* %6
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), i32 %118, i32 %119, i32 %120)
br label %126
122: ; preds = %20
%123 = load i32, i32* %5
%124 = load i32, i32* %4
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %123, i32 %124)
store i32 -4, i32* %2
br label %127
126: ; preds = %115, %100, %88, %73, %58, %40
store i32 0, i32* %2
br label %127
127: ; preds = %126, %122, %110, %95, %83, %68, %53, %18
%128 = load i32, i32* %2
ret i32 %128
}

LLVM IR (-O2):
@.str = [36 x i8] c"Len: %d Type: %d Time: %d Task: %d\0A\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"Error: name len %d != %d\0A\00"
@.str.2 = [11 x i8] c"Create %s\0A\00"
@.str.3 = [33 x i8] c"Error: len = %d != 4 (CPU) - %d\0A\00"
@.str.4 = [41 x i8] c"Task %d dispatched on CPU %d at time %d\0A\00"
@.str.5 = [40 x i8] c"Task %d preempted on CPU %d at time %d\0A\00"
@.str.6 = [27 x i8] c"Error: len = %d != 0 - %d\0A\00"
@.str.7 = [29 x i8] c"Task %d wakes up at time %d\0A\00"
@.str.8 = [37 x i8] c"Task %d blocks on CPU %d at time %d\0A\00"
@.str.9 = [38 x i8] c"Error: len = %d != 4 (deadline) - %d\0A\00"
@.str.10 = [42 x i8] c"Deadline for task %d se to %d at time %d\0A\00"
@.str.11 = [19 x i8] c"Event %d - Len %d\0A\00"
define i32 @jtrace_read(i32* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [32 x i8]
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%12 = call i32 @jtrace_common(i32* %0, i32* %2, i32* %3, i32* %4, i32* %5)
%13 = icmp slt i32 %12, 0
br i1 %13, label %91, label %14
14: ; preds = %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18)
%20 = load i32, i32* %3
switch i32 %20, label %88 [
i32 9, label %21
i32 1, label %34
i32 2, label %45
i32 0, label %56
i32 3, label %66
i32 5, label %77
]
21: ; preds = %14
%22 = load i32, i32* %2
%23 = add nsw i32 %22, -4
%24 = call i32 @trace_read_int(i32* %0)
%25 = icmp eq i32 %23, %24
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %24)
br label %29
29: ; preds = %26, %21
%30 = call i32 @fread(i8* %11, i32 %24, i32 1, i32* %0)
%31 = sext i32 %24 to i64
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %91
34: ; preds = %14
%35 = load i32, i32* %2
%36 = icmp eq i32 %35, 4
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 1)
br label %91
40: ; preds = %34
%41 = call i32 @trace_read_int(i32* %0)
%42 = load i32, i32* %5
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 %42, i32 %41, i32 %43)
br label %91
45: ; preds = %14
%46 = load i32, i32* %2
%47 = icmp eq i32 %46, 4
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %46, i32 2)
br label %91
51: ; preds = %45
%52 = call i32 @trace_read_int(i32* %0)
%53 = load i32, i32* %5
%54 = load i32, i32* %4
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %53, i32 %52, i32 %54)
br label %91
56: ; preds = %14
%57 = load i32, i32* %2
%58 = icmp eq i32 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %57, i32 0)
br label %91
62: ; preds = %56
%63 = load i32, i32* %5
%64 = load i32, i32* %4
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i32 %63, i32 %64)
br label %91
66: ; preds = %14
%67 = load i32, i32* %2
%68 = icmp eq i32 %67, 4
br i1 %68, label %72, label %69
69: ; preds = %66
%70 = load i32, i32* @stderr
%71 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %67, i32 3)
br label %91
72: ; preds = %66
%73 = call i32 @trace_read_int(i32* %0)
%74 = load i32, i32* %5
%75 = load i32, i32* %4
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %74, i32 %73, i32 %75)
br label %91
77: ; preds = %14
%78 = load i32, i32* %2
%79 = icmp eq i32 %78, 4
br i1 %79, label %83, label %80
80: ; preds = %77
%81 = load i32, i32* @stderr
%82 = call i32 @fprintf(i32 %81, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %78, i32 5)
br label %91
83: ; preds = %77
%84 = call i32 @trace_read_int(i32* %0)
%85 = load i32, i32* %5
%86 = load i32, i32* %4
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), i32 %85, i32 %84, i32 %86)
br label %91
88: ; preds = %14
%89 = load i32, i32* %2
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %20, i32 %89)
br label %91
91: ; preds = %29, %40, %51, %62, %72, %83, %1, %88, %80, %69, %59, %48, %37
%92 = phi i32 [ -4, %88 ], [ -3, %80 ], [ -3, %69 ], [ -3, %59 ], [ -3, %48 ], [ -3, %37 ], [ %12, %1 ], [ 0, %83 ], [ 0, %72 ], [ 0, %62 ], [ 0, %51 ], [ 0, %40 ], [ 0, %29 ]
ret i32 %92
}