#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, double);
scalar_t__ scanf(char *, double *, int *);
double sqrt(double);
int main(void) {
  double num = 0;
  int iter_cnt = 0;
  double sum = 0;
  while (scanf("%lf %d", &num, &iter_cnt) != EOF) {
    sum = 0;
    for (int i = 0; i < iter_cnt; ++i) {
      sum += num;
      num = sqrt(num);
    }
    printf("%.2f\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <scanf@plt>
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%rax
je     11d7 <main+0xa7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c1 <main+0x91>
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1189 <main+0x59>
movsd  -0x20(%rbp),%xmm0
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xeb2(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x2e7c(%rip),%r13
cmp    0x0(%r13),%rax
jne    1183 <main+0x53>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe85(%rip),%r14
lea    0xe77(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%rbx
jmp    11c0 <main+0x90>
nopl   (%rax)
mov    %r14,%rdi
movapd %xmm1,%xmm0
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     1172 <main+0x42>
cmpl   $0x0,0xc(%rsp)
xorpd  %xmm1,%xmm1
jle    11a0 <main+0x70>
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
movsd  0x10(%rsp),%xmm2
jmp    1218 <main+0xe8>
nopl   0x0(%rax)
movapd %xmm2,%xmm0
movsd  %xmm1,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1050 <sqrt@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm0,0x10(%rsp)
add    $0x1,%ebp
movapd %xmm0,%xmm2
cmp    0xc(%rsp),%ebp
jge    11a0 <main+0x70>
ucomisd 0xde0(%rip),%xmm2
jb     11e0 <main+0xb0>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    1201 <main+0xd1>

LLVM IR (-O0):
@.str = [7 x i8] c"%lf %d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
br label %6
6: ; preds = %24, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %2, i32* %3)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %27
10: ; preds = %6
store double 0.000000e+00, double* %4
store i32 0, i32* %5
br label %11
11: ; preds = %21, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load double, double* %2
%17 = load double, double* %4
%18 = fadd double %17, %16
store double %18, double* %4
%19 = load double, double* %2
%20 = call double @sqrt(double %19)
store double %20, double* %2
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = load double, double* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %25)
br label %6
27: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%lf %d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %1, i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %28, label %8
8: ; preds = %0, %13
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load double, double* %1
br label %19
13: ; preds = %19, %8
%14 = phi double [ 0.000000e+00, %8 ], [ %23, %19 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %14)
%16 = call i64 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double* %1, i32* %2)
%17 = load i64, i64* @EOF
%18 = icmp eq i64 %16, %17
br i1 %18, label %28, label %8
19: ; preds = %11, %19
%20 = phi double [ %24, %19 ], [ %12, %11 ]
%21 = phi i32 [ %25, %19 ], [ 0, %11 ]
%22 = phi double [ %23, %19 ], [ 0.000000e+00, %11 ]
%23 = fadd double %22, %20
%24 = call double @sqrt(double %20)
store double %24, double* %1
%25 = add nuw nsw i32 %21, 1
%26 = load i32, i32* %2
%27 = icmp slt i32 %25, %26
br i1 %27, label %19, label %13
28: ; preds = %13, %0
ret i32 0
}