#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 */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int);
int random();
int /*<<< orphan*/ srandom(unsigned int);
int /*<<< orphan*/ stderr;
void *strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct timeval tv;
  unsigned seed;
  int mbv = 1;
  int Mbv = 255;
  size_t mlen = 0;
  size_t Mlen = 128;
  if (argc < 5) {
    fprintf(stderr,
            "usage: %s <min length> <max length> "
            "<min byte val> <max byte val> <length>\n",
            argv[0]);
    exit(1);
  }
  mlen = strtoul(argv[1], NULL, 0);
  Mlen = strtoul(argv[2], NULL, 0);
  mbv = strtoul(argv[3], NULL, 0);
  Mbv = strtoul(argv[4], NULL, 0);
  gettimeofday(&tv, NULL);
  seed = (unsigned)tv.tv_sec;
  seed %= (60 * 60 * 24);
  seed *= 1000;
  seed += (unsigned)(tv.tv_usec / 1000);
  srandom(seed);
  size_t len = random() % (Mlen - mlen + 1) + mlen;
  for (size_t i = 0; i < len; i++) {
    if (random() % 5 == 0) {
      switch (random() % 4) {
      case 0:
        putchar(' ');
        break;
      case 1:
        putchar('\t');
        break;
      case 2:
        putchar('\n');
        break;
      case 3:
        putchar('\r');
        break;
      }
    } else
      putchar(random() % (Mbv - mbv + 1) + mbv);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0xff,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x80,-0x40(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11d4 <main+0x64>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe4b(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x18(%rbp),%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x15180,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x24(%rbp)
imul   $0x3e8,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <srandom@plt>
mov    $0x0,%al
call   1070 <random@plt>
cltq
mov    -0x40(%rbp),%rcx
sub    -0x38(%rbp),%rcx
add    $0x1,%rcx
xor    %edx,%edx
div    %rcx
add    -0x38(%rbp),%rdx
mov    %rdx,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    136e <main+0x1fe>
mov    $0x0,%al
call   1070 <random@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    133b <main+0x1cb>
xor    %eax,%eax
call   1070 <random@plt>
mov    %eax,%edx
add    $0x3,%edx
test   %eax,%eax
mov    %eax,%ecx
cmovs  %edx,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x58(%rbp)
sub    $0x3,%eax
ja     1336 <main+0x1c6>
mov    -0x58(%rbp),%rax
lea    0xd0a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1336 <main+0x1c6>
mov    $0x9,%edi
call   1030 <putchar@plt>
jmp    1336 <main+0x1c6>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1336 <main+0x1c6>
mov    $0xd,%edi
call   1030 <putchar@plt>
jmp    1358 <main+0x1e8>
mov    $0x0,%al
call   1070 <random@plt>
mov    -0x2c(%rbp),%ecx
sub    -0x28(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    -0x28(%rbp),%edi
call   1030 <putchar@plt>
jmp    135d <main+0x1ed>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    129e <main+0x12e>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jle    12d4 <main+0x164>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,%r13
mov    0x18(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,%r14
mov    0x20(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtoul@plt>
mov    %rax,%r12
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x10(%rsp),%eax
mov    $0xc22e4507,%ecx
imul   %rax,%rcx
shr    $0x30,%rcx
imul   $0x15180,%ecx,%ecx
sub    %ecx,%eax
imul   $0x3e8,%eax,%eax
movslq 0x8(%rsp),%rcx
imul   $0x10624dd3,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rdi
add    %ecx,%edi
add    %eax,%edi
call   1040 <srandom@plt>
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%rcx
sub    %r15,%r13
add    $0x1,%r13
mov    %rcx,%rdx
or     %r13,%rdx
shr    $0x20,%rdx
je     1244 <main+0xd4>
mov    %rcx,%rax
xor    %edx,%edx
div    %r13
mov    %rdx,%r13
add    %r15,%r13
jne    1251 <main+0xe1>
jmp    12c3 <main+0x153>
xor    %edx,%edx
div    %r13d
mov    %edx,%r13d
add    %r15,%r13
je     12c3 <main+0x153>
sub    %r14d,%r12d
add    $0x1,%r12d
lea    0xded(%rip),%r15
xor    %ebx,%ebx
jmp    1287 <main+0x117>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cltd
idiv   %r12d
mov    %edx,%edi
add    %r14d,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r13,%rbx
jae    12c3 <main+0x153>
xor    %eax,%eax
call   1070 <random@plt>
imul   $0xcccccccd,%eax,%ebp
add    $0x19999999,%ebp
xor    %eax,%eax
call   1070 <random@plt>
cmp    $0x33333332,%ebp
ja     1270 <main+0x100>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
sub    %ecx,%eax
cmp    $0x4,%eax
jae    127e <main+0x10e>
cltq
mov    (%r15,%rax,4),%edi
jmp    1279 <main+0x109>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd19(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [76 x i8] c"usage: %s <min length> <max length> <min byte val> <max byte val> <length>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timeval
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
store i32 255, i32* %9
store i64 0, i64* %10
store i64 128, i64* %11
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i8* @strtoul(i8* %26, i32* null, i32 0)
%28 = ptrtoint i8* %27 to i64
store i64 %28, i64* %10
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i8* @strtoul(i8* %31, i32* null, i32 0)
%33 = ptrtoint i8* %32 to i64
store i64 %33, i64* %11
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i8* @strtoul(i8* %36, i32* null, i32 0)
%38 = ptrtoint i8* %37 to i32
store i32 %38, i32* %8
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 4
%41 = load i8*, i8** %40
%42 = call i8* @strtoul(i8* %41, i32* null, i32 0)
%43 = ptrtoint i8* %42 to i32
store i32 %43, i32* %9
%44 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%45 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%46 = load i64, i64* %45
%47 = trunc i64 %46 to i32
store i32 %47, i32* %7
%48 = load i32, i32* %7
%49 = urem i32 %48, 86400
store i32 %49, i32* %7
%50 = load i32, i32* %7
%51 = mul i32 %50, 1000
store i32 %51, i32* %7
%52 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%53 = load i32, i32* %52
%54 = sdiv i32 %53, 1000
%55 = load i32, i32* %7
%56 = add i32 %55, %54
store i32 %56, i32* %7
%57 = load i32, i32* %7
%58 = call i32 @srandom(i32 %57)
%59 = call i32 (...) @random()
%60 = sext i32 %59 to i64
%61 = load i64, i64* %11
%62 = load i64, i64* %10
%63 = sub i64 %61, %62
%64 = add i64 %63, 1
%65 = urem i64 %60, %64
%66 = load i64, i64* %10
%67 = add i64 %65, %66
store i64 %67, i64* %12
store i64 0, i64* %13
br label %68
68: ; preds = %99, %23
%69 = load i64, i64* %13
%70 = load i64, i64* %12
%71 = icmp ult i64 %69, %70
br i1 %71, label %72, label %102
72: ; preds = %68
%73 = call i32 (...) @random()
%74 = srem i32 %73, 5
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %88
76: ; preds = %72
%77 = call i32 (...) @random()
%78 = srem i32 %77, 4
switch i32 %78, label %87 [
i32 0, label %79
i32 1, label %81
i32 2, label %83
i32 3, label %85
]
79: ; preds = %76
%80 = call i32 @putchar(i32 32)
br label %87
81: ; preds = %76
%82 = call i32 @putchar(i32 9)
br label %87
83: ; preds = %76
%84 = call i32 @putchar(i32 10)
br label %87
85: ; preds = %76
%86 = call i32 @putchar(i32 13)
br label %87
87: ; preds = %76, %85, %83, %81, %79
br label %98
88: ; preds = %72
%89 = call i32 (...) @random()
%90 = load i32, i32* %9
%91 = load i32, i32* %8
%92 = sub nsw i32 %90, %91
%93 = add nsw i32 %92, 1
%94 = srem i32 %89, %93
%95 = load i32, i32* %8
%96 = add nsw i32 %94, %95
%97 = call i32 @putchar(i32 %96)
br label %98
98: ; preds = %88, %87
br label %99
99: ; preds = %98
%100 = load i64, i64* %13
%101 = add i64 %100, 1
store i64 %101, i64* %13
br label %68
102: ; preds = %68
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [76 x i8] c"usage: %s <min length> <max length> <min byte val> <max byte val> <length>\0A\00"
@switch.table.main = [4 x i32] [i32 32, i32 9, i32 10, i32 13]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = icmp slt i32 %0, 5
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i8* @strtoul(i8* nocapture %13, i32* null, i32 0)
%15 = ptrtoint i8* %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i8* @strtoul(i8* nocapture %17, i32* null, i32 0)
%19 = ptrtoint i8* %18 to i64
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i8* @strtoul(i8* nocapture %21, i32* null, i32 0)
%23 = ptrtoint i8* %22 to i64
%24 = trunc i64 %23 to i32
%25 = getelementptr inbounds i8*, i8** %1, i64 4
%26 = load i8*, i8** %25
%27 = tail call i8* @strtoul(i8* nocapture %26, i32* null, i32 0)
%28 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%30 = load i64, i64* %29
%31 = trunc i64 %30 to i32
%32 = urem i32 %31, 86400
%33 = mul nuw nsw i32 %32, 1000
%34 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%35 = load i32, i32* %34
%36 = sdiv i32 %35, 1000
%37 = add nsw i32 %33, %36
%38 = tail call i32 @srandom(i32 %37)
%39 = tail call i32 (...) @random()
%40 = sext i32 %39 to i64
%41 = sub i64 1, %15
%42 = add i64 %41, %19
%43 = urem i64 %40, %42
%44 = add i64 %43, %15
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %11
%47 = ptrtoint i8* %27 to i64
%48 = trunc i64 %47 to i32
%49 = sub i32 1, %24
%50 = add i32 %49, %48
br label %52
51: ; preds = %71, %11
ret i32 0
52: ; preds = %46, %71
%53 = phi i64 [ 0, %46 ], [ %72, %71 ]
%54 = tail call i32 (...) @random()
%55 = srem i32 %54, 5
%56 = icmp eq i32 %55, 0
%57 = tail call i32 (...) @random()
br i1 %56, label %58, label %61
58: ; preds = %52
%59 = srem i32 %57, 4
%60 = icmp ult i32 %59, 4
br i1 %60, label %64, label %71
61: ; preds = %52
%62 = srem i32 %57, %50
%63 = add nsw i32 %62, %24
br label %68
64: ; preds = %58
%65 = sext i32 %59 to i64
%66 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.main, i64 0, i64 %65
%67 = load i32, i32* %66
br label %68
68: ; preds = %64, %61
%69 = phi i32 [ %63, %61 ], [ %67, %64 ]
%70 = tail call i32 @putchar(i32 %69)
br label %71
71: ; preds = %58, %68
%72 = add nuw i64 %53, 1
%73 = icmp ult i64 %72, %44
br i1 %73, label %52, label %51
}