#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 */
scalar_t__ RAND_MAX;
double pow(double, double);
scalar_t__ rand();
int /*<<< orphan*/ srand(int);
void sequential(int n, int seed, int *circle_count) {
  int i;
  srand(seed);
  *circle_count = 0;
  for (i = 0; i < n; i++) {
    double x, y;
    x = (double)rand() / ((double)RAND_MAX + 1.0e0);
    y = (double)rand() / ((double)RAND_MAX + 1.0e0);
    if ((pow(x, 2.0) + pow(y, 2.0)) < 1.0)
      (*circle_count)++;
  }
  return;
}


x86 assembly (clang, -O0):
<sequential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <srand@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1223 <sequential+0xf3>
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e6e(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xe79(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e41(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xe4c(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x30(%rbp),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe05(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1210 <sequential+0xe0>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1215 <sequential+0xe5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <sequential+0x2b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequential>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %edi,%ebp
mov    %esi,%edi
call   1030 <srand@plt>
movl   $0x0,(%r14)
test   %ebp,%ebp
jle    11c7 <sequential+0xa7>
mov    0x2e9e(%rip),%rbx
jmp    1155 <sequential+0x35>
nopl   0x0(%rax)
add    $0xffffffff,%ebp
je     11c7 <sequential+0xa7>
xor    %eax,%eax
call   1040 <rand@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movsd  0xe8c(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
xor    %eax,%eax
call   1040 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
movsd  0xe5f(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm0,%xmm2
jbe    1150 <sequential+0x30>
addl   $0x1,(%r14)
jmp    1150 <sequential+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define void @sequential(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = load i32, i32* %5
%11 = call i32 @srand(i32 %10)
%12 = load i32*, i32** %6
store i32 0, i32* %12
store i32 0, i32* %7
br label %13
13: ; preds = %41, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %44
17: ; preds = %13
%18 = call i64 (...) @rand()
%19 = sitofp i64 %18 to double
%20 = load i64, i64* @RAND_MAX
%21 = sitofp i64 %20 to double
%22 = fadd double %21, 1.000000e+00
%23 = fdiv double %19, %22
store double %23, double* %8
%24 = call i64 (...) @rand()
%25 = sitofp i64 %24 to double
%26 = load i64, i64* @RAND_MAX
%27 = sitofp i64 %26 to double
%28 = fadd double %27, 1.000000e+00
%29 = fdiv double %25, %28
store double %29, double* %9
%30 = load double, double* %8
%31 = call double @pow(double %30, double 2.000000e+00)
%32 = load double, double* %9
%33 = call double @pow(double %32, double 2.000000e+00)
%34 = fadd double %31, %33
%35 = fcmp olt double %34, 1.000000e+00
br i1 %35, label %36, label %40
36: ; preds = %17
%37 = load i32*, i32** %6
%38 = load i32, i32* %37
%39 = add nsw i32 %38, 1
store i32 %39, i32* %37
br label %40
40: ; preds = %36, %17
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %13
44: ; preds = %13
ret void
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define void @sequential(i32 %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32 @srand(i32 %1)
store i32 0, i32* %2
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %30
6: ; preds = %3, %27
%7 = phi i32 [ %28, %27 ], [ 0, %3 ]
%8 = tail call i64 (...) @rand()
%9 = sitofp i64 %8 to double
%10 = load i64, i64* @RAND_MAX
%11 = sitofp i64 %10 to double
%12 = fadd double %11, 1.000000e+00
%13 = fdiv double %9, %12
%14 = tail call i64 (...) @rand()
%15 = sitofp i64 %14 to double
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to double
%18 = fadd double %17, 1.000000e+00
%19 = fdiv double %15, %18
%20 = fmul double %13, %13
%21 = fmul double %19, %19
%22 = fadd double %20, %21
%23 = fcmp olt double %22, 1.000000e+00
br i1 %23, label %24, label %27
24: ; preds = %6
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %27
27: ; preds = %24, %6
%28 = add nuw nsw i32 %7, 1
%29 = icmp eq i32 %28, %0
br i1 %29, label %30, label %6
30: ; preds = %27, %3
ret void
}