int main(void) {
  float value1 = 0.0F;
  float value2 = 0.0F;
  float value3 = 0.0F;
  printf("Enter two floating-point values separated by blanks: ");
  scanf("%f %f", &value1, &value2);
  printf("\nvalue1 addr is %d, value2 addr is %d", &value1, &value2);
  value3 = average(value1, value2);
  printf("\nThe average is : %f\n", value3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1040 <average@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1040 <average@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Enter two floating-point values separated by blanks: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [38 x i8] c"\0Avalue1 addr is %d, value2 addr is %d\00"
@.str.3 = [22 x i8] c"\0AThe average is : %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), float* %2, float* %3)
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = call i32 (double, double, ...) bitcast (i32 (...)* @average to i32 (double, double, ...)*)(double %9, double %11)
%13 = sitofp i32 %12 to float
store float %13, float* %4
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"Enter two floating-point values separated by blanks: \00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [38 x i8] c"\0Avalue1 addr is %d, value2 addr is %d\00"
@.str.3 = [22 x i8] c"\0AThe average is : %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), float* %1, float* %2)
%8 = load float, float* %1
%9 = fpext float %8 to double
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = call i32 (double, double, ...) bitcast (i32 (...)* @average to i32 (double, double, ...)*)(double %9, double %11)
%13 = sitofp i32 %12 to float
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %14)
ret i32 0
}