#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 */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int simulacao(int);
int main() {
  int i, n, m, nrepeticoes, canoasSeguras;
  float porcentagem = 0.0;
  scanf("%d %d %d", &n, &m, &nrepeticoes);
  for (i = 0; i < nrepeticoes; i++) {
    canoasSeguras = simulacao(n);
    if (canoasSeguras >= m)
      porcentagem++;
  }
  porcentagem *= 100.0 / nrepeticoes;
  printf("P: %.2f%%.\n", porcentagem);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xebe(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ae <main+0x7e>
mov    -0xc(%rbp),%edi
call   1030 <simulacao@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     119b <main+0x6b>
movss  0xe77(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11a0 <main+0x70>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1166 <main+0x36>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe45(%rip),%xmm1
divsd  %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11a9 <main+0x79>
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
jmp    117b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
mov    0x4(%rsp),%eax
cmp    %eax,%ebx
jge    119e <main+0x6e>
mov    0xc(%rsp),%edi
call   1030 <simulacao@plt>
movss  (%rsp),%xmm0
addss  0xe6f(%rip),%xmm0
cmp    0x8(%rsp),%eax
jl     1170 <main+0x40>
movss  %xmm0,(%rsp)
jmp    1170 <main+0x40>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
jmp    11ac <main+0x7c>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xe50(%rip),%xmm2
divsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [12 x i8] c"P: %.2f%%.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
store i32 0, i32* %2
br label %9
9: ; preds = %23, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* %3
%15 = call i32 @simulacao(i32 %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load float, float* %7
%21 = fadd float %20, 1.000000e+00
store float %21, float* %7
br label %22
22: ; preds = %19, %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %9
26: ; preds = %9
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = fdiv double 1.000000e+02, %28
%30 = load float, float* %7
%31 = fpext float %30 to double
%32 = fmul double %31, %29
%33 = fptrunc double %32 to float
store float %33, float* %7
%34 = load float, float* %7
%35 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.1 = [12 x i8] c"P: %.2f%%.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %0, %10
%11 = phi float [ %18, %10 ], [ 0.000000e+00, %0 ]
%12 = phi i32 [ %19, %10 ], [ 0, %0 ]
%13 = load i32, i32* %1
%14 = call i32 @simulacao(i32 %13)
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
%17 = fadd float %11, 1.000000e+00
%18 = select i1 %16, float %11, float %17
%19 = add nuw nsw i32 %12, 1
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %10, label %22
22: ; preds = %10
%23 = fpext float %18 to double
br label %24
24: ; preds = %22, %0
%25 = phi double [ 0.000000e+00, %0 ], [ %23, %22 ]
%26 = phi i32 [ %8, %0 ], [ %20, %22 ]
%27 = sitofp i32 %26 to double
%28 = fdiv double 1.000000e+02, %27
%29 = fmul double %28, %25
%30 = fptrunc double %29 to float
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float %30)
ret i32 0
}