#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 cos(double);
int /*<<< orphan*/ printf(char *, double, double);
double radius(int /*<<< orphan*/);
int /*<<< orphan*/ rand_norm();
double sin(double);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
double varphi(int /*<<< orphan*/);
int main(void) {
  int i;
  double r, p;
  srand(time(NULL));
  for (i = 0; i < (1 << 14); i++) {
    r = radius(rand_norm());
    p = varphi(rand_norm());
    printf("%.12f %.12f\n", r * cos(p), r * sin(p));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4000,-0x8(%rbp)
jge    123d <main+0xbd>
mov    $0x0,%al
call   1030 <rand_norm@plt>
mov    %eax,%edi
call   1050 <radius@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand_norm@plt>
mov    %eax,%edi
call   1070 <varphi@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1080 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
lea    0xdd6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x4000,%ebp
lea    0xe60(%rip),%rbx
xor    %eax,%eax
call   1030 <rand_norm@plt>
mov    %eax,%edi
call   1050 <radius@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand_norm@plt>
mov    %eax,%edi
call   1070 <varphi@plt>
movsd  %xmm0,0x8(%rsp)
call   10a0 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1080 <sin@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x20>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%.12f %.12f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
store i32 0, i32* %2
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 16384
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = call i32 (...) @rand_norm()
%12 = call double @radius(i32 %11)
store double %12, double* %3
%13 = call i32 (...) @rand_norm()
%14 = call double @varphi(i32 %13)
store double %14, double* %4
%15 = load double, double* %3
%16 = load double, double* %4
%17 = call double @cos(double %16)
%18 = fmul double %15, %17
%19 = load double, double* %3
%20 = load double, double* %4
%21 = call double @sin(double %20)
%22 = fmul double %19, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %18, double %22)
br label %24
24: ; preds = %10
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %7
27: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%.12f %.12f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %14, %3 ]
%5 = tail call i32 (...) @rand_norm()
%6 = tail call double @radius(i32 %5)
%7 = tail call i32 (...) @rand_norm()
%8 = tail call double @varphi(i32 %7)
%9 = tail call double @cos(double %8)
%10 = fmul double %6, %9
%11 = tail call double @sin(double %8)
%12 = fmul double %6, %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %10, double %12)
%14 = add nuw nsw i32 %4, 1
%15 = icmp eq i32 %14, 16384
br i1 %15, label %16, label %3
16: ; preds = %3
ret i32 0
}