#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 exp(double);
int falsePosition(double, double, int);
int /*<<< orphan*/ printf(char *, int);
double secantMethod(int, int, int);
int main() {
  double temp;
  printf("Birth rate is %lf\n", temp = secantMethod(-1, 1, 100));
  printf("Population in 2 years is: %.2lf\n",
         1564000 * exp(temp) + (435000 / temp) * (exp(temp) - 1));
  printf("Interest rate required: %lf\n", falsePosition(0.01, 0.1, 100));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    $0x64,%edx
call   1040 <secantMethod@plt>
movsd  %xmm0,-0x10(%rbp)
cvttsd2si %xmm0,%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1050 <exp@plt>
imul   $0x17dd60,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe77(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <exp@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe22(%rip),%xmm0
movsd  0xe22(%rip),%xmm1
mov    $0x64,%edi
call   1060 <falsePosition@plt>
mov    %eax,%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    $0x64,%edx
call   1040 <secantMethod@plt>
movsd  %xmm0,(%rsp)
cvttsd2si %xmm0,%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
call   1050 <exp@plt>
imul   $0x17dd60,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe6e(%rip),%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1050 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe34(%rip),%xmm0
movsd  0xe34(%rip),%xmm1
mov    $0x64,%edi
call   1060 <falsePosition@plt>
lea    0xe5f(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Birth rate is %lf\0A\00"
@.str.1 = [33 x i8] c"Population in 2 years is: %.2lf\0A\00"
@.str.2 = [29 x i8] c"Interest rate required: %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call double @secantMethod(i32 -1, i32 1, i32 100)
store double %3, double* %2
%4 = fptosi double %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load double, double* %2
%7 = call i32 @exp(double %6)
%8 = mul nsw i32 1564000, %7
%9 = sitofp i32 %8 to double
%10 = load double, double* %2
%11 = fdiv double 4.350000e+05, %10
%12 = load double, double* %2
%13 = call i32 @exp(double %12)
%14 = sub nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = call double @llvm.fmuladd.f64(double %11, double %15, double %9)
%17 = fptosi double %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i32 @falsePosition(double 1.000000e-02, double 1.000000e-01, i32 100)
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Birth rate is %lf\0A\00"
@.str.1 = [33 x i8] c"Population in 2 years is: %.2lf\0A\00"
@.str.2 = [29 x i8] c"Interest rate required: %lf\0A\00"
define i32 @main() {
%1 = tail call double @secantMethod(i32 -1, i32 1, i32 100)
%2 = fptosi double %1 to i32
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @exp(double %1)
%5 = mul nsw i32 %4, 1564000
%6 = sitofp i32 %5 to double
%7 = fdiv double 4.350000e+05, %1
%8 = tail call i32 @exp(double %1)
%9 = add nsw i32 %8, -1
%10 = sitofp i32 %9 to double
%11 = tail call double @llvm.fmuladd.f64(double %7, double %10, double %6)
%12 = fptosi double %11 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @falsePosition(double 1.000000e-02, double 1.000000e-01, i32 100)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}