#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 /*<<< orphan*/ setplane(int, int);
void effect_plane(int plane, int delay) {
  int i;
  for (i = 0; i < 8; i++) {
    fill(0);
    setplane(plane, i);
    delay_ms(delay);
  }
  for (i = 7; i >= 0; i--) {
    fill(0);
    setplane(plane, i);
    delay_ms(delay);
  }
}


x86 assembly (clang, -O0):
<effect_plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1177 <effect_plane+0x47>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <setplane@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay_ms@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <effect_plane+0x15>
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11b0 <effect_plane+0x80>
xor    %edi,%edi
call   1030 <fill@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <setplane@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay_ms@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <effect_plane+0x4e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_plane>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x6,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x7,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x7,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x6,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x4,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
call   1050 <delay_ms@plt>
xor    %edi,%edi
call   1030 <fill@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <setplane@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <delay_ms@plt>

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

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