#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);
int rand();
int /*<<< orphan*/ setvoxel(int, int, int);
void fireworks(int iterations, 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 particles[30][6];
  fill(0x00);
  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(300 + 250 * e);
      fill(0x00);
    }
    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(0x00);
    }
  }
}


x86 assembly (clang, -O0):
<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)
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14b4 <fireworks+0x374>
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    1219 <fireworks+0xd9>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <setvoxel@plt>
imul   $0xfa,-0x14(%rbp),%edi
add    $0x12c,%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    11d8 <fireworks+0x98>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    130f <fireworks+0x1cf>
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    1220 <fireworks+0xe0>
movl   $0x0,-0x14(%rbp)
cmpl   $0x19,-0x14(%rbp)
jge    14a1 <fireworks+0x361>
movslq -0x14(%rbp),%rcx
lea    0xcd5(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x64,%eax
mov    %eax,-0x30(%rbp)
movslq -0x14(%rbp),%rcx
lea    0xcc1(%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    1484 <fireworks+0x344>
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    1354 <fireworks+0x214>
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    1316 <fireworks+0x1d6>
jmp    14a6 <fireworks+0x366>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <fireworks+0x34>
add    $0x310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fireworks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2f8,%rsp
mov    %esi,%r14d
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebx,0x10(%rsp)
test   %ebx,%ebx
jle    13df <fireworks+0x29f>
xor    %eax,%eax
mov    %r14d,0xc(%rsp)
mov    %eax,0x14(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r15d
lea    0x3(%r15),%r12d
test   %eax,%eax
cmovns %eax,%r12d
and    $0xfffffffc,%r12d
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r13d
lea    0x3(%r13),%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),%r14d
add    $0x5,%r14d
neg    %r12d
add    %r12d,%r15d
add    $0x2,%r15d
neg    %ebx
add    %ebx,%r13d
add    $0x2,%r13d
mov    $0x12c,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %r13d,%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    $0xfa,%ebx
cmp    %ebp,%r14d
jne    11e0 <fireworks+0xa0>
imul   $0x64,%r15d,%eax
mov    %eax,0x1c(%rsp)
imul   $0x64,%r13d,%eax
mov    %eax,0x18(%rsp)
imul   $0x64,%r14d,%ebx
mov    $0x14,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x1c(%rsp),%eax
mov    %eax,0xc(%rsp,%rbp,1)
mov    0x18(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,1)
mov    %ebx,0x14(%rsp,%rbp,1)
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>
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>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0xc8,%ecx,%ecx
sub    %r14d,%r12d
add    $0x64,%r12d
mov    %r12d,0x18(%rsp,%rbp,1)
sub    %r15d,%r13d
add    $0x64,%r13d
mov    %r13d,0x1c(%rsp,%rbp,1)
sub    %eax,%ecx
add    $0x64,%ecx
mov    %ecx,0x20(%rsp,%rbp,1)
add    $0x18,%rbp
cmp    $0x2e4,%rbp
jne    1230 <fireworks+0xf0>
xor    %r15d,%r15d
mov    0xc(%rsp),%r14d
lea    0xd0e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq (%r12,%r15,4),%rax
lea    0x64(%rax),%ebp
imul   $0xffffffff99999999,%rax,%r13
mov    %r13,%rax
shr    $0x3f,%rax
sar    $0x23,%r13
add    %eax,%r13d
xor    %ebx,%ebx
xchg   %ax,%ax
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    %r13d,%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    1320 <fireworks+0x1e0>
mov    %r14d,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
add    $0x1,%r15
cmp    $0x19,%r15
jne    1300 <fireworks+0x1c0>
mov    0x14(%rsp),%eax
add    $0x1,%eax
cmp    0x10(%rsp),%eax
jne    1170 <fireworks+0x30>
add    $0x2f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@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 @fireworks(i32 %0, i32 %1) {
%3 = alloca [30 x [6 x i32]]
%4 = bitcast [30 x [6 x i32]]* %3 to i8*
%5 = tail call i32 @fill(i32 0)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %94
7: ; preds = %2, %91
%8 = phi i32 [ %92, %91 ], [ 0, %2 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 4
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 4
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 2
%15 = add nsw i32 %14, 5
%16 = add nsw i32 %10, 2
%17 = add nsw i32 %12, 2
br label %22
18: ; preds = %22
%19 = mul nsw i32 %16, 100
%20 = mul nsw i32 %17, 100
%21 = mul nsw i32 %15, 100
br label %31
22: ; preds = %7, %22
%23 = phi i32 [ %29, %22 ], [ 0, %7 ]
%24 = tail call i32 @setvoxel(i32 %16, i32 %17, i32 %23)
%25 = mul nuw nsw i32 %23, 250
%26 = add nuw nsw i32 %25, 300
%27 = tail call i32 @delay_ms(i32 %26)
%28 = tail call i32 @fill(i32 0)
%29 = add nuw nsw i32 %23, 1
%30 = icmp eq i32 %29, %15
br i1 %30, label %18, label %22
31: ; preds = %18, %31
%32 = phi i64 [ 0, %18 ], [ %48, %31 ]
%33 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 0
store i32 %19, i32* %33
%34 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 1
store i32 %20, i32* %34
%35 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 2
store i32 %21, i32* %35
%36 = tail call i32 (...) @rand()
%37 = srem i32 %36, 200
%38 = tail call i32 (...) @rand()
%39 = srem i32 %38, 200
%40 = tail call i32 (...) @rand()
%41 = srem i32 %40, 200
%42 = sub nsw i32 100, %37
%43 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 3
store i32 %42, i32* %43
%44 = sub nsw i32 100, %39
%45 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 4
store i32 %44, i32* %45
%46 = sub nsw i32 100, %41
%47 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %32, i64 5
store i32 %46, i32* %47
%48 = add nuw nsw i64 %32, 1
%49 = icmp eq i64 %48, 30
br i1 %49, label %50, label %31
50: ; preds = %31, %86
%51 = phi i64 [ %89, %86 ], [ 0, %31 ]
%52 = getelementptr inbounds [25 x i32], [25 x i32]* @fireworks.coeff, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = add nsw i32 %53, 100
%55 = sdiv i32 %53, -20
br label %56
56: ; preds = %50, %56
%57 = phi i64 [ 0, %50 ], [ %84, %56 ]
%58 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 3
%59 = load i32, i32* %58
%60 = mul nsw i32 %59, 100
%61 = sdiv i32 %60, %54
%62 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 0
%63 = load i32, i32* %62
%64 = add nsw i32 %63, %61
store i32 %64, i32* %62
%65 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 4
%66 = load i32, i32* %65
%67 = mul nsw i32 %66, 100
%68 = sdiv i32 %67, %54
%69 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 1
%70 = load i32, i32* %69
%71 = add nsw i32 %70, %68
store i32 %71, i32* %69
%72 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 5
%73 = load i32, i32* %72
%74 = mul nsw i32 %73, 100
%75 = sdiv i32 %74, %54
%76 = getelementptr inbounds [30 x [6 x i32]], [30 x [6 x i32]]* %3, i64 0, i64 %57, i64 2
%77 = load i32, i32* %76
%78 = add i32 %75, %55
%79 = add i32 %78, %77
store i32 %79, i32* %76
%80 = sdiv i32 %64, 100
%81 = sdiv i32 %71, 100
%82 = sdiv i32 %79, 100
%83 = tail call i32 @setvoxel(i32 %80, i32 %81, i32 %82)
%84 = add nuw nsw i64 %57, 1
%85 = icmp eq i64 %84, 30
br i1 %85, label %86, label %56
86: ; preds = %56
%87 = tail call i32 @delay_ms(i32 %1)
%88 = tail call i32 @fill(i32 0)
%89 = add nuw nsw i64 %51, 1
%90 = icmp eq i64 %89, 25
br i1 %90, label %91, label %50
91: ; preds = %86
%92 = add nuw nsw i32 %8, 1
%93 = icmp eq i32 %92, %0
br i1 %93, label %94, label %7
94: ; preds = %91, %2
ret void
}