#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*/ getseed();
char *malloc(unsigned short);
int /*<<< orphan*/ printf(char *, char *);
char rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int main() {
  char *env_LD_BIND_NOW;
  srand(getseed());
  if (rand() % 2) {
    int r = rand();
    if (r % 3 == 0)
      env_LD_BIND_NOW = "1";
    else if (r % 3 == 1)
      env_LD_BIND_NOW = "on";
    else
      env_LD_BIND_NOW = "off";
  } else {
    unsigned short s = 8 + (rand() % 1024);
    unsigned short ndx = 0;
    env_LD_BIND_NOW = malloc(s);
    while (ndx < s)
      *(env_LD_BIND_NOW + ndx++) = 'A' + (rand() % ('Z' - 'A'));
  }
  printf("%s", env_LD_BIND_NOW);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getseed@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f2 <main+0xa2>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b9 <main+0x69>
lea    0xe50(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11ed <main+0x9d>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11dd <main+0x8d>
lea    0xe2e(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11e8 <main+0x98>
lea    0xe21(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11ed <main+0x9d>
jmp    126c <main+0x11c>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
add    $0x8,%edx
mov    %dx,%ax
mov    %ax,-0x16(%rbp)
movw   $0x0,-0x18(%rbp)
movzwl -0x16(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movzwl -0x18(%rbp),%eax
movzwl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jge    1267 <main+0x117>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    $0x19,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%cx
mov    %cx,%si
add    $0x1,%si
mov    %si,-0x18(%rbp)
movzwl %cx,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1221 <main+0xd1>
jmp    126c <main+0x11c>
mov    -0x10(%rbp),%rsi
lea    0xd92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getseed@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <rand@plt>
movsbl %al,%eax
test   $0x1,%bl
jne    11d7 <main+0x87>
add    $0x8,%eax
movzwl %ax,%r15d
mov    %r15d,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
test   %r15w,%r15w
je     1213 <main+0xc3>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <rand@plt>
movsbl %al,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
add    $0x41,%al
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11a0 <main+0x50>
jmp    1213 <main+0xc3>
imul   $0x56,%eax,%ecx
movzwl %cx,%ecx
mov    %ecx,%edx
shr    $0xf,%edx
shr    $0x8,%ecx
add    %dl,%cl
movzbl %cl,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%edx
sub    %cl,%dl
cmp    $0x1,%dl
lea    0xe07(%rip),%rdx
lea    0xe03(%rip),%rsi
cmove  %rdx,%rsi
cmp    %cl,%al
lea    0xdf1(%rip),%r14
cmovne %rsi,%r14
lea    0xdef(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i16
%5 = alloca i16
store i32 0, i32* %1
%6 = call i32 (...) @getseed()
%7 = call i32 @srand(i32 %6)
%8 = call signext i8 (...) @rand()
%9 = sext i8 %8 to i32
%10 = srem i32 %9, 2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %0
%13 = call signext i8 (...) @rand()
%14 = sext i8 %13 to i32
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = srem i32 %15, 3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %26
19: ; preds = %12
%20 = load i32, i32* %3
%21 = srem i32 %20, 3
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %19
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %25
24: ; preds = %19
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %25
25: ; preds = %24, %23
br label %26
26: ; preds = %25, %18
br label %54
27: ; preds = %0
%28 = call signext i8 (...) @rand()
%29 = sext i8 %28 to i32
%30 = srem i32 %29, 1024
%31 = add nsw i32 8, %30
%32 = trunc i32 %31 to i16
store i16 %32, i16* %4
store i16 0, i16* %5
%33 = load i16, i16* %4
%34 = call i8* @malloc(i16 zeroext %33)
store i8* %34, i8** %2
br label %35
35: ; preds = %41, %27
%36 = load i16, i16* %5
%37 = zext i16 %36 to i32
%38 = load i16, i16* %4
%39 = zext i16 %38 to i32
%40 = icmp slt i32 %37, %39
br i1 %40, label %41, label %53
41: ; preds = %35
%42 = call signext i8 (...) @rand()
%43 = sext i8 %42 to i32
%44 = srem i32 %43, 25
%45 = add nsw i32 65, %44
%46 = trunc i32 %45 to i8
%47 = load i8*, i8** %2
%48 = load i16, i16* %5
%49 = add i16 %48, 1
store i16 %49, i16* %5
%50 = zext i16 %48 to i32
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %47, i64 %51
store i8 %46, i8* %52
br label %35
53: ; preds = %35
br label %54
54: ; preds = %53, %26
%55 = load i8*, i8** %2
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i32 (...) @getseed()
%2 = tail call i32 @srand(i32 %1)
%3 = tail call signext i8 (...) @rand()
%4 = and i8 %3, 1
%5 = icmp eq i8 %4, 0
%6 = tail call signext i8 (...) @rand()
br i1 %5, label %13, label %7
7: ; preds = %0
%8 = srem i8 %6, 3
%9 = icmp eq i8 %8, 1
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%11 = icmp eq i8 %8, 0
%12 = select i1 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %10
br label %28
13: ; preds = %0
%14 = sext i8 %6 to i16
%15 = add nsw i16 %14, 8
%16 = tail call i8* @malloc(i16 zeroext %15)
%17 = icmp eq i16 %15, 0
br i1 %17, label %28, label %18
18: ; preds = %13
%19 = zext i16 %15 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %25, %20 ]
%22 = tail call signext i8 (...) @rand()
%23 = srem i8 %22, 25
%24 = add nsw i8 %23, 65
%25 = add nuw nsw i64 %21, 1
%26 = getelementptr inbounds i8, i8* %16, i64 %21
store i8 %24, i8* %26
%27 = icmp eq i64 %25, %19
br i1 %27, label %28, label %20
28: ; preds = %20, %13, %7
%29 = phi i8* [ %12, %7 ], [ %16, %13 ], [ %16, %20 ]
%30 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %29)
ret i32 0
}