#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, ci, j;
  printf("Qual o capital inicial? ");
  scanf("%d", &ci);
  printf("Qual a taxa de juro dada pelo banco? ");
  scanf("%d", &j);
  printf("Durante quantos anos? ");
  scanf("%d", &n);
  float inside = 1 + (float)j / 100.0f;
  float ca = ci;
  for (int i = 0; i < n; ++i) {
    ca *= inside;
  }
  printf("O capital acumulado ao fim de %d anos é de %.3f euros.\n", n, ca);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2ssl -0x10(%rbp),%xmm1
movss  0xe6e(%rip),%xmm0
divss  %xmm0,%xmm1
movss  0xe5e(%rip),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e5 <main+0xc5>
movss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bc <main+0x9c>
mov    -0x8(%rbp),%esi
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cvtsi2ssl 0x8(%rsp),%xmm0
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11f9 <main+0xd9>
cvtsi2ssl 0x4(%rsp),%xmm1
divss  0xe67(%rip),%xmm1
addss  0xe63(%rip),%xmm1
lea    -0x1(%rsi),%ecx
mov    %esi,%eax
and    $0x7,%eax
cmp    $0x7,%ecx
jb     11e5 <main+0xc5>
mov    %esi,%ecx
and    $0xfffffff8,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
add    $0xfffffff8,%ecx
jne    11c0 <main+0xa0>
test   %eax,%eax
je     11f9 <main+0xd9>
nopl   0x0(%rax)
mulss  %xmm1,%xmm0
add    $0xffffffff,%eax
jne    11f0 <main+0xd0>
cvtss2sd %xmm0,%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Qual o capital inicial? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Qual a taxa de juro dada pelo banco? \00"
@.str.3 = [23 x i8] c"Durante quantos anos? \00"
@.str.4 = [57 x i8] c"O capital acumulado ao fim de %d anos \C3\A9 de %.3f euros.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fdiv float %15, 1.000000e+02
%17 = fadd float 1.000000e+00, %16
store float %17, float* %5
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
store float %19, float* %6
store i32 0, i32* %7
br label %20
20: ; preds = %28, %0
%21 = load i32, i32* %7
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load float, float* %5
%26 = load float, float* %6
%27 = fmul float %26, %25
store float %27, float* %6
br label %28
28: ; preds = %24
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %20
31: ; preds = %20
%32 = load i32, i32* %2
%33 = load float, float* %6
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i32 %32, double %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Qual o capital inicial? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"Qual a taxa de juro dada pelo banco? \00"
@.str.3 = [23 x i8] c"Durante quantos anos? \00"
@.str.4 = [57 x i8] c"O capital acumulado ao fim de %d anos \C3\A9 de %.3f euros.\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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to float
%15 = fdiv float %14, 1.000000e+02
%16 = fadd float %15, 1.000000e+00
%17 = load i32, i32* %2
%18 = sitofp i32 %17 to float
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %37
21: ; preds = %0
%22 = add i32 %19, -1
%23 = and i32 %19, 7
%24 = icmp ult i32 %22, 7
br i1 %24, label %27, label %25
25: ; preds = %21
%26 = and i32 %19, -8
br label %41
27: ; preds = %41, %21
%28 = phi float [ undef, %21 ], [ %51, %41 ]
%29 = phi float [ %18, %21 ], [ %51, %41 ]
%30 = icmp eq i32 %23, 0
br i1 %30, label %37, label %31
31: ; preds = %27, %31
%32 = phi float [ %34, %31 ], [ %29, %27 ]
%33 = phi i32 [ %35, %31 ], [ 0, %27 ]
%34 = fmul float %16, %32
%35 = add i32 %33, 1
%36 = icmp eq i32 %35, %23
br i1 %36, label %37, label %31
37: ; preds = %27, %31, %0
%38 = phi float [ %18, %0 ], [ %28, %27 ], [ %34, %31 ]
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i32 %19, double %39)
ret i32 0
41: ; preds = %41, %25
%42 = phi float [ %18, %25 ], [ %51, %41 ]
%43 = phi i32 [ 0, %25 ], [ %52, %41 ]
%44 = fmul float %16, %42
%45 = fmul float %16, %44
%46 = fmul float %16, %45
%47 = fmul float %16, %46
%48 = fmul float %16, %47
%49 = fmul float %16, %48
%50 = fmul float %16, %49
%51 = fmul float %16, %50
%52 = add i32 %43, 8
%53 = icmp eq i32 %52, %26
br i1 %53, label %27, label %41
}