#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*/ dd_add_dd_d(double const *, double, double *);
int /*<<< orphan*/ dd_copy(double const *, double *);
int dd_eq(double const *, double *);
int /*<<< orphan*/ dd_floor(double const *, double *);
void dd_nint(const double *a, double *b) {
  double f[2];
  dd_floor(a, f);
  if (dd_eq(a, f) == 1) {
    dd_copy(a, b);
  } else {
    double c[2];
    dd_add_dd_d(a, 0.5, c);
    dd_floor(c, b);
  }
}


x86 assembly (clang, -O0):
<dd_nint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <dd_floor@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <dd_eq@plt>
cmp    $0x1,%eax
jne    1185 <dd_nint+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <dd_copy@plt>
jmp    11a7 <dd_nint+0x67>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
movsd  0xe6b(%rip),%xmm0
call   1050 <dd_add_dd_d@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <dd_floor@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_nint>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%r15
mov    %r15,%rsi
call   1040 <dd_floor@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <dd_eq@plt>
cmp    $0x1,%eax
jne    1179 <dd_nint+0x39>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <dd_copy@plt>
jmp    119a <dd_nint+0x5a>
movsd  0xe7f(%rip),%xmm0
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <dd_add_dd_d@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <dd_floor@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dd_nint(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [2 x double]
%6 = alloca [2 x double]
store double* %0, double** %3
store double* %1, double** %4
%7 = load double*, double** %3
%8 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%9 = call i32 @dd_floor(double* %7, double* %8)
%10 = load double*, double** %3
%11 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%12 = call i32 @dd_eq(double* %10, double* %11)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load double*, double** %3
%16 = load double*, double** %4
%17 = call i32 @dd_copy(double* %15, double* %16)
br label %25
18: ; preds = %2
%19 = load double*, double** %3
%20 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%21 = call i32 @dd_add_dd_d(double* %19, double 5.000000e-01, double* %20)
%22 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%23 = load double*, double** %4
%24 = call i32 @dd_floor(double* %22, double* %23)
br label %25
25: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
define void @dd_nint(double* %0, double* %1) {
%3 = alloca [2 x double]
%4 = alloca [2 x double]
%5 = bitcast [2 x double]* %3 to i8*
%6 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%7 = call i32 @dd_floor(double* %0, double* %6)
%8 = call i32 @dd_eq(double* %0, double* %6)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @dd_copy(double* %0, double* %1)
br label %17
12: ; preds = %2
%13 = bitcast [2 x double]* %4 to i8*
%14 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%15 = call i32 @dd_add_dd_d(double* %0, double 5.000000e-01, double* %14)
%16 = call i32 @dd_floor(double* %14, double* %1)
br label %17
17: ; preds = %12, %10
ret void
}