#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 fab(float);
float fang(float);
float fun(int m, int n) {
  float x1 = m, x2 = n,
        tmp = (x1 * fang(x2) - x2 * fang(x1)) / (fang(x2) - fang(x1));
  while (fab(fang(tmp)) > 1e-4) {
    if (fang(tmp) * fang(x1) > 0)
      x1 = tmp;
    else if (fang(tmp) * fang(x2) > 0)
      x2 = tmp;
    tmp = (x1 * fang(x2) - x2 * fang(x1)) / (fang(x2) - fang(x1));
  }
  return tmp;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <fang@plt>
movss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x20(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <fang@plt>
movss  -0x1c(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x18(%rbp),%xmm0
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <fang@plt>
call   1030 <fab@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe13(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    130c <fun+0x1ec>
movss  -0x14(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <fang@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1237 <fun+0x117>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1277 <fun+0x157>
movss  -0x14(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fang@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1272 <fun+0x152>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1277 <fun+0x157>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <fang@plt>
movss  -0x44(%rbp),%xmm1
movss  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x3c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <fang@plt>
movss  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x34(%rbp),%xmm0
subss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    11d2 <fun+0xb2>
movss  -0x14(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
sub    $0x18,%rsp
cvtsi2ss %edi,%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
jmp    1152 <fun+0x32>
nopw   0x0(%rax,%rax,1)
movss  0x8(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
call   1040 <fang@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <fang@plt>
movss  0x14(%rsp),%xmm2
mulss  %xmm2,%xmm0
movss  0x8(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movaps %xmm2,%xmm0
call   1040 <fang@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <fang@plt>
movss  0x10(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
call   1040 <fang@plt>
call   1030 <fab@plt>
test   %eax,%eax
jle    124b <fun+0x12b>
movss  0x8(%rsp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <fang@plt>
mulss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     1140 <fun+0x20>
movss  0x8(%rsp),%xmm0
call   1040 <fang@plt>
movss  %xmm0,0x10(%rsp)
movss  0x14(%rsp),%xmm0
call   1040 <fang@plt>
mulss  0x10(%rsp),%xmm0
ucomiss 0xdda(%rip),%xmm0
jbe    1240 <fun+0x120>
movss  0x8(%rsp),%xmm0
jmp    1152 <fun+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  0x14(%rsp),%xmm0
jmp    1152 <fun+0x32>
movss  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @fun(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
store float %9, float* %5
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
store float %11, float* %6
%12 = load float, float* %5
%13 = load float, float* %6
%14 = call float @fang(float %13)
%15 = load float, float* %6
%16 = load float, float* %5
%17 = call float @fang(float %16)
%18 = fmul float %15, %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %12, float %14, float %19)
%21 = load float, float* %6
%22 = call float @fang(float %21)
%23 = load float, float* %5
%24 = call float @fang(float %23)
%25 = fsub float %22, %24
%26 = fdiv float %20, %25
store float %26, float* %7
br label %27
27: ; preds = %52, %2
%28 = load float, float* %7
%29 = call float @fang(float %28)
%30 = call i32 @fab(float %29)
%31 = sitofp i32 %30 to double
%32 = fcmp ogt double %31, 1.000000e-04
br i1 %32, label %33, label %68
33: ; preds = %27
%34 = load float, float* %7
%35 = call float @fang(float %34)
%36 = load float, float* %5
%37 = call float @fang(float %36)
%38 = fmul float %35, %37
%39 = fcmp ogt float %38, 0.000000e+00
br i1 %39, label %40, label %42
40: ; preds = %33
%41 = load float, float* %7
store float %41, float* %5
br label %52
42: ; preds = %33
%43 = load float, float* %7
%44 = call float @fang(float %43)
%45 = load float, float* %6
%46 = call float @fang(float %45)
%47 = fmul float %44, %46
%48 = fcmp ogt float %47, 0.000000e+00
br i1 %48, label %49, label %51
49: ; preds = %42
%50 = load float, float* %7
store float %50, float* %6
br label %51
51: ; preds = %49, %42
br label %52
52: ; preds = %51, %40
%53 = load float, float* %5
%54 = load float, float* %6
%55 = call float @fang(float %54)
%56 = load float, float* %6
%57 = load float, float* %5
%58 = call float @fang(float %57)
%59 = fmul float %56, %58
%60 = fneg float %59
%61 = call float @llvm.fmuladd.f32(float %53, float %55, float %60)
%62 = load float, float* %6
%63 = call float @fang(float %62)
%64 = load float, float* %5
%65 = call float @fang(float %64)
%66 = fsub float %63, %65
%67 = fdiv float %61, %66
store float %67, float* %7
br label %27
68: ; preds = %27
%69 = load float, float* %7
ret float %69
}

LLVM IR (-O2):
define float @fun(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = tail call float @fang(float %4)
%6 = tail call float @fang(float %3)
%7 = fneg float %6
%8 = fmul float %4, %7
%9 = tail call float @llvm.fmuladd.f32(float %3, float %5, float %8)
%10 = tail call float @fang(float %4)
%11 = tail call float @fang(float %3)
%12 = fsub float %10, %11
%13 = fdiv float %9, %12
%14 = tail call float @fang(float %13)
%15 = tail call i32 @fab(float %14)
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %46
17: ; preds = %2, %31
%18 = phi float [ %42, %31 ], [ %13, %2 ]
%19 = phi float [ %33, %31 ], [ %4, %2 ]
%20 = phi float [ %32, %31 ], [ %3, %2 ]
%21 = tail call float @fang(float %18)
%22 = tail call float @fang(float %20)
%23 = fmul float %21, %22
%24 = fcmp ogt float %23, 0.000000e+00
br i1 %24, label %31, label %25
25: ; preds = %17
%26 = tail call float @fang(float %18)
%27 = tail call float @fang(float %19)
%28 = fmul float %26, %27
%29 = fcmp ogt float %28, 0.000000e+00
br i1 %29, label %30, label %31
30: ; preds = %25
br label %31
31: ; preds = %17, %25, %30
%32 = phi float [ %20, %30 ], [ %20, %25 ], [ %18, %17 ]
%33 = phi float [ %18, %30 ], [ %19, %25 ], [ %19, %17 ]
%34 = tail call float @fang(float %33)
%35 = tail call float @fang(float %32)
%36 = fneg float %33
%37 = fmul float %35, %36
%38 = tail call float @llvm.fmuladd.f32(float %32, float %34, float %37)
%39 = tail call float @fang(float %33)
%40 = tail call float @fang(float %32)
%41 = fsub float %39, %40
%42 = fdiv float %38, %41
%43 = tail call float @fang(float %42)
%44 = tail call i32 @fab(float %43)
%45 = icmp sgt i32 %44, 0
br i1 %45, label %17, label %46
46: ; preds = %31, %2
%47 = phi float [ %13, %2 ], [ %42, %31 ]
ret float %47
}