#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*/ antispiral(int);
int /*<<< orphan*/ fill_hexagon(int, int /*<<< orphan*/);
int /*<<< orphan*/ hexahole(int);
int /*<<< orphan*/ radioactive(int);
int /*<<< orphan*/ spiral(int);
void generate_barriers(int cycle) {
  switch (cycle % 88) {
  case 12:
  case 38:
  case 50:
  case 74:
    fill_hexagon(8, 0);
    return;
  }
  if (cycle % 88 < 11)
    spiral(cycle);
  else if (cycle % 88 < 38)
    hexahole(cycle);
  else if (cycle % 88 < 50)
    antispiral(cycle);
  else if (cycle % 88 < 74)
    hexahole(cycle);
  else
    radioactive(cycle);
}


x86 assembly (clang, -O0):
<generate_barriers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
mov    %ecx,%eax
imul   $0x2e8ba2e9,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x58,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
sub    $0xc,%eax
je     11be <generate_barriers+0x6e>
jmp    118b <generate_barriers+0x3b>
mov    -0x8(%rbp),%eax
sub    $0x26,%eax
je     11be <generate_barriers+0x6e>
jmp    119c <generate_barriers+0x4c>
mov    -0x8(%rbp),%eax
sub    $0x32,%eax
je     11be <generate_barriers+0x6e>
jmp    11ad <generate_barriers+0x5d>
mov    -0x8(%rbp),%eax
sub    $0x4a,%eax
jne    11cf <generate_barriers+0x7f>
jmp    11be <generate_barriers+0x6e>
mov    $0x8,%edi
xor    %esi,%esi
call   1040 <fill_hexagon@plt>
jmp    126a <generate_barriers+0x11a>
mov    -0x4(%rbp),%eax
mov    $0x58,%ecx
cltd
idiv   %ecx
cmp    $0xb,%edx
jge    11f0 <generate_barriers+0xa0>
mov    -0x4(%rbp),%edi
call   1070 <spiral@plt>
jmp    126a <generate_barriers+0x11a>
mov    -0x4(%rbp),%eax
mov    $0x58,%ecx
cltd
idiv   %ecx
cmp    $0x26,%edx
jge    1211 <generate_barriers+0xc1>
mov    -0x4(%rbp),%edi
call   1050 <hexahole@plt>
jmp    1265 <generate_barriers+0x115>
mov    -0x4(%rbp),%eax
mov    $0x58,%ecx
cltd
idiv   %ecx
cmp    $0x32,%edx
jge    1232 <generate_barriers+0xe2>
mov    -0x4(%rbp),%edi
call   1060 <antispiral@plt>
jmp    1260 <generate_barriers+0x110>
mov    -0x4(%rbp),%eax
mov    $0x58,%ecx
cltd
idiv   %ecx
cmp    $0x4a,%edx
jge    1253 <generate_barriers+0x103>
mov    -0x4(%rbp),%edi
call   1050 <hexahole@plt>
jmp    125b <generate_barriers+0x10b>
mov    -0x4(%rbp),%edi
call   1030 <radioactive@plt>
jmp    1260 <generate_barriers+0x110>
jmp    1265 <generate_barriers+0x115>
jmp    126a <generate_barriers+0x11a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_barriers>:
movslq %edi,%rax
imul   $0x2e8ba2e9,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   $0x58,%eax,%eax
mov    %eax,%ecx
neg    %ecx
add    %edi,%ecx
add    $0xfffffff4,%ecx
cmp    $0x3e,%ecx
ja     1194 <generate_barriers+0x44>
movabs $0x4000004004000001,%rdx
bt     %rcx,%rdx
jae    1194 <generate_barriers+0x44>
mov    $0x8,%edi
xor    %esi,%esi
jmp    1040 <fill_hexagon@plt>
mov    %edi,%ecx
sub    %eax,%ecx
cmp    $0xa,%ecx
jg     11a2 <generate_barriers+0x52>
jmp    1070 <spiral@plt>
cmp    $0x25,%ecx
ja     11ac <generate_barriers+0x5c>
jmp    1050 <hexahole@plt>
cmp    $0x31,%ecx
ja     11b6 <generate_barriers+0x66>
jmp    1060 <antispiral@plt>
cmp    $0x49,%ecx
ja     11c0 <generate_barriers+0x70>
jmp    1050 <hexahole@plt>
jmp    1030 <radioactive@plt>

LLVM IR (-O0):
define void @generate_barriers(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 88
switch i32 %4, label %7 [
i32 12, label %5
i32 38, label %5
i32 50, label %5
i32 74, label %5
]
5: ; preds = %1, %1, %1, %1
%6 = call i32 @fill_hexagon(i32 8, i32 0)
br label %41
7: ; preds = %1
%8 = load i32, i32* %2
%9 = srem i32 %8, 88
%10 = icmp slt i32 %9, 11
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 @spiral(i32 %12)
br label %41
14: ; preds = %7
%15 = load i32, i32* %2
%16 = srem i32 %15, 88
%17 = icmp slt i32 %16, 38
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* %2
%20 = call i32 @hexahole(i32 %19)
br label %40
21: ; preds = %14
%22 = load i32, i32* %2
%23 = srem i32 %22, 88
%24 = icmp slt i32 %23, 50
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %2
%27 = call i32 @antispiral(i32 %26)
br label %39
28: ; preds = %21
%29 = load i32, i32* %2
%30 = srem i32 %29, 88
%31 = icmp slt i32 %30, 74
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i32, i32* %2
%34 = call i32 @hexahole(i32 %33)
br label %38
35: ; preds = %28
%36 = load i32, i32* %2
%37 = call i32 @radioactive(i32 %36)
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %25
br label %40
40: ; preds = %39, %18
br label %41
41: ; preds = %5, %40, %11
ret void
}

LLVM IR (-O2):
define void @generate_barriers(i32 %0) {
%2 = srem i32 %0, 88
switch i32 %2, label %5 [
i32 12, label %3
i32 38, label %3
i32 50, label %3
i32 74, label %3
]
3: ; preds = %1, %1, %1, %1
%4 = tail call i32 @fill_hexagon(i32 8, i32 0)
br label %23
5: ; preds = %1
%6 = icmp slt i32 %2, 11
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @spiral(i32 %0)
br label %23
9: ; preds = %5
%10 = icmp ult i32 %2, 38
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @hexahole(i32 %0)
br label %23
13: ; preds = %9
%14 = icmp ult i32 %2, 50
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 @antispiral(i32 %0)
br label %23
17: ; preds = %13
%18 = icmp ult i32 %2, 74
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 @hexahole(i32 %0)
br label %23
21: ; preds = %17
%22 = tail call i32 @radioactive(i32 %0)
br label %23
23: ; preds = %11, %19, %21, %15, %3, %7
ret void
}