#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 DBL_EPSILON;
double DBL_MAX;
double DBL_MIN;
scalar_t__ FLT_RADIX;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
double log10(double);
int /*<<< orphan*/ stderr;
double d1mach_(int *i) {
  switch (*i) {
  case 1:
    return DBL_MIN;
  case 2:
    return DBL_MAX;
  case 3:
    return DBL_EPSILON;
  case 4:
    return DBL_EPSILON;
  case 5:
    return log10((double)FLT_RADIX);
  default:
    fprintf(stderr, " D1MACH - I OUT OF BOUNDS %d", *i);
    abort();
  }
}


x86 assembly (clang, -O0):
<d1mach_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     11d7 <d1mach_+0xa7>
mov    -0x18(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e59(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f9 <d1mach_+0xc9>
mov    0x2e3c(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f9 <d1mach_+0xc9>
mov    0x2e47(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f9 <d1mach_+0xc9>
mov    0x2e32(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f9 <d1mach_+0xc9>
mov    0x2e25(%rip),%rax
cvtsi2sdq (%rax),%xmm0
call   1050 <log10@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f9 <d1mach_+0xc9>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe27(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d1mach_>:
push   %rax
mov    (%rdi),%edx
lea    -0x1(%rdx),%eax
cmp    $0x4,%eax
ja     117c <d1mach_+0x4c>
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e8e(%rip),%rax
jmp    1164 <d1mach_+0x34>
mov    0x2e6d(%rip),%rax
jmp    1164 <d1mach_+0x34>
mov    0x2e5c(%rip),%rax
movsd  (%rax),%xmm0
pop    %rax
ret
mov    0x2e77(%rip),%rax
cvtsi2sdq (%rax),%xmm0
pop    %rax
jmp    1050 <log10@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@DBL_MIN = global double 0.000000e+00
@DBL_MAX = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
@FLT_RADIX = global i64 0
@stderr = global i32 0
@.str = [29 x i8] c" D1MACH - I OUT OF BOUNDS %d\00"
define double @d1mach_(i32* %0) {
%2 = alloca double
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
switch i32 %5, label %18 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
]
6: ; preds = %1
%7 = load double, double* @DBL_MIN
store double %7, double* %2
br label %24
8: ; preds = %1
%9 = load double, double* @DBL_MAX
store double %9, double* %2
br label %24
10: ; preds = %1
%11 = load double, double* @DBL_EPSILON
store double %11, double* %2
br label %24
12: ; preds = %1
%13 = load double, double* @DBL_EPSILON
store double %13, double* %2
br label %24
14: ; preds = %1
%15 = load i64, i64* @FLT_RADIX
%16 = sitofp i64 %15 to double
%17 = call double @log10(double %16)
store double %17, double* %2
br label %24
18: ; preds = %1
%19 = load i32, i32* @stderr
%20 = load i32*, i32** %3
%21 = load i32, i32* %20
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %14, %12, %10, %8, %6
%25 = load double, double* %2
ret double %25
}

LLVM IR (-O2):
@DBL_MIN = global double 0.000000e+00
@DBL_MAX = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
@FLT_RADIX = global i64 0
@stderr = global i32 0
@.str = [29 x i8] c" D1MACH - I OUT OF BOUNDS %d\00"
define double @d1mach_(i32* nocapture %0) {
%2 = load i32, i32* %0
switch i32 %2, label %15 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
i32 5, label %11
]
3: ; preds = %1
%4 = load double, double* @DBL_MIN
br label %19
5: ; preds = %1
%6 = load double, double* @DBL_MAX
br label %19
7: ; preds = %1
%8 = load double, double* @DBL_EPSILON
br label %19
9: ; preds = %1
%10 = load double, double* @DBL_EPSILON
br label %19
11: ; preds = %1
%12 = load i64, i64* @FLT_RADIX
%13 = sitofp i64 %12 to double
%14 = tail call double @log10(double %13)
br label %19
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %2)
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %11, %9, %7, %5, %3
%20 = phi double [ %14, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ]
ret double %20
}