#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 chk_square(double, double);
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);
      fprintf(of, "%f %f\n", x + 2.0, y);
    } else if (chk_square(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    0xe81(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x186a0,-0xc(%rbp)
jge    1290 <main+0x110>
xorps  %xmm0,%xmm0
movsd  0xe32(%rip),%xmm1
call   10a0 <randnum@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  0xe1d(%rip),%xmm1
call   10a0 <randnum@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1060 <chkcir@plt>
cmp    $0x1,%eax
jne    1246 <main+0xc6>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe01(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movsd  0xddd(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xddf(%rip),%rsi
call   1070 <fprintf@plt>
jmp    127d <main+0xfd>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <chk_square@plt>
cmp    $0x1,%eax
jne    1278 <main+0xf8>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xda8(%rip),%rsi
call   1070 <fprintf@plt>
jmp    127d <main+0xfd>
jmp    1282 <main+0x102>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b6 <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    0xe81(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x186a0,%ebp
lea    0xe63(%rip),%r14
jmp    1203 <main+0x83>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1070 <fprintf@plt>
movsd  (%rsp),%xmm0
addsd  0xe25(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1070 <fprintf@plt>
add    $0xffffffff,%ebp
je     1257 <main+0xd7>
xorps  %xmm0,%xmm0
movsd  0xdf2(%rip),%xmm1
call   10a0 <randnum@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movsd  0xddd(%rip),%xmm1
call   10a0 <randnum@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
movsd  %xmm1,0x8(%rsp)
call   1060 <chkcir@plt>
cmp    $0x1,%eax
je     11c0 <main+0x40>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <chk_square@plt>
cmp    $0x1,%eax
je     11e8 <main+0x68>
jmp    11fe <main+0x7e>
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 = %41, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 100000
br i1 %11, label %12, label %44
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 %29
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)
%24 = load i32*, i32** %1
%25 = load double, double* %3
%26 = fadd double %25, 2.000000e+00
%27 = load double, double* %4
%28 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %26, double %27)
br label %40
29: ; preds = %12
%30 = load double, double* %3
%31 = load double, double* %4
%32 = call i32 @chk_square(double %30, double %31)
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load i32*, i32** %1
%36 = load double, double* %3
%37 = load double, double* %4
%38 = call i32 @fprintf(i32* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %36, double %37)
br label %39
39: ; preds = %34, %29
br label %40
40: ; preds = %39, %19
br label %41
41: ; preds = %40
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %9
44: ; preds = %9
%45 = load i32*, i32** %1
%46 = call i32 @fclose(i32* %45)
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 = %22
%6 = tail call i32 @fclose(i32* %1)
ret void
7: ; preds = %0, %22
%8 = phi i32 [ 0, %0 ], [ %23, %22 ]
%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 %16
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)
%15 = fadd double %9, 2.000000e+00
br label %19
16: ; preds = %7
%17 = tail call i32 @chk_square(double %9, double %10)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %16, %13
%20 = phi double [ %15, %13 ], [ %9, %16 ]
%21 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %20, double %10)
br label %22
22: ; preds = %19, %16
%23 = add nuw nsw i32 %8, 1
%24 = icmp eq i32 %23, 100000
br i1 %24, label %5, label %7
}