#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 NewtonRaphson_call(double, double, double, double, double, double *);
int NewtonRaphson_put(double, double, double, double, double, double *);
int /*<<< orphan*/ assert(int);
int NewtonRaphson(int fCall, double S, double X, double T, double r, double cm,
                  double *piv) {
  assert(((S) == (S)) && (S) >= 0.000001 && (S) <= 1000000000000.0);
  assert(((X) == (X)) && (X) >= 0.000001 && (X) <= 1000000000000.0);
  assert(((T) == (T)) && (T) >= (1.0 / (253.0 * 24.0)) && (T) <= (20.0));
  assert(((r) == (r)) && (r) >= 0.0 && (r) <= 1000.0);
  if (fCall)
    return NewtonRaphson_call(S, X, T, r, cm, piv);
  else
    return NewtonRaphson_put(S, X, T, r, cm, piv);
}


x86 assembly (clang, -O0):
<NewtonRaphson>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x39(%rbp)
jne    11a2 <NewtonRaphson+0x72>
jp     11a2 <NewtonRaphson+0x72>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x39(%rbp)
jb     11a2 <NewtonRaphson+0x72>
movsd  0xe71(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x3a(%rbp)
jne    11f9 <NewtonRaphson+0xc9>
jp     11f9 <NewtonRaphson+0xc9>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
movsd  0xe27(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x3a(%rbp)
jb     11f9 <NewtonRaphson+0xc9>
movsd  0xe1a(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x3a(%rbp)
mov    -0x3a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x20(%rbp),%xmm0
mov    %al,-0x3b(%rbp)
jne    1250 <NewtonRaphson+0x120>
jp     1250 <NewtonRaphson+0x120>
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
movsd  0xde0(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x3b(%rbp)
jb     1250 <NewtonRaphson+0x120>
movsd  0xdd3(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
setae  %al
mov    %al,-0x3b(%rbp)
mov    -0x3b(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x28(%rbp),%xmm0
mov    %al,-0x3c(%rbp)
jne    12a2 <NewtonRaphson+0x172>
jp     12a2 <NewtonRaphson+0x172>
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x3c(%rbp)
jb     12a2 <NewtonRaphson+0x172>
movsd  0xd89(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
setae  %al
mov    %al,-0x3c(%rbp)
mov    -0x3c(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
je     12e3 <NewtonRaphson+0x1b3>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
mov    -0x38(%rbp),%rdi
call   1050 <NewtonRaphson_call@plt>
mov    %eax,-0x4(%rbp)
jmp    1308 <NewtonRaphson+0x1d8>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
mov    -0x38(%rbp),%rdi
call   1030 <NewtonRaphson_put@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NewtonRaphson>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
ucomisd %xmm0,%xmm0
setnp  %al
ucomisd 0xebb(%rip),%xmm0
setae  %cl
and    %al,%cl
movsd  0xeb6(%rip),%xmm5
movsd  %xmm0,0x20(%rsp)
ucomisd %xmm0,%xmm5
mov    %rsi,%rbx
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
mov    %edi,%ebp
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  (%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe67(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe62(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm1
setnp  %al
ucomisd 0xe44(%rip),%xmm1
setae  %cl
and    %al,%cl
movsd  0xe3f(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
movsd  0xe1d(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
test   %ebp,%ebp
je     1243 <NewtonRaphson+0x113>
movsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
mov    %rbx,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <NewtonRaphson_call@plt>
movsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
mov    %rbx,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <NewtonRaphson_put@plt>

LLVM IR (-O0):
define i32 @NewtonRaphson(i32 %0, double %1, double %2, double %3, double %4, double %5, double* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double*
store i32 %0, i32* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double* %6, double** %15
%16 = load double, double* %10
%17 = load double, double* %10
%18 = fcmp oeq double %16, %17
br i1 %18, label %19, label %25
19: ; preds = %7
%20 = load double, double* %10
%21 = fcmp oge double %20, 0x3EB0C6F7A0B5ED8D
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load double, double* %10
%24 = fcmp ole double %23, 1.000000e+12
br label %25
25: ; preds = %22, %19, %7
%26 = phi i1 [ false, %19 ], [ false, %7 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load double, double* %11
%30 = load double, double* %11
%31 = fcmp oeq double %29, %30
br i1 %31, label %32, label %38
32: ; preds = %25
%33 = load double, double* %11
%34 = fcmp oge double %33, 0x3EB0C6F7A0B5ED8D
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load double, double* %11
%37 = fcmp ole double %36, 1.000000e+12
br label %38
38: ; preds = %35, %32, %25
%39 = phi i1 [ false, %32 ], [ false, %25 ], [ %37, %35 ]
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load double, double* %12
%43 = load double, double* %12
%44 = fcmp oeq double %42, %43
br i1 %44, label %45, label %51
45: ; preds = %38
%46 = load double, double* %12
%47 = fcmp oge double %46, 0x3F2596179C29D2CE
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load double, double* %12
%50 = fcmp ole double %49, 2.000000e+01
br label %51
51: ; preds = %48, %45, %38
%52 = phi i1 [ false, %45 ], [ false, %38 ], [ %50, %48 ]
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load double, double* %13
%56 = load double, double* %13
%57 = fcmp oeq double %55, %56
br i1 %57, label %58, label %64
58: ; preds = %51
%59 = load double, double* %13
%60 = fcmp oge double %59, 0.000000e+00
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load double, double* %13
%63 = fcmp ole double %62, 1.000000e+03
br label %64
64: ; preds = %61, %58, %51
%65 = phi i1 [ false, %58 ], [ false, %51 ], [ %63, %61 ]
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i32, i32* %9
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %78
70: ; preds = %64
%71 = load double, double* %10
%72 = load double, double* %11
%73 = load double, double* %12
%74 = load double, double* %13
%75 = load double, double* %14
%76 = load double*, double** %15
%77 = call i32 @NewtonRaphson_call(double %71, double %72, double %73, double %74, double %75, double* %76)
store i32 %77, i32* %8
br label %86
78: ; preds = %64
%79 = load double, double* %10
%80 = load double, double* %11
%81 = load double, double* %12
%82 = load double, double* %13
%83 = load double, double* %14
%84 = load double*, double** %15
%85 = call i32 @NewtonRaphson_put(double %79, double %80, double %81, double %82, double %83, double* %84)
store i32 %85, i32* %8
br label %86
86: ; preds = %78, %70
%87 = load i32, i32* %8
ret i32 %87
}

LLVM IR (-O2):
define i32 @NewtonRaphson(i32 %0, double %1, double %2, double %3, double %4, double %5, double* %6) {
%8 = fcmp ord double %1, 0.000000e+00
%9 = fcmp oge double %1, 0x3EB0C6F7A0B5ED8D
%10 = and i1 %8, %9
%11 = fcmp ole double %1, 1.000000e+12
%12 = and i1 %11, %10
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = fcmp ord double %2, 0.000000e+00
%16 = fcmp oge double %2, 0x3EB0C6F7A0B5ED8D
%17 = and i1 %15, %16
%18 = fcmp ole double %2, 1.000000e+12
%19 = and i1 %18, %17
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = fcmp ord double %3, 0.000000e+00
%23 = fcmp oge double %3, 0x3F2596179C29D2CE
%24 = and i1 %22, %23
%25 = fcmp ole double %3, 2.000000e+01
%26 = and i1 %25, %24
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = fcmp oge double %4, 0.000000e+00
%30 = fcmp ole double %4, 1.000000e+03
%31 = and i1 %29, %30
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = icmp eq i32 %0, 0
br i1 %34, label %37, label %35
35: ; preds = %7
%36 = tail call i32 @NewtonRaphson_call(double %1, double %2, double %3, double %4, double %5, double* %6)
br label %39
37: ; preds = %7
%38 = tail call i32 @NewtonRaphson_put(double %1, double %2, double %3, double %4, double %5, double* %6)
br label %39
39: ; preds = %37, %35
%40 = phi i32 [ %36, %35 ], [ %38, %37 ]
ret i32 %40
}