#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 MARCH_SADDLES();
int /*<<< orphan*/ assert(int /*<<< orphan*/);
float fabs(float);
float march_singular_raw(float, float, float, float, int, float);
float march_singular_usc(float, float, float, float, int, float);
float march_singular(float a, float b, float c, float d, float x, float y) {
  int option = MARCH_SADDLES();
  float mv = (a + b + c + d) / 4;
  float d0 = fabs(b - mv);
  float d1 = fabs(d - mv);
  if (0 == option)
    option = d1 < d0 ? -1 : 1;
  if (2 == option)
    option = d1 > d0 ? -1 : 1;
  if (3 == option)
    option = d1 >= d0 ? -1 : 1;
  if (100 == option)
    option = d1 >= d0 ? -100 : 100;
  if (10 == option)
    option = 1;
  if (-10 == option)
    option = -1;
  switch (option) {
  case 1:
    return march_singular_raw(a, b, c, d, x, y);
  case -1:
    return -march_singular_raw(-c, -d, -a, -b, 1 - x, y);
  case 100:
    return march_singular_usc(a, b, c, d, x, y);
  case -100:
    return -march_singular_usc(-c, -d, -a, -b, 1 - x, y);
  case -2:
    return -1;
  default:
    assert(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<march_singular>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  %xmm4,-0x18(%rbp)
movss  %xmm5,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <MARCH_SADDLES@plt>
mov    %eax,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe64(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x24(%rbp),%xmm0
call   1060 <fabs@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x24(%rbp),%xmm0
call   1060 <fabs@plt>
movss  %xmm0,-0x2c(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%eax
jne    11f5 <march_singular+0xa5>
movss  -0x2c(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x2,%eax
cmp    -0x20(%rbp),%eax
jne    1220 <march_singular+0xd0>
movss  -0x2c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x3,%eax
cmp    -0x20(%rbp),%eax
jne    124b <march_singular+0xfb>
movss  -0x2c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x64,%eax
cmp    -0x20(%rbp),%eax
jne    1276 <march_singular+0x126>
movss  -0x2c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
mov    $0x64,%eax
mov    $0xffffff9c,%ecx
ucomiss %xmm1,%xmm0
cmovae %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0xa,%eax
cmp    -0x20(%rbp),%eax
jne    128b <march_singular+0x13b>
movl   $0x1,-0x20(%rbp)
mov    $0xfffffff6,%eax
cmp    -0x20(%rbp),%eax
jne    12a0 <march_singular+0x150>
movl   $0xffffffff,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0xffffff9c,%eax
je     13cc <march_singular+0x27c>
jmp    12b4 <march_singular+0x164>
mov    -0x30(%rbp),%eax
sub    $0xfffffffe,%eax
je     1446 <march_singular+0x2f6>
jmp    12c5 <march_singular+0x175>
mov    -0x30(%rbp),%eax
sub    $0xffffffff,%eax
je     1325 <march_singular+0x1d5>
jmp    12d6 <march_singular+0x186>
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
je     12f8 <march_singular+0x1a8>
jmp    12e7 <march_singular+0x197>
mov    -0x30(%rbp),%eax
sub    $0x64,%eax
je     139f <march_singular+0x24f>
jmp    1458 <march_singular+0x308>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
cvttss2si -0x18(%rbp),%edi
movss  -0x1c(%rbp),%xmm4
call   1040 <march_singular_raw@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1467 <march_singular+0x317>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x8(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0xc(%rbp),%xmm3
movd   %xmm3,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm3
movss  0xc93(%rip),%xmm4
subss  -0x18(%rbp),%xmm4
cvttss2si %xmm4,%edi
movss  -0x1c(%rbp),%xmm4
call   1040 <march_singular_raw@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1467 <march_singular+0x317>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
cvttss2si -0x18(%rbp),%edi
movss  -0x1c(%rbp),%xmm4
call   1050 <march_singular_usc@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1467 <march_singular+0x317>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x8(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0xc(%rbp),%xmm3
movd   %xmm3,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm3
movss  0xbec(%rip),%xmm4
subss  -0x18(%rbp),%xmm4
cvttss2si %xmm4,%edi
movss  -0x1c(%rbp),%xmm4
call   1050 <march_singular_usc@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1467 <march_singular+0x317>
movss  0xbb6(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1467 <march_singular+0x317>
xor    %edi,%edi
call   1070 <assert@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<march_singular>:
sub    $0x58,%rsp
movss  %xmm5,0xc(%rsp)
movss  %xmm4,0x8(%rsp)
movaps %xmm3,0x40(%rsp)
movaps %xmm2,0x30(%rsp)
movaps %xmm1,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <MARCH_SADDLES@plt>
movaps 0x10(%rsp),%xmm5
movaps 0x30(%rsp),%xmm2
movaps 0x20(%rsp),%xmm4
movaps 0x40(%rsp),%xmm3
movaps %xmm5,%xmm0
addss  %xmm4,%xmm0
addss  %xmm2,%xmm0
addss  %xmm3,%xmm0
mulss  0xe6a(%rip),%xmm0
movaps %xmm3,%xmm1
unpcklps %xmm4,%xmm1
shufps $0x0,%xmm0,%xmm0
subps  %xmm0,%xmm1
andps  0xe66(%rip),%xmm1
pshufd $0x55,%xmm1,%xmm0
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
setbe  %cl
test   %eax,%eax
lea    -0x1(%rcx,%rcx,1),%ecx
cmovne %eax,%ecx
xor    %eax,%eax
xor    %edx,%edx
ucomiss %xmm0,%xmm1
setbe  %al
setb   %dl
mov    $0xffffff9c,%esi
mov    $0x64,%edi
cmovae %esi,%edi
cmp    $0x2,%ecx
lea    -0x1(%rax,%rax,1),%eax
cmovne %ecx,%eax
cmp    $0x3,%eax
lea    -0x1(%rdx,%rdx,1),%ecx
cmovne %eax,%ecx
cmp    $0x64,%ecx
cmove  %edi,%ecx
cmp    $0xa,%ecx
mov    $0x1,%edx
cmovne %ecx,%edx
cmp    $0xfffffff6,%edx
mov    $0xffffffff,%eax
cmovne %edx,%eax
cmp    $0xfffffffe,%eax
jle    123d <march_singular+0xfd>
cmp    $0xffffffff,%eax
je     1258 <march_singular+0x118>
cmp    $0x64,%eax
je     1296 <march_singular+0x156>
cmp    $0x1,%eax
jne    12f9 <march_singular+0x1b9>
cvttss2si 0x8(%rsp),%edi
movaps %xmm5,%xmm0
movaps %xmm4,%xmm1
movss  0xc(%rsp),%xmm4
add    $0x58,%rsp
jmp    1040 <march_singular_raw@plt>
cmp    $0xffffff9c,%eax
je     12b1 <march_singular+0x171>
cmp    $0xfffffffe,%eax
jne    12f9 <march_singular+0x1b9>
movss  0xdb1(%rip),%xmm0
add    $0x58,%rsp
ret
movaps 0xdc1(%rip),%xmm0
xorps  %xmm0,%xmm2
xorps  %xmm0,%xmm3
xorps  %xmm0,%xmm5
xorps  %xmm0,%xmm4
movss  0xd95(%rip),%xmm0
subss  0x8(%rsp),%xmm0
cvttss2si %xmm0,%edi
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
movaps %xmm5,%xmm2
movaps %xmm4,%xmm3
movss  0xc(%rsp),%xmm4
call   1040 <march_singular_raw@plt>
jmp    12ed <march_singular+0x1ad>
cvttss2si 0x8(%rsp),%edi
movaps %xmm5,%xmm0
movaps %xmm4,%xmm1
movss  0xc(%rsp),%xmm4
add    $0x58,%rsp
jmp    1050 <march_singular_usc@plt>
movaps 0xd68(%rip),%xmm0
xorps  %xmm0,%xmm2
xorps  %xmm0,%xmm3
xorps  %xmm0,%xmm5
xorps  %xmm0,%xmm4
movss  0xd3c(%rip),%xmm0
subss  0x8(%rsp),%xmm0
cvttss2si %xmm0,%edi
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
movaps %xmm5,%xmm2
movaps %xmm4,%xmm3
movss  0xc(%rsp),%xmm4
call   1050 <march_singular_usc@plt>
xorps  0xd2c(%rip),%xmm0
add    $0x58,%rsp
ret
xor    %edi,%edi
call   1060 <assert@plt>
xorps  %xmm0,%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define float @march_singular(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca float
%16 = alloca float
%17 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
%18 = call i32 (...) @MARCH_SADDLES()
store i32 %18, i32* %14
%19 = load float, float* %8
%20 = load float, float* %9
%21 = fadd float %19, %20
%22 = load float, float* %10
%23 = fadd float %21, %22
%24 = load float, float* %11
%25 = fadd float %23, %24
%26 = fdiv float %25, 4.000000e+00
store float %26, float* %15
%27 = load float, float* %9
%28 = load float, float* %15
%29 = fsub float %27, %28
%30 = call float @fabs(float %29)
store float %30, float* %16
%31 = load float, float* %11
%32 = load float, float* %15
%33 = fsub float %31, %32
%34 = call float @fabs(float %33)
store float %34, float* %17
%35 = load i32, i32* %14
%36 = icmp eq i32 0, %35
br i1 %36, label %37, label %43
37: ; preds = %6
%38 = load float, float* %17
%39 = load float, float* %16
%40 = fcmp olt float %38, %39
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 -1, i32 1
store i32 %42, i32* %14
br label %43
43: ; preds = %37, %6
%44 = load i32, i32* %14
%45 = icmp eq i32 2, %44
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = load float, float* %17
%48 = load float, float* %16
%49 = fcmp ogt float %47, %48
%50 = zext i1 %49 to i64
%51 = select i1 %49, i32 -1, i32 1
store i32 %51, i32* %14
br label %52
52: ; preds = %46, %43
%53 = load i32, i32* %14
%54 = icmp eq i32 3, %53
br i1 %54, label %55, label %61
55: ; preds = %52
%56 = load float, float* %17
%57 = load float, float* %16
%58 = fcmp oge float %56, %57
%59 = zext i1 %58 to i64
%60 = select i1 %58, i32 -1, i32 1
store i32 %60, i32* %14
br label %61
61: ; preds = %55, %52
%62 = load i32, i32* %14
%63 = icmp eq i32 100, %62
br i1 %63, label %64, label %70
64: ; preds = %61
%65 = load float, float* %17
%66 = load float, float* %16
%67 = fcmp oge float %65, %66
%68 = zext i1 %67 to i64
%69 = select i1 %67, i32 -100, i32 100
store i32 %69, i32* %14
br label %70
70: ; preds = %64, %61
%71 = load i32, i32* %14
%72 = icmp eq i32 10, %71
br i1 %72, label %73, label %74
73: ; preds = %70
store i32 1, i32* %14
br label %74
74: ; preds = %73, %70
%75 = load i32, i32* %14
%76 = icmp eq i32 -10, %75
br i1 %76, label %77, label %78
77: ; preds = %74
store i32 -1, i32* %14
br label %78
78: ; preds = %77, %74
%79 = load i32, i32* %14
switch i32 %79, label %129 [
i32 1, label %80
i32 -1, label %89
i32 100, label %104
i32 -100, label %113
i32 -2, label %128
]
80: ; preds = %78
%81 = load float, float* %8
%82 = load float, float* %9
%83 = load float, float* %10
%84 = load float, float* %11
%85 = load float, float* %12
%86 = fptosi float %85 to i32
%87 = load float, float* %13
%88 = call float @march_singular_raw(float %81, float %82, float %83, float %84, i32 %86, float %87)
store float %88, float* %7
br label %132
89: ; preds = %78
%90 = load float, float* %10
%91 = fneg float %90
%92 = load float, float* %11
%93 = fneg float %92
%94 = load float, float* %8
%95 = fneg float %94
%96 = load float, float* %9
%97 = fneg float %96
%98 = load float, float* %12
%99 = fsub float 1.000000e+00, %98
%100 = fptosi float %99 to i32
%101 = load float, float* %13
%102 = call float @march_singular_raw(float %91, float %93, float %95, float %97, i32 %100, float %101)
%103 = fneg float %102
store float %103, float* %7
br label %132
104: ; preds = %78
%105 = load float, float* %8
%106 = load float, float* %9
%107 = load float, float* %10
%108 = load float, float* %11
%109 = load float, float* %12
%110 = fptosi float %109 to i32
%111 = load float, float* %13
%112 = call float @march_singular_usc(float %105, float %106, float %107, float %108, i32 %110, float %111)
store float %112, float* %7
br label %132
113: ; preds = %78
%114 = load float, float* %10
%115 = fneg float %114
%116 = load float, float* %11
%117 = fneg float %116
%118 = load float, float* %8
%119 = fneg float %118
%120 = load float, float* %9
%121 = fneg float %120
%122 = load float, float* %12
%123 = fsub float 1.000000e+00, %122
%124 = fptosi float %123 to i32
%125 = load float, float* %13
%126 = call float @march_singular_usc(float %115, float %117, float %119, float %121, i32 %124, float %125)
%127 = fneg float %126
store float %127, float* %7
br label %132
128: ; preds = %78
store float -1.000000e+00, float* %7
br label %132
129: ; preds = %78
%130 = call i32 @assert(i32 0)
br label %131
131: ; preds = %129
store float 0.000000e+00, float* %7
br label %132
132: ; preds = %131, %128, %113, %104, %89, %80
%133 = load float, float* %7
ret float %133
}

LLVM IR (-O2):
define float @march_singular(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = tail call i32 (...) @MARCH_SADDLES()
%8 = fadd float %0, %1
%9 = fadd float %8, %2
%10 = fadd float %9, %3
%11 = fmul float %10, 2.500000e-01
%12 = insertelement <2 x float> poison, float %3, i64 0
%13 = insertelement <2 x float> %12, float %1, i64 1
%14 = insertelement <2 x float> poison, float %11, i64 0
%15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer
%16 = fsub <2 x float> %13, %15
%17 = call <2 x float> @llvm.fabs.v2f32(<2 x float> %16)
%18 = icmp eq i32 %7, 0
%19 = extractelement <2 x float> %17, i64 0
%20 = extractelement <2 x float> %17, i64 1
%21 = fcmp olt float %19, %20
%22 = select i1 %21, i32 -1, i32 1
%23 = select i1 %18, i32 %22, i32 %7
%24 = icmp eq i32 %23, 2
%25 = fcmp ogt float %19, %20
%26 = select i1 %25, i32 -1, i32 1
%27 = select i1 %24, i32 %26, i32 %23
%28 = icmp eq i32 %27, 3
%29 = fcmp oge float %19, %20
%30 = select i1 %29, i32 -1, i32 1
%31 = select i1 %28, i32 %30, i32 %27
%32 = icmp eq i32 %31, 100
%33 = select i1 %29, i32 -100, i32 100
%34 = select i1 %32, i32 %33, i32 %31
%35 = icmp eq i32 %34, 10
%36 = select i1 %35, i32 1, i32 %34
%37 = icmp eq i32 %36, -10
%38 = select i1 %37, i32 -1, i32 %36
switch i32 %38, label %63 [
i32 1, label %39
i32 -1, label %42
i32 100, label %51
i32 -100, label %54
i32 -2, label %65
]
39: ; preds = %6
%40 = fptosi float %4 to i32
%41 = tail call float @march_singular_raw(float %0, float %1, float %2, float %3, i32 %40, float %5)
br label %65
42: ; preds = %6
%43 = fneg float %2
%44 = fneg float %3
%45 = fneg float %0
%46 = fneg float %1
%47 = fsub float 1.000000e+00, %4
%48 = fptosi float %47 to i32
%49 = tail call float @march_singular_raw(float %43, float %44, float %45, float %46, i32 %48, float %5)
%50 = fneg float %49
br label %65
51: ; preds = %6
%52 = fptosi float %4 to i32
%53 = tail call float @march_singular_usc(float %0, float %1, float %2, float %3, i32 %52, float %5)
br label %65
54: ; preds = %6
%55 = fneg float %2
%56 = fneg float %3
%57 = fneg float %0
%58 = fneg float %1
%59 = fsub float 1.000000e+00, %4
%60 = fptosi float %59 to i32
%61 = tail call float @march_singular_usc(float %55, float %56, float %57, float %58, i32 %60, float %5)
%62 = fneg float %61
br label %65
63: ; preds = %6
%64 = tail call i32 @assert(i32 0)
br label %65
65: ; preds = %6, %63, %54, %51, %42, %39
%66 = phi float [ 0.000000e+00, %63 ], [ %62, %54 ], [ %53, %51 ], [ %50, %42 ], [ %41, %39 ], [ -1.000000e+00, %6 ]
ret float %66
}