#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 *, ...);
float root(float, float);
int /*<<< orphan*/ scanf(char *, float *, float *);
void main() {
  float x1, x2, f1, f2, x;
  do {
    printf("input x1,x2:\n");
    scanf("%f,%f", &x1, &x2);
    f1 = f(x1);
    f2 = f(x2);
  } while (f1 * f2 >= 0);
  x = root(x1, x2);
  printf("A root of equation is %8.4f", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1060 <scanf@plt>
movss  -0x4(%rbp),%xmm0
call   1030 <f@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <f@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    1148 <main+0x8>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1050 <root@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec4(%rip),%r14
lea    0xe9b(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1070 <scanf@plt>
movss  0x10(%rsp),%xmm0
call   1040 <f@plt>
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <f@plt>
mulss  0x14(%rsp),%xmm0
ucomiss 0xe41(%rip),%xmm0
jae    1180 <main+0x30>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <root@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"input x1,x2:\0A\00"
@.str.1 = [6 x i8] c"%f,%f\00"
@.str.2 = [28 x i8] c"A root of equation is %8.4f\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
br label %6
6: ; preds = %13, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%9 = load float, float* %1
%10 = call float @f(float %9)
store float %10, float* %3
%11 = load float, float* %2
%12 = call float @f(float %11)
store float %12, float* %4
br label %13
13: ; preds = %6
%14 = load float, float* %3
%15 = load float, float* %4
%16 = fmul float %14, %15
%17 = fcmp oge float %16, 0.000000e+00
br i1 %17, label %6, label %18
18: ; preds = %13
%19 = load float, float* %1
%20 = load float, float* %2
%21 = call float @root(float %19, float %20)
store float %21, float* %5
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %23)
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%f,%f\00"
@.str.2 = [28 x i8] c"A root of equation is %8.4f\00"
@str = [13 x i8] c"input x1,x2:\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
%8 = load float, float* %1
%9 = call float @f(float %8)
%10 = load float, float* %2
%11 = call float @f(float %10)
%12 = fmul float %9, %11
%13 = fcmp ult float %12, 0.000000e+00
br i1 %13, label %14, label %5
14: ; preds = %5
%15 = load float, float* %1
%16 = load float, float* %2
%17 = call float @root(float %15, float %16)
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %18)
ret void
}