#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  float dividendo, divisor, soma;
  printf("Vamos calcular uma sequencia legal!\n\n(Sequencia do Tipo: 1/1 + 3/2 "
         "+ 5/3 + 7/4 + ... + 99/50)\n\n");
  soma = 0.0;
  getch();
  dividendo = 1;
  for (divisor = 1; divisor <= 50; divisor++) {
    soma = soma + (dividendo / divisor);
    dividendo += 2;
  }
  printf("A soma e: %.4f\n", soma);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getch@plt>
movss  0xeac(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe9f(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe96(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11b9 <main+0x99>
movss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
divss  -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe70(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe56(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1166 <main+0x46>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getch@plt>
movss  0xeb4(%rip),%xmm0
mov    $0x1,%eax
xorps  %xmm2,%xmm2
movss  0xea8(%rip),%xmm1
nopl   0x0(%rax)
xorps  %xmm3,%xmm3
cvtsi2ss %eax,%xmm3
movaps %xmm0,%xmm4
divss  %xmm3,%xmm4
addss  %xmm2,%xmm4
addss  %xmm1,%xmm0
lea    0x1(%rax),%ecx
xorps  %xmm3,%xmm3
cvtsi2ss %ecx,%xmm3
movaps %xmm0,%xmm2
divss  %xmm3,%xmm2
addss  %xmm4,%xmm2
addss  %xmm1,%xmm0
add    $0x2,%eax
cmp    $0x33,%eax
jne    1160 <main+0x30>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [96 x i8] c"Vamos calcular uma sequencia legal!\0A\0A(Sequencia do Tipo: 1/1 + 3/2 + 5/3 + 7/4 + ... + 99/50)\0A\0A\00"
@.str.1 = [16 x i8] c"A soma e: %.4f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %4
%6 = call i32 (...) @getch()
store float 1.000000e+00, float* %2
store float 1.000000e+00, float* %3
br label %7
7: ; preds = %18, %0
%8 = load float, float* %3
%9 = fcmp ole float %8, 5.000000e+01
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load float, float* %4
%12 = load float, float* %2
%13 = load float, float* %3
%14 = fdiv float %12, %13
%15 = fadd float %11, %14
store float %15, float* %4
%16 = load float, float* %2
%17 = fadd float %16, 2.000000e+00
store float %17, float* %2
br label %18
18: ; preds = %10
%19 = load float, float* %3
%20 = fadd float %19, 1.000000e+00
store float %20, float* %3
br label %7
21: ; preds = %7
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"A soma e: %.4f\0A\00"
@str = [95 x i8] c"Vamos calcular uma sequencia legal!\0A\0A(Sequencia do Tipo: 1/1 + 3/2 + 5/3 + 7/4 + ... + 99/50)\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([95 x i8], [95 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getch()
br label %3
3: ; preds = %3, %0
%4 = phi float [ 0.000000e+00, %0 ], [ %14, %3 ]
%5 = phi i32 [ 1, %0 ], [ %16, %3 ]
%6 = phi float [ 1.000000e+00, %0 ], [ %15, %3 ]
%7 = sitofp i32 %5 to float
%8 = fdiv float %6, %7
%9 = fadd float %4, %8
%10 = fadd float %6, 2.000000e+00
%11 = add nuw nsw i32 %5, 1
%12 = sitofp i32 %11 to float
%13 = fdiv float %10, %12
%14 = fadd float %9, %13
%15 = fadd float %10, 2.000000e+00
%16 = add nuw nsw i32 %5, 2
%17 = icmp eq i32 %16, 51
br i1 %17, label %18, label %3
18: ; preds = %3
%19 = fpext float %14 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %19)
%21 = tail call i32 (...) @getch()
ret i32 0
}