#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 *, double, double);
int /*<<< orphan*/ showfpstruc(double);
int main(int argc, char **argv) {
  int i;
  double f, sum, prod;
  f = 0.1;
  sum = 0.0;
  for (i = 0; i < 10; ++i)
    sum += f;
  prod = f * 10.0;
  printf("sum = %.20f, product = %.20f\n", sum, f * 10.0);
  showfpstruc(sum);
  showfpstruc(prod);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1179 <main+0x59>
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <main+0x32>
movsd  0xe87(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe70(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
call   1030 <showfpstruc@plt>
movsd  -0x30(%rbp),%xmm0
call   1030 <showfpstruc@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
call   1040 <printf@plt>
movsd  0xebb(%rip),%xmm0
call   1030 <showfpstruc@plt>
movsd  0xeb6(%rip),%xmm0
call   1030 <showfpstruc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"sum = %.20f, product = %.20f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e-01, double* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %6
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load double, double* %7
%15 = load double, double* %8
%16 = fadd double %15, %14
store double %16, double* %8
br label %17
17: ; preds = %13
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %10
20: ; preds = %10
%21 = load double, double* %7
%22 = fmul double %21, 1.000000e+01
store double %22, double* %9
%23 = load double, double* %8
%24 = load double, double* %7
%25 = fmul double %24, 1.000000e+01
%26 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double %23, double %25)
%27 = load double, double* %8
%28 = call i32 @showfpstruc(double %27)
%29 = load double, double* %9
%30 = call i32 @showfpstruc(double %29)
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [30 x i8] c"sum = %.20f, product = %.20f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 0x3FEFFFFFFFFFFFFF, double 1.000000e+00)
%4 = tail call i32 @showfpstruc(double 0x3FEFFFFFFFFFFFFF)
%5 = tail call i32 @showfpstruc(double 1.000000e+00)
ret i32 0
}