#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 */
double RAND_MAX;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
int /*<<< orphan*/ usleep(int);
int main(int argc __attribute__((unused)),
         char *argv[] __attribute__((unused))) {
  printf("\033[40m\033[32m\033[0j");
  while (1) {
    int c1 = (int)(78.0 * (float)rand() / (RAND_MAX + 1.0));
    int c2 = (int)(78.0 * (float)rand() / (RAND_MAX + 1.0));
    char caractere1 = 33 + ((unsigned int)rand()) % 80;
    char caractere2 = 33 + ((unsigned int)rand()) % 80;
    if (c2 < c1) {
      int b = c1;
      c1 = c2;
      c2 = b - c2;
    } else {
      c2 -= c1;
    }
    while (c1--)
      printf(" ");
    printf("%c", caractere1);
    while (c2--)
      printf(" ");
    printf("%c\n", caractere2);
    usleep(30000);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
mov    0x2e69(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe62(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe4e(%rip),%xmm1
mov    0x2e2f(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x50,%ecx
xor    %edx,%edx
div    %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x19(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x50,%ecx
xor    %edx,%edx
div    %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x1a(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121e <main+0xee>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1229 <main+0xf9>
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    122e <main+0xfe>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1255 <main+0x125>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <main+0xfe>
movsbl -0x19(%rbp),%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     128e <main+0x15e>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1267 <main+0x137>
movsbl -0x1a(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x7530,%edi
call   1050 <usleep@plt>
jmp    1154 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e85(%rip),%r12
mov    $0xcccccccd,%r13d
jmp    118b <main+0x4b>
nopl   0x0(%rax,%rax,1)
lea    0xeb8(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7530,%edi
call   1060 <usleep@plt>
xor    %eax,%eax
call   1050 <rand@plt>
mov    %rax,%rbx
movsd  (%r12),%xmm0
movaps %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
unpcklps %xmm0,%xmm1
cvtps2pd %xmm1,%xmm0
mulpd  0xe3c(%rip),%xmm0
movsd  (%r12),%xmm1
unpcklpd (%rsp),%xmm1
addpd  0xe39(%rip),%xmm1
divpd  %xmm1,%xmm0
cvttpd2dq %xmm0,%xmm0
movd   %xmm0,%ebp
pshufd $0x55,%xmm0,%xmm0
movd   %xmm0,%eax
mov    %ebp,%ecx
sub    %eax,%ecx
mov    %eax,%r14d
cmovl  %ebp,%r14d
neg    %ecx
sub    %eax,%ebp
cmovl  %ecx,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
mov    %rax,%r15
test   %r14d,%r14d
je     1230 <main+0xf0>
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
jne    1220 <main+0xe0>
mov    %ebx,%eax
imul   %r13,%rax
shr    $0x26,%rax
shl    $0x4,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
add    $0x21,%ebx
mov    %r15d,%eax
imul   %r13,%rax
shr    $0x26,%rax
shl    $0x4,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r15d
add    $0x21,%r15d
mov    %ebx,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
je     1170 <main+0x30>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1270 <main+0x130>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [15 x i8] c"\1B[40m\1B[32m\1B[0j\00"
@RAND_MAX = global double 0.000000e+00
@.str.1 = [2 x i8] c" \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %2, %69
%13 = call i64 (...) @rand()
%14 = sitofp i64 %13 to float
%15 = fpext float %14 to double
%16 = fmul double 7.800000e+01, %15
%17 = load double, double* @RAND_MAX
%18 = fadd double %17, 1.000000e+00
%19 = fdiv double %16, %18
%20 = fptosi double %19 to i32
store i32 %20, i32* %6
%21 = call i64 (...) @rand()
%22 = sitofp i64 %21 to float
%23 = fpext float %22 to double
%24 = fmul double 7.800000e+01, %23
%25 = load double, double* @RAND_MAX
%26 = fadd double %25, 1.000000e+00
%27 = fdiv double %24, %26
%28 = fptosi double %27 to i32
store i32 %28, i32* %7
%29 = call i64 (...) @rand()
%30 = trunc i64 %29 to i32
%31 = urem i32 %30, 80
%32 = add i32 33, %31
%33 = trunc i32 %32 to i8
store i8 %33, i8* %8
%34 = call i64 (...) @rand()
%35 = trunc i64 %34 to i32
%36 = urem i32 %35, 80
%37 = add i32 33, %36
%38 = trunc i32 %37 to i8
store i8 %38, i8* %9
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %48
42: ; preds = %12
%43 = load i32, i32* %6
store i32 %43, i32* %10
%44 = load i32, i32* %7
store i32 %44, i32* %6
%45 = load i32, i32* %10
%46 = load i32, i32* %7
%47 = sub nsw i32 %45, %46
store i32 %47, i32* %7
br label %52
48: ; preds = %12
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = sub nsw i32 %50, %49
store i32 %51, i32* %7
br label %52
52: ; preds = %48, %42
br label %53
53: ; preds = %57, %52
%54 = load i32, i32* %6
%55 = add nsw i32 %54, -1
store i32 %55, i32* %6
%56 = icmp ne i32 %54, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %53
59: ; preds = %53
%60 = load i8, i8* %8
%61 = sext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %67, %59
%64 = load i32, i32* %7
%65 = add nsw i32 %64, -1
store i32 %65, i32* %7
%66 = icmp ne i32 %64, 0
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %63
69: ; preds = %63
%70 = load i8, i8* %9
%71 = sext i8 %70 to i32
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = call i32 @usleep(i32 30000)
br label %12
}

LLVM IR (-O2):
@.str = [15 x i8] c"\1B[40m\1B[32m\1B[0j\00"
@RAND_MAX = global double 0.000000e+00
@.str.3 = [4 x i8] c"%c\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %2, %48
%5 = tail call i64 (...) @rand()
%6 = load double, double* @RAND_MAX
%7 = tail call i64 (...) @rand()
%8 = insertelement <2 x i64> poison, i64 %7, i64 0
%9 = insertelement <2 x i64> %8, i64 %5, i64 1
%10 = sitofp <2 x i64> %9 to <2 x float>
%11 = fpext <2 x float> %10 to <2 x double>
%12 = fmul <2 x double> %11, <double 7.800000e+01, double 7.800000e+01>
%13 = load double, double* @RAND_MAX
%14 = insertelement <2 x double> poison, double %13, i64 0
%15 = insertelement <2 x double> %14, double %6, i64 1
%16 = fadd <2 x double> %15, <double 1.000000e+00, double 1.000000e+00>
%17 = fdiv <2 x double> %12, %16
%18 = fptosi <2 x double> %17 to <2 x i32>
%19 = tail call i64 (...) @rand()
%20 = trunc i64 %19 to i32
%21 = urem i32 %20, 80
%22 = add nuw nsw i32 %21, 33
%23 = tail call i64 (...) @rand()
%24 = trunc i64 %23 to i32
%25 = urem i32 %24, 80
%26 = add nuw nsw i32 %25, 33
%27 = extractelement <2 x i32> %18, i64 0
%28 = extractelement <2 x i32> %18, i64 1
%29 = icmp slt i32 %27, %28
%30 = sub nsw i32 %28, %27
%31 = sub nsw i32 %27, %28
%32 = select i1 %29, i32 %30, i32 %31
%33 = select i1 %29, i32 %27, i32 %28
%34 = icmp eq i32 %33, 0
br i1 %34, label %40, label %35
35: ; preds = %4, %35
%36 = phi i32 [ %37, %35 ], [ %33, %4 ]
%37 = add nsw i32 %36, -1
%38 = tail call i32 @putchar(i32 32)
%39 = icmp eq i32 %37, 0
br i1 %39, label %40, label %35
40: ; preds = %35, %4
%41 = tail call i32 @putchar(i32 %22)
%42 = icmp eq i32 %32, 0
br i1 %42, label %48, label %43
43: ; preds = %40, %43
%44 = phi i32 [ %45, %43 ], [ %32, %40 ]
%45 = add nsw i32 %44, -1
%46 = tail call i32 @putchar(i32 32)
%47 = icmp eq i32 %45, 0
br i1 %47, label %48, label %43
48: ; preds = %43, %40
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%50 = tail call i32 @usleep(i32 30000)
br label %4
}