#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 */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ close(int);
int creat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
scalar_t__ rand();
int /*<<< orphan*/ write(int, char **, int);
int main() {
  int s;
  char r[6291456];
  for (s = 0; s < 6291456; s++) {
    r[s] = 1 + (char)(254.0 * (float)rand() / (float)RAND_MAX);
  }
  int randomdata = creat("random.dat", S_IRWXU);
  if (randomdata != -1) {
    write(randomdata, &r, 6291456);
    close(randomdata);
  } else
    printf("error creating file\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x600020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x600000,-0x8(%rbp)
jge    11cb <main+0x7b>
xor    %eax,%eax
call   1070 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe72(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e47(%rip),%rax
cvtsi2ssq (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movsbl %al,%eax
add    $0x1,%eax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x600010(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <main+0x19>
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
lea    0xe2d(%rip),%rdi
call   1060 <creat@plt>
mov    %eax,-0x600014(%rbp)
cmpl   $0xffffffff,-0x600014(%rbp)
je     121a <main+0xca>
mov    -0x600014(%rbp),%edi
lea    -0x600010(%rbp),%rsi
mov    $0x600000,%edx
call   1030 <write@plt>
mov    -0x600014(%rbp),%edi
call   1050 <close@plt>
jmp    1226 <main+0xd6>
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x600020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x600008,%rsp
mov    0x2e7f(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe75(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssq (%r14),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x1,%al
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x600000,%rbx
jne    1170 <main+0x20>
mov    0x2e30(%rip),%rax
mov    (%rax),%esi
lea    0xe47(%rip),%rdi
call   1060 <creat@plt>
cmp    $0xffffffff,%eax
je     11e5 <main+0x95>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x600000,%edx
call   1040 <write@plt>
mov    %ebx,%edi
call   1050 <close@plt>
jmp    11f1 <main+0xa1>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x600008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [11 x i8] c"random.dat\00"
@S_IRWXU = global i32 0
@.str.1 = [21 x i8] c"error creating file\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6291456 x i8]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %24, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 6291456
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = call i64 (...) @rand()
%10 = sitofp i64 %9 to float
%11 = fpext float %10 to double
%12 = fmul double 2.540000e+02, %11
%13 = load i64, i64* @RAND_MAX
%14 = sitofp i64 %13 to float
%15 = fpext float %14 to double
%16 = fdiv double %12, %15
%17 = fptosi double %16 to i8
%18 = sext i8 %17 to i32
%19 = add nsw i32 1, %18
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [6291456 x i8], [6291456 x i8]* %3, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %8
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %5
27: ; preds = %5
%28 = load i32, i32* @S_IRWXU
%29 = call i32 @creat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %28)
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i32, i32* %4
%34 = bitcast [6291456 x i8]* %3 to i8**
%35 = call i32 @write(i32 %33, i8** %34, i32 6291456)
%36 = load i32, i32* %4
%37 = call i32 @close(i32 %36)
br label %40
38: ; preds = %27
%39 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %32
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [11 x i8] c"random.dat\00"
@S_IRWXU = global i32 0
@str = [20 x i8] c"error creating file\00"
define i32 @main() {
%1 = alloca [6291456 x i8]
%2 = getelementptr inbounds [6291456 x i8], [6291456 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %16, %3 ]
%5 = tail call i64 (...) @rand()
%6 = sitofp i64 %5 to float
%7 = fpext float %6 to double
%8 = fmul double %7, 2.540000e+02
%9 = load i64, i64* @RAND_MAX
%10 = sitofp i64 %9 to float
%11 = fpext float %10 to double
%12 = fdiv double %8, %11
%13 = fptosi double %12 to i8
%14 = add i8 %13, 1
%15 = getelementptr inbounds [6291456 x i8], [6291456 x i8]* %1, i64 0, i64 %4
store i8 %14, i8* %15
%16 = add nuw nsw i64 %4, 1
%17 = icmp eq i64 %16, 6291456
br i1 %17, label %18, label %3
18: ; preds = %3
%19 = load i32, i32* @S_IRWXU
%20 = tail call i32 @creat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = bitcast [6291456 x i8]* %1 to i8**
%24 = call i32 @write(i32 %20, i8** %23, i32 6291456)
%25 = tail call i32 @close(i32 %20)
br label %28
26: ; preds = %18
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
ret i32 0
}