#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 F(double);
double fabs(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double a, b, c, eps;
  printf("Введите 1-ую границу интервала: ");
  scanf("%lf", &a);
  printf("Введите 2-ую границу интервала: ");
  scanf("%lf", &b);
  eps = 0.0001;
  do {
    c = (a + b) / 2;
    if (F(c) * F(a) < 0)
      a = c;
    else
      b = c;
  } while (fabs(a - b) >= eps);
  printf("Минимум функции на заданном интервале = %lf\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf06(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <F@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <F@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
cmp    $0x0,%eax
jge    11da <main+0xaa>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e4 <main+0xb4>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e9 <main+0xb9>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe16(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x28(%rbp),%xmm0
jae    1188 <main+0x58>
movsd  -0x20(%rbp),%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf10(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
jmp    11b0 <main+0x80>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
movapd %xmm0,%xmm3
movapd %xmm1,%xmm2
subsd  %xmm3,%xmm2
andpd  0xe6a(%rip),%xmm2
ucomisd 0xe5a(%rip),%xmm2
jb     11f7 <main+0xc7>
addsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
mulsd  0xe40(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <F@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1030 <F@plt>
imul   %ebx,%eax
test   %eax,%eax
jns    1180 <main+0x50>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm3
movapd %xmm0,%xmm1
jmp    1196 <main+0x66>
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 1-\D1\83\D1\8E \D0\B3\D1\80\D0\B0\D0\BD\D0\B8\D1\86\D1\83 \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B0: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [58 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 2-\D1\83\D1\8E \D0\B3\D1\80\D0\B0\D0\BD\D0\B8\D1\86\D1\83 \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B0: \00"
@.str.3 = [78 x i8] c"\D0\9C\D0\B8\D0\BD\D0\B8\D0\BC\D1\83\D0\BC \D1\84\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D0\B8 \D0\BD\D0\B0 \D0\B7\D0\B0\D0\B4\D0\B0\D0\BD\D0\BD\D0\BE\D0\BC \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B5 = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
store double 1.000000e-04, double* %5
br label %10
10: ; preds = %26, %0
%11 = load double, double* %2
%12 = load double, double* %3
%13 = fadd double %11, %12
%14 = fdiv double %13, 2.000000e+00
store double %14, double* %4
%15 = load double, double* %4
%16 = call i32 @F(double %15)
%17 = load double, double* %2
%18 = call i32 @F(double %17)
%19 = mul nsw i32 %16, %18
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %10
%22 = load double, double* %4
store double %22, double* %2
br label %25
23: ; preds = %10
%24 = load double, double* %4
store double %24, double* %3
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25
%27 = load double, double* %2
%28 = load double, double* %3
%29 = fsub double %27, %28
%30 = call double @llvm.fabs.f64(double %29)
%31 = load double, double* %5
%32 = fcmp oge double %30, %31
br i1 %32, label %10, label %33
33: ; preds = %26
%34 = load double, double* %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0), double %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 1-\D1\83\D1\8E \D0\B3\D1\80\D0\B0\D0\BD\D0\B8\D1\86\D1\83 \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B0: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [58 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 2-\D1\83\D1\8E \D0\B3\D1\80\D0\B0\D0\BD\D0\B8\D1\86\D1\83 \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B0: \00"
@.str.3 = [78 x i8] c"\D0\9C\D0\B8\D0\BD\D0\B8\D0\BC\D1\83\D0\BC \D1\84\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D0\B8 \D0\BD\D0\B0 \D0\B7\D0\B0\D0\B4\D0\B0\D0\BD\D0\BD\D0\BE\D0\BC \D0\B8\D0\BD\D1\82\D0\B5\D1\80\D0\B2\D0\B0\D0\BB\D0\B5 = %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%9 = load double, double* %1
%10 = load double, double* %2
br label %11
11: ; preds = %25, %0
%12 = phi double [ %26, %25 ], [ %10, %0 ]
%13 = phi double [ %27, %25 ], [ %9, %0 ]
%14 = fadd double %13, %12
%15 = fmul double %14, 5.000000e-01
%16 = call i32 @F(double %15)
%17 = load double, double* %1
%18 = call i32 @F(double %17)
%19 = mul nsw i32 %18, %16
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %11
store double %15, double* %1
%22 = load double, double* %2
br label %25
23: ; preds = %11
store double %15, double* %2
%24 = load double, double* %1
br label %25
25: ; preds = %21, %23
%26 = phi double [ %22, %21 ], [ %15, %23 ]
%27 = phi double [ %15, %21 ], [ %24, %23 ]
%28 = fsub double %27, %26
%29 = call double @llvm.fabs.f64(double %28)
%30 = fcmp ult double %29, 1.000000e-04
br i1 %30, label %31, label %11
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0), double %15)
ret i32 0
}