#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*/ delay_ms(int);
int /*<<< orphan*/ fill(int /*<<< orphan*/);
int rand();
int /*<<< orphan*/ setvoxel(int, int, int);
void effect_fireworks(int seconds, int delay) {
  int i, f, e;
  int origin_x = 3;
  int origin_y = 3;
  int origin_z = 3;
  int rand_y, rand_x, rand_z;
  int slowrate, gravity;
  int iterations = seconds * 1000 / delay / (36 + 25);
  int particles[30][6];
  fill(0);
  for (i = 0; i < iterations; i++) {
    origin_x = rand() % 4;
    origin_y = rand() % 4;
    origin_z = rand() % 2;
    origin_z += 5;
    origin_x += 2;
    origin_y += 2;
    for (e = 0; e < origin_z; e++) {
      setvoxel(origin_x, origin_y, e);
      delay_ms(delay * (2 + 2 * e));
      fill(0);
    }
    for (f = 0; f < 30; f++) {
      particles[f][0] = origin_x * 100;
      particles[f][1] = origin_y * 100;
      particles[f][2] = origin_z * 100;
      rand_x = rand() % 200;
      rand_y = rand() % 200;
      rand_z = rand() % 200;
      particles[f][3] = 100 - rand_x;
      particles[f][4] = 100 - rand_y;
      particles[f][5] = 100 - rand_z;
    }
    for (e = 0; e < 25; e++) {
      static const int coeff[25] = {
          5,    55,   105,  156,  207,  260,  314,  370,  428,
          489,  552,  620,  691,  768,  850,  940,  1039, 1149,
          1273, 1413, 1574, 1763, 1989, 2264, 2610,
      };
      slowrate = 100 + coeff[e];
      gravity = coeff[e] / 20;
      for (f = 0; f < 30; f++) {
        particles[f][0] += particles[f][3] * 100 / slowrate;
        particles[f][1] += particles[f][4] * 100 / slowrate;
        particles[f][2] += particles[f][5] * 100 / slowrate;
        particles[f][2] -= gravity;
        setvoxel(particles[f][0] / 100, particles[f][1] / 100,
                 particles[f][2] / 100);
      }
      delay_ms(delay);
      fill(0);
    }
  }
}


x86 assembly (clang, -O0):
<effect_fireworks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x310,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    $0x3d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    14cc <effect_fireworks+0x38c>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1231 <effect_fireworks+0xf1>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <setvoxel@plt>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
imul   %eax,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ee <effect_fireworks+0xae>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    1327 <effect_fireworks+0x1e7>
imul   $0x64,-0x18(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
imul   $0x64,-0x1c(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
imul   $0x64,-0x20(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xc8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    $0x64,%ecx
sub    -0x28(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0xc(%rax)
mov    $0x64,%ecx
sub    -0x24(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x10(%rax)
mov    $0x64,%ecx
sub    -0x2c(%rbp),%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1238 <effect_fireworks+0xf8>
movl   $0x0,-0x14(%rbp)
cmpl   $0x19,-0x14(%rbp)
jge    14b9 <effect_fireworks+0x379>
movslq -0x14(%rbp),%rcx
lea    0xcbd(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x64,%eax
mov    %eax,-0x30(%rbp)
movslq -0x14(%rbp),%rcx
lea    0xca9(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    149c <effect_fireworks+0x35c>
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
imul   $0x64,0xc(%rax),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
imul   $0x64,0x10(%rax),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
imul   $0x64,0x14(%rax),%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
movslq -0x10(%rbp),%rdx
lea    -0x310(%rbp),%rax
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
add    0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
mov    -0x34(%rbp),%edx
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
sub    %edx,%ecx
mov    %ecx,0x8(%rax)
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
movslq -0x10(%rbp),%rcx
lea    -0x310(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1040 <setvoxel@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    136c <effect_fireworks+0x22c>
mov    -0x8(%rbp),%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    132e <effect_fireworks+0x1ee>
jmp    14be <effect_fireworks+0x37e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118a <effect_fireworks+0x4a>
add    $0x310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_fireworks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2f8,%rsp
mov    %esi,%r15d
imul   $0x3e8,%edi,%eax
cltd
idiv   %esi
mov    %eax,%ebx
xor    %edi,%edi
call   1030 <fill@plt>
cmp    $0x3d,%ebx
jl     13ff <effect_fireworks+0x2bf>
movslq %ebx,%rax
imul   $0x4325c53f,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x24,%rcx
add    %eax,%ecx
mov    %rcx,0x10(%rsp)
lea    (%r15,%r15,1),%eax
mov    %eax,(%rsp)
xor    %eax,%eax
mov    %r15,0x18(%rsp)
nopl   0x0(%rax)
mov    %eax,0x4(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r14d
lea    0x3(%r14),%r13d
test   %eax,%eax
cmovns %eax,%r13d
and    $0xfffffffc,%r13d
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r12d
lea    0x3(%r12),%ebx
test   %eax,%eax
cmovns %eax,%ebx
and    $0xfffffffc,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r15d
add    $0x5,%r15d
neg    %r13d
add    %r13d,%r14d
add    $0x2,%r14d
neg    %ebx
add    %ebx,%r12d
add    $0x2,%r12d
mov    (%rsp),%r13d
mov    %r13d,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %r12d,%esi
mov    %ebp,%edx
call   1040 <setvoxel@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
add    $0x1,%ebp
add    %r13d,%ebx
cmp    %ebp,%r15d
jne    1210 <effect_fireworks+0xd0>
imul   $0x64,%r14d,%eax
mov    %eax,0xc(%rsp)
imul   $0x64,%r12d,%eax
mov    %eax,0x8(%rsp)
imul   $0x64,%r15d,%ebx
mov    $0x14,%ebp
nop
mov    0xc(%rsp),%eax
mov    %eax,0xc(%rsp,%rbp,1)
mov    0x8(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,1)
mov    %ebx,0x14(%rsp,%rbp,1)
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%r15
imul   $0x51eb851f,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0xc8,%eax,%r13d
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%r14
imul   $0x51eb851f,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0xc8,%eax,%r12d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0xc8,%ecx,%ecx
sub    %r15d,%r13d
add    $0x64,%r13d
mov    %r13d,0x18(%rsp,%rbp,1)
sub    %r14d,%r12d
add    $0x64,%r12d
mov    %r12d,0x1c(%rsp,%rbp,1)
sub    %eax,%ecx
add    $0x64,%ecx
mov    %ecx,0x20(%rsp,%rbp,1)
add    $0x18,%rbp
cmp    $0x2e4,%rbp
jne    1250 <effect_fireworks+0x110>
xor    %r14d,%r14d
mov    0x18(%rsp),%r15
lea    0xcee(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq 0x0(%r13,%r14,4),%rax
lea    0x64(%rax),%ebp
imul   $0xffffffff99999999,%rax,%r12
mov    %r12,%rax
shr    $0x3f,%rax
sar    $0x23,%r12
add    %eax,%r12d
xor    %ebx,%ebx
nop
imul   $0x64,0x2c(%rsp,%rbx,1),%eax
cltd
idiv   %ebp
mov    %eax,%ecx
add    0x20(%rsp,%rbx,1),%ecx
mov    %ecx,0x20(%rsp,%rbx,1)
imul   $0x64,0x30(%rsp,%rbx,1),%eax
cltd
idiv   %ebp
mov    %eax,%esi
add    0x24(%rsp,%rbx,1),%esi
mov    %esi,0x24(%rsp,%rbx,1)
imul   $0x64,0x34(%rsp,%rbx,1),%eax
cltd
idiv   %ebp
add    %r12d,%eax
add    0x28(%rsp,%rbx,1),%eax
mov    %eax,0x28(%rsp,%rbx,1)
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rdi
add    %ecx,%edi
movslq %esi,%rcx
imul   $0x51eb851f,%rcx,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rsi
add    %ecx,%esi
cltq
imul   $0x51eb851f,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x25,%rdx
add    %eax,%edx
call   1040 <setvoxel@plt>
add    $0x18,%rbx
cmp    $0x2d0,%rbx
jne    1340 <effect_fireworks+0x200>
mov    %r15d,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
add    $0x1,%r14
cmp    $0x19,%r14
jne    1320 <effect_fireworks+0x1e0>
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    0x10(%rsp),%eax
jne    11a0 <effect_fireworks+0x60>
add    $0x2f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@effect_fireworks.coeff = internal constant [25 x i32] [i32 5, i32 55, i32 105, i32 156, i32 207, i32 260, i32 314, i32 370, i32 428, i32 489, i32 552, i32 620, i32 691, i32 768, i32 850, i32 940, i32 1039, i32 1149, i32 1273, i32 1413, i32 1574, i32 1763, i32 1989, i32 2264, i32 2610]
define void @effect_fireworks(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [30 x [6 x i32]]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 3, i32* %8
store i32 3, i32* %9
store i32 3, i32* %10
%18 = load i32, i32* %3
%19 = mul nsw i32 %18, 1000
%20 = load i32, i32* %4
%21 = sdiv i32 %19, %20
%22 = sdiv i32 %21, 61
store i32 %22, i32* %16
%23 = call i32 @fill(i32 0)
store i32 0, i32* %5
br label %24
24: ; preds = %208, %2
%25 = load i32, i32* %5
%26 = load i32, i32* %16
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %211
28: ; preds = %24
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 4
store i32 %30, i32* %8
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 4
store i32 %32, i32* %9
%33 = call i32 (...) @rand()
%34 = srem i32 %33, 2
store i32 %34, i32* %10
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 5
store i32 %36, i32* %10
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 2
store i32 %38, i32* %8
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 2
store i32 %40, i32* %9
store i32 0, i32* %7
br label %41
41: ; preds = %57, %28
%42 = load i32, i32* %7
%43 = load i32, i32* %10
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %60
45: ; preds = %41
%46 = load i32, i32* %8
%47 = load i32, i32* %9
%48 = load i32, i32* %7
%49 = call i32 @setvoxel(i32 %46, i32 %47, i32 %48)
%50 = load i32, i32* %4
%51 = load i32, i32* %7
%52 = mul nsw i32 2, %51
%53 = add nsw i32 2, %52
%54 = mul nsw i32 %50, %53
%55 = call i32 @delay_ms(i32 %54)
%56 = call i32 @fill(i32 0)
br label %57
57: ; preds = %45
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %41
60: ; preds = %41
store i32 0, i32* %6
br label %61
61: ; preds = %107, %60
%62 = load i32, i32* %6
%63 = icmp slt i32 %62, 30
br i1 %63, label %64, label %110
64: ; preds = %61
%65 = load i32, i32* %8
%66 = mul nsw i32 %65, 100
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %68
%70 = getelementptr inbounds [6 x i32], [6 x i32]* %69, i64 0, i64 0
store i32 %66, i32* %70
%71 = load i32, i32* %9
%72 = mul nsw i32 %71, 100
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %74
%76 = getelementptr inbounds [6 x i32], [6 x i32]* %75, i64 0, i64 1
store i32 %72, i32* %76
%77 = load i32, i32* %10
%78 = mul nsw i32 %77, 100
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %80
%82 = getelementptr inbounds [6 x i32], [6 x i32]* %81, i64 0, i64 2
store i32 %78, i32* %82
%83 = call i32 (...) @rand()
%84 = srem i32 %83, 200
store i32 %84, i32* %12
%85 = call i32 (...) @rand()
%86 = srem i32 %85, 200
store i32 %86, i32* %11
%87 = call i32 (...) @rand()
%88 = srem i32 %87, 200
store i32 %88, i32* %13
%89 = load i32, i32* %12
%90 = sub nsw i32 100, %89
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %92
%94 = getelementptr inbounds [6 x i32], [6 x i32]* %93, i64 0, i64 3
store i32 %90, i32* %94
%95 = load i32, i32* %11
%96 = sub nsw i32 100, %95
%97 = load i32, i32* %6
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %98
%100 = getelementptr inbounds [6 x i32], [6 x i32]* %99, i64 0, i64 4
store i32 %96, i32* %100
%101 = load i32, i32* %13
%102 = sub nsw i32 100, %101
%103 = load i32, i32* %6
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %104
%106 = getelementptr inbounds [6 x i32], [6 x i32]* %105, i64 0, i64 5
store i32 %102, i32* %106
br label %107
107: ; preds = %64
%108 = load i32, i32* %6
%109 = add nsw i32 %108, 1
store i32 %109, i32* %6
br label %61
110: ; preds = %61
store i32 0, i32* %7
br label %111
111: ; preds = %204, %110
%112 = load i32, i32* %7
%113 = icmp slt i32 %112, 25
br i1 %113, label %114, label %207
114: ; preds = %111
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [25 x i32], [25 x i32]* @effect_fireworks.coeff, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = add nsw i32 100, %118
store i32 %119, i32* %14
%120 = load i32, i32* %7
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [25 x i32], [25 x i32]* @effect_fireworks.coeff, i64 0, i64 %121
%123 = load i32, i32* %122
%124 = sdiv i32 %123, 20
store i32 %124, i32* %15
store i32 0, i32* %6
br label %125
125: ; preds = %197, %114
%126 = load i32, i32* %6
%127 = icmp slt i32 %126, 30
br i1 %127, label %128, label %200
128: ; preds = %125
%129 = load i32, i32* %6
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %130
%132 = getelementptr inbounds [6 x i32], [6 x i32]* %131, i64 0, i64 3
%133 = load i32, i32* %132
%134 = mul nsw i32 %133, 100
%135 = load i32, i32* %14
%136 = sdiv i32 %134, %135
%137 = load i32, i32* %6
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %138
%140 = getelementptr inbounds [6 x i32], [6 x i32]* %139, i64 0, i64 0
%141 = load i32, i32* %140
%142 = add nsw i32 %141, %136
store i32 %142, i32* %140
%143 = load i32, i32* %6
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %144
%146 = getelementptr inbounds [6 x i32], [6 x i32]* %145, i64 0, i64 4
%147 = load i32, i32* %146
%148 = mul nsw i32 %147, 100
%149 = load i32, i32* %14
%150 = sdiv i32 %148, %149
%151 = load i32, i32* %6
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %152
%154 = getelementptr inbounds [6 x i32], [6 x i32]* %153, i64 0, i64 1
%155 = load i32, i32* %154
%156 = add nsw i32 %155, %150
store i32 %156, i32* %154
%157 = load i32, i32* %6
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %158
%160 = getelementptr inbounds [6 x i32], [6 x i32]* %159, i64 0, i64 5
%161 = load i32, i32* %160
%162 = mul nsw i32 %161, 100
%163 = load i32, i32* %14
%164 = sdiv i32 %162, %163
%165 = load i32, i32* %6
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %166
%168 = getelementptr inbounds [6 x i32], [6 x i32]* %167, i64 0, i64 2
%169 = load i32, i32* %168
%170 = add nsw i32 %169, %164
store i32 %170, i32* %168
%171 = load i32, i32* %15
%172 = load i32, i32* %6
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %173
%175 = getelementptr inbounds [6 x i32], [6 x i32]* %174, i64 0, i64 2
%176 = load i32, i32* %175
%177 = sub nsw i32 %176, %171
store i32 %177, i32* %175
%178 = load i32, i32* %6
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %179
%181 = getelementptr inbounds [6 x i32], [6 x i32]* %180, i64 0, i64 0
%182 = load i32, i32* %181
%183 = sdiv i32 %182, 100
%184 = load i32, i32* %6
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %185
%187 = getelementptr inbounds [6 x i32], [6 x i32]* %186, i64 0, i64 1
%188 = load i32, i32* %187
%189 = sdiv i32 %188, 100
%190 = load i32, i32* %6
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %17, i64 0, i64 %191
%193 = getelementptr inbounds [6 x i32], [6 x i32]* %192, i64 0, i64 2
%194 = load i32, i32* %193
%195 = sdiv i32 %194, 100
%196 = call i32 @setvoxel(i32 %183, i32 %189, i32 %195)
br label %197
197: ; preds = %128
%198 = load i32, i32* %6
%199 = add nsw i32 %198, 1
store i32 %199, i32* %6
br label %125
200: ; preds = %125
%201 = load i32, i32* %4
%202 = call i32 @delay_ms(i32 %201)
%203 = call i32 @fill(i32 0)
br label %204
204: ; preds = %200
%205 = load i32, i32* %7
%206 = add nsw i32 %205, 1
store i32 %206, i32* %7
br label %111
207: ; preds = %111
br label %208
208: ; preds = %207
%209 = load i32, i32* %5
%210 = add nsw i32 %209, 1
store i32 %210, i32* %5
br label %24
211: ; preds = %24
ret void
}

LLVM IR (-O2):
@effect_fireworks.coeff = internal unnamed_addr constant [25 x i32] [i32 5, i32 55, i32 105, i32 156, i32 207, i32 260, i32 314, i32 370, i32 428, i32 489, i32 552, i32 620, i32 691, i32 768, i32 850, i32 940, i32 1039, i32 1149, i32 1273, i32 1413, i32 1574, i32 1763, i32 1989, i32 2264, i32 2610]
define void @effect_fireworks(i32 %0, i32 %1) {
%3 = alloca [30 x [6 x i32]]
%4 = mul nsw i32 %0, 1000
%5 = sdiv i32 %4, %1
%6 = sdiv i32 %5, 61
%7 = bitcast [30 x [6 x i32]]* %3 to i8*
%8 = tail call i32 @fill(i32 0)
%9 = icmp sgt i32 %5, 60
br i1 %9, label %10, label %98
10: ; preds = %2, %95
%11 = phi i32 [ %96, %95 ], [ 0, %2 ]
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 4
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 4
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 2
%18 = add nsw i32 %17, 5
%19 = add nsw i32 %13, 2
%20 = add nsw i32 %15, 2
br label %25
21: ; preds = %25
%22 = mul nsw i32 %19, 100
%23 = mul nsw i32 %20, 100
%24 = mul nsw i32 %18, 100
br label %35
25: ; preds = %10, %25
%26 = phi i32 [ %33, %25 ], [ 0, %10 ]
%27 = tail call i32 @setvoxel(i32 %19, i32 %20, i32 %26)
%28 = shl nuw nsw i32 %26, 1
%29 = add nuw nsw i32 %28, 2
%30 = mul nsw i32 %29, %1
%31 = tail call i32 @delay_ms(i32 %30)
%32 = tail call i32 @fill(i32 0)
%33 = add nuw nsw i32 %26, 1
%34 = icmp eq i32 %33, %18
br i1 %34, label %21, label %25
35: ; preds = %21, %35
%36 = phi i64 [ 0, %21 ], [ %52, %35 ]
%37 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 0
store i32 %22, i32* %37
%38 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 1
store i32 %23, i32* %38
%39 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 2
store i32 %24, i32* %39
%40 = tail call i32 (...) @rand()
%41 = srem i32 %40, 200
%42 = tail call i32 (...) @rand()
%43 = srem i32 %42, 200
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 200
%46 = sub nsw i32 100, %41
%47 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 3
store i32 %46, i32* %47
%48 = sub nsw i32 100, %43
%49 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 4
store i32 %48, i32* %49
%50 = sub nsw i32 100, %45
%51 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %36, i64 5
store i32 %50, i32* %51
%52 = add nuw nsw i64 %36, 1
%53 = icmp eq i64 %52, 30
br i1 %53, label %54, label %35
54: ; preds = %35, %90
%55 = phi i64 [ %93, %90 ], [ 0, %35 ]
%56 = getelementptr inbounds [25 x i32], [25 x i32]* @effect_fireworks.coeff, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = add nsw i32 %57, 100
%59 = sdiv i32 %57, -20
br label %60
60: ; preds = %54, %60
%61 = phi i64 [ 0, %54 ], [ %88, %60 ]
%62 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 3
%63 = load i32, i32* %62
%64 = mul nsw i32 %63, 100
%65 = sdiv i32 %64, %58
%66 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 0
%67 = load i32, i32* %66
%68 = add nsw i32 %67, %65
store i32 %68, i32* %66
%69 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 4
%70 = load i32, i32* %69
%71 = mul nsw i32 %70, 100
%72 = sdiv i32 %71, %58
%73 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 1
%74 = load i32, i32* %73
%75 = add nsw i32 %74, %72
store i32 %75, i32* %73
%76 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 5
%77 = load i32, i32* %76
%78 = mul nsw i32 %77, 100
%79 = sdiv i32 %78, %58
%80 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %61, i64 2
%81 = load i32, i32* %80
%82 = add i32 %79, %59
%83 = add i32 %82, %81
store i32 %83, i32* %80
%84 = sdiv i32 %68, 100
%85 = sdiv i32 %75, 100
%86 = sdiv i32 %83, 100
%87 = tail call i32 @setvoxel(i32 %84, i32 %85, i32 %86)
%88 = add nuw nsw i64 %61, 1
%89 = icmp eq i64 %88, 30
br i1 %89, label %90, label %60
90: ; preds = %60
%91 = tail call i32 @delay_ms(i32 %1)
%92 = tail call i32 @fill(i32 0)
%93 = add nuw nsw i64 %55, 1
%94 = icmp eq i64 %93, 25
br i1 %94, label %95, label %54
95: ; preds = %90
%96 = add nuw nsw i32 %11, 1
%97 = icmp eq i32 %96, %6
br i1 %97, label %98, label %10
98: ; preds = %95, %2
ret void
}