#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 /*<<< orphan*/ drift_kepu_fchk(double, double, double, double, double,
                                   double, double *);
int /*<<< orphan*/ drift_kepu_guess(double, double, double, double, double,
                                    double *);
int /*<<< orphan*/ drift_kepu_lag(double *, double, double, double, double,
                                  double, double *, double *, double *,
                                  double *, int *);
int /*<<< orphan*/ drift_kepu_new(double *, double, double, double, double,
                                  double, double *, double *, double *,
                                  double *, int *);
scalar_t__ fabs(double);
void drift_kepu(double dt0, double r0, double mu, double alpha, double u,
                double *fp, double *c1, double *c2, double *c3, int *iflag) {
  double s, st;
  drift_kepu_guess(dt0, r0, mu, alpha, u, &s);
  st = s;
  drift_kepu_new(&s, dt0, r0, mu, alpha, u, fp, c1, c2, c3, iflag);
  if (*iflag != 0) {
    double fo, fn;
    drift_kepu_fchk(dt0, r0, mu, alpha, u, st, &fo);
    drift_kepu_fchk(dt0, r0, mu, alpha, u, s, &fn);
    if (fabs(fo) < fabs(fn)) {
      s = st;
    }
    drift_kepu_lag(&s, dt0, r0, mu, alpha, u, fp, c1, c2, c3, iflag);
  }
}


x86 assembly (clang, -O0):
<drift_kepu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
lea    -0x58(%rbp),%rdi
call   1070 <drift_kepu_guess@plt>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
lea    -0x58(%rbp),%rdi
call   1030 <drift_kepu_new@plt>
mov    -0x50(%rbp),%rax
cmpl   $0x0,(%rax)
je     12ad <drift_kepu+0x15d>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x60(%rbp),%xmm5
lea    -0x68(%rbp),%rdi
call   1050 <drift_kepu_fchk@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x58(%rbp),%xmm5
lea    -0x70(%rbp),%rdi
call   1050 <drift_kepu_fchk@plt>
movsd  -0x68(%rbp),%xmm0
call   1040 <fabs@plt>
mov    %rax,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1040 <fabs@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
cmp    %rcx,%rax
jge    1277 <drift_kepu+0x127>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x50(%rbp),%r9
lea    -0x58(%rbp),%rdi
call   1060 <drift_kepu_lag@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drift_kepu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,%rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
movsd  %xmm4,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0x28(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <drift_kepu_guess@plt>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %rbp,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1030 <drift_kepu_new@plt>
cmpl   $0x0,(%rbx)
je     129a <drift_kepu+0x14a>
lea    0x40(%rsp),%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
call   1050 <drift_kepu_fchk@plt>
movsd  0x28(%rsp),%xmm5
lea    0x38(%rsp),%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
call   1050 <drift_kepu_fchk@plt>
movsd  0x40(%rsp),%xmm0
call   1040 <fabs@plt>
mov    %rax,%rbp
movsd  0x38(%rsp),%xmm0
call   1040 <fabs@plt>
cmp    %rax,%rbp
jge    1264 <drift_kepu+0x114>
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
lea    0x28(%rsp),%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1060 <drift_kepu_lag@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @drift_kepu(double %0, double %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, i32* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca i32*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store double* %8, double** %19
store i32* %9, i32** %20
%25 = load double, double* %11
%26 = load double, double* %12
%27 = load double, double* %13
%28 = load double, double* %14
%29 = load double, double* %15
%30 = call i32 @drift_kepu_guess(double %25, double %26, double %27, double %28, double %29, double* %21)
%31 = load double, double* %21
store double %31, double* %22
%32 = load double, double* %11
%33 = load double, double* %12
%34 = load double, double* %13
%35 = load double, double* %14
%36 = load double, double* %15
%37 = load double*, double** %16
%38 = load double*, double** %17
%39 = load double*, double** %18
%40 = load double*, double** %19
%41 = load i32*, i32** %20
%42 = call i32 @drift_kepu_new(double* %21, double %32, double %33, double %34, double %35, double %36, double* %37, double* %38, double* %39, double* %40, i32* %41)
%43 = load i32*, i32** %20
%44 = load i32, i32* %43
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %80
46: ; preds = %10
%47 = load double, double* %11
%48 = load double, double* %12
%49 = load double, double* %13
%50 = load double, double* %14
%51 = load double, double* %15
%52 = load double, double* %22
%53 = call i32 @drift_kepu_fchk(double %47, double %48, double %49, double %50, double %51, double %52, double* %23)
%54 = load double, double* %11
%55 = load double, double* %12
%56 = load double, double* %13
%57 = load double, double* %14
%58 = load double, double* %15
%59 = load double, double* %21
%60 = call i32 @drift_kepu_fchk(double %54, double %55, double %56, double %57, double %58, double %59, double* %24)
%61 = load double, double* %23
%62 = call i64 @fabs(double %61)
%63 = load double, double* %24
%64 = call i64 @fabs(double %63)
%65 = icmp slt i64 %62, %64
br i1 %65, label %66, label %68
66: ; preds = %46
%67 = load double, double* %22
store double %67, double* %21
br label %68
68: ; preds = %66, %46
%69 = load double, double* %11
%70 = load double, double* %12
%71 = load double, double* %13
%72 = load double, double* %14
%73 = load double, double* %15
%74 = load double*, double** %16
%75 = load double*, double** %17
%76 = load double*, double** %18
%77 = load double*, double** %19
%78 = load i32*, i32** %20
%79 = call i32 @drift_kepu_lag(double* %21, double %69, double %70, double %71, double %72, double %73, double* %74, double* %75, double* %76, double* %77, i32* %78)
br label %80
80: ; preds = %68, %10
ret void
}

LLVM IR (-O2):
define void @drift_kepu(double %0, double %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, i32* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = bitcast double* %11 to i8*
%15 = call i32 @drift_kepu_guess(double %0, double %1, double %2, double %3, double %4, double* %11)
%16 = load double, double* %11
%17 = call i32 @drift_kepu_new(double* %11, double %0, double %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, i32* %9)
%18 = load i32, i32* %9
%19 = icmp eq i32 %18, 0
br i1 %19, label %34, label %20
20: ; preds = %10
%21 = bitcast double* %12 to i8*
%22 = bitcast double* %13 to i8*
%23 = call i32 @drift_kepu_fchk(double %0, double %1, double %2, double %3, double %4, double %16, double* %12)
%24 = load double, double* %11
%25 = call i32 @drift_kepu_fchk(double %0, double %1, double %2, double %3, double %4, double %24, double* %13)
%26 = load double, double* %12
%27 = call i64 @fabs(double %26)
%28 = load double, double* %13
%29 = call i64 @fabs(double %28)
%30 = icmp slt i64 %27, %29
br i1 %30, label %31, label %32
31: ; preds = %20
store double %16, double* %11
br label %32
32: ; preds = %31, %20
%33 = call i32 @drift_kepu_lag(double* %11, double %0, double %1, double %2, double %3, double %4, double* %5, double* %6, double* %7, double* %8, i32* %9)
br label %34
34: ; preds = %32, %10
ret void
}