#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 */
scalar_t__ bwd_subs_d3(int, double *, double *, double *, double);
int /*<<< orphan*/ fwd_subs_d3(int, double *, double *);
scalar_t__ palu_d3(int, double *, double *, double *, double);
int d3(int n, double *a, double *b, double *c, double *f, double tol) {
  if (palu_d3(n, a, b, c, tol))
    return 1;
  fwd_subs_d3(n, c, f);
  if (bwd_subs_d3(n, a, b, f, tol))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<d3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
movsd  -0x30(%rbp),%xmm0
call   1050 <palu_d3@plt>
cmp    $0x0,%rax
je     117f <d3+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    11c5 <d3+0x95>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <fwd_subs_d3@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
movsd  -0x30(%rbp),%xmm0
call   1030 <bwd_subs_d3@plt>
cmp    $0x0,%rax
je     11be <d3+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    11c5 <d3+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d3>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,%ebp
movsd  %xmm0,0x8(%rsp)
call   1050 <palu_d3@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1190 <d3+0x60>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <fwd_subs_d3@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
movsd  0x8(%rsp),%xmm0
call   1030 <bwd_subs_d3@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @d3(i32 %0, double* %1, double* %2, double* %3, double* %4, double %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store double %5, double* %13
%14 = load i32, i32* %8
%15 = load double*, double** %9
%16 = load double*, double** %10
%17 = load double*, double** %11
%18 = load double, double* %13
%19 = call i64 @palu_d3(i32 %14, double* %15, double* %16, double* %17, double %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %6
store i32 1, i32* %7
br label %36
22: ; preds = %6
%23 = load i32, i32* %8
%24 = load double*, double** %11
%25 = load double*, double** %12
%26 = call i32 @fwd_subs_d3(i32 %23, double* %24, double* %25)
%27 = load i32, i32* %8
%28 = load double*, double** %9
%29 = load double*, double** %10
%30 = load double*, double** %12
%31 = load double, double* %13
%32 = call i64 @bwd_subs_d3(i32 %27, double* %28, double* %29, double* %30, double %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %22
store i32 1, i32* %7
br label %36
35: ; preds = %22
store i32 0, i32* %7
br label %36
36: ; preds = %35, %34, %21
%37 = load i32, i32* %7
ret i32 %37
}

LLVM IR (-O2):
define i32 @d3(i32 %0, double* %1, double* %2, double* %3, double* %4, double %5) {
%7 = tail call i64 @palu_d3(i32 %0, double* %1, double* %2, double* %3, double %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = tail call i32 @fwd_subs_d3(i32 %0, double* %3, double* %4)
%11 = tail call i64 @bwd_subs_d3(i32 %0, double* %1, double* %2, double* %4, double %5)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %9, %6
%15 = phi i32 [ 1, %6 ], [ %13, %9 ]
ret i32 %15
}