#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 main() {
  float sum = 0, num;
  for (int i = 1; i <= 100; i++) {
    sum += 1.0 / i;
  }
  printf("Sum of reciprocals: %f\n", sum);
  int m;
  sum = 0;
  printf("How many numbers? ");
  scanf("%d", &m);
  for (int j = 0; j < m; j++) {
    printf("Enter a number: ");
    scanf("%f", &num);
    sum += num;
  }
  printf("%f", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jg     117d <main+0x5d>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113e <main+0x1e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120c <main+0xec>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c3 <main+0xa3>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
xorpd  %xmm0,%xmm0
movsd  0xeca(%rip),%xmm1
mov    $0x2,%eax
movsd  0xec5(%rip),%xmm2
movapd %xmm1,%xmm3
nopw   0x0(%rax,%rax,1)
movapd %xmm1,%xmm4
divsd  %xmm3,%xmm4
addsd  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtsd2ss %xmm4,%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
movapd %xmm1,%xmm5
divsd  %xmm4,%xmm5
addsd  %xmm0,%xmm5
xorps  %xmm0,%xmm0
cvtsd2ss %xmm5,%xmm0
addsd  %xmm2,%xmm3
cvtss2sd %xmm0,%xmm0
add    $0x2,%eax
cmp    $0x66,%eax
jne    1150 <main+0x30>
lea    0xe78(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1218 <main+0xf8>
xorpd  %xmm0,%xmm0
lea    0xe6c(%rip),%r14
lea    0xe76(%rip),%r15
lea    0x14(%rsp),%rbx
xor    %ebp,%ebp
movss  %xmm0,0x10(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11e0 <main+0xc0>
cvtss2sd %xmm0,%xmm0
jmp    121c <main+0xfc>
xorpd  %xmm0,%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Sum of reciprocals: %f\0A\00"
@.str.1 = [19 x i8] c"How many numbers? \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"Enter a number: \00"
@.str.4 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store i32 1, i32* %4
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 100
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fdiv double 1.000000e+00, %12
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = fadd double %15, %13
%17 = fptrunc double %16 to float
store float %17, float* %2
br label %18
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %7
21: ; preds = %7
%22 = load float, float* %2
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %23)
store float 0.000000e+00, float* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
store i32 0, i32* %6
br label %27
27: ; preds = %37, %21
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %3)
%34 = load float, float* %3
%35 = load float, float* %2
%36 = fadd float %35, %34
store float %36, float* %2
br label %37
37: ; preds = %31
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %27
40: ; preds = %27
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Sum of reciprocals: %f\0A\00"
@.str.1 = [19 x i8] c"How many numbers? \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"Enter a number: \00"
@.str.4 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
br label %11
4: ; preds = %11
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %25)
%6 = bitcast i32* %2 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %32, label %29
11: ; preds = %11, %0
%12 = phi i32 [ 1, %0 ], [ %24, %11 ]
%13 = phi double [ 0.000000e+00, %0 ], [ %25, %11 ]
%14 = sitofp i32 %12 to double
%15 = fdiv double 1.000000e+00, %14
%16 = fadd double %13, %15
%17 = fptrunc double %16 to float
%18 = add nuw nsw i32 %12, 1
%19 = fpext float %17 to double
%20 = sitofp i32 %18 to double
%21 = fdiv double 1.000000e+00, %20
%22 = fadd double %21, %19
%23 = fptrunc double %22 to float
%24 = add nuw nsw i32 %12, 2
%25 = fpext float %23 to double
%26 = icmp eq i32 %24, 101
br i1 %26, label %4, label %11
27: ; preds = %32
%28 = fpext float %38 to double
br label %29
29: ; preds = %27, %4
%30 = phi double [ 0.000000e+00, %4 ], [ %28, %27 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %30)
ret i32 0
32: ; preds = %4, %32
%33 = phi i32 [ %39, %32 ], [ 0, %4 ]
%34 = phi float [ %38, %32 ], [ 0.000000e+00, %4 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %1)
%37 = load float, float* %1
%38 = fadd float %34, %37
%39 = add nuw nsw i32 %33, 1
%40 = load i32, i32* %2
%41 = icmp slt i32 %39, %40
br i1 %41, label %32, label %27
}