#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 nkep_drift3_pert(double, double, double *, double *, double);
void drift_shep_pert(double mu, double B2, double *r0, double *v0, double dt) {
  if (nkep_drift3_pert(mu, B2, r0, v0, dt) == -1) {
    drift_shep_pert(mu, B2, r0, v0, dt / 2);
    drift_shep_pert(mu, B2, r0, v0, dt / 2);
  }
}


x86 assembly (clang, -O0):
<drift_shep_pert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x28(%rbp),%xmm2
call   1040 <nkep_drift3_pert@plt>
cmp    $0xffffffff,%eax
jne    11b4 <drift_shep_pert+0x94>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x28(%rbp),%xmm2
movsd  0xe7d(%rip),%xmm3
divsd  %xmm3,%xmm2
call   1030 <drift_shep_pert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movsd  -0x28(%rbp),%xmm2
movsd  0xe55(%rip),%xmm3
divsd  %xmm3,%xmm2
call   1030 <drift_shep_pert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drift_shep_pert>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,(%rsp)
xchg   %ax,%ax
call   1040 <nkep_drift3_pert@plt>
cmp    $0xffffffff,%eax
jne    118c <drift_shep_pert+0x6c>
movsd  (%rsp),%xmm2
mulsd  0xea9(%rip),%xmm2
movsd  %xmm2,(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <drift_shep_pert@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm2
jmp    1140 <drift_shep_pert+0x20>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @drift_shep_pert(double %0, double %1, double* %2, double* %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
store double %4, double* %10
%11 = load double, double* %6
%12 = load double, double* %7
%13 = load double*, double** %8
%14 = load double*, double** %9
%15 = load double, double* %10
%16 = call i32 @nkep_drift3_pert(double %11, double %12, double* %13, double* %14, double %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %31
18: ; preds = %5
%19 = load double, double* %6
%20 = load double, double* %7
%21 = load double*, double** %8
%22 = load double*, double** %9
%23 = load double, double* %10
%24 = fdiv double %23, 2.000000e+00
%25 = load double, double* %6
%26 = load double, double* %7
%27 = load double*, double** %8
%28 = load double*, double** %9
%29 = load double, double* %10
%30 = fdiv double %29, 2.000000e+00
br label %31
31: ; preds = %18, %5
ret void
}

LLVM IR (-O2):
define void @drift_shep_pert(double %0, double %1, double* %2, double* %3, double %4) {
%6 = tail call i32 @nkep_drift3_pert(double %0, double %1, double* %2, double* %3, double %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %13
8: ; preds = %5, %8
%9 = phi double [ %10, %8 ], [ %4, %5 ]
%10 = fmul double %9, 5.000000e-01
tail call void @drift_shep_pert(double %0, double %1, double* %2, double* %3, double %10)
%11 = tail call i32 @nkep_drift3_pert(double %0, double %1, double* %2, double* %3, double %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %8, label %13
13: ; preds = %8, %5
ret void
}