#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 EXIT_SUCCESS;
int /*<<< orphan*/ checkInput(double *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double n, sum = 0;
  printf("Enter number: ");
  checkInput(&n);
  int i;
  for (i = 0; i < n; i++) {
    double number;
    checkInput(&number);
    sum += number;
  }
  printf("%.1lf", sum);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <checkInput@plt>
movl   $0x0,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    118f <main+0x6f>
lea    -0x28(%rbp),%rdi
call   1040 <checkInput@plt>
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <main+0x35>
movsd  -0x18(%rbp),%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
call   1040 <checkInput@plt>
movsd  (%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jbe    118f <main+0x6f>
xorpd  %xmm0,%xmm0
mov    $0x1,%ebp
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <checkInput@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtsi2sd %ebp,%xmm2
movsd  (%rsp),%xmm1
add    $0x1,%ebp
ucomisd %xmm2,%xmm1
ja     1160 <main+0x40>
lea    0xe79(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"Enter number: \00"
@.str.1 = [6 x i8] c"%.1lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @checkInput(double* %1)
%6 = load double, double* %1
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %20
8: ; preds = %0
%9 = bitcast double* %2 to i8*
br label %10
10: ; preds = %8, %10
%11 = phi i32 [ 0, %8 ], [ %16, %10 ]
%12 = phi double [ 0.000000e+00, %8 ], [ %15, %10 ]
%13 = call i32 @checkInput(double* %2)
%14 = load double, double* %2
%15 = fadd double %12, %14
%16 = add nuw nsw i32 %11, 1
%17 = sitofp i32 %16 to double
%18 = load double, double* %1
%19 = fcmp ogt double %18, %17
br i1 %19, label %10, label %20
20: ; preds = %10, %0
%21 = phi double [ 0.000000e+00, %0 ], [ %15, %10 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}