#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 pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, double *);
int main() {
  printf("Provide the encoding size and the mutation rate\n");
  printf("Size: int\nRate: [0, 1]\n");
  int size;
  double rate, result;
  scanf("%d %lf", &size, &rate);
  result = 100 * (1 - pow(1 - rate, size));
  printf("\n%lf%%\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
movsd  0xe89(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%esi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
imul   $0x64,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xeaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <scanf@plt>
movsd  0xe86(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
mov    0xc(%rsp),%esi
call   1060 <pow@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
imul   $0x64,%ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Provide the encoding size and the mutation rate\0A\00"
@.str.1 = [24 x i8] c"Size: int\0ARate: [0, 1]\0A\00"
@.str.2 = [7 x i8] c"%d %lf\00"
@.str.3 = [8 x i8] c"\0A%lf%%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %2, double* %3)
%8 = load double, double* %3
%9 = fsub double 1.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = load i32, i32* %2
%12 = call i32 @pow(i32 %10, i32 %11)
%13 = sub nsw i32 1, %12
%14 = mul nsw i32 100, %13
%15 = sitofp i32 %14 to double
store double %15, double* %4
%16 = load double, double* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"%d %lf\00"
@.str.3 = [8 x i8] c"\0A%lf%%\0A\00"
@str = [48 x i8] c"Provide the encoding size and the mutation rate\00"
@str.4 = [23 x i8] c"Size: int\0ARate: [0, 1]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.4, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %1, double* %2)
%8 = load double, double* %2
%9 = fsub double 1.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = load i32, i32* %1
%12 = call i32 @pow(i32 %10, i32 %11)
%13 = sub nsw i32 1, %12
%14 = mul nsw i32 %13, 100
%15 = sitofp i32 %14 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %15)
ret i32 0
}