#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 */
float powf(int, int);
int /*<<< orphan*/ printf(char *, float);
int main(int argc, const char *argv[]) {
  float a, b, c;
  a = powf(10, 8);
  b = a * (-1);
  c = 1;
  printf("\nAttempt 1:\n(a + b) + c = %f", (a + b) + c);
  printf("\na + (b + c) = %f\n\n", a + (b + c));
  float x, result1, result2;
  x = powf(10, 8);
  result1 = (x * -1) + (x + 1);
  result2 = ((x * -1) + x) + 1;
  printf("\nAttempt 2:\n(a + b) + c = %f", result2);
  printf("\na + (b + c) = %f\n\n", result1);
  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)
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <powf@plt>
movss  %xmm0,-0x14(%rbp)
movss  0xeb2(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe9c(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
addss  -0x1c(%rbp),%xmm1
addss  %xmm1,%xmm0
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <powf@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  0xe3c(%rip),%xmm0
addss  -0x20(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xe18(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
lea    0xe3c(%rip),%rdi
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
lea    0xe17(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <powf@plt>
movss  %xmm0,0xc(%rsp)
subss  %xmm0,%xmm0
addss  0xeba(%rip),%xmm0
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
movss  0xea6(%rip),%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm1,%xmm0
addss  %xmm1,%xmm0
lea    0xeb2(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x8,%esi
call   1030 <powf@plt>
movaps %xmm0,%xmm2
movss  0xe6f(%rip),%xmm1
addss  %xmm1,%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,0xc(%rsp)
subss  %xmm0,%xmm0
addss  %xmm1,%xmm0
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\0AAttempt 1:\0A(a + b) + c = %f\00"
@.str.1 = [20 x i8] c"\0Aa + (b + c) = %f\0A\0A\00"
@.str.2 = [29 x i8] c"\0AAttempt 2:\0A(a + b) + c = %f\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
%12 = call float @powf(i32 10, i32 8)
store float %12, float* %6
%13 = load float, float* %6
%14 = fmul float %13, -1.000000e+00
store float %14, float* %7
store float 1.000000e+00, float* %8
%15 = load float, float* %6
%16 = load float, float* %7
%17 = fadd float %15, %16
%18 = load float, float* %8
%19 = fadd float %17, %18
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %19)
%21 = load float, float* %6
%22 = load float, float* %7
%23 = load float, float* %8
%24 = fadd float %22, %23
%25 = fadd float %21, %24
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %25)
%27 = call float @powf(i32 10, i32 8)
store float %27, float* %9
%28 = load float, float* %9
%29 = load float, float* %9
%30 = fadd float %29, 1.000000e+00
%31 = call float @llvm.fmuladd.f32(float %28, float -1.000000e+00, float %30)
store float %31, float* %10
%32 = load float, float* %9
%33 = load float, float* %9
%34 = call float @llvm.fmuladd.f32(float %32, float -1.000000e+00, float %33)
%35 = fadd float %34, 1.000000e+00
store float %35, float* %11
%36 = load float, float* %11
%37 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), float %36)
%38 = load float, float* %10
%39 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"\0AAttempt 1:\0A(a + b) + c = %f\00"
@.str.1 = [20 x i8] c"\0Aa + (b + c) = %f\0A\0A\00"
@.str.2 = [29 x i8] c"\0AAttempt 2:\0A(a + b) + c = %f\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call float @powf(i32 10, i32 8)
%4 = fsub float %3, %3
%5 = fadd float %4, 1.000000e+00
%6 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %5)
%7 = fsub float 1.000000e+00, %3
%8 = fadd float %3, %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %8)
%10 = tail call float @powf(i32 10, i32 8)
%11 = fadd float %10, 1.000000e+00
%12 = tail call float @llvm.fmuladd.f32(float %10, float -1.000000e+00, float %11)
%13 = tail call float @llvm.fmuladd.f32(float %10, float -1.000000e+00, float %10)
%14 = fadd float %13, 1.000000e+00
%15 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), float %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %12)
ret i32 0
}