#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 ceil(double);
double log(double);
double pow(double, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, double *, double *, int *, double *);
int main() {
  double c, i, n, m1, m2;
  int n1, n2;
  scanf("%lf %lf %d %lf", &c, &i, &n1, &m2);
  i = 1 + (i / 100);
  m1 = c * pow(i, n1);
  n = log((m2 / c)) / log(i);
  n2 = ceil(n);
  printf("Montante = %.2lf\n", m1);
  printf("%d lote(s)\n", n2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x34(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1050 <scanf@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe80(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe6c(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x34(%rbp),%edi
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x38(%rbp)
cvttsd2si -0x28(%rbp),%esi
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xeb4(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x28(%rsp),%r8
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0xe7d(%rip),%xmm0
addsd  0xe7d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    0x14(%rsp),%edi
call   1070 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x28(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <log@plt>
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,%ebx
cvttsd2si (%rsp),%esi
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe33(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%lf %lf %d %lf\00"
@.str.1 = [18 x i8] c"Montante = %.2lf\0A\00"
@.str.2 = [12 x i8] c"%d lote(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, i32* %7, double* %6)
%10 = load double, double* %3
%11 = fdiv double %10, 1.000000e+02
%12 = fadd double 1.000000e+00, %11
store double %12, double* %3
%13 = load double, double* %2
%14 = load double, double* %3
%15 = load i32, i32* %7
%16 = call double @pow(double %14, i32 %15)
%17 = fmul double %13, %16
store double %17, double* %5
%18 = load double, double* %6
%19 = load double, double* %2
%20 = fdiv double %18, %19
%21 = call double @log(double %20)
%22 = load double, double* %3
%23 = call double @log(double %22)
%24 = fdiv double %21, %23
store double %24, double* %4
%25 = load double, double* %4
%26 = call i32 @ceil(double %25)
store i32 %26, i32* %8
%27 = load double, double* %5
%28 = fptosi double %27 to i32
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%lf %lf %d %lf\00"
@.str.1 = [18 x i8] c"Montante = %.2lf\0A\00"
@.str.2 = [12 x i8] c"%d lote(s)\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double* %1, double* %2, i32* %4, double* %3)
%10 = load double, double* %2
%11 = fdiv double %10, 1.000000e+02
%12 = fadd double %11, 1.000000e+00
store double %12, double* %2
%13 = load double, double* %1
%14 = load i32, i32* %4
%15 = call double @pow(double %12, i32 %14)
%16 = fmul double %13, %15
%17 = load double, double* %3
%18 = load double, double* %1
%19 = fdiv double %17, %18
%20 = call double @log(double %19)
%21 = load double, double* %2
%22 = call double @log(double %21)
%23 = fdiv double %20, %22
%24 = call i32 @ceil(double %23)
%25 = fptosi double %16 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret i32 0
}