#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 pow(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double t = 0;
  int numerador = 1, denominador_exp = 0;
  while (numerador <= 39) {
    t += numerador / pow(2, denominador_exp++);
    numerador += 2;
  }
  printf("%.2f\n", t);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x27,-0x14(%rbp)
jg     118e <main+0x6e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <main+0x25>
movsd  -0x10(%rbp),%xmm0
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xorpd  %xmm0,%xmm0
mov    $0x1,%r14d
xor    %ebx,%ebx
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
mov    %ebx,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0x1(%rbx),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
lea    0x2(%r14),%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
add    $0x2,%ebx
add    $0x4,%r14d
cmp    $0x14,%ebx
jne    1130 <main+0x10>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store i32 1, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 39
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = call i32 @pow(i32 2, i32 %10)
%13 = sdiv i32 %9, %12
%14 = sitofp i32 %13 to double
%15 = load double, double* %2
%16 = fadd double %15, %14
store double %16, double* %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 2
store i32 %18, i32* %3
br label %5
19: ; preds = %5
%20 = load double, double* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %11, %1 ]
%3 = phi i32 [ 1, %0 ], [ %16, %1 ]
%4 = phi double [ 0.000000e+00, %0 ], [ %15, %1 ]
%5 = or i32 %2, 1
%6 = tail call i32 @pow(i32 2, i32 %2)
%7 = sdiv i32 %3, %6
%8 = sitofp i32 %7 to double
%9 = fadd double %4, %8
%10 = add nuw nsw i32 %3, 2
%11 = add nuw nsw i32 %2, 2
%12 = tail call i32 @pow(i32 2, i32 %5)
%13 = sdiv i32 %10, %12
%14 = sitofp i32 %13 to double
%15 = fadd double %9, %14
%16 = add nuw nsw i32 %3, 4
%17 = icmp eq i32 %11, 20
br i1 %17, label %18, label %1
18: ; preds = %1
%19 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %15)
ret i32 0
}