#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*/ attrset(int);
int keyboard_get_key();
int /*<<< orphan*/ mvaddch(int, int, int);
int /*<<< orphan*/ mvaddnstr(int, int /*<<< orphan*/, char const *, int);
int /*<<< orphan*/ usleep(int);
void sparkle_pause(void) {
  static const char *str = "*    *    *    *    *    *    *    *    *    *    "
                           "*    *    *    *    *    *    *    ";
  unsigned a, b;
  attrset(((4) & 0x0f) | (((0) & 0x0f) << 4));
  do {
    for (a = 0; a < 5; a++) {
      mvaddnstr(0, 0, str + a, 80);
      mvaddnstr(21, 0, str + (4 - a), 80);
      for (b = 1; b < 21; b++) {
        if ((a + b + 2) % 5 == 1) {
          mvaddch(
              b, 79,
              ((('*') & 0xff) | ((((4) & 0x0f) | (((0) & 0x0f) << 4)) << 8)));
          mvaddch(
              21 - b, 0,
              ((('*') & 0xff) | ((((4) & 0x0f) | (((0) & 0x0f) << 4)) << 8)));
        } else {
          mvaddch(b, 79,
                  (((0) & 0xff) | ((((0) & 0x0f) | (((0) & 0x0f) << 4)) << 8)));
          mvaddch(21 - b, 0,
                  (((0) & 0xff) | ((((0) & 0x0f) | (((0) & 0x0f) << 4)) << 8)));
        }
      }
      if (keyboard_get_key() != -1) {
        return;
      }
      usleep(150 * 1000);
    }
  } while (1);
}


x86 assembly (clang, -O0):
<sparkle_pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <attrset@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jae    126a <sparkle_pause+0x11a>
mov    0x2ece(%rip),%rdx
mov    -0x4(%rbp),%eax
add    %rax,%rdx
xor    %esi,%esi
mov    $0x50,%ecx
mov    %esi,%edi
call   1030 <mvaddnstr@plt>
mov    0x2eb3(%rip),%rdx
mov    $0x4,%eax
sub    -0x4(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdx
mov    $0x15,%edi
xor    %esi,%esi
mov    $0x50,%ecx
call   1030 <mvaddnstr@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x15,-0x8(%rbp)
jae    123d <sparkle_pause+0xed>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x2,%eax
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x1,%edx
jne    120a <sparkle_pause+0xba>
mov    -0x8(%rbp),%edi
mov    $0x4f,%esi
mov    $0x42a,%edx
call   1060 <mvaddch@plt>
mov    $0x15,%edi
sub    -0x8(%rbp),%edi
xor    %esi,%esi
mov    $0x42a,%edx
call   1060 <mvaddch@plt>
jmp    122a <sparkle_pause+0xda>
mov    -0x8(%rbp),%edi
mov    $0x4f,%esi
xor    %edx,%edx
call   1060 <mvaddch@plt>
mov    $0x15,%edi
sub    -0x8(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1060 <mvaddch@plt>
jmp    122f <sparkle_pause+0xdf>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ba <sparkle_pause+0x6a>
mov    $0x0,%al
call   1040 <keyboard_get_key@plt>
cmp    $0xffffffff,%eax
je     1252 <sparkle_pause+0x102>
jmp    127e <sparkle_pause+0x12e>
mov    $0x249f0,%edi
call   1070 <usleep@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <sparkle_pause+0x19>
jmp    126f <sparkle_pause+0x11f>
mov    $0x1,%al
test   $0x1,%al
jne    1162 <sparkle_pause+0x12>
jmp    127e <sparkle_pause+0x12e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sparkle_pause>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x4,%edi
call   1050 <attrset@plt>
mov    $0xcccccccd,%r12d
mov    $0xfffffffe,%r13d
mov    $0x3,%r15d
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    0xe79(%rip),%rbx
lea    (%rbx,%rbp,1),%rdx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x50,%ecx
call   1030 <mvaddnstr@plt>
mov    %rbx,%rdx
mov    %rbp,0x10(%rsp)
sub    %rbp,%rdx
add    $0x4,%rdx
mov    $0x15,%edi
xor    %esi,%esi
mov    $0x50,%ecx
call   1030 <mvaddnstr@plt>
mov    $0x1,%ebx
mov    $0x14,%ebp
mov    %r15d,0xc(%rsp)
jmp    11f7 <sparkle_pause+0xa7>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x4f,%esi
mov    %r14d,%edx
call   1060 <mvaddch@plt>
mov    %ebp,%edi
xor    %esi,%esi
mov    %r14d,%edx
call   1060 <mvaddch@plt>
add    $0x1,%ebx
add    $0x1,%r15d
add    $0xffffffff,%ebp
je     1220 <sparkle_pause+0xd0>
mov    %r15d,%eax
imul   %r12,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%eax
add    %r13d,%eax
add    %ebp,%eax
mov    $0x42a,%r14d
cmp    $0x14,%eax
je     11d0 <sparkle_pause+0x80>
xor    %r14d,%r14d
jmp    11d0 <sparkle_pause+0x80>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <keyboard_get_key@plt>
cmp    $0xffffffff,%eax
jne    125b <sparkle_pause+0x10b>
mov    $0x249f0,%edi
call   1070 <usleep@plt>
mov    0x10(%rsp),%rbp
add    $0x1,%rbp
add    $0xffffffff,%r13d
mov    0xc(%rsp),%r15d
add    $0x1,%r15d
cmp    $0x5,%rbp
jne    1180 <sparkle_pause+0x30>
jmp    116e <sparkle_pause+0x1e>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@sparkle_pause.str = internal global i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i32 0, i32 0)
@.str = [86 x i8] c"* * * * * * * * * * * * * * * * * \00"
define void @sparkle_pause() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @attrset(i32 4)
br label %4
4: ; preds = %56, %0
store i32 0, i32* %1
br label %5
5: ; preds = %52, %4
%6 = load i32, i32* %1
%7 = icmp ult i32 %6, 5
br i1 %7, label %8, label %55
8: ; preds = %5
%9 = load i8*, i8** @sparkle_pause.str
%10 = load i32, i32* %1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = call i32 @mvaddnstr(i32 0, i32 0, i8* %12, i32 80)
%14 = load i8*, i8** @sparkle_pause.str
%15 = load i32, i32* %1
%16 = sub i32 4, %15
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = call i32 @mvaddnstr(i32 21, i32 0, i8* %18, i32 80)
store i32 1, i32* %2
br label %20
20: ; preds = %43, %8
%21 = load i32, i32* %2
%22 = icmp ult i32 %21, 21
br i1 %22, label %23, label %46
23: ; preds = %20
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = add i32 %24, %25
%27 = add i32 %26, 2
%28 = urem i32 %27, 5
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %36
30: ; preds = %23
%31 = load i32, i32* %2
%32 = call i32 @mvaddch(i32 %31, i32 79, i32 1066)
%33 = load i32, i32* %2
%34 = sub i32 21, %33
%35 = call i32 @mvaddch(i32 %34, i32 0, i32 1066)
br label %42
36: ; preds = %23
%37 = load i32, i32* %2
%38 = call i32 @mvaddch(i32 %37, i32 79, i32 0)
%39 = load i32, i32* %2
%40 = sub i32 21, %39
%41 = call i32 @mvaddch(i32 %40, i32 0, i32 0)
br label %42
42: ; preds = %36, %30
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add i32 %44, 1
store i32 %45, i32* %2
br label %20
46: ; preds = %20
%47 = call i32 (...) @keyboard_get_key()
%48 = icmp ne i32 %47, -1
br i1 %48, label %49, label %50
49: ; preds = %46
br label %57
50: ; preds = %46
%51 = call i32 @usleep(i32 150000)
br label %52
52: ; preds = %50
%53 = load i32, i32* %1
%54 = add i32 %53, 1
store i32 %54, i32* %1
br label %5
55: ; preds = %5
br label %56
56: ; preds = %55
br i1 true, label %4, label %57
57: ; preds = %49, %56
ret void
}

LLVM IR (-O2):
@.str = [86 x i8] c"* * * * * * * * * * * * * * * * * \00"
define void @sparkle_pause() {
%1 = tail call i32 @attrset(i32 4)
br label %2
2: ; preds = %27, %0
br label %3
3: ; preds = %2, %27
%4 = phi i64 [ 0, %2 ], [ %29, %27 ]
%5 = getelementptr inbounds [86 x i8], [86 x i8]* @.str, i64 0, i64 %4
%6 = tail call i32 @mvaddnstr(i32 0, i32 0, i8* %5, i32 80)
%7 = sub nuw nsw i64 4, %4
%8 = getelementptr inbounds [86 x i8], [86 x i8]* @.str, i64 0, i64 %7
%9 = tail call i32 @mvaddnstr(i32 21, i32 0, i8* %8, i32 80)
%10 = trunc i64 %4 to i32
%11 = add i32 %10, 2
br label %12
12: ; preds = %3, %12
%13 = phi i32 [ 1, %3 ], [ %21, %12 ]
%14 = add nuw nsw i32 %11, %13
%15 = urem i32 %14, 5
%16 = icmp eq i32 %15, 1
%17 = select i1 %16, i32 1066, i32 0
%18 = tail call i32 @mvaddch(i32 %13, i32 79, i32 %17)
%19 = sub nuw nsw i32 21, %13
%20 = tail call i32 @mvaddch(i32 %19, i32 0, i32 %17)
%21 = add nuw nsw i32 %13, 1
%22 = icmp eq i32 %21, 21
br i1 %22, label %23, label %12
23: ; preds = %12
%24 = tail call i32 (...) @keyboard_get_key()
%25 = icmp eq i32 %24, -1
br i1 %25, label %27, label %26
26: ; preds = %23
ret void
27: ; preds = %23
%28 = tail call i32 @usleep(i32 150000)
%29 = add nuw nsw i64 %4, 1
%30 = icmp eq i64 %29, 5
br i1 %30, label %2, label %3
}