#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 effect_telcstairs_do(int, int, int);
void effect_telcstairs(int invert, int delay, int val) {
  int x;
  if (invert) {
    for (x = 8 * 2; x >= 0; x--) {
      x = effect_telcstairs_do(x, val, delay);
    }
  } else {
    for (x = 0; x < 8 * 2; x++) {
      x = effect_telcstairs_do(x, val, delay);
    }
  }
}


x86 assembly (clang, -O0):
<effect_telcstairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1160 <effect_telcstairs+0x50>
movl   $0x10,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     115b <effect_telcstairs+0x4b>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <effect_telcstairs_do@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <effect_telcstairs+0x22>
jmp    1195 <effect_telcstairs+0x85>
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    1190 <effect_telcstairs+0x80>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <effect_telcstairs_do@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1167 <effect_telcstairs+0x57>
jmp    1195 <effect_telcstairs+0x85>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_telcstairs>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
test   %edi,%edi
je     1132 <effect_telcstairs+0x22>
mov    $0x10,%edi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <effect_telcstairs_do@plt>
lea    -0x1(%rax),%edi
test   %eax,%eax
jg     1120 <effect_telcstairs+0x10>
jmp    1151 <effect_telcstairs+0x41>
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <effect_telcstairs_do@plt>
lea    0x1(%rax),%edi
cmp    $0xf,%eax
jl     1140 <effect_telcstairs+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @effect_telcstairs(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %10, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 16, %3 ]
%7 = tail call i32 @effect_telcstairs_do(i32 %6, i32 %2, i32 %1)
%8 = add nsw i32 %7, -1
%9 = icmp sgt i32 %7, 0
br i1 %9, label %5, label %15
10: ; preds = %3, %10
%11 = phi i32 [ %13, %10 ], [ 0, %3 ]
%12 = tail call i32 @effect_telcstairs_do(i32 %11, i32 %2, i32 %1)
%13 = add nsw i32 %12, 1
%14 = icmp slt i32 %12, 15
br i1 %14, label %10, label %15
15: ; preds = %5, %10
ret void
}