#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_blinky2() {
  int i, r;
  fill(0x00);
  for (r = 0; r < 2; r++) {
    i = 350;
    while (i > 0) {
      fill(0x00);
      delay_ms(i);
      fill(0xff);
      delay_ms(100);
      i = i - (7 + (500 / (i / 10)));
    }
    delay_ms(500);
    i = 350;
    while (i > 0) {
      fill(0x00);
      delay_ms(351 - i);
      fill(0xff);
      delay_ms(100);
      i = i - (7 + (500 / (i / 10)));
    }
  }
}


x86 assembly (clang, -O0):
<effect_blinky2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1224 <effect_blinky2+0x104>
movl   $0x15e,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11a1 <effect_blinky2+0x81>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x4(%rbp),%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1f4,%eax
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    $0x7,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <effect_blinky2+0x27>
mov    $0x1f4,%edi
call   1040 <delay_ms@plt>
movl   $0x15e,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1211 <effect_blinky2+0xf1>
xor    %edi,%edi
call   1030 <fill@plt>
mov    $0x15f,%edi
sub    -0x4(%rbp),%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1f4,%eax
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    $0x7,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <effect_blinky2+0x92>
jmp    1216 <effect_blinky2+0xf6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <effect_blinky2+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_blinky2>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <fill@plt>
mov    $0x15e,%ebx
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebx,%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    %ebx,%ecx
imul   %r14,%rcx
shr    $0x23,%rcx
mov    $0x1f4,%eax
xor    %edx,%edx
div    %ecx
neg    %eax
add    %eax,%ebx
add    $0xfffffff9,%ebx
test   %ebx,%ebx
jg     1140 <effect_blinky2+0x20>
mov    $0x1f4,%edi
call   1040 <delay_ms@plt>
mov    $0x15e,%ebx
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1030 <fill@plt>
mov    $0x15f,%edi
sub    %ebx,%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    %ebx,%ecx
imul   %r14,%rcx
shr    $0x23,%rcx
mov    $0x1f4,%eax
xor    %edx,%edx
div    %ecx
neg    %eax
add    %eax,%ebx
add    $0xfffffff9,%ebx
test   %ebx,%ebx
jg     11a0 <effect_blinky2+0x80>
mov    $0x15e,%ebx
mov    $0xcccccccd,%r14d
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebx,%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    %ebx,%ecx
imul   %r14,%rcx
shr    $0x23,%rcx
mov    $0x1f4,%eax
xor    %edx,%edx
div    %ecx
neg    %eax
add    %eax,%ebx
add    $0xfffffff9,%ebx
test   %ebx,%ebx
jg     11f0 <effect_blinky2+0xd0>
mov    $0x1f4,%edi
call   1040 <delay_ms@plt>
mov    $0x15e,%ebx
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1030 <fill@plt>
mov    $0x15f,%edi
sub    %ebx,%edi
call   1040 <delay_ms@plt>
mov    $0xff,%edi
call   1030 <fill@plt>
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    %ebx,%ecx
imul   %r14,%rcx
shr    $0x23,%rcx
mov    $0x1f4,%eax
xor    %edx,%edx
div    %ecx
neg    %eax
add    %eax,%ebx
add    $0xfffffff9,%ebx
test   %ebx,%ebx
jg     1250 <effect_blinky2+0x130>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @effect_blinky2() {
%1 = tail call i32 @fill(i32 0)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 350, %0 ], [ %11, %2 ]
%4 = tail call i32 @fill(i32 0)
%5 = tail call i32 @delay_ms(i32 %3)
%6 = tail call i32 @fill(i32 255)
%7 = tail call i32 @delay_ms(i32 100)
%8 = udiv i32 %3, 10
%9 = udiv i32 500, %8
%10 = add nsw i32 %3, -7
%11 = sub nsw i32 %10, %9
%12 = icmp sgt i32 %11, 0
br i1 %12, label %2, label %13
13: ; preds = %2
%14 = tail call i32 @delay_ms(i32 500)
br label %15
15: ; preds = %13, %15
%16 = phi i32 [ 350, %13 ], [ %25, %15 ]
%17 = tail call i32 @fill(i32 0)
%18 = sub nsw i32 351, %16
%19 = tail call i32 @delay_ms(i32 %18)
%20 = tail call i32 @fill(i32 255)
%21 = tail call i32 @delay_ms(i32 100)
%22 = udiv i32 %16, 10
%23 = udiv i32 500, %22
%24 = add nsw i32 %16, -7
%25 = sub nsw i32 %24, %23
%26 = icmp sgt i32 %25, 0
br i1 %26, label %15, label %27
27: ; preds = %15, %27
%28 = phi i32 [ %36, %27 ], [ 350, %15 ]
%29 = tail call i32 @fill(i32 0)
%30 = tail call i32 @delay_ms(i32 %28)
%31 = tail call i32 @fill(i32 255)
%32 = tail call i32 @delay_ms(i32 100)
%33 = udiv i32 %28, 10
%34 = udiv i32 500, %33
%35 = add nsw i32 %28, -7
%36 = sub nsw i32 %35, %34
%37 = icmp sgt i32 %36, 0
br i1 %37, label %27, label %38
38: ; preds = %27
%39 = tail call i32 @delay_ms(i32 500)
br label %40
40: ; preds = %40, %38
%41 = phi i32 [ 350, %38 ], [ %50, %40 ]
%42 = tail call i32 @fill(i32 0)
%43 = sub nsw i32 351, %41
%44 = tail call i32 @delay_ms(i32 %43)
%45 = tail call i32 @fill(i32 255)
%46 = tail call i32 @delay_ms(i32 100)
%47 = udiv i32 %41, 10
%48 = udiv i32 500, %47
%49 = add nsw i32 %41, -7
%50 = sub nsw i32 %49, %48
%51 = icmp sgt i32 %50, 0
br i1 %51, label %40, label %52
52: ; preds = %40
ret void
}