#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*/ assert(int);
int /*<<< orphan*/ biseccion(double, double, double);
int /*<<< orphan*/ f(double);
int /*<<< orphan*/ newton(double, double, double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sgn(int /*<<< orphan*/);
int main(void) {
  int op = 0;
  while (op != 3) {
    printf("\n*****************************************\n");
    printf("*  %sNumerical analysis - Finding roots%s   *\n", "\033[0;40;32m",
           "\033[0m");
    printf("*****************************************\n");
    printf("*            Enter an option            *\n");
    printf("*****************************************\n");
    printf("* %s1%s - Bisection method                  *\n", "\033[0;40;32m",
           "\033[0m");
    printf("* %s2%s - Newton method                     *\n", "\033[0;40;32m",
           "\033[0m");
    printf("* %s3%s - Exit                              *\n", "\033[0;40;32m",
           "\033[0m");
    printf("*****************************************\n");
    printf("\n");
    scanf("%d", &op);
    switch (op) {
    case 1: {
      double a = 0.00, b = 0.00, epsilon = 0.00;
      printf("Enter initial interval:\n");
      scanf("%lf", &a);
      scanf("%lf", &b);
      while (a >= b || sgn(f(a)) == sgn(f(b))) {
        printf("The entry is not a valid interval. ");
        printf("Please enter initial interval:\n");
        scanf("%lf", &a);
        scanf("%lf", &b);
      }
      printf("Enter admitted tolerance:\n");
      scanf("%lf", &epsilon);
      assert(a < b && sgn(f(a)) != sgn(f(b)));
      printf("The succession of approximations to the root are: ");
      biseccion(a, b, epsilon);
    } break;
    case 2: {
      int MAX_ITE = 0;
      double xnext = 0.00, epsilon = 0.00, r = 0;
      printf("Enter a positive number to calculate its root:\n");
      scanf("%lf", &r);
      while (r <= 0) {
        printf("Wrong entry. Please enter a positive number to calculate its "
               "cubic root:\n");
        scanf("%lf", &r);
      }
      assert(r > 0);
      printf("Enter an initial approximation of the root:\n");
      scanf("%lf", &xnext);
      printf("Enter the admitted tolerance:\n");
      scanf("%lf", &epsilon);
      printf("Enter the maximum number of iterations allowed:\n");
      scanf("%d", &MAX_ITE);
      newton(r, xnext, epsilon, MAX_ITE);
    } break;
    case 3: {
      printf("\n Exited successfully. \n");
    } break;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     153c <main+0x3cc>
lea    0xe69(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x45(%rbp)
call   1050 <printf@plt>
mov    -0x45(%rbp),%al
lea    0xe81(%rip),%rdi
lea    0xea9(%rip),%rsi
mov    %rsi,-0x60(%rbp)
lea    0xea9(%rip),%rdx
mov    %rdx,-0x58(%rbp)
call   1050 <printf@plt>
mov    -0x45(%rbp),%al
lea    0xe31(%rip),%rdi
mov    %rdi,-0x50(%rbp)
call   1050 <printf@plt>
mov    -0x45(%rbp),%al
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x45(%rbp),%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x45(%rbp),%al
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x45(%rbp),%al
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x45(%rbp),%al
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x45(%rbp),%al
call   1050 <printf@plt>
mov    -0x45(%rbp),%al
lea    0x1094(%rip),%rdi
call   1050 <printf@plt>
mov    -0x45(%rbp),%al
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x1,%eax
je     129d <main+0x12d>
jmp    127b <main+0x10b>
mov    -0x44(%rbp),%eax
sub    $0x2,%eax
je     1422 <main+0x2b2>
jmp    128c <main+0x11c>
mov    -0x44(%rbp),%eax
sub    $0x3,%eax
je     1529 <main+0x3b9>
jmp    1537 <main+0x3c7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xe63(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x61(%rbp)
jae    132e <main+0x1be>
movsd  -0x10(%rbp),%xmm0
call   1040 <f@plt>
mov    %eax,%edi
call   1090 <sgn@plt>
mov    %eax,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <f@plt>
mov    %eax,%edi
call   1090 <sgn@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    133e <main+0x1ce>
jmp    1383 <main+0x213>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdde(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xdcc(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
jmp    12e7 <main+0x177>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xda7(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x69(%rbp)
jbe    13ee <main+0x27e>
movsd  -0x10(%rbp),%xmm0
call   1040 <f@plt>
mov    %eax,%edi
call   1090 <sgn@plt>
mov    %eax,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <f@plt>
mov    %eax,%edi
call   1090 <sgn@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
cmp    %ecx,%eax
setne  %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <biseccion@plt>
jmp    1537 <main+0x3c7>
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xce9(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jb     1494 <main+0x324>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcbb(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
jmp    1461 <main+0x2f1>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc7d(%rip),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc5d(%rip),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xda7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc21(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
mov    -0x24(%rbp),%edi
call   1060 <newton@plt>
jmp    1537 <main+0x3c7>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1186 <main+0x16>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0x14(%rsp)
lea    0xf22(%rip),%rbp
lea    0x18(%rsp),%r14
mov    %rsp,%r13
jmp    1247 <main+0xb7>
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1090 <assert@plt>
lea    0xff0(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0x1003(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0x1008(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb8(%rip),%rdi
lea    0x24(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    0x24(%rsp),%edi
call   1080 <newton@plt>
mov    0x14(%rsp),%eax
cmp    $0x3,%eax
je     14e1 <main+0x351>
lea    0xedc(%rip),%rdi
call   1050 <puts@plt>
lea    0xda6(%rip),%rdi
lea    0xdce(%rip),%rbx
mov    %rbx,%rsi
lea    0xdcf(%rip),%r12
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xeaf(%rip),%r15
mov    %r15,%rdi
call   1050 <puts@plt>
lea    0xeca(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1050 <puts@plt>
lea    0xda0(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdbb(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdd6(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xddf(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    $0x3,%eax
je     14d0 <main+0x340>
cmp    $0x2,%eax
je     1440 <main+0x2b0>
cmp    $0x1,%eax
lea    0x8(%rsp),%r15
lea    0xdb5(%rip),%rbx
jne    123e <main+0xae>
movq   $0x0,0x18(%rsp)
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xf44(%rip),%rdi
jmp    1361 <main+0x1d1>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xf5a(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movsd  0x18(%rsp),%xmm0
ucomisd (%rsp),%xmm0
jae    1350 <main+0x1c0>
call   1060 <f@plt>
mov    %eax,%edi
call   10b0 <sgn@plt>
mov    %eax,%r12d
movsd  (%rsp),%xmm0
call   1060 <f@plt>
mov    %eax,%edi
call   10b0 <sgn@plt>
cmp    %eax,%r12d
je     1350 <main+0x1c0>
lea    0xee8(%rip),%rdi
call   1050 <puts@plt>
xor    %r12d,%r12d
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movsd  0x18(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1406 <main+0x276>
call   1060 <f@plt>
mov    %eax,%edi
call   10b0 <sgn@plt>
mov    %eax,%r12d
movsd  (%rsp),%xmm0
call   1060 <f@plt>
mov    %eax,%edi
call   10b0 <sgn@plt>
cmp    %eax,%r12d
setne  %r12b
movzbl %r12b,%edi
call   1090 <assert@plt>
lea    0xce1(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <biseccion@plt>
jmp    123a <main+0xaa>
nopl   0x0(%rax,%rax,1)
movl   $0x0,0x24(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xd2e(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
lea    0x8(%rsp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
lea    0xdab(%rip),%rbx
jb     11c0 <main+0x30>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm1
jae    14a0 <main+0x310>
jmp    11c0 <main+0x30>
nopw   0x0(%rax,%rax,1)
lea    0xca8(%rip),%rdi
call   1050 <puts@plt>
jmp    123a <main+0xaa>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0A*****************************************\0A\00"
@.str.1 = [47 x i8] c"* %sNumerical analysis - Finding roots%s *\0A\00"
@.str.2 = [11 x i8] c"\1B[0;40;32m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.4 = [43 x i8] c"*****************************************\0A\00"
@.str.5 = [43 x i8] c"* Enter an option *\0A\00"
@.str.6 = [47 x i8] c"* %s1%s - Bisection method *\0A\00"
@.str.7 = [47 x i8] c"* %s2%s - Newton method *\0A\00"
@.str.8 = [47 x i8] c"* %s3%s - Exit *\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [25 x i8] c"Enter initial interval:\0A\00"
@.str.12 = [4 x i8] c"%lf\00"
@.str.13 = [36 x i8] c"The entry is not a valid interval. \00"
@.str.14 = [32 x i8] c"Please enter initial interval:\0A\00"
@.str.15 = [27 x i8] c"Enter admitted tolerance:\0A\00"
@.str.16 = [51 x i8] c"The succession of approximations to the root are: \00"
@.str.17 = [48 x i8] c"Enter a positive number to calculate its root:\0A\00"
@.str.18 = [74 x i8] c"Wrong entry. Please enter a positive number to calculate its cubic root:\0A\00"
@.str.19 = [45 x i8] c"Enter an initial approximation of the root:\0A\00"
@.str.20 = [31 x i8] c"Enter the admitted tolerance:\0A\00"
@.str.21 = [49 x i8] c"Enter the maximum number of iterations allowed:\0A\00"
@.str.22 = [25 x i8] c"\0A Exited successfully. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
br label %10
10: ; preds = %99, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %100
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %2)
%25 = load i32, i32* %2
switch i32 %25, label %99 [
i32 1, label %26
i32 2, label %72
i32 3, label %97
]
26: ; preds = %13
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %3)
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %4)
br label %30
30: ; preds = %44, %26
%31 = load double, double* %3
%32 = load double, double* %4
%33 = fcmp oge double %31, %32
br i1 %33, label %42, label %34
34: ; preds = %30
%35 = load double, double* %3
%36 = call i32 @f(double %35)
%37 = call i32 @sgn(i32 %36)
%38 = load double, double* %4
%39 = call i32 @f(double %38)
%40 = call i32 @sgn(i32 %39)
%41 = icmp eq i32 %37, %40
br label %42
42: ; preds = %34, %30
%43 = phi i1 [ true, %30 ], [ %41, %34 ]
br i1 %43, label %44, label %49
44: ; preds = %42
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %3)
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %4)
br label %30
49: ; preds = %42
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0))
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %5)
%52 = load double, double* %3
%53 = load double, double* %4
%54 = fcmp olt double %52, %53
br i1 %54, label %55, label %63
55: ; preds = %49
%56 = load double, double* %3
%57 = call i32 @f(double %56)
%58 = call i32 @sgn(i32 %57)
%59 = load double, double* %4
%60 = call i32 @f(double %59)
%61 = call i32 @sgn(i32 %60)
%62 = icmp ne i32 %58, %61
br label %63
63: ; preds = %55, %49
%64 = phi i1 [ false, %49 ], [ %62, %55 ]
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
%68 = load double, double* %3
%69 = load double, double* %4
%70 = load double, double* %5
%71 = call i32 @biseccion(double %68, double %69, double %70)
br label %99
72: ; preds = %13
store i32 0, i32* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0))
%74 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %9)
br label %75
75: ; preds = %78, %72
%76 = load double, double* %9
%77 = fcmp ole double %76, 0.000000e+00
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.18, i64 0, i64 0))
%80 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %9)
br label %75
81: ; preds = %75
%82 = load double, double* %9
%83 = fcmp ogt double %82, 0.000000e+00
%84 = zext i1 %83 to i32
%85 = call i32 @assert(i32 %84)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.19, i64 0, i64 0))
%87 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %7)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0))
%89 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %8)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.21, i64 0, i64 0))
%91 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %6)
%92 = load double, double* %9
%93 = load double, double* %7
%94 = load double, double* %8
%95 = load i32, i32* %6
%96 = call i32 @newton(double %92, double %93, double %94, i32 %95)
br label %99
97: ; preds = %13
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.22, i64 0, i64 0))
br label %99
99: ; preds = %13, %97, %81, %63
br label %10
100: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [47 x i8] c"* %sNumerical analysis - Finding roots%s *\0A\00"
@.str.2 = [11 x i8] c"\1B[0;40;32m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@.str.6 = [47 x i8] c"* %s1%s - Bisection method *\0A\00"
@.str.7 = [47 x i8] c"* %s2%s - Newton method *\0A\00"
@.str.8 = [47 x i8] c"* %s3%s - Exit *\0A\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.12 = [4 x i8] c"%lf\00"
@.str.13 = [36 x i8] c"The entry is not a valid interval. \00"
@.str.16 = [51 x i8] c"The succession of approximations to the root are: \00"
@str = [43 x i8] c"\0A*****************************************\00"
@str.24 = [42 x i8] c"* Enter an option *\00"
@str.26 = [42 x i8] c"*****************************************\00"
@str.27 = [24 x i8] c"\0A Exited successfully. \00"
@str.28 = [47 x i8] c"Enter a positive number to calculate its root:\00"
@str.29 = [44 x i8] c"Enter an initial approximation of the root:\00"
@str.30 = [30 x i8] c"Enter the admitted tolerance:\00"
@str.31 = [48 x i8] c"Enter the maximum number of iterations allowed:\00"
@str.32 = [73 x i8] c"Wrong entry. Please enter a positive number to calculate its cubic root:\00"
@str.33 = [24 x i8] c"Enter initial interval:\00"
@str.34 = [26 x i8] c"Enter admitted tolerance:\00"
@str.35 = [31 x i8] c"Please enter initial interval:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%10 = bitcast i32* %5 to i8*
%11 = bitcast double* %6 to i8*
%12 = bitcast double* %7 to i8*
%13 = bitcast double* %8 to i8*
%14 = bitcast double* %2 to i8*
%15 = bitcast double* %3 to i8*
%16 = bitcast double* %4 to i8*
br label %17
17: ; preds = %0, %100
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.26, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.24, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.26, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.26, i64 0, i64 0))
%27 = call i32 @putchar(i32 10)
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
switch i32 %29, label %100 [
i32 1, label %30
i32 2, label %70
i32 3, label %96
]
30: ; preds = %17
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
br label %31
31: ; preds = %46, %30
%32 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @str.35, i64 0, i64 0), %46 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.33, i64 0, i64 0), %30 ]
%33 = call i32 @puts(i8* dereferenceable(1) %32)
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %2)
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %3)
%36 = load double, double* %2
%37 = load double, double* %3
%38 = fcmp ult double %36, %37
br i1 %38, label %39, label %46
39: ; preds = %31
%40 = call i32 @f(double %36)
%41 = call i32 @sgn(i32 %40)
%42 = load double, double* %3
%43 = call i32 @f(double %42)
%44 = call i32 @sgn(i32 %43)
%45 = icmp eq i32 %41, %44
br i1 %45, label %46, label %48
46: ; preds = %31, %39
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
br label %31
48: ; preds = %39
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.34, i64 0, i64 0))
%50 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %4)
%51 = load double, double* %2
%52 = load double, double* %3
%53 = fcmp olt double %51, %52
br i1 %53, label %54, label %61
54: ; preds = %48
%55 = call i32 @f(double %51)
%56 = call i32 @sgn(i32 %55)
%57 = load double, double* %3
%58 = call i32 @f(double %57)
%59 = call i32 @sgn(i32 %58)
%60 = icmp ne i32 %56, %59
br label %61
61: ; preds = %54, %48
%62 = phi i1 [ false, %48 ], [ %60, %54 ]
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
%66 = load double, double* %2
%67 = load double, double* %3
%68 = load double, double* %4
%69 = call i32 @biseccion(double %66, double %67, double %68)
br label %98
70: ; preds = %17
store i32 0, i32* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.28, i64 0, i64 0))
%72 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %8)
%73 = load double, double* %8
%74 = fcmp ugt double %73, 0.000000e+00
br i1 %74, label %80, label %75
75: ; preds = %70, %75
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.32, i64 0, i64 0))
%77 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %8)
%78 = load double, double* %8
%79 = fcmp ugt double %78, 0.000000e+00
br i1 %79, label %80, label %75
80: ; preds = %75, %70
%81 = phi double [ %73, %70 ], [ %78, %75 ]
%82 = fcmp ogt double %81, 0.000000e+00
%83 = zext i1 %82 to i32
%84 = call i32 @assert(i32 %83)
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.29, i64 0, i64 0))
%86 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %6)
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.30, i64 0, i64 0))
%88 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double* %7)
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.31, i64 0, i64 0))
%90 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %5)
%91 = load double, double* %8
%92 = load double, double* %6
%93 = load double, double* %7
%94 = load i32, i32* %5
%95 = call i32 @newton(double %91, double %92, double %93, i32 %94)
br label %98
96: ; preds = %17
%97 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.27, i64 0, i64 0))
br label %98
98: ; preds = %61, %80, %96
%99 = load i32, i32* %1
br label %100
100: ; preds = %98, %17
%101 = phi i32 [ %99, %98 ], [ %29, %17 ]
%102 = icmp eq i32 %101, 3
br i1 %102, label %103, label %17
103: ; preds = %100
ret i32 0
}