#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, ...);
void part2() {
  float f = 0.1F;
  float sum = 0;
  int i;
  for (i = 0; i < 10; i++) {
    sum = sum + f;
  }
  printf("\nPart 2 -- f is %e,  sum is %e\n", f, sum);
  printf("Part 2B?  sum == 1.0F IS false (%d)\n", sum == 1.0F);
}


x86 assembly (clang, -O0):
<part2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    115b <part2+0x4b>
movss  -0x8(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <part2+0x24>
cvttss2si -0x4(%rbp),%esi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe80(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<part2>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
xor    %esi,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"\0APart 2 -- f is %e, sum is %e\0A\00"
@.str.1 = [37 x i8] c"Part 2B? sum == 1.0F IS false (%d)\0A\00"
define void @part2() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
store float 0x3FB99999A0000000, float* %1
store float 0.000000e+00, float* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load float, float* %2
%9 = load float, float* %1
%10 = fadd float %8, %9
store float %10, float* %2
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load float, float* %1
%16 = fptosi float %15 to i32
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %16, double %18)
%20 = load float, float* %2
%21 = fcmp oeq float %20, 1.000000e+00
%22 = zext i1 %21 to i32
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %22)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"\0APart 2 -- f is %e, sum is %e\0A\00"
@.str.1 = [37 x i8] c"Part 2B? sum == 1.0F IS false (%d)\0A\00"
define void @part2() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 0, double 0x3FF0000020000000)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}