#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__ same_birthday(int);
double probability_mc(int people, int experiments) {
  int count = 0;
  for (int i = 0; i < experiments; i++) {
    count += same_birthday(people);
  }
  return (1.0 * count) / experiments;
}


x86 assembly (clang, -O0):
<probability_mc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115b <probability_mc+0x4b>
mov    -0x4(%rbp),%edi
call   1030 <same_birthday@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112c <probability_mc+0x1c>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe98(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probability_mc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
test   %esi,%esi
jle    1145 <probability_mc+0x35>
mov    %edi,%r15d
xor    %ebx,%ebx
mov    %r14d,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%edi
call   1030 <same_birthday@plt>
add    %eax,%ebx
add    $0xffffffff,%ebp
jne    1130 <probability_mc+0x20>
cvtsi2sd %ebx,%xmm0
jmp    1149 <probability_mc+0x39>
xorpd  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm1
divsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @probability_mc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i32, i32* %3
%13 = call i64 @same_birthday(i32 %12)
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
br label %18
18: ; preds = %11
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %7
21: ; preds = %7
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to double
%24 = fmul double 1.000000e+00, %23
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = fdiv double %24, %26
ret double %27
}

LLVM IR (-O2):
define double @probability_mc(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %10, label %6
4: ; preds = %10
%5 = sitofp i32 %15 to double
br label %6
6: ; preds = %4, %2
%7 = phi double [ 0.000000e+00, %2 ], [ %5, %4 ]
%8 = sitofp i32 %1 to double
%9 = fdiv double %7, %8
ret double %9
10: ; preds = %2, %10
%11 = phi i32 [ %16, %10 ], [ 0, %2 ]
%12 = phi i32 [ %15, %10 ], [ 0, %2 ]
%13 = tail call i64 @same_birthday(i32 %0)
%14 = trunc i64 %13 to i32
%15 = add i32 %12, %14
%16 = add nuw nsw i32 %11, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %4, label %10
}