#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(void) {
  setbuf(stdout, NULL);
  double startkapital, zinssatz, anfangssumme, summmme;
  int laufzeit;
  printf("\n\n\t\tWieviel Kapital moechten Sie anlegen?\n\t\t--> ");
  scanf("%lf", &startkapital);
  printf("\n\n\t\tWieviel %%-Zinsen moechten Sie angeben?\n\t\t--> ");
  scanf("%lf", &zinssatz);
  printf("\n\n\t\tWelche Laufzeit in Jahren schwebt Ihnen vor?\n\t\t--> ");
  scanf("%d", &laufzeit);
  anfangssumme = startkapital;
  printf("\n\n\t\tBerechnung:\n\n");
  for (int i = 1; i <= laufzeit; i++) {
    startkapital = startkapital + ((startkapital / 100) * zinssatz);
    if (i == 1) {
      printf("\t\tKapital %.2lf EUR ergibt verzinst zu %.2lf%% im %d Jahr: "
             "%.2lf EUR\n",
             anfangssumme, zinssatz, i, startkapital);
    } else {
      printf("\t\tKapital %.2lf EUR ergibt verzinst zu %.2lf%% im %d Jahr: "
             "%.2lf EUR\n",
             summmme, zinssatz, i, startkapital);
    }
    summmme = startkapital;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf02(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     126b <main+0x13b>
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe12(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    1233 <main+0x103>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x30(%rbp),%esi
movsd  -0x10(%rbp),%xmm2
lea    0xe96(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
jmp    1253 <main+0x123>
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x30(%rbp),%esi
movsd  -0x10(%rbp),%xmm2
lea    0xe71(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d0 <main+0xa0>
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecd(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xefb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xf25(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    126b <main+0x12b>
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
divsd  0xe12(%rip),%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
lea    0xea2(%rip),%rdi
mov    $0x1,%ebx
movsd  0x20(%rsp),%xmm0
mov    $0x1,%esi
mov    $0x3,%al
call   1050 <printf@plt>
cmpl   $0x2,0xc(%rsp)
jl     126b <main+0x12b>
lea    0xe7d(%rip),%r14
xchg   %ax,%ax
add    $0x1,%ebx
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm2
divsd  0xdbb(%rip),%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%al
call   1050 <printf@plt>
cmp    0xc(%rsp),%ebx
jl     1230 <main+0xf0>
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [49 x i8] c"\0A\0A\09\09Wieviel Kapital moechten Sie anlegen?\0A\09\09--> \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [51 x i8] c"\0A\0A\09\09Wieviel %%-Zinsen moechten Sie angeben?\0A\09\09--> \00"
@.str.3 = [56 x i8] c"\0A\0A\09\09Welche Laufzeit in Jahren schwebt Ihnen vor?\0A\09\09--> \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [18 x i8] c"\0A\0A\09\09Berechnung:\0A\0A\00"
@.str.6 = [70 x i8] c"\09\09Kapital %.2lf EUR ergibt verzinst zu %.2lf%% im %d Jahr: %.2lf EUR\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32, i32* @stdout
%9 = call i32 @setbuf(i32 %8, i32* null)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%16 = load double, double* %2
store double %16, double* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %7
br label %18
18: ; preds = %44, %0
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %47
22: ; preds = %18
%23 = load double, double* %2
%24 = load double, double* %2
%25 = fdiv double %24, 1.000000e+02
%26 = load double, double* %3
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double %23)
store double %27, double* %2
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %36
30: ; preds = %22
%31 = load double, double* %4
%32 = load double, double* %3
%33 = load i32, i32* %7
%34 = load double, double* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0), double %31, double %32, i32 %33, double %34)
br label %42
36: ; preds = %22
%37 = load double, double* %5
%38 = load double, double* %3
%39 = load i32, i32* %7
%40 = load double, double* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0), double %37, double %38, i32 %39, double %40)
br label %42
42: ; preds = %36, %30
%43 = load double, double* %2
store double %43, double* %5
br label %44
44: ; preds = %42
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %18
47: ; preds = %18
%48 = load i32, i32* @EXIT_SUCCESS
ret i32 %48
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [49 x i8] c"\0A\0A\09\09Wieviel Kapital moechten Sie anlegen?\0A\09\09--> \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [51 x i8] c"\0A\0A\09\09Wieviel %%-Zinsen moechten Sie angeben?\0A\09\09--> \00"
@.str.3 = [56 x i8] c"\0A\0A\09\09Welche Laufzeit in Jahren schwebt Ihnen vor?\0A\09\09--> \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.6 = [70 x i8] c"\09\09Kapital %.2lf EUR ergibt verzinst zu %.2lf%% im %d Jahr: %.2lf EUR\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [17 x i8] c"\0A\0A\09\09Berechnung:\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca i32
%4 = load i32, i32* @stdout
%5 = tail call i32 @setbuf(i32 %4, i32* null)
%6 = bitcast double* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%15 = load double, double* %1
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 1
br i1 %18, label %27, label %19
19: ; preds = %0
%20 = load double, double* %1
%21 = fdiv double %20, 1.000000e+02
%22 = load double, double* %2
%23 = call double @llvm.fmuladd.f64(double %21, double %22, double %20)
store double %23, double* %1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0), double %15, double %22, i32 1, double %23)
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 1
br i1 %26, label %29, label %27
27: ; preds = %29, %19, %0
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
29: ; preds = %19, %29
%30 = phi i32 [ %37, %29 ], [ 2, %19 ]
%31 = load double, double* %1
%32 = fdiv double %31, 1.000000e+02
%33 = load double, double* %2
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double %31)
store double %34, double* %1
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.6, i64 0, i64 0), double %31, double %33, i32 %30, double %34)
%36 = load i32, i32* %3
%37 = add nuw nsw i32 %30, 1
%38 = icmp slt i32 %30, %36
br i1 %38, label %29, label %27
}