#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 */
double atan2(double, double);
double fabs(double);
double o(double x, double y, double (*f)(double, double), double i) {
  double r = f(x, y);
  return fabs(r) < 0.02
             ? (atan2(f(x, y + 1e-3) - r, f(x + 1e-3, y) - r) + 0.3) * 1.273 +
                   6.5
         : r < 0 ? i
                 : 0;
}


x86 assembly (clang, -O0):
<o>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   *%rax
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movaps 0xee4(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11dc <o+0xcc>
mov    -0x18(%rbp),%rax
movsd  -0x8(%rbp),%xmm0
movsd  0xead(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
call   *%rax
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe90(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  0xe62(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe46(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe42(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1210 <o+0x100>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11f9 <o+0xe9>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1206 <o+0xf6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1206 <o+0xf6>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<o>:
push   %rbx
sub    $0x30,%rsp
movaps %xmm2,0x10(%rsp)
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x8(%rsp)
call   *%rdi
movapd %xmm0,%xmm2
movapd 0xeca(%rip),%xmm0
andpd  %xmm2,%xmm0
movsd  0xece(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11b3 <o+0xa3>
movsd  0x8(%rsp),%xmm1
addsd  0xec2(%rip),%xmm1
movsd  (%rsp),%xmm0
movapd %xmm2,0x10(%rsp)
call   *%rbx
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
addsd  0xe9c(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   *%rbx
movapd %xmm0,%xmm1
subsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
call   1030 <atan2@plt>
addsd  0xe7f(%rip),%xmm0
mulsd  0xe7f(%rip),%xmm0
addsd  0xe7f(%rip),%xmm0
jmp    11c6 <o+0xb6>
xorpd  %xmm0,%xmm0
cmpltsd %xmm0,%xmm2
andpd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @o(double %0, double %1, double (double, double)* %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double (double, double)*
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double (double, double)* %2, double (double, double)** %7
store double %3, double* %8
%10 = load double (double, double)*, double (double, double)** %7
%11 = load double, double* %5
%12 = load double, double* %6
%13 = call double %10(double %11, double %12)
store double %13, double* %9
%14 = load double, double* %9
%15 = call double @llvm.fabs.f64(double %14)
%16 = fcmp olt double %15, 2.000000e-02
br i1 %16, label %17, label %35
17: ; preds = %4
%18 = load double (double, double)*, double (double, double)** %7
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fadd double %20, 1.000000e-03
%22 = call double %18(double %19, double %21)
%23 = load double, double* %9
%24 = fsub double %22, %23
%25 = load double (double, double)*, double (double, double)** %7
%26 = load double, double* %5
%27 = fadd double %26, 1.000000e-03
%28 = load double, double* %6
%29 = call double %25(double %27, double %28)
%30 = load double, double* %9
%31 = fsub double %29, %30
%32 = call double @atan2(double %24, double %31)
%33 = fadd double %32, 3.000000e-01
%34 = call double @llvm.fmuladd.f64(double %33, double 1.273000e+00, double 6.500000e+00)
br label %43
35: ; preds = %4
%36 = load double, double* %9
%37 = fcmp olt double %36, 0.000000e+00
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = load double, double* %8
br label %41
40: ; preds = %35
br label %41
41: ; preds = %40, %38
%42 = phi double [ %39, %38 ], [ 0.000000e+00, %40 ]
br label %43
43: ; preds = %41, %17
%44 = phi double [ %34, %17 ], [ %42, %41 ]
ret double %44
}

LLVM IR (-O2):
define double @o(double %0, double %1, double (double, double)* nocapture %2, double %3) {
%5 = tail call double %2(double %0, double %1)
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp olt double %6, 2.000000e-02
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = fadd double %1, 1.000000e-03
%10 = tail call double %2(double %0, double %9)
%11 = fsub double %10, %5
%12 = fadd double %0, 1.000000e-03
%13 = tail call double %2(double %12, double %1)
%14 = fsub double %13, %5
%15 = tail call double @atan2(double %11, double %14)
%16 = fadd double %15, 3.000000e-01
%17 = tail call double @llvm.fmuladd.f64(double %16, double 1.273000e+00, double 6.500000e+00)
br label %21
18: ; preds = %4
%19 = fcmp olt double %5, 0.000000e+00
%20 = select i1 %19, double %3, double 0.000000e+00
br label %21
21: ; preds = %18, %8
%22 = phi double [ %17, %8 ], [ %20, %18 ]
ret double %22
}