#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 */
double rt_rand(unsigned int *);
void jitter_disc2f(unsigned int *pval, float *dir) {
  float dx, dy;
  do {
    dx = (rt_rand(pval) / 4294967296.0) - 0.5f;
    dy = (rt_rand(pval) / 4294967296.0) - 0.5f;
  } while ((dx * dx + dy * dy) > 0.250f);
  dir[0] = dx;
  dir[1] = dy;
}


x86 assembly (clang, -O0):
<jitter_disc2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rt_rand@plt>
movsd  0xed7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rt_rand@plt>
movsd  0xead(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe99(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe78(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1120 <jitter_disc2f+0x10>
movss  -0x14(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jitter_disc2f>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <rt_rand@plt>
movsd  0xed0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1030 <rt_rand@plt>
movss  0x4(%rsp),%xmm3
mulsd  0xea0(%rip),%xmm0
addsd  0xea0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
movaps %xmm3,%xmm2
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
ucomiss 0xe8b(%rip),%xmm2
ja     1120 <jitter_disc2f+0x10>
movss  %xmm3,(%r14)
movss  %xmm0,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @jitter_disc2f(i32* %0, float* %1) {
%3 = alloca i32*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
store i32* %0, i32** %3
store float* %1, float** %4
br label %7
7: ; preds = %18, %2
%8 = load i32*, i32** %3
%9 = call double @rt_rand(i32* %8)
%10 = fdiv double %9, 0x41F0000000000000
%11 = fsub double %10, 5.000000e-01
%12 = fptrunc double %11 to float
store float %12, float* %5
%13 = load i32*, i32** %3
%14 = call double @rt_rand(i32* %13)
%15 = fdiv double %14, 0x41F0000000000000
%16 = fsub double %15, 5.000000e-01
%17 = fptrunc double %16 to float
store float %17, float* %6
br label %18
18: ; preds = %7
%19 = load float, float* %5
%20 = load float, float* %5
%21 = load float, float* %6
%22 = load float, float* %6
%23 = fmul float %21, %22
%24 = call float @llvm.fmuladd.f32(float %19, float %20, float %23)
%25 = fcmp ogt float %24, 2.500000e-01
br i1 %25, label %7, label %26
26: ; preds = %18
%27 = load float, float* %5
%28 = load float*, float** %4
%29 = getelementptr inbounds float, float* %28, i64 0
store float %27, float* %29
%30 = load float, float* %6
%31 = load float*, float** %4
%32 = getelementptr inbounds float, float* %31, i64 1
store float %30, float* %32
ret void
}

LLVM IR (-O2):
define void @jitter_disc2f(i32* %0, float* nocapture writeonly %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call double @rt_rand(i32* %0)
%5 = fmul double %4, 0x3DF0000000000000
%6 = fadd double %5, -5.000000e-01
%7 = fptrunc double %6 to float
%8 = tail call double @rt_rand(i32* %0)
%9 = fmul double %8, 0x3DF0000000000000
%10 = fadd double %9, -5.000000e-01
%11 = fptrunc double %10 to float
%12 = fmul float %11, %11
%13 = tail call float @llvm.fmuladd.f32(float %7, float %7, float %12)
%14 = fcmp ogt float %13, 2.500000e-01
br i1 %14, label %3, label %15
15: ; preds = %3
store float %7, float* %1
%16 = getelementptr inbounds float, float* %1, i64 1
store float %11, float* %16
ret void
}