#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*/ sparkle_flash(int, int, int);
void effect_random_sparkle(int seconds, int delay) {
  int i;
  int iterations = seconds * 1000 / delay / 40;
  for (i = 1; i < 20; i++) {
    sparkle_flash(iterations, i, delay);
  }
  for (i = 20; i >= 1; i--) {
    sparkle_flash(iterations, i, delay);
  }
}


x86 assembly (clang, -O0):
<effect_random_sparkle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    $0x28,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    1161 <effect_random_sparkle+0x51>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <sparkle_flash@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <effect_random_sparkle+0x2b>
movl   $0x14,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     118e <effect_random_sparkle+0x7e>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <sparkle_flash@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <effect_random_sparkle+0x58>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_random_sparkle>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
imul   $0x3e8,%edi,%eax
cltd
idiv   %esi
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x24,%rbx
add    %eax,%ebx
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x8,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x9,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xa,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xb,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xc,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xd,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xe,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xf,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x10,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x11,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x12,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x13,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x14,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x13,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x12,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x11,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x10,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xf,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xe,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xd,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xc,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xb,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0xa,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x9,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x8,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
call   1030 <sparkle_flash@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <sparkle_flash@plt>

LLVM IR (-O0):
define void @effect_random_sparkle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = mul nsw i32 %7, 1000
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
%11 = sdiv i32 %10, 40
store i32 %11, i32* %6
store i32 1, i32* %5
br label %12
12: ; preds = %20, %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 20
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = call i32 @sparkle_flash(i32 %16, i32 %17, i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %12
23: ; preds = %12
store i32 20, i32* %5
br label %24
24: ; preds = %32, %23
%25 = load i32, i32* %5
%26 = icmp sge i32 %25, 1
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = call i32 @sparkle_flash(i32 %28, i32 %29, i32 %30)
br label %32
32: ; preds = %27
%33 = load i32, i32* %5
%34 = add nsw i32 %33, -1
store i32 %34, i32* %5
br label %24
35: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @effect_random_sparkle(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 1000
%4 = sdiv i32 %3, %1
%5 = sdiv i32 %4, 40
%6 = tail call i32 @sparkle_flash(i32 %5, i32 1, i32 %1)
%7 = tail call i32 @sparkle_flash(i32 %5, i32 2, i32 %1)
%8 = tail call i32 @sparkle_flash(i32 %5, i32 3, i32 %1)
%9 = tail call i32 @sparkle_flash(i32 %5, i32 4, i32 %1)
%10 = tail call i32 @sparkle_flash(i32 %5, i32 5, i32 %1)
%11 = tail call i32 @sparkle_flash(i32 %5, i32 6, i32 %1)
%12 = tail call i32 @sparkle_flash(i32 %5, i32 7, i32 %1)
%13 = tail call i32 @sparkle_flash(i32 %5, i32 8, i32 %1)
%14 = tail call i32 @sparkle_flash(i32 %5, i32 9, i32 %1)
%15 = tail call i32 @sparkle_flash(i32 %5, i32 10, i32 %1)
%16 = tail call i32 @sparkle_flash(i32 %5, i32 11, i32 %1)
%17 = tail call i32 @sparkle_flash(i32 %5, i32 12, i32 %1)
%18 = tail call i32 @sparkle_flash(i32 %5, i32 13, i32 %1)
%19 = tail call i32 @sparkle_flash(i32 %5, i32 14, i32 %1)
%20 = tail call i32 @sparkle_flash(i32 %5, i32 15, i32 %1)
%21 = tail call i32 @sparkle_flash(i32 %5, i32 16, i32 %1)
%22 = tail call i32 @sparkle_flash(i32 %5, i32 17, i32 %1)
%23 = tail call i32 @sparkle_flash(i32 %5, i32 18, i32 %1)
%24 = tail call i32 @sparkle_flash(i32 %5, i32 19, i32 %1)
%25 = tail call i32 @sparkle_flash(i32 %5, i32 20, i32 %1)
%26 = tail call i32 @sparkle_flash(i32 %5, i32 19, i32 %1)
%27 = tail call i32 @sparkle_flash(i32 %5, i32 18, i32 %1)
%28 = tail call i32 @sparkle_flash(i32 %5, i32 17, i32 %1)
%29 = tail call i32 @sparkle_flash(i32 %5, i32 16, i32 %1)
%30 = tail call i32 @sparkle_flash(i32 %5, i32 15, i32 %1)
%31 = tail call i32 @sparkle_flash(i32 %5, i32 14, i32 %1)
%32 = tail call i32 @sparkle_flash(i32 %5, i32 13, i32 %1)
%33 = tail call i32 @sparkle_flash(i32 %5, i32 12, i32 %1)
%34 = tail call i32 @sparkle_flash(i32 %5, i32 11, i32 %1)
%35 = tail call i32 @sparkle_flash(i32 %5, i32 10, i32 %1)
%36 = tail call i32 @sparkle_flash(i32 %5, i32 9, i32 %1)
%37 = tail call i32 @sparkle_flash(i32 %5, i32 8, i32 %1)
%38 = tail call i32 @sparkle_flash(i32 %5, i32 7, i32 %1)
%39 = tail call i32 @sparkle_flash(i32 %5, i32 6, i32 %1)
%40 = tail call i32 @sparkle_flash(i32 %5, i32 5, i32 %1)
%41 = tail call i32 @sparkle_flash(i32 %5, i32 4, i32 %1)
%42 = tail call i32 @sparkle_flash(i32 %5, i32 3, i32 %1)
%43 = tail call i32 @sparkle_flash(i32 %5, i32 2, i32 %1)
%44 = tail call i32 @sparkle_flash(i32 %5, i32 1, i32 %1)
ret void
}