#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*/ printf(char *, char *);
int rand();
int /*<<< orphan*/ usleep(int);
void printGibberish() {
  int numberOfCrazyLines = 10 + (rand() % 40);
  int linePrintCounter = 0;
  char buffer[100];
  int i;
  for (linePrintCounter = 0; linePrintCounter < numberOfCrazyLines;
       linePrintCounter++) {
    for (i = 0; i < 100; i++) {
      if (i == 99) {
        buffer[i] = '\0';
        continue;
      }
      buffer[i] = (char)(rand() % 256);
    }
    printf("%s\n", buffer);
    usleep(1000 * 50);
  }
}


x86 assembly (clang, -O0):
<printGibberish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x28,%ecx
cltd
idiv   %ecx
add    $0xa,%edx
mov    %edx,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e2 <printGibberish+0xb2>
movl   $0x0,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    11ba <printGibberish+0x8a>
cmpl   $0x63,-0x74(%rbp)
jne    1193 <printGibberish+0x63>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
jmp    11ac <printGibberish+0x7c>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1171 <printGibberish+0x41>
lea    -0x70(%rbp),%rsi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    $0xc350,%edi
call   1050 <usleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <printGibberish+0x2e>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printGibberish>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%r12
imul   $0x66666667,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
shl    $0x3,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r12d
cmp    $0xfffffff7,%r12d
jl     11ca <printGibberish+0x9a>
add    $0x9,%r12d
lea    0xe8b(%rip),%r14
mov    %rsp,%r15
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x63,%rbx
jne    1190 <printGibberish+0x60>
movb   $0x0,0x63(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    $0xc350,%edi
call   1050 <usleep@plt>
lea    0x1(%r13),%eax
cmp    %r12d,%r13d
mov    %eax,%r13d
jne    1180 <printGibberish+0x50>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @printGibberish() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 40
%7 = add nsw i32 10, %6
store i32 %7, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %8
8: ; preds = %37, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %40
12: ; preds = %8
store i32 0, i32* %4
br label %13
13: ; preds = %30, %12
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %33
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 99
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
br label %30
23: ; preds = %16
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 256
%26 = trunc i32 %25 to i8
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %28
store i8 %26, i8* %29
br label %30
30: ; preds = %23, %19
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %13
33: ; preds = %13
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = call i32 @usleep(i32 50000)
br label %37
37: ; preds = %33
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %8
40: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @printGibberish() {
%1 = alloca [100 x i8]
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 40
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = icmp sgt i32 %3, -10
br i1 %5, label %6, label %23
6: ; preds = %0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 99
%8 = add nsw i32 %3, 9
br label %9
9: ; preds = %6, %18
%10 = phi i32 [ 0, %6 ], [ %21, %18 ]
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = call i32 (...) @rand()
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
store i8 %14, i8* %15
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, 99
br i1 %17, label %18, label %11
18: ; preds = %11
store i8 0, i8* %7
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%20 = call i32 @usleep(i32 50000)
%21 = add nuw nsw i32 %10, 1
%22 = icmp eq i32 %10, %8
br i1 %22, label %23, label %9
23: ; preds = %18, %0
ret void
}