#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 rand();
double create_init_value() {
  int negative = rand() % 2;
  double value = (double)(rand() % 10 + 1) / (rand() % 10 + 1);
  if (negative)
    value = -value;
  return value;
}


x86 assembly (clang, -O0):
<create_init_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
cvtsi2sd %edx,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x18(%rbp),%xmm0
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
cvtsi2sd %edx,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1194 <create_init_value+0x84>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_init_value>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
test   $0x1,%bl
je     119a <create_init_value+0x8a>
xorpd  0xe66(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @create_init_value() {
%1 = alloca i32
%2 = alloca double
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 2
store i32 %4, i32* %1
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 10
%7 = add nsw i32 %6, 1
%8 = sitofp i32 %7 to double
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 10
%11 = add nsw i32 %10, 1
%12 = sitofp i32 %11 to double
%13 = fdiv double %8, %12
store double %13, double* %2
%14 = load i32, i32* %1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load double, double* %2
%18 = fneg double %17
store double %18, double* %2
br label %19
19: ; preds = %16, %0
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
define double @create_init_value() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 10
%4 = add nsw i32 %3, 1
%5 = sitofp i32 %4 to double
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = add nsw i32 %7, 1
%9 = sitofp i32 %8 to double
%10 = fdiv double %5, %9
%11 = and i32 %1, 1
%12 = icmp eq i32 %11, 0
%13 = fneg double %10
%14 = select i1 %12, double %10, double %13
ret double %14
}