#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int random();
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int main(void) {
  int i = 0;
  int r = 0;
  setbuf(stdout, NULL);
  while (8675309) {
    r = ((random()) % (5) + 1);
    fputs("All work and no play makes Jack a dull boy.", stdout);
    for (i = -5; i < r; i++) {
      putchar(' ');
    }
    sleep(2 + r);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
mov    $0x0,%al
call   1060 <random@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
lea    0xe5c(%rip),%rdi
call   1050 <fputs@plt>
movl   $0xfffffffb,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d4 <main+0x84>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0x60>
mov    -0xc(%rbp),%edi
add    $0x2,%edi
call   1070 <sleep@plt>
jmp    117f <main+0x2f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e81(%rip),%r14
mov    (%r14),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0xe90(%rip),%r15
xor    %eax,%eax
call   1060 <random@plt>
movslq %eax,%r12
imul   $0x66666667,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ebx
mov    %r12d,%ebp
sub    %ebx,%ebp
mov    (%r14),%esi
mov    %r15,%rdi
call   1050 <fputs@plt>
neg    %ebx
add    %r12d,%ebx
add    $0x6,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x60>
add    $0x3,%ebp
mov    %ebp,%edi
call   1070 <sleep@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [44 x i8] c"All work and no play makes Jack a dull boy.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* @stdout
%5 = call i32 @setbuf(i32 %4, i32* null)
br label %6
6: ; preds = %0, %21
%7 = call i32 (...) @random()
%8 = srem i32 %7, 5
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 -5, i32* %2
br label %12
12: ; preds = %18, %6
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 @putchar(i8 signext 32)
br label %18
18: ; preds = %16
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %12
21: ; preds = %12
%22 = load i32, i32* %3
%23 = add nsw i32 2, %22
%24 = call i32 @sleep(i32 %23)
br label %6
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [44 x i8] c"All work and no play makes Jack a dull boy.\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @setbuf(i32 %1, i32* null)
br label %3
3: ; preds = %13, %0
%4 = tail call i32 (...) @random()
%5 = srem i32 %4, 5
%6 = load i32, i32* @stdout
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %3, %8
%9 = phi i32 [ -5, %3 ], [ %11, %8 ]
%10 = tail call i32 @putchar(i8 signext 32)
%11 = add nsw i32 %9, 1
%12 = icmp eq i32 %9, %5
br i1 %12, label %13, label %8
13: ; preds = %8
%14 = add nsw i32 %5, 3
%15 = tail call i32 @sleep(i32 %14)
br label %3
}