#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*/ f(double);
double findRootBetween(double, double);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sameSign(int /*<<< orphan*/, int /*<<< orphan*/);
int scanf(char *, double *, double *);
int main(void) {
  double x, y;
  int numbers;
  do {
    printf("%s", "Find a ROOT between two number: ");
    numbers = scanf("%lf%lf", &x, &y);
    if (numbers == 2 && !sameSign(f(x), f(y))) {
      double solution = findRootBetween(x, y);
      printf("\nThere is a root in %lf\n", solution);
    } else if (numbers == 2 && sameSign(f(x), f(y)))
      printf("\nf must have different signs in %lf and %lf\n", x, y);
    else if (numbers != 2)
      printf("\nBye\n\n");
  } while (numbers == 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1070 <scanf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    11ec <main+0x9c>
movsd  -0x10(%rbp),%xmm0
call   1030 <f@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <f@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%esi
call   1050 <sameSign@plt>
cmp    $0x0,%rax
jne    11ec <main+0x9c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1060 <findRootBetween@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe4b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1260 <main+0x110>
cmpl   $0x2,-0x1c(%rbp)
jne    123e <main+0xee>
movsd  -0x10(%rbp),%xmm0
call   1030 <f@plt>
mov    %eax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <f@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   1050 <sameSign@plt>
cmp    $0x0,%rax
je     123e <main+0xee>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe12(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    125b <main+0x10b>
cmpl   $0x2,-0x1c(%rbp)
je     1256 <main+0x106>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125b <main+0x10b>
jmp    1260 <main+0x110>
jmp    1265 <main+0x115>
cmpl   $0x2,-0x1c(%rbp)
je     115f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1080 <scanf@plt>
cmp    $0x2,%eax
jne    126a <main+0x10a>
lea    0xe5a(%rip),%r12
lea    0xe74(%rip),%r13
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%rbp
jmp    11fd <main+0x9d>
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm1
call   1070 <findRootBetween@plt>
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe20(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1080 <scanf@plt>
cmp    $0x2,%eax
jne    126a <main+0x10a>
movsd  0x10(%rsp),%xmm0
call   1040 <f@plt>
mov    %eax,%r14d
movsd  0x8(%rsp),%xmm0
call   1040 <f@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1060 <sameSign@plt>
movsd  0x10(%rsp),%xmm0
test   %rax,%rax
je     11c0 <main+0x60>
call   1040 <f@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1040 <f@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <sameSign@plt>
test   %rax,%rax
je     11d9 <main+0x79>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0xde6(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
jmp    11d9 <main+0x79>
lea    0xe00(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [33 x i8] c"Find a ROOT between two number: \00"
@.str.2 = [7 x i8] c"%lf%lf\00"
@.str.3 = [25 x i8] c"\0AThere is a root in %lf\0A\00"
@.str.4 = [45 x i8] c"\0Af must have different signs in %lf and %lf\0A\00"
@.str.5 = [7 x i8] c"\0ABye\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
br label %6
6: ; preds = %46, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double* %2, double* %3)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %24
11: ; preds = %6
%12 = load double, double* %2
%13 = call i32 @f(double %12)
%14 = load double, double* %3
%15 = call i32 @f(double %14)
%16 = call i64 @sameSign(i32 %13, i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %11
%19 = load double, double* %2
%20 = load double, double* %3
%21 = call double @findRootBetween(double %19, double %20)
store double %21, double* %5
%22 = load double, double* %5
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %22)
br label %45
24: ; preds = %11, %6
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load double, double* %2
%29 = call i32 @f(double %28)
%30 = load double, double* %3
%31 = call i32 @f(double %30)
%32 = call i64 @sameSign(i32 %29, i32 %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %27
%35 = load double, double* %2
%36 = load double, double* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %35, double %36)
br label %44
38: ; preds = %27, %24
%39 = load i32, i32* %4
%40 = icmp ne i32 %39, 2
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
br label %44
44: ; preds = %43, %34
br label %45
45: ; preds = %44, %18
br label %46
46: ; preds = %45
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 2
br i1 %48, label %6, label %49
49: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [33 x i8] c"Find a ROOT between two number: \00"
@.str.2 = [7 x i8] c"%lf%lf\00"
@.str.3 = [25 x i8] c"\0AThere is a root in %lf\0A\00"
@.str.4 = [45 x i8] c"\0Af must have different signs in %lf and %lf\0A\00"
@str = [6 x i8] c"\0ABye\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double* %1, double* %2)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %34
8: ; preds = %0, %30
%9 = load double, double* %1
%10 = call i32 @f(double %9)
%11 = load double, double* %2
%12 = call i32 @f(double %11)
%13 = call i64 @sameSign(i32 %10, i32 %12)
%14 = icmp eq i64 %13, 0
%15 = load double, double* %1
br i1 %14, label %16, label %20
16: ; preds = %8
%17 = load double, double* %2
%18 = call double @findRootBetween(double %15, double %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %18)
br label %30
20: ; preds = %8
%21 = call i32 @f(double %15)
%22 = load double, double* %2
%23 = call i32 @f(double %22)
%24 = call i64 @sameSign(i32 %21, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %20
%27 = load double, double* %1
%28 = load double, double* %2
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %27, double %28)
br label %30
30: ; preds = %20, %16, %26
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double* %1, double* %2)
%33 = icmp eq i32 %32, 2
br i1 %33, label %8, label %34
34: ; preds = %30, %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}