#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 *, float *);
int main() {
  int j;
  float kapital, p, zkapital;
  printf("Anfangskapital: ");
  scanf("%f", &kapital);
  printf("Zinssatz (%%): ");
  scanf("%f", &p);
  printf("Zielbetrag: ");
  scanf("%f", &zkapital);
  p /= 100.0f;
  for (j = 0; kapital < zkapital; j++) {
    kapital *= (1.0f + p);
  }
  printf("Das Zielkaptial in Hoehe von %.2f € ist nach %d Jahren erreicht "
         "(tatsaechlicher Betrag = %.2f)\n",
         zkapital, j, kapital);
  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    0xed5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xe6a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11de <main+0xbe>
movss  0xe43(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x86>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe3f(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm2
divss  0xe71(%rip),%xmm2
movss  %xmm2,0xc(%rsp)
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jbe    11c2 <main+0xa2>
addss  0xe56(%rip),%xmm2
xor    %ebx,%ebx
mulss  %xmm2,%xmm1
add    $0x1,%ebx
ucomiss %xmm1,%xmm0
ja     11b0 <main+0x90>
movss  %xmm1,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe68(%rip),%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Anfangskapital: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"Zinssatz (%%): \00"
@.str.3 = [13 x i8] c"Zielbetrag: \00"
@.str.4 = [98 x i8] c"Das Zielkaptial in Hoehe von %.2f \E2\82\AC ist nach %d Jahren erreicht (tatsaechlicher Betrag = %.2f)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%12 = load float, float* %4
%13 = fdiv float %12, 1.000000e+02
store float %13, float* %4
store i32 0, i32* %2
br label %14
14: ; preds = %23, %0
%15 = load float, float* %3
%16 = load float, float* %5
%17 = fcmp olt float %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load float, float* %4
%20 = fadd float 1.000000e+00, %19
%21 = load float, float* %3
%22 = fmul float %21, %20
store float %22, float* %3
br label %23
23: ; preds = %18
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %14
26: ; preds = %14
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = load i32, i32* %2
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.4, i64 0, i64 0), double %28, i32 %29, double %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Anfangskapital: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"Zinssatz (%%): \00"
@.str.3 = [13 x i8] c"Zielbetrag: \00"
@.str.4 = [98 x i8] c"Das Zielkaptial in Hoehe von %.2f \E2\82\AC ist nach %d Jahren erreicht (tatsaechlicher Betrag = %.2f)\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 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), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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), float* %3)
%13 = load float, float* %2
%14 = fdiv float %13, 1.000000e+02
store float %14, float* %2
%15 = load float, float* %3
%16 = load float, float* %1
%17 = fcmp olt float %16, %15
br i1 %17, label %18, label %27
18: ; preds = %0
%19 = fadd float %14, 1.000000e+00
br label %20
20: ; preds = %18, %20
%21 = phi i32 [ 0, %18 ], [ %24, %20 ]
%22 = phi float [ %16, %18 ], [ %23, %20 ]
%23 = fmul float %19, %22
%24 = add nuw nsw i32 %21, 1
%25 = fcmp olt float %23, %15
br i1 %25, label %20, label %26
26: ; preds = %20
store float %23, float* %1
br label %27
27: ; preds = %26, %0
%28 = phi i32 [ %24, %26 ], [ 0, %0 ]
%29 = phi float [ %23, %26 ], [ %16, %0 ]
%30 = fpext float %15 to double
%31 = fpext float %29 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str.4, i64 0, i64 0), double %30, i32 %28, double %31)
ret i32 0
}