#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 M_PI;
double cos(int);
double log(double);
int random();
double sqrt(double);
int gen_random_file_size(int min, int max) {
  double u1, u2, z;
  int i;
  int ave;
  int range;
  int ZZ;
  if (min >= max) {
    return (-1);
  }
  range = max - min;
  ave = range / 2;
  for (i = 0; i < 10; i++) {
    u1 = ((double)(random() % 1000000)) / 1000000;
    u2 = ((double)(random() % 1000000)) / 1000000;
    z = sqrt(-2.0 * log(u1)) * cos((M_PI * 2) * u2);
    ZZ = min + (ave + (z * (ave / 4)));
    if (ZZ >= min && ZZ < max) {
      return (ZZ);
    }
  }
  return (-1);
}


x86 assembly (clang, -O0):
<gen_random_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1166 <gen_random_file_size+0x26>
movl   $0xffffffff,-0x4(%rbp)
jmp    1296 <gen_random_file_size+0x156>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0xa,-0x2c(%rbp)
jge    128f <gen_random_file_size+0x14f>
mov    $0x0,%al
call   1030 <random@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xe5f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  0xe3b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe15(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x30(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mov    -0x30(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     127c <gen_random_file_size+0x13c>
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    127c <gen_random_file_size+0x13c>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1296 <gen_random_file_size+0x156>
jmp    1281 <gen_random_file_size+0x141>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1184 <gen_random_file_size+0x44>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_random_file_size>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %esi,%eax
sub    %edi,%eax
jle    12a1 <gen_random_file_size+0x161>
mov    %esi,%r14d
mov    %edi,%r12d
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x3,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xa,%ebx
mov    0x2e48(%rip),%r15
jmp    11b9 <gen_random_file_size+0x79>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%ebx
je     12a1 <gen_random_file_size+0x161>
xor    %eax,%eax
call   1030 <random@plt>
cltq
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
imul   $0xf4240,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe13(%rip),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <random@plt>
movslq %eax,%rbp
imul   $0x431bde83,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
imul   $0xf4240,%eax,%eax
sub    %eax,%ebp
movsd  (%rsp),%xmm0
call   1050 <log@plt>
mulsd  0xdde(%rip),%xmm0
ucomisd 0xdde(%rip),%xmm0
jb     1240 <gen_random_file_size+0x100>
sqrtsd %xmm0,%xmm0
jmp    1245 <gen_random_file_size+0x105>
nopw   0x0(%rax,%rax,1)
call   1060 <sqrt@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mov    (%r15),%eax
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  0xd9b(%rip),%xmm0
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%eax
cmp    %r12d,%eax
jl     11b0 <gen_random_file_size+0x70>
cmp    %r14d,%eax
jge    11b0 <gen_random_file_size+0x70>
jmp    12a6 <gen_random_file_size+0x166>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define i32 @gen_random_file_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %72
17: ; preds = %2
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %11
%21 = load i32, i32* %11
%22 = sdiv i32 %21, 2
store i32 %22, i32* %10
store i32 0, i32* %9
br label %23
23: ; preds = %68, %17
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 10
br i1 %25, label %26, label %71
26: ; preds = %23
%27 = call i32 (...) @random()
%28 = srem i32 %27, 1000000
%29 = sitofp i32 %28 to double
%30 = fdiv double %29, 1.000000e+06
store double %30, double* %6
%31 = call i32 (...) @random()
%32 = srem i32 %31, 1000000
%33 = sitofp i32 %32 to double
%34 = fdiv double %33, 1.000000e+06
store double %34, double* %7
%35 = load double, double* %6
%36 = call double @log(double %35)
%37 = fmul double -2.000000e+00, %36
%38 = call double @sqrt(double %37)
%39 = load i32, i32* @M_PI
%40 = mul nsw i32 %39, 2
%41 = sitofp i32 %40 to double
%42 = load double, double* %7
%43 = fmul double %41, %42
%44 = fptosi double %43 to i32
%45 = call double @cos(i32 %44)
%46 = fmul double %38, %45
store double %46, double* %8
%47 = load i32, i32* %4
%48 = sitofp i32 %47 to double
%49 = load i32, i32* %10
%50 = sitofp i32 %49 to double
%51 = load double, double* %8
%52 = load i32, i32* %10
%53 = sdiv i32 %52, 4
%54 = sitofp i32 %53 to double
%55 = call double @llvm.fmuladd.f64(double %51, double %54, double %50)
%56 = fadd double %48, %55
%57 = fptosi double %56 to i32
store i32 %57, i32* %12
%58 = load i32, i32* %12
%59 = load i32, i32* %4
%60 = icmp sge i32 %58, %59
br i1 %60, label %61, label %67
61: ; preds = %26
%62 = load i32, i32* %12
%63 = load i32, i32* %5
%64 = icmp slt i32 %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = load i32, i32* %12
store i32 %66, i32* %3
br label %72
67: ; preds = %61, %26
br label %68
68: ; preds = %67
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %23
71: ; preds = %23
store i32 -1, i32* %3
br label %72
72: ; preds = %71, %65, %16
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@M_PI = global i32 0
define i32 @gen_random_file_size(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
br i1 %3, label %4, label %40
4: ; preds = %2
%5 = sub nsw i32 %1, %0
%6 = sdiv i32 %5, 2
%7 = sitofp i32 %0 to double
%8 = sitofp i32 %6 to double
%9 = sdiv i32 %5, 8
%10 = sitofp i32 %9 to double
br label %14
11: ; preds = %14
%12 = add nuw nsw i32 %15, 1
%13 = icmp eq i32 %12, 10
br i1 %13, label %40, label %14
14: ; preds = %4, %11
%15 = phi i32 [ 0, %4 ], [ %12, %11 ]
%16 = tail call i32 (...) @random()
%17 = srem i32 %16, 1000000
%18 = sitofp i32 %17 to double
%19 = fdiv double %18, 1.000000e+06
%20 = tail call i32 (...) @random()
%21 = srem i32 %20, 1000000
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 1.000000e+06
%24 = tail call double @log(double %19)
%25 = fmul double %24, -2.000000e+00
%26 = tail call double @sqrt(double %25)
%27 = load i32, i32* @M_PI
%28 = shl nsw i32 %27, 1
%29 = sitofp i32 %28 to double
%30 = fmul double %23, %29
%31 = fptosi double %30 to i32
%32 = tail call double @cos(i32 %31)
%33 = fmul double %26, %32
%34 = tail call double @llvm.fmuladd.f64(double %33, double %10, double %8)
%35 = fadd double %34, %7
%36 = fptosi double %35 to i32
%37 = icmp sge i32 %36, %0
%38 = icmp slt i32 %36, %1
%39 = and i1 %37, %38
br i1 %39, label %40, label %11
40: ; preds = %11, %14, %2
%41 = phi i32 [ -1, %2 ], [ -1, %11 ], [ %36, %14 ]
ret i32 %41
}