#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 */
float pow(int, int);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, k;
  float m = 0.0, resultado = 0.0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    m = (pow(2 * i - 1, 2 * i - 1)) / (pow(2 * i, 2 * i));
    if (i == 1) {
      resultado = m;
    }
    if (((i % 2) == 0) && (i > 1)) {
      k = 1;
    } else if (((i % 2) != 0) && (i > 1)) {
      k = 2;
    }
    switch (k) {
    case 1:
      resultado = resultado + m;
      break;
    case 2:
      resultado = resultado * m;
      break;
    }
  }
  printf("\nO resultado obtido e %.2lf\n", resultado);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1273 <main+0x143>
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
sub    $0x1,%esi
call   1050 <pow@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11c4 <main+0x94>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ee <main+0xbe>
cmpl   $0x1,-0xc(%rbp)
jle    11ee <main+0xbe>
movl   $0x1,-0x10(%rbp)
jmp    1218 <main+0xe8>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1213 <main+0xe3>
cmpl   $0x1,-0xc(%rbp)
jle    1213 <main+0xe3>
movl   $0x2,-0x10(%rbp)
jmp    1218 <main+0xe8>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x1,%eax
je     123d <main+0x10d>
jmp    122c <main+0xfc>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
je     1251 <main+0x121>
jmp    1260 <main+0x130>
movss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1260 <main+0x130>
movss  -0x18(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1265 <main+0x135>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <main+0x36>
movss  -0x18(%rbp),%xmm0
lea    0xd84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11fd <main+0xcd>
xorps  %xmm1,%xmm1
xor    %r12d,%r12d
mov    $0x2,%r15d
mov    $0x1,%ebx
jmp    1181 <main+0x51>
nopl   (%rax)
mulss  %xmm1,%xmm0
add    $0x2,%ebx
movaps %xmm0,%xmm1
cmp    0xc(%rsp),%r12d
jge    1200 <main+0xd0>
movss  %xmm1,0x10(%rsp)
mov    %r12d,%r14d
lea    0x1(%r14),%r12d
test   $0x1,%r12b
mov    %ebp,%eax
cmovne %r15d,%eax
cmp    $0x2,%r12d
cmovb  %ebp,%eax
test   $0x1,%r12b
mov    %eax,%ebp
mov    $0x1,%ecx
cmove  %ecx,%ebp
cmp    $0x2,%r12d
cmovb  %eax,%ebp
lea    0x1(%rbx),%r13d
mov    %ebx,%edi
mov    %ebx,%esi
call   1050 <pow@plt>
movss  %xmm0,0x14(%rsp)
mov    %r13d,%edi
mov    %r13d,%esi
call   1050 <pow@plt>
movss  0x14(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
test   %r14d,%r14d
je     11ea <main+0xba>
movss  0x10(%rsp),%xmm0
cmp    $0x2,%ebp
je     1170 <main+0x40>
cmp    $0x1,%ebp
jne    1174 <main+0x44>
addss  %xmm1,%xmm0
jmp    1174 <main+0x44>
xorps  %xmm0,%xmm0
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"\0AO resultado obtido e %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %8
8: ; preds = %58, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %61
12: ; preds = %8
%13 = load i32, i32* %3
%14 = mul nsw i32 2, %13
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %3
%17 = mul nsw i32 2, %16
%18 = sub nsw i32 %17, 1
%19 = call float @pow(i32 %15, i32 %18)
%20 = load i32, i32* %3
%21 = mul nsw i32 2, %20
%22 = load i32, i32* %3
%23 = mul nsw i32 2, %22
%24 = call float @pow(i32 %21, i32 %23)
%25 = fdiv float %19, %24
store float %25, float* %5
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %12
%29 = load float, float* %5
store float %29, float* %6
br label %30
30: ; preds = %28, %12
%31 = load i32, i32* %3
%32 = srem i32 %31, 2
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* %3
%36 = icmp sgt i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 1, i32* %4
br label %47
38: ; preds = %34, %30
%39 = load i32, i32* %3
%40 = srem i32 %39, 2
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = load i32, i32* %3
%44 = icmp sgt i32 %43, 1
br i1 %44, label %45, label %46
45: ; preds = %42
store i32 2, i32* %4
br label %46
46: ; preds = %45, %42, %38
br label %47
47: ; preds = %46, %37
%48 = load i32, i32* %4
switch i32 %48, label %57 [
i32 1, label %49
i32 2, label %53
]
49: ; preds = %47
%50 = load float, float* %6
%51 = load float, float* %5
%52 = fadd float %50, %51
store float %52, float* %6
br label %57
53: ; preds = %47
%54 = load float, float* %6
%55 = load float, float* %5
%56 = fmul float %54, %55
store float %56, float* %6
br label %57
57: ; preds = %47, %53, %49
br label %58
58: ; preds = %57
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %8
61: ; preds = %8
%62 = load float, float* %6
%63 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float %62)
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"\0AO resultado obtido e %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %34, label %6
6: ; preds = %0, %29
%7 = phi float [ %30, %29 ], [ 0.000000e+00, %0 ]
%8 = phi i32 [ %24, %29 ], [ undef, %0 ]
%9 = phi i32 [ %31, %29 ], [ 1, %0 ]
%10 = shl nuw nsw i32 %9, 1
%11 = add nsw i32 %10, -1
%12 = call float @pow(i32 %11, i32 %11)
%13 = call float @pow(i32 %10, i32 %10)
%14 = fdiv float %12, %13
%15 = icmp eq i32 %9, 1
%16 = select i1 %15, float %14, float %7
%17 = and i32 %9, 1
%18 = icmp eq i32 %17, 0
%19 = icmp ugt i32 %9, 1
%20 = and i1 %19, %18
%21 = icmp ne i32 %17, 0
%22 = and i1 %19, %21
%23 = select i1 %22, i32 2, i32 %8
%24 = select i1 %20, i32 1, i32 %23
switch i32 %24, label %29 [
i32 1, label %25
i32 2, label %27
]
25: ; preds = %6
%26 = fadd float %14, %16
br label %29
27: ; preds = %6
%28 = fmul float %14, %16
br label %29
29: ; preds = %25, %27, %6
%30 = phi float [ %16, %6 ], [ %28, %27 ], [ %26, %25 ]
%31 = add nuw nsw i32 %9, 1
%32 = load i32, i32* %1
%33 = icmp slt i32 %9, %32
br i1 %33, label %6, label %34
34: ; preds = %29, %0
%35 = phi float [ 0.000000e+00, %0 ], [ %30, %29 ]
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), float %35)
ret i32 0
}