#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_MANT_DIG;
int DBL_MAX;
double DBL_MAX_EXP;
double DBL_MIN;
double DBL_MIN_EXP;
double FLT_RADIX;
double FLT_ROUNDS;
double dmach(char *cmach) {
  double sfmin, small, rmach;
  extern int lsame_(char *, char *);
  if (lsame_(cmach, "E")) {
    rmach = DBL_EPSILON * 0.5;
  } else if (lsame_(cmach, "S")) {
    sfmin = DBL_MIN;
    small = 1. / DBL_MAX;
    if (small >= sfmin) {
      sfmin = small * (DBL_EPSILON * 0.5 + 1.);
    }
    rmach = sfmin;
  } else if (lsame_(cmach, "B")) {
    rmach = FLT_RADIX;
  } else if (lsame_(cmach, "P")) {
    rmach = DBL_EPSILON * 0.5 * FLT_RADIX;
  } else if (lsame_(cmach, "N")) {
    rmach = DBL_MANT_DIG;
  } else if (lsame_(cmach, "R")) {
    rmach = FLT_ROUNDS;
  } else if (lsame_(cmach, "M")) {
    rmach = DBL_MIN_EXP;
  } else if (lsame_(cmach, "U")) {
    rmach = DBL_MIN;
  } else if (lsame_(cmach, "L")) {
    rmach = DBL_MAX_EXP;
  } else if (lsame_(cmach, "O")) {
    rmach = DBL_MAX;
  }
  return rmach;
}


x86 assembly (clang, -O0):
<dmach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xee9(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     1152 <dmach+0x42>
movsd  0xec3(%rip),%xmm0
mov    0x2e7c(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1392 <dmach+0x282>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     11e7 <dmach+0xd7>
mov    0x2e3e(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e26(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xe7a(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11d8 <dmach+0xc8>
movsd  -0x18(%rbp),%xmm0
mov    0x2e0d(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xe41(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe3d(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    138d <dmach+0x27d>
mov    -0x8(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     1215 <dmach+0x105>
mov    0x2de1(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1388 <dmach+0x278>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     1256 <dmach+0x146>
movsd  0xdca(%rip),%xmm0
mov    0x2d83(%rip),%rax
mulsd  (%rax),%xmm0
mov    0x2da0(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1383 <dmach+0x273>
mov    -0x8(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     1284 <dmach+0x174>
mov    0x2d52(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    137e <dmach+0x26e>
mov    -0x8(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     12b2 <dmach+0x1a2>
mov    0x2d3c(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1379 <dmach+0x269>
mov    -0x8(%rbp),%rdi
lea    0xd5f(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     12e0 <dmach+0x1d0>
mov    0x2d06(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1374 <dmach+0x264>
mov    -0x8(%rbp),%rdi
lea    0xd33(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     130e <dmach+0x1fe>
mov    0x2cb0(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    136f <dmach+0x25f>
mov    -0x8(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     133c <dmach+0x22c>
mov    0x2ca2(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    136a <dmach+0x25a>
mov    -0x8(%rbp),%rdi
lea    0xcdb(%rip),%rsi
call   1030 <lsame_@plt>
cmp    $0x0,%eax
je     1365 <dmach+0x255>
mov    0x2c4c(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    136a <dmach+0x25a>
jmp    136f <dmach+0x25f>
jmp    1374 <dmach+0x264>
jmp    1379 <dmach+0x269>
jmp    137e <dmach+0x26e>
jmp    1383 <dmach+0x273>
jmp    1388 <dmach+0x278>
jmp    138d <dmach+0x27d>
jmp    1392 <dmach+0x282>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmach>:
push   %rbx
mov    %rdi,%rbx
lea    0xef5(%rip),%rsi
call   1030 <lsame_@plt>
test   %eax,%eax
je     1139 <dmach+0x29>
mov    0x2e95(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xec9(%rip),%xmm0
pop    %rbx
ret
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     11a4 <dmach+0x94>
mov    0x2e5d(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e4a(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    0x2e57(%rip),%rax
movsd  (%rax),%xmm2
mulsd  0xe8b(%rip),%xmm2
movsd  0xe8b(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm0,%xmm3
mulsd  %xmm3,%xmm2
movapd %xmm1,%xmm0
cmpnlesd %xmm3,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
pop    %rbx
ret
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     11c4 <dmach+0xb4>
mov    0x2e2a(%rip),%rax
movsd  (%rax),%xmm0
pop    %rbx
ret
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     11f7 <dmach+0xe7>
mov    0x2de2(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xe16(%rip),%xmm0
mov    0x2df7(%rip),%rax
mulsd  (%rax),%xmm0
pop    %rbx
ret
lea    0xe1a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     1213 <dmach+0x103>
mov    0x2db7(%rip),%rax
jmp    11be <dmach+0xae>
lea    0xe00(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     122f <dmach+0x11f>
mov    0x2db3(%rip),%rax
jmp    11be <dmach+0xae>
lea    0xde6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     124e <dmach+0x13e>
mov    0x2d8f(%rip),%rax
jmp    11be <dmach+0xae>
lea    0xdc9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     126d <dmach+0x15d>
mov    0x2d48(%rip),%rax
jmp    11be <dmach+0xae>
lea    0xdac(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     128c <dmach+0x17c>
mov    0x2d49(%rip),%rax
jmp    11be <dmach+0xae>
lea    0xd8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <lsame_@plt>
test   %eax,%eax
je     12ac <dmach+0x19c>
mov    0x2d02(%rip),%rax
cvtsi2sdl (%rax),%xmm0
pop    %rbx
ret
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"E\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.1 = [2 x i8] c"S\00"
@DBL_MIN = global double 0.000000e+00
@DBL_MAX = global i32 0
@.str.2 = [2 x i8] c"B\00"
@FLT_RADIX = global double 0.000000e+00
@.str.3 = [2 x i8] c"P\00"
@.str.4 = [2 x i8] c"N\00"
@DBL_MANT_DIG = global double 0.000000e+00
@.str.5 = [2 x i8] c"R\00"
@FLT_ROUNDS = global double 0.000000e+00
@.str.6 = [2 x i8] c"M\00"
@DBL_MIN_EXP = global double 0.000000e+00
@.str.7 = [2 x i8] c"U\00"
@.str.8 = [2 x i8] c"L\00"
@DBL_MAX_EXP = global double 0.000000e+00
@.str.9 = [2 x i8] c"O\00"
define double @dmach(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @lsame_(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load double, double* @DBL_EPSILON
%11 = fmul double %10, 5.000000e-01
store double %11, double* %5
br label %92
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = call i32 @lsame_(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load double, double* @DBL_MIN
store double %17, double* %3
%18 = load i32, i32* @DBL_MAX
%19 = sitofp i32 %18 to double
%20 = fdiv double 1.000000e+00, %19
store double %20, double* %4
%21 = load double, double* %4
%22 = load double, double* %3
%23 = fcmp oge double %21, %22
br i1 %23, label %24, label %29
24: ; preds = %16
%25 = load double, double* %4
%26 = load double, double* @DBL_EPSILON
%27 = call double @llvm.fmuladd.f64(double %26, double 5.000000e-01, double 1.000000e+00)
%28 = fmul double %25, %27
store double %28, double* %3
br label %29
29: ; preds = %24, %16
%30 = load double, double* %3
store double %30, double* %5
br label %91
31: ; preds = %12
%32 = load i8*, i8** %2
%33 = call i32 @lsame_(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load double, double* @FLT_RADIX
store double %36, double* %5
br label %90
37: ; preds = %31
%38 = load i8*, i8** %2
%39 = call i32 @lsame_(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = load double, double* @DBL_EPSILON
%43 = fmul double %42, 5.000000e-01
%44 = load double, double* @FLT_RADIX
%45 = fmul double %43, %44
store double %45, double* %5
br label %89
46: ; preds = %37
%47 = load i8*, i8** %2
%48 = call i32 @lsame_(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = load double, double* @DBL_MANT_DIG
store double %51, double* %5
br label %88
52: ; preds = %46
%53 = load i8*, i8** %2
%54 = call i32 @lsame_(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = load double, double* @FLT_ROUNDS
store double %57, double* %5
br label %87
58: ; preds = %52
%59 = load i8*, i8** %2
%60 = call i32 @lsame_(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = load double, double* @DBL_MIN_EXP
store double %63, double* %5
br label %86
64: ; preds = %58
%65 = load i8*, i8** %2
%66 = call i32 @lsame_(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load double, double* @DBL_MIN
store double %69, double* %5
br label %85
70: ; preds = %64
%71 = load i8*, i8** %2
%72 = call i32 @lsame_(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = load double, double* @DBL_MAX_EXP
store double %75, double* %5
br label %84
76: ; preds = %70
%77 = load i8*, i8** %2
%78 = call i32 @lsame_(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %76
%81 = load i32, i32* @DBL_MAX
%82 = sitofp i32 %81 to double
store double %82, double* %5
br label %83
83: ; preds = %80, %76
br label %84
84: ; preds = %83, %74
br label %85
85: ; preds = %84, %68
br label %86
86: ; preds = %85, %62
br label %87
87: ; preds = %86, %56
br label %88
88: ; preds = %87, %50
br label %89
89: ; preds = %88, %41
br label %90
90: ; preds = %89, %35
br label %91
91: ; preds = %90, %29
br label %92
92: ; preds = %91, %9
%93 = load double, double* %5
ret double %93
}

LLVM IR (-O2):
@.str = [2 x i8] c"E\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.1 = [2 x i8] c"S\00"
@DBL_MIN = global double 0.000000e+00
@DBL_MAX = global i32 0
@.str.2 = [2 x i8] c"B\00"
@FLT_RADIX = global double 0.000000e+00
@.str.3 = [2 x i8] c"P\00"
@.str.4 = [2 x i8] c"N\00"
@DBL_MANT_DIG = global double 0.000000e+00
@.str.5 = [2 x i8] c"R\00"
@FLT_ROUNDS = global double 0.000000e+00
@.str.6 = [2 x i8] c"M\00"
@DBL_MIN_EXP = global double 0.000000e+00
@.str.7 = [2 x i8] c"U\00"
@.str.8 = [2 x i8] c"L\00"
@DBL_MAX_EXP = global double 0.000000e+00
@.str.9 = [2 x i8] c"O\00"
define double @dmach(i8* %0) {
%2 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load double, double* @DBL_EPSILON
%6 = fmul double %5, 5.000000e-01
br label %64
7: ; preds = %1
%8 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %7
%11 = load double, double* @DBL_MIN
%12 = load i32, i32* @DBL_MAX
%13 = sitofp i32 %12 to double
%14 = fdiv double 1.000000e+00, %13
%15 = fcmp ult double %14, %11
%16 = load double, double* @DBL_EPSILON
%17 = tail call double @llvm.fmuladd.f64(double %16, double 5.000000e-01, double 1.000000e+00)
%18 = fmul double %14, %17
%19 = select i1 %15, double %11, double %18
br label %64
20: ; preds = %7
%21 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = load double, double* @FLT_RADIX
br label %64
25: ; preds = %20
%26 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %25
%29 = load double, double* @DBL_EPSILON
%30 = fmul double %29, 5.000000e-01
%31 = load double, double* @FLT_RADIX
%32 = fmul double %30, %31
br label %64
33: ; preds = %25
%34 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = load double, double* @DBL_MANT_DIG
br label %64
38: ; preds = %33
%39 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = load double, double* @FLT_ROUNDS
br label %64
43: ; preds = %38
%44 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%45 = icmp eq i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %43
%47 = load double, double* @DBL_MIN_EXP
br label %64
48: ; preds = %43
%49 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%50 = icmp eq i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = load double, double* @DBL_MIN
br label %64
53: ; preds = %48
%54 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%55 = icmp eq i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %53
%57 = load double, double* @DBL_MAX_EXP
br label %64
58: ; preds = %53
%59 = tail call i32 @lsame_(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%60 = icmp eq i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i32, i32* @DBL_MAX
%63 = sitofp i32 %62 to double
br label %64
64: ; preds = %10, %28, %41, %51, %58, %61, %56, %46, %36, %23, %4
%65 = phi double [ %6, %4 ], [ %19, %10 ], [ %24, %23 ], [ %32, %28 ], [ %37, %36 ], [ %42, %41 ], [ %47, %46 ], [ %52, %51 ], [ %57, %56 ], [ %63, %61 ], [ undef, %58 ]
ret double %65
}