#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 */
typedef float int64_t;

/* Variables and functions */
float FLT_EPSILON;
int /*<<< orphan*/ printf(char *, float, ...);
int main(int argc, char *argv[]) {
  float f32a = 10000.0, f32b = 0.00001;
  printf("a = %f b = %f\n", f32a, f32b);
  int64_t i64a = (double)f32a / (double)FLT_EPSILON;
  int64_t i64b = (double)f32b / (double)FLT_EPSILON;
  int64_t i64c = i64a + i64b;
  float f32c = i64c * FLT_EPSILON;
  printf("sum = %f (should be %f)\n", f32c, f32a + f32b);
  printf("x=%x\n", 1.0f);
  return 0;
}


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)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeb7(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x2e74(%rip),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x2e4f(%rip),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
mov    0x2e1f(%rip),%rax
mulss  (%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
addss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe37(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
movss  0xe06(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf18(%rip),%rdi
movss  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
movss  (%rax),%xmm1
movaps %xmm1,%xmm0
shufps $0x0,%xmm1,%xmm0
movaps 0xed8(%rip),%xmm2
divps  %xmm0,%xmm2
movaps %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm0
addss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
lea    0xede(%rip),%rdi
movsd  0xea7(%rip),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
movss  0xe85(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"a = %f b = %f\0A\00"
@FLT_EPSILON = global float 0.000000e+00
@.str.1 = [25 x i8] c"sum = %f (should be %f)\0A\00"
@.str.2 = [6 x i8] c"x=%x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 1.000000e+04, float* %6
store float 0x3EE4F8B580000000, float* %7
%12 = load float, float* %6
%13 = load float, float* %7
%14 = fpext float %13 to double
%15 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), float %12, double %14)
%16 = load float, float* %6
%17 = fpext float %16 to double
%18 = load float, float* @FLT_EPSILON
%19 = fpext float %18 to double
%20 = fdiv double %17, %19
%21 = fptrunc double %20 to float
store float %21, float* %8
%22 = load float, float* %7
%23 = fpext float %22 to double
%24 = load float, float* @FLT_EPSILON
%25 = fpext float %24 to double
%26 = fdiv double %23, %25
%27 = fptrunc double %26 to float
store float %27, float* %9
%28 = load float, float* %8
%29 = load float, float* %9
%30 = fadd float %28, %29
store float %30, float* %10
%31 = load float, float* %10
%32 = load float, float* @FLT_EPSILON
%33 = fmul float %31, %32
store float %33, float* %11
%34 = load float, float* %11
%35 = load float, float* %6
%36 = load float, float* %7
%37 = fadd float %35, %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), float %34, double %38)
%40 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float 1.000000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"a = %f b = %f\0A\00"
@FLT_EPSILON = global float 0.000000e+00
@.str.1 = [25 x i8] c"sum = %f (should be %f)\0A\00"
@.str.2 = [6 x i8] c"x=%x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), float 1.000000e+04, double 0x3EE4F8B580000000)
%4 = load float, float* @FLT_EPSILON
%5 = insertelement <2 x float> poison, float %4, i64 0
%6 = shufflevector <2 x float> %5, <2 x float> poison, <2 x i32> zeroinitializer
%7 = fdiv <2 x float> <float 1.000000e+04, float 0x3EE4F8B580000000>, %6
%8 = shufflevector <2 x float> %7, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%9 = fadd <2 x float> %7, %8
%10 = extractelement <2 x float> %9, i64 0
%11 = fmul float %4, %10
%12 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), float %11, double 1.000000e+04)
%13 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), float 1.000000e+00)
ret i32 0
}