#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 */
double add_hi(double, double);
double add_lo(double, double);
double translate_trig2pi(int hilo, double N, int J, double Z) {
  if (hilo == 0)
    return (add_lo(add_lo(Z, J / 4.0), N));
  else
    return (add_hi(add_hi(Z, J / 4.0), N));
}


x86 assembly (clang, -O0):
<translate_trig2pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
movsd  %xmm1,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1171 <translate_trig2pi+0x51>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xeac(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1030 <add_lo@plt>
movsd  -0x18(%rbp),%xmm1
call   1030 <add_lo@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    119b <translate_trig2pi+0x7b>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xe7d(%rip),%xmm2
divsd  %xmm2,%xmm1
call   1040 <add_hi@plt>
movsd  -0x18(%rbp),%xmm1
call   1040 <add_hi@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate_trig2pi>:
push   %rax
cvtsi2sd %esi,%xmm2
movsd  %xmm0,(%rsp)
mulsd  0xece(%rip),%xmm2
movaps %xmm1,%xmm0
movapd %xmm2,%xmm1
test   %edi,%edi
je     114d <translate_trig2pi+0x2d>
call   1040 <add_hi@plt>
movsd  (%rsp),%xmm1
pop    %rax
jmp    1040 <add_hi@plt>
call   1030 <add_lo@plt>
movsd  (%rsp),%xmm1
pop    %rax
jmp    1030 <add_lo@plt>

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

LLVM IR (-O2):
define double @translate_trig2pi(i32 %0, double %1, i32 %2, double %3) {
%5 = icmp eq i32 %0, 0
%6 = sitofp i32 %2 to double
%7 = fmul double %6, 2.500000e-01
br i1 %5, label %8, label %11
8: ; preds = %4
%9 = tail call double @add_lo(double %3, double %7)
%10 = tail call double @add_lo(double %9, double %1)
br label %14
11: ; preds = %4
%12 = tail call double @add_hi(double %3, double %7)
%13 = tail call double @add_hi(double %12, double %1)
br label %14
14: ; preds = %11, %8
%15 = phi double [ %10, %8 ], [ %13, %11 ]
ret double %15
}