#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*/ abs(int /*<<< orphan*/);
int /*<<< orphan*/ f(double);
double const fabs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, ...);
scalar_t__ sgn(int /*<<< orphan*/);
double biseccion(double a, double b, const double epsilon) {
  double c = 0.00;
  c = a + (b - a) / 2.00;
  if (sgn(f(a)) != sgn(f(c)))
    b = c;
  if (sgn(f(c)) != sgn(f(b)))
    a = c;
  if (fabs(f(c)) < epsilon) {
    printf("\nThe value of f(%lf) is %0.0lf\n", c, abs(f(c)));
    return c;
  } else {
    printf("%lf, ", c);
    return biseccion(a, b, epsilon);
  }
}


x86 assembly (clang, -O0):
<biseccion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xe6a(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1080 <sgn@plt>
mov    %rax,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1080 <sgn@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     11e3 <biseccion+0x83>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1080 <sgn@plt>
mov    %rax,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1080 <sgn@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     1223 <biseccion+0xc3>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1070 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1285 <biseccion+0x125>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <f@plt>
mov    %eax,%edi
call   1040 <abs@plt>
movsd  -0x40(%rbp),%xmm0
mov    %eax,%esi
lea    0xd99(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b1 <biseccion+0x151>
movsd  -0x28(%rbp),%xmm0
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <biseccion@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biseccion>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
lea    0xecc(%rip),%r14
jmp    1170 <biseccion+0x30>
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  %xmm0,%xmm1
mulsd  0xe78(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <f@plt>
mov    %eax,%edi
call   1060 <sgn@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%edi
call   1060 <sgn@plt>
movsd  (%rsp),%xmm0
cmp    %rax,%rbx
je     11c1 <biseccion+0x81>
movsd  %xmm0,0x8(%rsp)
call   1030 <f@plt>
mov    %eax,%edi
call   1060 <sgn@plt>
mov    %rax,%r15
movsd  0x8(%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%edi
call   1060 <sgn@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%edi
call   1050 <fabs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     121b <biseccion+0xdb>
cmp    %rbx,%r15
movsd  (%rsp),%xmm0
je     1160 <biseccion+0x20>
movsd  %xmm0,0x10(%rsp)
jmp    1160 <biseccion+0x20>
movsd  (%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%esi
neg    %esi
cmovs  %eax,%esi
lea    0xdd5(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"\0AThe value of f(%lf) is %0.0lf\0A\00"
@.str.1 = [6 x i8] c"%lf, \00"
define double @biseccion(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double 0.000000e+00, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fsub double %10, %11
%13 = fdiv double %12, 2.000000e+00
%14 = fadd double %9, %13
store double %14, double* %8
%15 = load double, double* %5
%16 = call i32 @f(double %15)
%17 = call i64 @sgn(i32 %16)
%18 = load double, double* %8
%19 = call i32 @f(double %18)
%20 = call i64 @sgn(i32 %19)
%21 = icmp ne i64 %17, %20
br i1 %21, label %22, label %24
22: ; preds = %3
%23 = load double, double* %8
store double %23, double* %6
br label %24
24: ; preds = %22, %3
%25 = load double, double* %8
%26 = call i32 @f(double %25)
%27 = call i64 @sgn(i32 %26)
%28 = load double, double* %6
%29 = call i32 @f(double %28)
%30 = call i64 @sgn(i32 %29)
%31 = icmp ne i64 %27, %30
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = load double, double* %8
store double %33, double* %5
br label %34
34: ; preds = %32, %24
%35 = load double, double* %8
%36 = call i32 @f(double %35)
%37 = call double @fabs(i32 %36)
%38 = load double, double* %7
%39 = fcmp olt double %37, %38
br i1 %39, label %40, label %47
40: ; preds = %34
%41 = load double, double* %8
%42 = load double, double* %8
%43 = call i32 @f(double %42)
%44 = call i32 @abs(i32 %43)
%45 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %41, i32 %44)
%46 = load double, double* %8
store double %46, double* %4
br label %54
47: ; preds = %34
%48 = load double, double* %8
%49 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %48)
%50 = load double, double* %5
%51 = load double, double* %6
%52 = load double, double* %7
%53 = call double @biseccion(double %50, double %51, double %52)
store double %53, double* %4
br label %54
54: ; preds = %47, %40
%55 = load double, double* %4
ret double %55
}

LLVM IR (-O2):
@.str = [32 x i8] c"\0AThe value of f(%lf) is %0.0lf\0A\00"
@.str.1 = [6 x i8] c"%lf, \00"
define double @biseccion(double %0, double %1, double %2) {
br label %4
4: ; preds = %27, %3
%5 = phi double [ %0, %3 ], [ %29, %27 ]
%6 = phi double [ %1, %3 ], [ %15, %27 ]
%7 = fsub double %6, %5
%8 = fmul double %7, 5.000000e-01
%9 = fadd double %5, %8
%10 = tail call i32 @f(double %5)
%11 = tail call i64 @sgn(i32 %10)
%12 = tail call i32 @f(double %9)
%13 = tail call i64 @sgn(i32 %12)
%14 = icmp eq i64 %11, %13
%15 = select i1 %14, double %6, double %9
%16 = tail call i32 @f(double %9)
%17 = tail call i64 @sgn(i32 %16)
%18 = tail call i32 @f(double %15)
%19 = tail call i64 @sgn(i32 %18)
%20 = tail call i32 @f(double %9)
%21 = tail call double @fabs(i32 %20)
%22 = fcmp olt double %21, %2
br i1 %22, label %23, label %27
23: ; preds = %4
%24 = tail call i32 @f(double %9)
%25 = tail call i32 @llvm.abs.i32(i32 %24, i1 true)
%26 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %9, i32 %25)
ret double %9
27: ; preds = %4
%28 = icmp eq i64 %17, %19
%29 = select i1 %28, double %5, double %9
%30 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %9)
br label %4
}