#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 f(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float);
int main() {
  float x;
  float n;
  printf("x=");
  scanf("%f", x);
  printf("n=");
  scanf("%f", n);
  printf("x=%f n=%f f=%f", x, n, ((f(x + n) - f(x)) / n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0x8(%rbp),%xmm0
lea    0xeb9(%rip),%rdi
call   1050 <scanf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
lea    0xe9a(%rip),%rdi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
call   1030 <f@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <f@plt>
movss  -0x24(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x18(%rbp),%xmm0
subss  %xmm3,%xmm2
divss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe29(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <scanf@plt>
call   1030 <f@plt>
call   1030 <f@plt>
lea    0xe99(%rip),%rdi
movsd  0xe83(%rip),%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"x=\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [3 x i8] c"n=\00"
@.str.3 = [15 x i8] c"x=%f n=%f f=%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = load float, float* %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%8 = load float, float* %3
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %8)
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fadd float %14, %15
%17 = call float @f(float %16)
%18 = load float, float* %2
%19 = call float @f(float %18)
%20 = fsub float %17, %19
%21 = load float, float* %3
%22 = fdiv float %20, %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %11, double %13, double %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"x=\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [3 x i8] c"n=\00"
@.str.3 = [15 x i8] c"x=%f n=%f f=%f\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float undef)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float undef)
%5 = tail call float @f(float undef)
%6 = tail call float @f(float undef)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double undef, double undef, double 0x7FF8000000000000)
ret i32 0
}