#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);
void effect_blinky(int repeat, int mindelay, int maxdelay) {
  int i, r;
  fill(0);
  for (r = 0; r < repeat; r++) {
    i = maxdelay;
    while (i >= mindelay) {
      fill(0xff);
      delay_ms(mindelay);
      fill(0);
      delay_ms(i);
      i = i * 8 / 10;
    }
    i = mindelay;
    while (i <= maxdelay) {
      fill(0xff);
      delay_ms(mindelay);
      fill(0);
      delay_ms(i);
      i = i * 12 / 10;
    }
  }
}


x86 assembly (clang, -O0):
<effect_blinky>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ee <effect_blinky+0xce>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1194 <effect_blinky+0x74>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    -0x8(%rbp),%edi
call   1040 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x10(%rbp),%edi
call   1040 <delay_ms@plt>
mov    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1151 <effect_blinky+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11db <effect_blinky+0xbb>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    -0x8(%rbp),%edi
call   1040 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x10(%rbp),%edi
call   1040 <delay_ms@plt>
imul   $0xc,-0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    119a <effect_blinky+0x7a>
jmp    11e0 <effect_blinky+0xc0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <effect_blinky+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_blinky>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%r14d
xor    %r12d,%r12d
xor    %edi,%edi
call   1030 <fill@plt>
test   %r14d,%r14d
jg     1159 <effect_blinky+0x39>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %r14d,%r12d
je     113f <effect_blinky+0x1f>
mov    %r15d,%ebx
cmp    %ebp,%r15d
jl     1150 <effect_blinky+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xff,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
call   1040 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebx,%edi
call   1040 <delay_ms@plt>
shl    $0x3,%ebx
movslq %ebx,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
cmp    %ebp,%ebx
jge    1170 <effect_blinky+0x50>
mov    %ebp,%ebx
cmp    %ebp,%r15d
jl     1150 <effect_blinky+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xff,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
call   1040 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebx,%edi
call   1040 <delay_ms@plt>
shl    $0x2,%ebx
lea    (%rbx,%rbx,2),%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
cmp    %r15d,%ebx
jle    11c0 <effect_blinky+0xa0>
jmp    1150 <effect_blinky+0x30>

LLVM IR (-O0):
define void @effect_blinky(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = call i32 @fill(i32 0)
store i32 0, i32* %8
br label %10
10: ; preds = %47, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %50
14: ; preds = %10
%15 = load i32, i32* %6
store i32 %15, i32* %7
br label %16
16: ; preds = %20, %14
%17 = load i32, i32* %7
%18 = load i32, i32* %5
%19 = icmp sge i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = call i32 @fill(i32 255)
%22 = load i32, i32* %5
%23 = call i32 @delay_ms(i32 %22)
%24 = call i32 @fill(i32 0)
%25 = load i32, i32* %7
%26 = call i32 @delay_ms(i32 %25)
%27 = load i32, i32* %7
%28 = mul nsw i32 %27, 8
%29 = sdiv i32 %28, 10
store i32 %29, i32* %7
br label %16
30: ; preds = %16
%31 = load i32, i32* %5
store i32 %31, i32* %7
br label %32
32: ; preds = %36, %30
%33 = load i32, i32* %7
%34 = load i32, i32* %6
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %46
36: ; preds = %32
%37 = call i32 @fill(i32 255)
%38 = load i32, i32* %5
%39 = call i32 @delay_ms(i32 %38)
%40 = call i32 @fill(i32 0)
%41 = load i32, i32* %7
%42 = call i32 @delay_ms(i32 %41)
%43 = load i32, i32* %7
%44 = mul nsw i32 %43, 12
%45 = sdiv i32 %44, 10
store i32 %45, i32* %7
br label %32
46: ; preds = %32
br label %47
47: ; preds = %46
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %10
50: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @effect_blinky(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @fill(i32 0)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %32
6: ; preds = %3
%7 = icmp slt i32 %2, %1
br label %8
8: ; preds = %6, %29
%9 = phi i32 [ 0, %6 ], [ %30, %29 ]
br i1 %7, label %29, label %11
10: ; preds = %11
br i1 %7, label %29, label %20
11: ; preds = %8, %11
%12 = phi i32 [ %18, %11 ], [ %2, %8 ]
%13 = tail call i32 @fill(i32 255)
%14 = tail call i32 @delay_ms(i32 %1)
%15 = tail call i32 @fill(i32 0)
%16 = tail call i32 @delay_ms(i32 %12)
%17 = shl nsw i32 %12, 3
%18 = sdiv i32 %17, 10
%19 = icmp slt i32 %18, %1
br i1 %19, label %10, label %11
20: ; preds = %10, %20
%21 = phi i32 [ %27, %20 ], [ %1, %10 ]
%22 = tail call i32 @fill(i32 255)
%23 = tail call i32 @delay_ms(i32 %1)
%24 = tail call i32 @fill(i32 0)
%25 = tail call i32 @delay_ms(i32 %21)
%26 = mul nsw i32 %21, 12
%27 = sdiv i32 %26, 10
%28 = icmp sgt i32 %27, %2
br i1 %28, label %29, label %20
29: ; preds = %20, %8, %10
%30 = add nuw nsw i32 %9, 1
%31 = icmp eq i32 %30, %0
br i1 %31, label %32, label %8
32: ; preds = %29, %3
ret void
}