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


x86 assembly (clang, -O0):
<drift_shep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x20(%rbp),%xmm1
call   1040 <nkep_drift3@plt>
cmp    $0xffffffff,%eax
jne    11a0 <drift_shep+0x80>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x20(%rbp),%xmm1
movsd  0xe8c(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1030 <drift_shep@plt>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  -0x20(%rbp),%xmm1
movsd  0xe69(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1030 <drift_shep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drift_shep>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
nopl   0x0(%rax)
call   1040 <nkep_drift3@plt>
cmp    $0xffffffff,%eax
jne    1183 <drift_shep+0x63>
movsd  0x8(%rsp),%xmm1
mulsd  0xea8(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <drift_shep@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0x8(%rsp),%xmm1
jmp    1140 <drift_shep+0x20>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

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