#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int chkcir(double, double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double);
double randnum(double, double);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void main() {
  FILE *of = fopen("quiz.txt", "w");
  srand((unsigned int)time(NULL));
  for (int i = 0; i < 100000; i++) {
    double x = randnum(0.0, 3.0);
    double y = randnum(0.0, 3.0);
    if (chkcir(x, y) == true) {
      fprintf(of, "%f %f\n", x, y);
    }
  }
  fclose(of);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe89(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    1222 <main+0xb2>
xorps  %xmm0,%xmm0
movsd  0xe42(%rip),%xmm1
call   1090 <randnum@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  0xe2d(%rip),%xmm1
call   1090 <randnum@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1050 <chkcir@plt>
cmp    $0x1,%eax
jne    120f <main+0x9f>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe09(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1214 <main+0xa4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe89(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x186a0,%ebp
lea    0xe6b(%rip),%r14
jmp    11b5 <main+0x45>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     120a <main+0x9a>
xorps  %xmm0,%xmm0
movsd  0xe40(%rip),%xmm1
call   1090 <randnum@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movsd  0xe2b(%rip),%xmm1
call   1090 <randnum@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
call   1050 <chkcir@plt>
cmp    $0x1,%eax
jne    11b0 <main+0x40>
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1060 <fprintf@plt>
jmp    11b0 <main+0x40>
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"quiz.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
define void @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %1
%6 = call i64 @time(i32* null)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %2
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 100000
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = call double @randnum(double 0.000000e+00, double 3.000000e+00)
store double %13, double* %3
%14 = call double @randnum(double 0.000000e+00, double 3.000000e+00)
store double %14, double* %4
%15 = load double, double* %3
%16 = load double, double* %4
%17 = call i32 @chkcir(double %15, double %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %12
%20 = load i32*, i32** %1
%21 = load double, double* %3
%22 = load double, double* %4
%23 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %21, double %22)
br label %24
24: ; preds = %19, %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %9
28: ; preds = %9
%29 = load i32*, i32** %1
%30 = call i32 @fclose(i32* %29)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"quiz.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
define void @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
br label %7
5: ; preds = %15
%6 = tail call i32 @fclose(i32* %1)
ret void
7: ; preds = %0, %15
%8 = phi i32 [ 0, %0 ], [ %16, %15 ]
%9 = tail call double @randnum(double 0.000000e+00, double 3.000000e+00)
%10 = tail call double @randnum(double 0.000000e+00, double 3.000000e+00)
%11 = tail call i32 @chkcir(double %9, double %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %9, double %10)
br label %15
15: ; preds = %13, %7
%16 = add nuw nsw i32 %8, 1
%17 = icmp eq i32 %16, 100000
br i1 %17, label %5, label %7
}