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

/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
int /*<<< orphan*/ fill(int /*<<< orphan*/);
int /*<<< orphan*/ getpath(int /*<<< orphan*/, unsigned char *, int);
int /*<<< orphan*/ pathmove(unsigned char *, int);
int /*<<< orphan*/ setvoxel(int /*<<< orphan*/, int, int);
void effect_arrow_patharound(int seconds, int delay) {
  static unsigned char arrow[10] = {
      0x18, 0x3c, 0x7e, 0xff, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
  };
  int i, z, r;
  unsigned char path[28];
  int iterations = seconds * 1000 / delay;
  getpath(0, path, 28);
  fill(0);
  for (i = 0; i < iterations; i++) {
    pathmove(path, 28);
    r = i % 28;
    if (r < sizeof(arrow)) {
      r = arrow[r];
      for (z = 0; z < 8; z++) {
        if ((r >> z) & 1) {
          setvoxel(0, 7, z);
        }
      }
    }
    delay_ms(delay);
  }
}


x86 assembly (clang, -O0):
<effect_arrow_patharound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rsi
xor    %edi,%edi
mov    $0x1c,%edx
call   1050 <getpath@plt>
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1234 <effect_arrow_patharound+0xe4>
lea    -0x30(%rbp),%rdi
mov    $0x1c,%esi
call   1060 <pathmove@plt>
mov    -0xc(%rbp),%eax
mov    $0x1c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0xa,%rax
jae    121e <effect_arrow_patharound+0xce>
movslq -0x14(%rbp),%rcx
lea    0x2e7d(%rip),%rax
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    1219 <effect_arrow_patharound+0xc9>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1206 <effect_arrow_patharound+0xb6>
mov    -0x10(%rbp),%edx
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <setvoxel@plt>
jmp    120b <effect_arrow_patharound+0xbb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d9 <effect_arrow_patharound+0x89>
jmp    121e <effect_arrow_patharound+0xce>
mov    -0x8(%rbp),%edi
call   1070 <delay_ms@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <effect_arrow_patharound+0x3a>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_arrow_patharound>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,%r15d
imul   $0x3e8,%edi,%eax
cltd
idiv   %esi
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
xor    %edi,%edi
mov    $0x1c,%edx
call   1050 <getpath@plt>
xor    %edi,%edi
call   1030 <fill@plt>
test   %ebp,%ebp
jle    1324 <effect_arrow_patharound+0x1d4>
xor    %r12d,%r12d
movabs $0x4924924924924925,%r14
92 24 49
lea    0x10(%rsp),%r13
mov    %r15d,0xc(%rsp)
jmp    11c5 <effect_arrow_patharound+0x75>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
call   1070 <delay_ms@plt>
add    $0x1,%r12
add    $0xffffffff,%ebp
je     1324 <effect_arrow_patharound+0x1d4>
mov    %r12,%rax
shr    $0x2,%rax
mul    %r14
shr    %rdx
lea    (%rdx,%rdx,8),%rax
lea    (%rax,%rax,2),%rax
add    %rdx,%rax
mov    %r12,%rbx
sub    %rax,%rbx
mov    %r13,%rdi
mov    $0x1c,%esi
call   1060 <pathmove@plt>
cmp    $0x9,%ebx
ja     11b0 <effect_arrow_patharound+0x60>
mov    %r13,%r15
lea    0xe01(%rip),%rax
movzbl (%rbx,%rax,1),%r13d
test   $0x1,%r13b
jne    1280 <effect_arrow_patharound+0x130>
test   $0x2,%r13b
jne    1298 <effect_arrow_patharound+0x148>
test   $0x4,%r13b
jne    12b3 <effect_arrow_patharound+0x163>
test   $0x8,%r13b
jne    12ce <effect_arrow_patharound+0x17e>
test   $0x10,%r13b
jne    12e9 <effect_arrow_patharound+0x199>
test   $0x20,%r13b
jne    1304 <effect_arrow_patharound+0x1b4>
test   $0x40,%r13b
je     1253 <effect_arrow_patharound+0x103>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x6,%edx
call   1040 <setvoxel@plt>
test   $0x80,%r13b
mov    %r15,%r13
mov    0xc(%rsp),%r15d
je     11b0 <effect_arrow_patharound+0x60>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x7,%edx
call   1040 <setvoxel@plt>
jmp    11b0 <effect_arrow_patharound+0x60>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1040 <setvoxel@plt>
test   $0x2,%r13b
je     1214 <effect_arrow_patharound+0xc4>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x1,%edx
call   1040 <setvoxel@plt>
test   $0x4,%r13b
je     121e <effect_arrow_patharound+0xce>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x2,%edx
call   1040 <setvoxel@plt>
test   $0x8,%r13b
je     1228 <effect_arrow_patharound+0xd8>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1040 <setvoxel@plt>
test   $0x10,%r13b
je     1232 <effect_arrow_patharound+0xe2>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x4,%edx
call   1040 <setvoxel@plt>
test   $0x20,%r13b
je     123c <effect_arrow_patharound+0xec>
xor    %edi,%edi
mov    $0x7,%esi
mov    $0x5,%edx
call   1040 <setvoxel@plt>
test   $0x40,%r13b
jne    1242 <effect_arrow_patharound+0xf2>
jmp    1253 <effect_arrow_patharound+0x103>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@effect_arrow_patharound.arrow = internal global [10 x i8] c"\18<~\FF<<<<<<"
define void @effect_arrow_patharound(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [28 x i8]
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 1000
%12 = load i32, i32* %4
%13 = sdiv i32 %11, %12
store i32 %13, i32* %9
%14 = getelementptr inbounds [28 x i8], [28 x i8]* %8, i64 0, i64 0
%15 = call i32 @getpath(i32 0, i8* %14, i32 28)
%16 = call i32 @fill(i32 0)
store i32 0, i32* %5
br label %17
17: ; preds = %55, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %9
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %58
21: ; preds = %17
%22 = getelementptr inbounds [28 x i8], [28 x i8]* %8, i64 0, i64 0
%23 = call i32 @pathmove(i8* %22, i32 28)
%24 = load i32, i32* %5
%25 = srem i32 %24, 28
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = icmp ult i64 %27, 10
br i1 %28, label %29, label %52
29: ; preds = %21
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i8], [10 x i8]* @effect_arrow_patharound.arrow, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = zext i8 %33 to i32
store i32 %34, i32* %7
store i32 0, i32* %6
br label %35
35: ; preds = %48, %29
%36 = load i32, i32* %6
%37 = icmp slt i32 %36, 8
br i1 %37, label %38, label %51
38: ; preds = %35
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = ashr i32 %39, %40
%42 = and i32 %41, 1
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %38
%45 = load i32, i32* %6
%46 = call i32 @setvoxel(i32 0, i32 7, i32 %45)
br label %47
47: ; preds = %44, %38
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %35
51: ; preds = %35
br label %52
52: ; preds = %51, %21
%53 = load i32, i32* %4
%54 = call i32 @delay_ms(i32 %53)
br label %55
55: ; preds = %52
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %17
58: ; preds = %17
ret void
}

LLVM IR (-O2):
@effect_arrow_patharound.arrow = internal unnamed_addr constant [10 x i8] c"\18<~\FF<<<<<<"
define void @effect_arrow_patharound(i32 %0, i32 %1) {
%3 = alloca [28 x i8]
%4 = getelementptr inbounds [28 x i8], [28 x i8]* %3, i64 0, i64 0
%5 = mul nsw i32 %0, 1000
%6 = sdiv i32 %5, %1
%7 = call i32 @getpath(i32 0, i8* %4, i32 28)
%8 = call i32 @fill(i32 0)
%9 = icmp sgt i32 %6, 0
br i1 %9, label %10, label %63
10: ; preds = %2, %59
%11 = phi i32 [ %61, %59 ], [ 0, %2 ]
%12 = call i32 @pathmove(i8* %4, i32 28)
%13 = urem i32 %11, 28
%14 = icmp ult i32 %13, 10
br i1 %14, label %15, label %59
15: ; preds = %10
%16 = zext i32 %13 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* @effect_arrow_patharound.arrow, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = and i32 %19, 1
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %15
%23 = call i32 @setvoxel(i32 0, i32 7, i32 0)
br label %24
24: ; preds = %15, %22
%25 = and i32 %19, 2
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 @setvoxel(i32 0, i32 7, i32 1)
br label %29
29: ; preds = %27, %24
%30 = and i32 %19, 4
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %29
%33 = call i32 @setvoxel(i32 0, i32 7, i32 2)
br label %34
34: ; preds = %32, %29
%35 = and i32 %19, 8
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 @setvoxel(i32 0, i32 7, i32 3)
br label %39
39: ; preds = %37, %34
%40 = and i32 %19, 16
%41 = icmp eq i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 @setvoxel(i32 0, i32 7, i32 4)
br label %44
44: ; preds = %42, %39
%45 = and i32 %19, 32
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = call i32 @setvoxel(i32 0, i32 7, i32 5)
br label %49
49: ; preds = %47, %44
%50 = and i32 %19, 64
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %49
%53 = call i32 @setvoxel(i32 0, i32 7, i32 6)
br label %54
54: ; preds = %52, %49
%55 = and i32 %19, 128
%56 = icmp eq i32 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %54
%58 = call i32 @setvoxel(i32 0, i32 7, i32 7)
br label %59
59: ; preds = %54, %57, %10
%60 = call i32 @delay_ms(i32 %1)
%61 = add nuw i32 %11, 1
%62 = icmp eq i32 %61, %6
br i1 %62, label %63, label %10
63: ; preds = %59, %2
ret void
}