#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*/ line(int /*<<< orphan*/, int /*<<< orphan*/, int,
                        int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ transss();
void effect_wavy_plane(int seconds, int delay) {
  int iterations = seconds * 1000 / delay / 13;
  int i, j, t;
  static const unsigned char daa[13] = {0, 1, 2,    0x23, 5, 6, 7,
                                        6, 5, 0x23, 2,    1, 0};
  fill(0);
  for (j = 0; j < iterations; j++) {
    for (i = 0; i < 13; i++) {
      if (daa[i] >> 4) {
        t = daa[i] & 0x0f;
        line(0, 0, t + 1, 0, 7, t + 1, 1);
      } else
        t = daa[i];
      line(0, 0, t, 0, 7, t, 1);
      transss();
      delay_ms(delay);
    }
  }
  fill(0);
}


x86 assembly (clang, -O0):
<effect_wavy_plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    $0xd,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
call   1030 <fill@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124b <effect_wavy_plane+0x10b>
movl   $0x0,-0x10(%rbp)
cmpl   $0xd,-0x10(%rbp)
jge    1238 <effect_wavy_plane+0xf8>
movslq -0x10(%rbp),%rcx
lea    0xe66(%rip),%rax
movzbl (%rax,%rcx,1),%eax
sar    $0x4,%eax
cmp    $0x0,%eax
je     11ea <effect_wavy_plane+0xaa>
movslq -0x10(%rbp),%rcx
lea    0xe4b(%rip),%rax
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%r9d
add    $0x1,%r9d
xor    %ecx,%ecx
mov    $0x7,%r8d
mov    %ecx,%edi
mov    %ecx,%esi
movl   $0x1,(%rsp)
call   1050 <line@plt>
jmp    11fc <effect_wavy_plane+0xbc>
movslq -0x10(%rbp),%rcx
lea    0xe0b(%rip),%rax
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%r9d
xor    %ecx,%ecx
mov    $0x7,%r8d
mov    %ecx,%edi
mov    %ecx,%esi
movl   $0x1,(%rsp)
call   1050 <line@plt>
mov    $0x0,%al
call   1060 <transss@plt>
mov    -0x8(%rbp),%edi
call   1040 <delay_ms@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1185 <effect_wavy_plane+0x45>
jmp    123d <effect_wavy_plane+0xfd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <effect_wavy_plane+0x32>
xor    %edi,%edi
call   1030 <fill@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<effect_wavy_plane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
imul   $0x3e8,%edi,%eax
cltd
idiv   %esi
mov    %eax,%ebx
xor    %edi,%edi
call   1030 <fill@plt>
cmp    $0xd,%ebx
jl     1209 <effect_wavy_plane+0xc9>
movslq %ebx,%rax
imul   $0x4ec4ec4f,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x22,%r14
add    %eax,%r14d
lea    0xe78(%rip),%r15
xor    %r12d,%r12d
jmp    1199 <effect_wavy_plane+0x59>
nopl   (%rax)
add    $0x1,%r12d
cmp    %r14d,%r12d
je     1209 <effect_wavy_plane+0xc9>
xor    %ebp,%ebp
jmp    11f7 <effect_wavy_plane+0xb7>
nopl   (%rax)
and    $0xf,%ebx
lea    0x1(%rbx),%edx
movl   $0x1,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
xor    %ecx,%ecx
mov    $0x7,%r8d
mov    %edx,%r9d
call   1050 <line@plt>
movl   $0x1,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    $0x7,%r8d
mov    %ebx,%r9d
call   1050 <line@plt>
xor    %eax,%eax
call   1060 <transss@plt>
mov    %r13d,%edi
call   1040 <delay_ms@plt>
add    $0x1,%rbp
cmp    $0xd,%rbp
je     1190 <effect_wavy_plane+0x50>
movzbl 0x0(%rbp,%r15,1),%ebx
cmp    $0x9,%ebp
je     11a0 <effect_wavy_plane+0x60>
cmp    $0x3,%ebp
je     11a0 <effect_wavy_plane+0x60>
jmp    11c1 <effect_wavy_plane+0x81>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fill@plt>

LLVM IR (-O0):
@effect_wavy_plane.daa = internal constant [13 x i8] c"\00\01\02#\05\06\07\06\05#\02\01\00"
define void @effect_wavy_plane(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 1000
%11 = load i32, i32* %4
%12 = sdiv i32 %10, %11
%13 = sdiv i32 %12, 13
store i32 %13, i32* %5
%14 = call i32 @fill(i32 0)
store i32 0, i32* %7
br label %15
15: ; preds = %60, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %63
19: ; preds = %15
store i32 0, i32* %6
br label %20
20: ; preds = %56, %19
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 13
br i1 %22, label %23, label %59
23: ; preds = %20
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [13 x i8], [13 x i8]* @effect_wavy_plane.daa, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = ashr i32 %28, 4
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %43
31: ; preds = %23
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [13 x i8], [13 x i8]* @effect_wavy_plane.daa, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = and i32 %36, 15
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
%42 = call i32 @line(i32 0, i32 0, i32 %39, i32 0, i32 7, i32 %41, i32 1)
br label %49
43: ; preds = %23
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [13 x i8], [13 x i8]* @effect_wavy_plane.daa, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
store i32 %48, i32* %8
br label %49
49: ; preds = %43, %31
%50 = load i32, i32* %8
%51 = load i32, i32* %8
%52 = call i32 @line(i32 0, i32 0, i32 %50, i32 0, i32 7, i32 %51, i32 1)
%53 = call i32 (...) @transss()
%54 = load i32, i32* %4
%55 = call i32 @delay_ms(i32 %54)
br label %56
56: ; preds = %49
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %20
59: ; preds = %20
br label %60
60: ; preds = %59
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %15
63: ; preds = %15
%64 = call i32 @fill(i32 0)
ret void
}

LLVM IR (-O2):
@effect_wavy_plane.daa = internal unnamed_addr constant [13 x i8] c"\00\01\02#\05\06\07\06\05#\02\01\00"
define void @effect_wavy_plane(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 1000
%4 = sdiv i32 %3, %1
%5 = sdiv i32 %4, 13
%6 = tail call i32 @fill(i32 0)
%7 = icmp sgt i32 %4, 12
br i1 %7, label %8, label %30
8: ; preds = %2, %27
%9 = phi i32 [ %28, %27 ], [ 0, %2 ]
br label %10
10: ; preds = %8, %20
%11 = phi i64 [ 0, %8 ], [ %25, %20 ]
%12 = getelementptr inbounds [13 x i8], [13 x i8]* @effect_wavy_plane.daa, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = trunc i64 %11 to i32
switch i32 %15, label %20 [
i32 9, label %16
i32 3, label %16
]
16: ; preds = %10, %10
%17 = and i32 %14, 15
%18 = add nuw nsw i32 %17, 1
%19 = tail call i32 @line(i32 0, i32 0, i32 %18, i32 0, i32 7, i32 %18, i32 1)
br label %20
20: ; preds = %10, %16
%21 = phi i32 [ %17, %16 ], [ %14, %10 ]
%22 = tail call i32 @line(i32 0, i32 0, i32 %21, i32 0, i32 7, i32 %21, i32 1)
%23 = tail call i32 (...) @transss()
%24 = tail call i32 @delay_ms(i32 %1)
%25 = add nuw nsw i64 %11, 1
%26 = icmp eq i64 %25, 13
br i1 %26, label %27, label %10
27: ; preds = %20
%28 = add nuw nsw i32 %9, 1
%29 = icmp eq i32 %28, %5
br i1 %29, label %30, label %8
30: ; preds = %27, %2
%31 = tail call i32 @fill(i32 0)
ret void
}