#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 *, int *);
int main(int argc, const char *argv[]) {
  int n;
  float h, i;
  h = 0;
  printf("Digite o valor de N\t");
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    h = h + (1 / i);
  }
  printf("O valor de H é: \t %.2f \n", h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xe9c(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
cvtsi2ssl -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11ae <main+0x8e>
movss  -0x18(%rbp),%xmm0
movss  0xe77(%rip),%xmm1
divss  -0x1c(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe61(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1169 <main+0x49>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    117a <main+0x5a>
cvtsi2ss %eax,%xmm1
xorps  %xmm0,%xmm0
movss  0xea9(%rip),%xmm2
movaps %xmm2,%xmm3
nopw   0x0(%rax,%rax,1)
movaps %xmm2,%xmm4
divss  %xmm3,%xmm4
addss  %xmm4,%xmm0
addss  %xmm2,%xmm3
ucomiss %xmm3,%xmm1
jae    1160 <main+0x40>
cvtss2sd %xmm0,%xmm0
jmp    117d <main+0x5d>
xorps  %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Digite o valor de N\09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"O valor de H \C3\A9: \09 %.2f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0.000000e+00, float* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store float 1.000000e+00, float* %8
br label %11
11: ; preds = %21, %2
%12 = load float, float* %8
%13 = load i32, i32* %6
%14 = sitofp i32 %13 to float
%15 = fcmp ole float %12, %14
br i1 %15, label %16, label %24
16: ; preds = %11
%17 = load float, float* %7
%18 = load float, float* %8
%19 = fdiv float 1.000000e+00, %18
%20 = fadd float %17, %19
store float %20, float* %7
br label %21
21: ; preds = %16
%22 = load float, float* %8
%23 = fadd float %22, 1.000000e+00
store float %23, float* %8
br label %11
24: ; preds = %11
%25 = load float, float* %7
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Digite o valor de N\09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"O valor de H \C3\A9: \09 %.2f \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = icmp slt i32 %7, 1
br i1 %9, label %19, label %10
10: ; preds = %2, %10
%11 = phi float [ %15, %10 ], [ 1.000000e+00, %2 ]
%12 = phi float [ %14, %10 ], [ 0.000000e+00, %2 ]
%13 = fdiv float 1.000000e+00, %11
%14 = fadd float %12, %13
%15 = fadd float %11, 1.000000e+00
%16 = fcmp ugt float %15, %8
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = fpext float %14 to double
br label %19
19: ; preds = %17, %2
%20 = phi double [ 0.000000e+00, %2 ], [ %18, %17 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}