#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
float cos(float);
double fabs(float);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float, float, int,
                           float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *);
float sin(float);
int main(void) {
  FILE *fp = fopen("bisSearch.txt", "w");
  float a = 0, b = 0, mid = 0;
  int count = 0;
  do {
    printf("\nEnter values of lower limit and upper limit respectively.\n");
    scanf("%f %f", &a, &b);
    if ((a * sin(a) + cos(a)) * (b * sin(b) + cos(b)) > 0) {
      printf("f(%f) = %f;\nf(%f) = %f\n", a, (a * sin(a) + cos(a)), b,
             (b * sin(b) + cos(b)));
      printf("There is no root possible within the two points provided. Please "
             "try again.\n");
    }
  } while ((a * sin(a) + cos(a)) * (b * sin(b) + cos(b)) > 0);
  printf("       a\t|	f(a)\t|       b\t|	f(b)\t|   m=(a+b)/2\t|     "
         "f(m)\t|\n");
  printf("---------------------------------------------------------------------"
         "----------------------------\n");
  do {
    mid = (a + b) * 0.5;
    printf("%11f\t|%11f\t|%11f\t|%11f\t|%11f\t|%12f\t|\n", a,
           (a * sin(a) + cos(a)), b, (b * sin(b) + cos(b)), mid,
           (mid * sin(mid) + cos(mid)));
    fprintf(fp, "%f %f p%d\n%f 0\n\n", mid, (mid * sin(mid) + cos(mid)), count,
            mid);
    if ((mid * sin(mid) + cos(mid)) < 0.0000005 &&
        (mid * sin(mid) + cos(mid)) > -0.0000005)
      break;
    else if ((mid * sin(mid) + cos(mid)) * (a * sin(a) + cos(a)) > 0)
      a = mid;
    else
      b = mid;
    count++;
  } while (fabs(a - b) > 0.0000005);
  mid = (a + b) * 0.5;
  printf("\n\tThe root is: %f\n", mid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8f(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1070 <scanf@plt>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x14(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x34(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x2c(%rbp),%xmm1
movss  -0x28(%rbp),%xmm3
movaps %xmm0,%xmm2
movss  -0x24(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1328 <main+0x1b8>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x60(%rbp)
movss  -0x14(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x5c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x54(%rbp)
movss  -0x18(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x58(%rbp),%xmm3
movss  -0x54(%rbp),%xmm5
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm4
movsd  -0x40(%rbp),%xmm0
mulss  %xmm5,%xmm3
addss  %xmm4,%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd57(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xd61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    132d <main+0x1bd>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x74(%rbp)
movss  -0x14(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x74(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x70(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x68(%rbp)
movss  -0x18(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x6c(%rbp),%xmm1
movss  -0x68(%rbp),%xmm3
movaps %xmm0,%xmm2
movss  -0x64(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     11b8 <main+0x48>
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc1f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xcc(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xd0(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xd0(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movss  -0xcc(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc4(%rbp)
ff
movss  -0x18(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xc8(%rbp)
ff
movss  -0x18(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xc8(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movss  -0xc4(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0xc0(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xbc(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xc0(%rbp),%xmm5
ff
movss  -0xbc(%rbp),%xmm7
ff
movsd  -0xb8(%rbp),%xmm1
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0xa8(%rbp),%xmm3
ff
movsd  -0xa0(%rbp),%xmm4
ff
movaps %xmm0,%xmm6
movsd  -0x98(%rbp),%xmm0
ff
mulss  %xmm7,%xmm5
addss  %xmm6,%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xc2f(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x8c(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x90(%rbp),%xmm1
ff
movss  -0x8c(%rbp),%xmm3
ff
mov    -0x88(%rbp),%rdi
movaps %xmm0,%xmm2
movss  -0x80(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mov    -0x20(%rbp),%edx
movss  -0x1c(%rbp),%xmm2
lea    0xbda(%rip),%rsi
call   1050 <fprintf@plt>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0x7c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0x7c(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x78(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0x9fc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    166d <main+0x4fd>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0xd4(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xd8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xd8(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movss  -0xd4(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x9b2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    166d <main+0x4fd>
jmp    175d <main+0x5ed>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0xe8(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xec(%rbp)
ff
movss  -0x1c(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xec(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movss  -0xe8(%rbp),%xmm0
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xdc(%rbp)
ff
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xe4(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1060 <sin@plt>
movss  %xmm0,-0xe0(%rbp)
ff
movss  -0x14(%rbp),%xmm0
call   1080 <cos@plt>
movss  -0xe4(%rbp),%xmm1
ff
movss  -0xe0(%rbp),%xmm3
ff
movaps %xmm0,%xmm2
movss  -0xdc(%rbp),%xmm0
ff
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1724 <main+0x5b4>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    172e <main+0x5be>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1733 <main+0x5c3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
call   1040 <fabs@plt>
movsd  0x8ad(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     13d3 <main+0x263>
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x895(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xa16(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe83(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xed5(%rip),%r14
lea    0xe66(%rip),%r15
lea    0x10(%rsp),%rbp
lea    0x14(%rsp),%rbx
lea    0xf96(%rip),%r13
jmp    125d <main+0xdd>
nopl   0x0(%rax,%rax,1)
movss  0x10(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x8(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x20(%rsp)
movss  0x14(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x20(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
mulss  0x8(%rsp),%xmm1
ucomiss 0xdad(%rip),%xmm1
jbe    13b2 <main+0x232>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1080 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x8(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x20(%rsp)
movss  0x14(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x20(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
mulss  0x8(%rsp),%xmm1
ucomiss 0xd1a(%rip),%xmm1
jbe    11e0 <main+0x60>
movss  0x10(%rsp),%xmm1
movss  %xmm1,0x18(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x20(%rsp)
movss  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x20(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x14(%rsp),%xmm1
movss  %xmm1,0x28(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movaps %xmm1,%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x30(%rsp)
movss  0x14(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x30(%rsp),%xmm1
mulss  0x28(%rsp),%xmm1
addss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm3
lea    0xca2(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    $0x4,%al
call   1040 <printf@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    11e0 <main+0x60>
lea    0xd12(%rip),%rdi
call   1030 <puts@plt>
lea    0xd42(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
lea    0xc73(%rip),%r14
lea    0xc92(%rip),%r15
jmp    141b <main+0x29b>
nopl   0x0(%rax)
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movaps %xmm0,%xmm2
movss  0x10(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x8(%rsp),%xmm0
subss  %xmm2,%xmm0
add    $0x1,%ebp
call   1050 <fabs@plt>
ucomisd 0xbf3(%rip),%xmm0
jbe    1686 <main+0x506>
movss  0x10(%rsp),%xmm1
movss  %xmm1,0x20(%rsp)
movss  0x14(%rsp),%xmm0
addss  %xmm1,%xmm0
mulss  0xbc7(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
movaps %xmm1,%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x28(%rsp)
movss  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x28(%rsp),%xmm1
mulss  0x20(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movss  0x14(%rsp),%xmm1
movss  %xmm1,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
movaps %xmm1,%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x38(%rsp)
movss  0x14(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x38(%rsp),%xmm1
mulss  0x30(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x44(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x44(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm5
mov    %r14,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x38(%rsp),%xmm4
mov    $0x6,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x8(%rsp),%xmm2
movss  0x18(%rsp),%xmm1
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    %r12,%rdi
mov    %r15,%rsi
movaps %xmm2,%xmm0
mov    %ebp,%edx
call   1060 <fprintf@plt>
movss  0x8(%rsp),%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x18(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xa57(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    15f8 <main+0x478>
movss  0x8(%rsp),%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x18(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
ucomisd 0xa1e(%rip),%xmm0
ja     1686 <main+0x506>
movss  0x8(%rsp),%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x18(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x18(%rsp)
movss  0x10(%rsp),%xmm0
movss  %xmm0,0x20(%rsp)
call   1070 <sin@plt>
movss  %xmm0,0x28(%rsp)
movss  0x10(%rsp),%xmm0
call   1090 <cos@plt>
movss  0x28(%rsp),%xmm1
mulss  0x20(%rsp),%xmm1
addss  %xmm0,%xmm1
mulss  0x18(%rsp),%xmm1
ucomiss 0x99b(%rip),%xmm1
jbe    13e0 <main+0x260>
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x14(%rsp),%xmm2
jmp    13fb <main+0x27b>
movss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
mulss  0x966(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x9d8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"bisSearch.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [60 x i8] c"\0AEnter values of lower limit and upper limit respectively.\0A\00"
@.str.3 = [6 x i8] c"%f %f\00"
@.str.4 = [24 x i8] c"f(%f) = %f;\0Af(%f) = %f\0A\00"
@.str.5 = [77 x i8] c"There is no root possible within the two points provided. Please try again.\0A\00"
@.str.6 = [61 x i8] c" a\09|\09f(a)\09| b\09|\09f(b)\09| m=(a+b)/2\09| f(m)\09|\0A\00"
@.str.7 = [99 x i8] c"-------------------------------------------------------------------------------------------------\0A\00"
@.str.8 = [38 x i8] c"%11f\09|%11f\09|%11f\09|%11f\09|%11f\09|%12f\09|\0A\00"
@.str.9 = [17 x i8] c"%f %f p%d\0A%f 0\0A\0A\00"
@.str.10 = [19 x i8] c"\0A\09The root is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store i32 0, i32* %6
br label %8
8: ; preds = %47, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), float* %3, float* %4)
%11 = load float, float* %3
%12 = load float, float* %3
%13 = call float @sin(float %12)
%14 = load float, float* %3
%15 = call float @cos(float %14)
%16 = call float @llvm.fmuladd.f32(float %11, float %13, float %15)
%17 = load float, float* %4
%18 = load float, float* %4
%19 = call float @sin(float %18)
%20 = load float, float* %4
%21 = call float @cos(float %20)
%22 = call float @llvm.fmuladd.f32(float %17, float %19, float %21)
%23 = fmul float %16, %22
%24 = fcmp ogt float %23, 0.000000e+00
br i1 %24, label %25, label %46
25: ; preds = %8
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = load float, float* %3
%29 = load float, float* %3
%30 = call float @sin(float %29)
%31 = load float, float* %3
%32 = call float @cos(float %31)
%33 = call float @llvm.fmuladd.f32(float %28, float %30, float %32)
%34 = fpext float %33 to double
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = load float, float* %4
%38 = load float, float* %4
%39 = call float @sin(float %38)
%40 = load float, float* %4
%41 = call float @cos(float %40)
%42 = call float @llvm.fmuladd.f32(float %37, float %39, float %41)
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %27, double %34, double %36, double %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %25, %8
br label %47
47: ; preds = %46
%48 = load float, float* %3
%49 = load float, float* %3
%50 = call float @sin(float %49)
%51 = load float, float* %3
%52 = call float @cos(float %51)
%53 = call float @llvm.fmuladd.f32(float %48, float %50, float %52)
%54 = load float, float* %4
%55 = load float, float* %4
%56 = call float @sin(float %55)
%57 = load float, float* %4
%58 = call float @cos(float %57)
%59 = call float @llvm.fmuladd.f32(float %54, float %56, float %58)
%60 = fmul float %53, %59
%61 = fcmp ogt float %60, 0.000000e+00
br i1 %61, label %8, label %62
62: ; preds = %47
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.7, i64 0, i64 0))
br label %65
65: ; preds = %152, %62
%66 = load float, float* %3
%67 = load float, float* %4
%68 = fadd float %66, %67
%69 = fpext float %68 to double
%70 = fmul double %69, 5.000000e-01
%71 = fptrunc double %70 to float
store float %71, float* %5
%72 = load float, float* %3
%73 = fpext float %72 to double
%74 = load float, float* %3
%75 = load float, float* %3
%76 = call float @sin(float %75)
%77 = load float, float* %3
%78 = call float @cos(float %77)
%79 = call float @llvm.fmuladd.f32(float %74, float %76, float %78)
%80 = fpext float %79 to double
%81 = load float, float* %4
%82 = fpext float %81 to double
%83 = load float, float* %4
%84 = load float, float* %4
%85 = call float @sin(float %84)
%86 = load float, float* %4
%87 = call float @cos(float %86)
%88 = call float @llvm.fmuladd.f32(float %83, float %85, float %87)
%89 = fpext float %88 to double
%90 = load float, float* %5
%91 = fpext float %90 to double
%92 = load float, float* %5
%93 = load float, float* %5
%94 = call float @sin(float %93)
%95 = load float, float* %5
%96 = call float @cos(float %95)
%97 = call float @llvm.fmuladd.f32(float %92, float %94, float %96)
%98 = fpext float %97 to double
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), double %73, double %80, double %82, double %89, double %91, double %98)
%100 = load i32*, i32** %2
%101 = load float, float* %5
%102 = load float, float* %5
%103 = load float, float* %5
%104 = call float @sin(float %103)
%105 = load float, float* %5
%106 = call float @cos(float %105)
%107 = call float @llvm.fmuladd.f32(float %102, float %104, float %106)
%108 = load i32, i32* %6
%109 = load float, float* %5
%110 = call i32 @fprintf(i32* %100, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), float %101, float %107, i32 %108, float %109)
%111 = load float, float* %5
%112 = load float, float* %5
%113 = call float @sin(float %112)
%114 = load float, float* %5
%115 = call float @cos(float %114)
%116 = call float @llvm.fmuladd.f32(float %111, float %113, float %115)
%117 = fpext float %116 to double
%118 = fcmp olt double %117, 5.000000e-07
br i1 %118, label %119, label %129
119: ; preds = %65
%120 = load float, float* %5
%121 = load float, float* %5
%122 = call float @sin(float %121)
%123 = load float, float* %5
%124 = call float @cos(float %123)
%125 = call float @llvm.fmuladd.f32(float %120, float %122, float %124)
%126 = fpext float %125 to double
%127 = fcmp ogt double %126, -5.000000e-07
br i1 %127, label %128, label %129
128: ; preds = %119
br label %158
129: ; preds = %119, %65
%130 = load float, float* %5
%131 = load float, float* %5
%132 = call float @sin(float %131)
%133 = load float, float* %5
%134 = call float @cos(float %133)
%135 = call float @llvm.fmuladd.f32(float %130, float %132, float %134)
%136 = load float, float* %3
%137 = load float, float* %3
%138 = call float @sin(float %137)
%139 = load float, float* %3
%140 = call float @cos(float %139)
%141 = call float @llvm.fmuladd.f32(float %136, float %138, float %140)
%142 = fmul float %135, %141
%143 = fcmp ogt float %142, 0.000000e+00
br i1 %143, label %144, label %146
144: ; preds = %129
%145 = load float, float* %5
store float %145, float* %3
br label %148
146: ; preds = %129
%147 = load float, float* %5
store float %147, float* %4
br label %148
148: ; preds = %146, %144
br label %149
149: ; preds = %148
%150 = load i32, i32* %6
%151 = add nsw i32 %150, 1
store i32 %151, i32* %6
br label %152
152: ; preds = %149
%153 = load float, float* %3
%154 = load float, float* %4
%155 = fsub float %153, %154
%156 = call double @fabs(float %155)
%157 = fcmp ogt double %156, 5.000000e-07
br i1 %157, label %65, label %158
158: ; preds = %152, %128
%159 = load float, float* %3
%160 = load float, float* %4
%161 = fadd float %159, %160
%162 = fpext float %161 to double
%163 = fmul double %162, 5.000000e-01
%164 = fptrunc double %163 to float
store float %164, float* %5
%165 = load float, float* %5
%166 = fpext float %165 to double
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %166)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"bisSearch.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [6 x i8] c"%f %f\00"
@.str.4 = [24 x i8] c"f(%f) = %f;\0Af(%f) = %f\0A\00"
@.str.8 = [38 x i8] c"%11f\09|%11f\09|%11f\09|%11f\09|%11f\09|%12f\09|\0A\00"
@.str.9 = [17 x i8] c"%f %f p%d\0A%f 0\0A\0A\00"
@.str.10 = [19 x i8] c"\0A\09The root is: %f\0A\00"
@str = [59 x i8] c"\0AEnter values of lower limit and upper limit respectively.\00"
@str.11 = [60 x i8] c" a\09|\09f(a)\09| b\09|\09f(b)\09| m=(a+b)/2\09| f(m)\09|\00"
@str.12 = [98 x i8] c"-------------------------------------------------------------------------------------------------\00"
@str.13 = [76 x i8] c"There is no root possible within the two points provided. Please try again.\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%5 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
br label %6
6: ; preds = %38, %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), float* %1, float* %2)
%9 = load float, float* %1
%10 = call float @sin(float %9)
%11 = load float, float* %1
%12 = call float @cos(float %11)
%13 = call float @llvm.fmuladd.f32(float %9, float %10, float %12)
%14 = load float, float* %2
%15 = call float @sin(float %14)
%16 = load float, float* %2
%17 = call float @cos(float %16)
%18 = call float @llvm.fmuladd.f32(float %14, float %15, float %17)
%19 = fmul float %13, %18
%20 = fcmp ogt float %19, 0.000000e+00
br i1 %20, label %21, label %38
21: ; preds = %6
%22 = load float, float* %1
%23 = fpext float %22 to double
%24 = call float @sin(float %22)
%25 = load float, float* %1
%26 = call float @cos(float %25)
%27 = call float @llvm.fmuladd.f32(float %22, float %24, float %26)
%28 = fpext float %27 to double
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = call float @sin(float %29)
%32 = load float, float* %2
%33 = call float @cos(float %32)
%34 = call float @llvm.fmuladd.f32(float %29, float %31, float %33)
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), double %23, double %28, double %30, double %35)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.13, i64 0, i64 0))
br label %38
38: ; preds = %6, %21
%39 = load float, float* %1
%40 = call float @sin(float %39)
%41 = load float, float* %1
%42 = call float @cos(float %41)
%43 = call float @llvm.fmuladd.f32(float %39, float %40, float %42)
%44 = load float, float* %2
%45 = call float @sin(float %44)
%46 = load float, float* %2
%47 = call float @cos(float %46)
%48 = call float @llvm.fmuladd.f32(float %44, float %45, float %47)
%49 = fmul float %43, %48
%50 = fcmp ogt float %49, 0.000000e+00
br i1 %50, label %6, label %51
51: ; preds = %38
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.11, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str.12, i64 0, i64 0))
br label %54
54: ; preds = %109, %51
%55 = phi i32 [ 0, %51 ], [ %112, %109 ]
%56 = load float, float* %1
%57 = load float, float* %2
%58 = fadd float %56, %57
%59 = fmul float %58, 5.000000e-01
%60 = fpext float %56 to double
%61 = call float @sin(float %56)
%62 = load float, float* %1
%63 = call float @cos(float %62)
%64 = call float @llvm.fmuladd.f32(float %56, float %61, float %63)
%65 = fpext float %64 to double
%66 = load float, float* %2
%67 = fpext float %66 to double
%68 = call float @sin(float %66)
%69 = load float, float* %2
%70 = call float @cos(float %69)
%71 = call float @llvm.fmuladd.f32(float %66, float %68, float %70)
%72 = fpext float %71 to double
%73 = fpext float %59 to double
%74 = call float @sin(float %59)
%75 = call float @cos(float %59)
%76 = call float @llvm.fmuladd.f32(float %59, float %74, float %75)
%77 = fpext float %76 to double
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), double %60, double %65, double %67, double %72, double %73, double %77)
%79 = call float @sin(float %59)
%80 = call float @cos(float %59)
%81 = call float @llvm.fmuladd.f32(float %59, float %79, float %80)
%82 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), float %59, float %81, i32 %55, float %59)
%83 = call float @sin(float %59)
%84 = call float @cos(float %59)
%85 = call float @llvm.fmuladd.f32(float %59, float %83, float %84)
%86 = fpext float %85 to double
%87 = fcmp olt double %86, 5.000000e-07
br i1 %87, label %88, label %94
88: ; preds = %54
%89 = call float @sin(float %59)
%90 = call float @cos(float %59)
%91 = call float @llvm.fmuladd.f32(float %59, float %89, float %90)
%92 = fpext float %91 to double
%93 = fcmp ogt double %92, -5.000000e-07
br i1 %93, label %116, label %94
94: ; preds = %88, %54
%95 = call float @sin(float %59)
%96 = call float @cos(float %59)
%97 = call float @llvm.fmuladd.f32(float %59, float %95, float %96)
%98 = load float, float* %1
%99 = call float @sin(float %98)
%100 = load float, float* %1
%101 = call float @cos(float %100)
%102 = call float @llvm.fmuladd.f32(float %98, float %99, float %101)
%103 = fmul float %97, %102
%104 = fcmp ogt float %103, 0.000000e+00
br i1 %104, label %105, label %107
105: ; preds = %94
store float %59, float* %1
%106 = load float, float* %2
br label %109
107: ; preds = %94
store float %59, float* %2
%108 = load float, float* %1
br label %109
109: ; preds = %105, %107
%110 = phi float [ %106, %105 ], [ %59, %107 ]
%111 = phi float [ %59, %105 ], [ %108, %107 ]
%112 = add nuw nsw i32 %55, 1
%113 = fsub float %111, %110
%114 = call double @fabs(float %113)
%115 = fcmp ogt double %114, 5.000000e-07
br i1 %115, label %54, label %116
116: ; preds = %88, %109
%117 = load float, float* %1
%118 = load float, float* %2
%119 = fadd float %117, %118
%120 = fmul float %119, 5.000000e-01
%121 = fpext float %120 to double
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %121)
ret i32 0
}