#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 */
double log10(int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double d = 3e5;
  double p = 6000;
  double r = 0.01;
  double res = (log10(p) - log10(p - d * r)) / (log10(1 + r));
  printf("%.2lf\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb7(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%edi
call   1040 <log10@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe4b(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1770,%edi
call   1040 <log10@plt>
movsd  %xmm0,(%rsp)
mov    $0xbb8,%edi
call   1040 <log10@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    $0x1,%edi
call   1040 <log10@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
lea    0xe9e(%rip),%rdi
movapd %xmm1,%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 3.000000e+05, double* %2
store double 6.000000e+03, double* %3
store double 1.000000e-02, double* %4
%6 = load double, double* %3
%7 = fptosi double %6 to i32
%8 = call double @log10(i32 %7)
%9 = load double, double* %3
%10 = load double, double* %2
%11 = load double, double* %4
%12 = fneg double %10
%13 = call double @llvm.fmuladd.f64(double %12, double %11, double %9)
%14 = fptosi double %13 to i32
%15 = call double @log10(i32 %14)
%16 = fsub double %8, %15
%17 = load double, double* %4
%18 = fadd double 1.000000e+00, %17
%19 = fptosi double %18 to i32
%20 = call double @log10(i32 %19)
%21 = fdiv double %16, %20
store double %21, double* %5
%22 = load double, double* %5
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = tail call double @log10(i32 6000)
%2 = tail call double @log10(i32 3000)
%3 = fsub double %1, %2
%4 = tail call double @log10(i32 1)
%5 = fdiv double %3, %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %5)
ret i32 0
}