#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 uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ gzFile;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int gzread(int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ gzseek(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ read_gravity_well(int /*<<< orphan*/);
int /*<<< orphan*/ read_spawn_point(int /*<<< orphan*/);
int /*<<< orphan*/ read_speedup_ramp(int /*<<< orphan*/);
int /*<<< orphan*/ read_teleporter(int /*<<< orphan*/);
void bypass_objects(gzFile gzfile) {
  uint32_t num_objects;
  if (gzread(gzfile, &num_objects, 4) != 4)
    return;
  int o;
  for (o = 0; o < num_objects; o++) {
    uint8_t type;
    if (gzread(gzfile, &type, 1) != 1)
      return;
    switch (type) {
    case 0:
      gzseek(gzfile, 20, SEEK_CUR);
      break;
    case 1:
      gzseek(gzfile, 20, SEEK_CUR);
      break;
    case 2:
      gzseek(gzfile, 20, SEEK_CUR);
      break;
    case 3:
      gzseek(gzfile, 20, SEEK_CUR);
      break;
    case 4:
      gzseek(gzfile, 20, SEEK_CUR);
      break;
    case 5:
      read_spawn_point(gzfile);
      break;
    case 6:
      read_speedup_ramp(gzfile);
      break;
    case 7:
      read_teleporter(gzfile);
      break;
    case 8:
      read_gravity_well(gzfile);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<bypass_objects>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1050 <gzread@plt>
cmp    $0x4,%eax
je     118a <bypass_objects+0x2a>
jmp    12aa <bypass_objects+0x14a>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12aa <bypass_objects+0x14a>
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1050 <gzread@plt>
cmp    $0x1,%eax
je     11bc <bypass_objects+0x5c>
jmp    12aa <bypass_objects+0x14a>
mov    -0x10(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x8,%rax
ja     1297 <bypass_objects+0x137>
mov    -0x18(%rbp),%rax
lea    0xe28(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
mov    0x2de2(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
mov    0x2dc7(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
mov    0x2dac(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
call   1040 <read_spawn_point@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
call   1070 <read_speedup_ramp@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
call   1060 <read_teleporter@plt>
jmp    1297 <bypass_objects+0x137>
mov    -0x4(%rbp),%edi
call   1080 <read_gravity_well@plt>
jmp    129c <bypass_objects+0x13c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1191 <bypass_objects+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bypass_objects>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1050 <gzread@plt>
cmp    $0x4,%eax
jne    120d <bypass_objects+0xad>
cmpl   $0x0,0x8(%rsp)
jle    120d <bypass_objects+0xad>
xor    %ebp,%ebp
lea    0xc(%rsp),%r14
lea    0xe61(%rip),%r15
mov    0x2e42(%rip),%r12
jmp    11b9 <bypass_objects+0x59>
mov    %ebx,%edi
call   1080 <read_gravity_well@plt>
nop
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jge    120d <bypass_objects+0xad>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1050 <gzread@plt>
cmp    $0x1,%eax
jne    120d <bypass_objects+0xad>
mov    0xc(%rsp),%eax
cmp    $0x8,%rax
ja     11b0 <bypass_objects+0x50>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%r12),%edx
mov    %ebx,%edi
mov    $0x14,%esi
call   1030 <gzseek@plt>
jmp    11b0 <bypass_objects+0x50>
mov    %ebx,%edi
call   1040 <read_spawn_point@plt>
jmp    11b0 <bypass_objects+0x50>
mov    %ebx,%edi
call   1070 <read_speedup_ramp@plt>
jmp    11b0 <bypass_objects+0x50>
mov    %ebx,%edi
call   1060 <read_teleporter@plt>
jmp    11b0 <bypass_objects+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define void @bypass_objects(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @gzread(i32 %6, i32* %3, i32 4)
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %1
br label %58
10: ; preds = %1
store i32 0, i32* %4
br label %11
11: ; preds = %55, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %58
15: ; preds = %11
%16 = load i32, i32* %2
%17 = call i32 @gzread(i32 %16, i32* %5, i32 1)
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %15
br label %58
20: ; preds = %15
%21 = load i32, i32* %5
switch i32 %21, label %54 [
i32 0, label %22
i32 1, label %26
i32 2, label %30
i32 3, label %34
i32 4, label %38
i32 5, label %42
i32 6, label %45
i32 7, label %48
i32 8, label %51
]
22: ; preds = %20
%23 = load i32, i32* %2
%24 = load i32, i32* @SEEK_CUR
%25 = call i32 @gzseek(i32 %23, i32 20, i32 %24)
br label %54
26: ; preds = %20
%27 = load i32, i32* %2
%28 = load i32, i32* @SEEK_CUR
%29 = call i32 @gzseek(i32 %27, i32 20, i32 %28)
br label %54
30: ; preds = %20
%31 = load i32, i32* %2
%32 = load i32, i32* @SEEK_CUR
%33 = call i32 @gzseek(i32 %31, i32 20, i32 %32)
br label %54
34: ; preds = %20
%35 = load i32, i32* %2
%36 = load i32, i32* @SEEK_CUR
%37 = call i32 @gzseek(i32 %35, i32 20, i32 %36)
br label %54
38: ; preds = %20
%39 = load i32, i32* %2
%40 = load i32, i32* @SEEK_CUR
%41 = call i32 @gzseek(i32 %39, i32 20, i32 %40)
br label %54
42: ; preds = %20
%43 = load i32, i32* %2
%44 = call i32 @read_spawn_point(i32 %43)
br label %54
45: ; preds = %20
%46 = load i32, i32* %2
%47 = call i32 @read_speedup_ramp(i32 %46)
br label %54
48: ; preds = %20
%49 = load i32, i32* %2
%50 = call i32 @read_teleporter(i32 %49)
br label %54
51: ; preds = %20
%52 = load i32, i32* %2
%53 = call i32 @read_gravity_well(i32 %52)
br label %54
54: ; preds = %20, %51, %48, %45, %42, %38, %34, %30, %26, %22
br label %55
55: ; preds = %54
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %11
58: ; preds = %9, %19, %11
ret void
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define void @bypass_objects(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = call i32 @gzread(i32 %0, i32* %2, i32 4)
%6 = icmp eq i32 %5, 4
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %46
10: ; preds = %1
%11 = bitcast i32* %3 to i8*
br label %12
12: ; preds = %10, %41
%13 = phi i32 [ 0, %10 ], [ %42, %41 ]
%14 = call i32 @gzread(i32 %0, i32* %3, i32 1)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %45
16: ; preds = %12
%17 = load i32, i32* %3
switch i32 %17, label %41 [
i32 0, label %18
i32 1, label %21
i32 2, label %24
i32 3, label %27
i32 4, label %30
i32 5, label %33
i32 6, label %35
i32 7, label %37
i32 8, label %39
]
18: ; preds = %16
%19 = load i32, i32* @SEEK_CUR
%20 = call i32 @gzseek(i32 %0, i32 20, i32 %19)
br label %41
21: ; preds = %16
%22 = load i32, i32* @SEEK_CUR
%23 = call i32 @gzseek(i32 %0, i32 20, i32 %22)
br label %41
24: ; preds = %16
%25 = load i32, i32* @SEEK_CUR
%26 = call i32 @gzseek(i32 %0, i32 20, i32 %25)
br label %41
27: ; preds = %16
%28 = load i32, i32* @SEEK_CUR
%29 = call i32 @gzseek(i32 %0, i32 20, i32 %28)
br label %41
30: ; preds = %16
%31 = load i32, i32* @SEEK_CUR
%32 = call i32 @gzseek(i32 %0, i32 20, i32 %31)
br label %41
33: ; preds = %16
%34 = call i32 @read_spawn_point(i32 %0)
br label %41
35: ; preds = %16
%36 = call i32 @read_speedup_ramp(i32 %0)
br label %41
37: ; preds = %16
%38 = call i32 @read_teleporter(i32 %0)
br label %41
39: ; preds = %16
%40 = call i32 @read_gravity_well(i32 %0)
br label %41
41: ; preds = %16, %39, %37, %35, %33, %30, %27, %24, %21, %18
%42 = add nuw nsw i32 %13, 1
%43 = load i32, i32* %2
%44 = icmp slt i32 %42, %43
br i1 %44, label %12, label %46
45: ; preds = %12
br label %46
46: ; preds = %41, %45, %1
ret void
}