#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*/ p();
double pow(double, float);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  float x = 0, y = 0;
  int iter = 0, flag = 0;
  x = 1.0;
  y = (0.5 * pow(2.7182818284590452353602874713527, x / 2));
  p();
  printf("Iter No.  Xo\t\tXi\t\tf(x)\t\tg'(x)\t\tXo-Xi\n");
  p();
  while (y - x <= -0.000001 || y - x >= 0.000001) {
    if (iter == 0)
      if ((0.25 * pow(2.7182818284590452353602874713527, x / 2)) < -1 ||
          (0.25 * pow(2.7182818284590452353602874713527, x / 2)) > 1) {
        printf("Diverges");
        flag = 1;
        break;
      }
    printf("%d\t%f\t%f\t%f\t%f\t%.5f\n", (++iter), x, y,
           pow(2.7182818284590452353602874713527, x) - 4 * x * x,
           (0.25 * pow(2.7182818284590452353602874713527, x / 2)), y - x);
    x = y;
    y = (0.5 * pow(2.7182818284590452353602874713527, x / 2));
  }
  p();
  if (flag != 1)
    printf("\nThe solution is %f\n", y);
  p();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  0xec1(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xe85(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe6d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <p@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <p@plt>
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    $0x1,%al
movsd  0xe3c(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    %al,-0x15(%rbp)
jae    1201 <main+0xd1>
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe21(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1211 <main+0xe1>
jmp    13ae <main+0x27e>
cmpl   $0x0,-0x10(%rbp)
jne    12b5 <main+0x185>
movss  -0x8(%rbp),%xmm1
movss  0xe10(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xdd4(%rip),%xmm0
call   1050 <pow@plt>
movsd  0xde7(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xdd3(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1296 <main+0x166>
movss  -0x8(%rbp),%xmm1
movss  0xdd4(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xd98(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xda8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xda4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12b0 <main+0x180>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    13ae <main+0x27e>
jmp    12b5 <main+0x185>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    %eax,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm1
movsd  0xd1e(%rip),%xmm0
call   1050 <pow@plt>
movss  0xd49(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm1
movss  0xd1d(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xce1(%rip),%xmm0
call   1050 <pow@plt>
mov    -0x34(%rbp),%esi
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x20(%rbp),%xmm0
movsd  0xcdf(%rip),%xmm3
mulsd  %xmm4,%xmm3
movss  -0xc(%rbp),%xmm4
subss  -0x8(%rbp),%xmm4
cvtss2sd %xmm4,%xmm4
lea    0xd11(%rip),%rdi
mov    $0x5,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
movss  0xcb8(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xc7c(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xc64(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11bc <main+0x8c>
mov    $0x0,%al
call   1030 <p@plt>
cmpl   $0x1,-0x14(%rbp)
je     13d6 <main+0x2a6>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcb9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <p@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movsd  0xeb1(%rip),%xmm0
movss  0xee1(%rip),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <p@plt>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <p@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe7e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm4
movss  0xea6(%rip),%xmm0
addss  %xmm4,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xe67(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    11bd <main+0x7d>
ucomisd 0xe61(%rip),%xmm1
jb     136c <main+0x22c>
movss  0xe7b(%rip),%xmm3
mov    $0x1,%ebx
lea    0xe80(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,0x30(%rsp)
movaps %xmm4,%xmm2
movaps %xmm3,%xmm0
mulss  0xe44(%rip),%xmm0
movss  %xmm0,0x14(%rsp)
cmp    $0x1,%ebx
movsd  0xdfb(%rip),%xmm1
movss  %xmm4,0x8(%rsp)
movss  %xmm3,0x18(%rsp)
jne    1279 <main+0x139>
movapd %xmm1,%xmm0
movss  0x14(%rsp),%xmm1
call   1060 <pow@plt>
mulsd  0xdf6(%rip),%xmm0
movsd  0xdf6(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0xdc2(%rip),%xmm0
ja     1393 <main+0x253>
movss  0x14(%rsp),%xmm1
call   1060 <pow@plt>
movsd  0xda9(%rip),%xmm1
movss  0x18(%rsp),%xmm3
movss  0x8(%rsp),%xmm2
mulsd  0xdb5(%rip),%xmm0
ucomisd 0xdbd(%rip),%xmm0
ja     1393 <main+0x253>
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
movsd  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
movaps %xmm3,%xmm1
call   1060 <pow@plt>
movss  0x18(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  0xd94(%rip),%xmm1
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xd36(%rip),%xmm0
movss  0x14(%rsp),%xmm1
call   1060 <pow@plt>
movapd %xmm0,%xmm3
mulsd  0xd3f(%rip),%xmm3
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x30(%rsp),%xmm4
mov    $0x5,%al
call   1050 <printf@plt>
movss  0x8(%rsp),%xmm1
mulss  0xd25(%rip),%xmm1
movsd  0xce5(%rip),%xmm0
call   1060 <pow@plt>
movss  0x8(%rsp),%xmm2
mulsd  0xcda(%rip),%xmm0
xorps  %xmm4,%xmm4
cvtsd2ss %xmm0,%xmm4
movaps %xmm4,%xmm0
subss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
add    $0x1,%ebx
movsd  0xcc2(%rip),%xmm0
ucomisd %xmm1,%xmm0
movaps %xmm2,%xmm3
jae    11e0 <main+0xa0>
ucomisd 0xcb5(%rip),%xmm1
movaps %xmm2,%xmm3
jae    11e0 <main+0xa0>
movss  %xmm4,0x8(%rsp)
xor    %eax,%eax
call   1040 <p@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcdc(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    13a8 <main+0x268>
lea    0xcae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <p@plt>
xor    %eax,%eax
call   1040 <p@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Iter No. Xo\09\09Xi\09\09f(x)\09\09g'(x)\09\09Xo-Xi\0A\00"
@.str.1 = [9 x i8] c"Diverges\00"
@.str.2 = [21 x i8] c"%d\09%f\09%f\09%f\09%f\09%.5f\0A\00"
@.str.3 = [21 x i8] c"\0AThe solution is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %4
store i32 0, i32* %5
store float 1.000000e+00, float* %2
%6 = load float, float* %2
%7 = fdiv float %6, 2.000000e+00
%8 = call double @pow(double 0x4005BF0A8B145769, float %7)
%9 = fmul double 5.000000e-01, %8
%10 = fptrunc double %9 to float
store float %10, float* %3
%11 = call i32 (...) @p()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @p()
br label %14
14: ; preds = %46, %0
%15 = load float, float* %3
%16 = load float, float* %2
%17 = fsub float %15, %16
%18 = fpext float %17 to double
%19 = fcmp ole double %18, 0xBEB0C6F7A0B5ED8D
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load float, float* %3
%22 = load float, float* %2
%23 = fsub float %21, %22
%24 = fpext float %23 to double
%25 = fcmp oge double %24, 0x3EB0C6F7A0B5ED8D
br label %26
26: ; preds = %20, %14
%27 = phi i1 [ true, %14 ], [ %25, %20 ]
br i1 %27, label %28, label %76
28: ; preds = %26
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %46
31: ; preds = %28
%32 = load float, float* %2
%33 = fdiv float %32, 2.000000e+00
%34 = call double @pow(double 0x4005BF0A8B145769, float %33)
%35 = fmul double 2.500000e-01, %34
%36 = fcmp olt double %35, -1.000000e+00
br i1 %36, label %43, label %37
37: ; preds = %31
%38 = load float, float* %2
%39 = fdiv float %38, 2.000000e+00
%40 = call double @pow(double 0x4005BF0A8B145769, float %39)
%41 = fmul double 2.500000e-01, %40
%42 = fcmp ogt double %41, 1.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %37, %31
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %76
45: ; preds = %37
br label %46
46: ; preds = %45, %28
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
%49 = load float, float* %2
%50 = fpext float %49 to double
%51 = load float, float* %3
%52 = fpext float %51 to double
%53 = load float, float* %2
%54 = call double @pow(double 0x4005BF0A8B145769, float %53)
%55 = load float, float* %2
%56 = fmul float 4.000000e+00, %55
%57 = load float, float* %2
%58 = fmul float %56, %57
%59 = fpext float %58 to double
%60 = fsub double %54, %59
%61 = load float, float* %2
%62 = fdiv float %61, 2.000000e+00
%63 = call double @pow(double 0x4005BF0A8B145769, float %62)
%64 = fmul double 2.500000e-01, %63
%65 = load float, float* %3
%66 = load float, float* %2
%67 = fsub float %65, %66
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %48, double %50, double %52, double %60, double %64, double %68)
%70 = load float, float* %3
store float %70, float* %2
%71 = load float, float* %2
%72 = fdiv float %71, 2.000000e+00
%73 = call double @pow(double 0x4005BF0A8B145769, float %72)
%74 = fmul double 5.000000e-01, %73
%75 = fptrunc double %74 to float
store float %75, float* %3
br label %14
76: ; preds = %43, %26
%77 = call i32 (...) @p()
%78 = load i32, i32* %5
%79 = icmp ne i32 %78, 1
br i1 %79, label %80, label %84
80: ; preds = %76
%81 = load float, float* %3
%82 = fpext float %81 to double
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %82)
br label %84
84: ; preds = %80, %76
%85 = call i32 (...) @p()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"Diverges\00"
@.str.2 = [21 x i8] c"%d\09%f\09%f\09%f\09%f\09%.5f\0A\00"
@.str.3 = [21 x i8] c"\0AThe solution is %f\0A\00"
@str = [37 x i8] c"Iter No. Xo\09\09Xi\09\09f(x)\09\09g'(x)\09\09Xo-Xi\00"
define i32 @main() {
%1 = tail call double @pow(double 0x4005BF0A8B145769, float 5.000000e-01)
%2 = tail call i32 (...) @p()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @p()
%5 = fmul double %1, 5.000000e-01
%6 = fptrunc double %5 to float
%7 = fadd float %6, -1.000000e+00
%8 = fpext float %7 to double
%9 = fcmp ugt double %8, 0xBEB0C6F7A0B5ED8D
%10 = fcmp ult double %8, 0x3EB0C6F7A0B5ED8D
%11 = and i1 %9, %10
br i1 %11, label %51, label %12
12: ; preds = %0, %30
%13 = phi double [ %47, %30 ], [ %8, %0 ]
%14 = phi float [ %45, %30 ], [ %6, %0 ]
%15 = phi i32 [ %31, %30 ], [ 0, %0 ]
%16 = phi float [ %14, %30 ], [ 1.000000e+00, %0 ]
%17 = icmp eq i32 %15, 0
%18 = fmul float %16, 5.000000e-01
br i1 %17, label %19, label %30
19: ; preds = %12
%20 = tail call double @pow(double 0x4005BF0A8B145769, float %18)
%21 = fmul double %20, 2.500000e-01
%22 = fcmp olt double %21, -1.000000e+00
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = tail call double @pow(double 0x4005BF0A8B145769, float %18)
%25 = fmul double %24, 2.500000e-01
%26 = fcmp ogt double %25, 1.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %23, %19
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%29 = tail call i32 (...) @p()
br label %56
30: ; preds = %12, %23
%31 = add nuw nsw i32 %15, 1
%32 = fpext float %16 to double
%33 = fpext float %14 to double
%34 = tail call double @pow(double 0x4005BF0A8B145769, float %16)
%35 = fmul float %16, 4.000000e+00
%36 = fmul float %16, %35
%37 = fpext float %36 to double
%38 = fsub double %34, %37
%39 = tail call double @pow(double 0x4005BF0A8B145769, float %18)
%40 = fmul double %39, 2.500000e-01
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %31, double %32, double %33, double %38, double %40, double %13)
%42 = fmul float %14, 5.000000e-01
%43 = tail call double @pow(double 0x4005BF0A8B145769, float %42)
%44 = fmul double %43, 5.000000e-01
%45 = fptrunc double %44 to float
%46 = fsub float %45, %14
%47 = fpext float %46 to double
%48 = fcmp ugt double %47, 0xBEB0C6F7A0B5ED8D
%49 = fcmp ult double %47, 0x3EB0C6F7A0B5ED8D
%50 = and i1 %48, %49
br i1 %50, label %51, label %12
51: ; preds = %30, %0
%52 = phi float [ %6, %0 ], [ %45, %30 ]
%53 = tail call i32 (...) @p()
%54 = fpext float %52 to double
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), double %54)
br label %56
56: ; preds = %27, %51
%57 = tail call i32 (...) @p()
ret i32 0
}