#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*/ erase();
int /*<<< orphan*/ mvaddch(int, int, char);
int rand();
int /*<<< orphan*/ refresh();
void fade_dissolv(void) {
  int i;
  for (i = 0; i < 1000 * 10; i++) {
    mvaddch(rand() % (23 + 2), rand() % 80, ' ');
    refresh();
  }
  erase();
  refresh();
}


x86 assembly (clang, -O0):
<fade_dissolv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    11a1 <fade_dissolv+0x61>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x19,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x8(%rbp),%edi
mov    $0x50,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x20,%edx
call   1050 <mvaddch@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114f <fade_dissolv+0xf>
mov    $0x0,%al
call   1030 <erase@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fade_dissolv>:
push   %rbp
push   %rbx
push   %rax
mov    $0x2710,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
shl    $0x4,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %ebx,%edi
mov    $0x20,%edx
call   1050 <mvaddch@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
add    $0xffffffff,%ebp
jne    1150 <fade_dissolv+0x10>
xor    %eax,%eax
call   1030 <erase@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <refresh@plt>

LLVM IR (-O0):
define void @fade_dissolv() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 10000
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 25
%8 = call i32 (...) @rand()
%9 = srem i32 %8, 80
%10 = call i32 @mvaddch(i32 %7, i32 %9, i8 signext 32)
%11 = call i32 (...) @refresh()
br label %12
12: ; preds = %5
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %2
15: ; preds = %2
%16 = call i32 (...) @erase()
%17 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
define void @fade_dissolv() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %9, %1 ]
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 25
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 80
%7 = tail call i32 @mvaddch(i32 %4, i32 %6, i8 signext 32)
%8 = tail call i32 (...) @refresh()
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 10000
br i1 %10, label %11, label %1
11: ; preds = %1
%12 = tail call i32 (...) @erase()
%13 = tail call i32 (...) @refresh()
ret void
}