#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*/ printf(char const *, ...);
void mprintf(const char *format, double d) {
  if (1 / d == 0) {
    if (d > 0) {
      printf("Inf, ");
    } else {
      printf("-Inf, ");
    }
  } else {
    if (d >= 0 || d <= 0) {
      printf(format, d);
    } else {
      printf("NaN, ");
    }
  }
}


x86 assembly (clang, -O0):
<mprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xed7(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1179 <mprintf+0x69>
jp     1179 <mprintf+0x69>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1166 <mprintf+0x56>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <mprintf+0x64>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <mprintf+0xb1>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1199 <mprintf+0x89>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11ae <mprintf+0x9e>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11bc <mprintf+0xac>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <mprintf+0xb1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mprintf>:
movsd  0xee8(%rip),%xmm2
divsd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
jne    113c <mprintf+0x2c>
jp     113c <mprintf+0x2c>
ucomisd %xmm1,%xmm0
jbe    1149 <mprintf+0x39>
lea    0xed4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
ucomisd %xmm0,%xmm0
jp     1157 <mprintf+0x47>
mov    $0x1,%al
jmp    1030 <printf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Inf, \00"
@.str.1 = [7 x i8] c"-Inf, \00"
@.str.2 = [6 x i8] c"NaN, \00"
define void @mprintf(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fdiv double 1.000000e+00, %5
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load double, double* %4
%10 = fcmp ogt double %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %15
13: ; preds = %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
br label %29
16: ; preds = %2
%17 = load double, double* %4
%18 = fcmp oge double %17, 0.000000e+00
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load double, double* %4
%21 = fcmp ole double %20, 0.000000e+00
br i1 %21, label %22, label %26
22: ; preds = %19, %16
%23 = load i8*, i8** %3
%24 = load double, double* %4
%25 = call i32 (i8*, ...) @printf(i8* %23, double %24)
br label %28
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
br label %29
29: ; preds = %28, %15
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Inf, \00"
@.str.1 = [7 x i8] c"-Inf, \00"
@.str.2 = [6 x i8] c"NaN, \00"
define void @mprintf(i8* nocapture %0, double %1) {
%3 = fdiv double 1.000000e+00, %1
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = fcmp ogt double %1, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %17
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %17
11: ; preds = %2
%12 = fcmp ord double %1, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, double %1)
br label %17
15: ; preds = %11
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %13, %15, %7, %9
ret void
}