#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*/ sprintf(char *, char *, double);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
void wcscstr(char *cstr, int syswcs, double equinox, double epoch) {
  char *estr;
  if (epoch == 0.0)
    epoch = equinox;
  if (syswcs < 0) {
    if (equinox > 0.0) {
      if (equinox == 2000.0)
        syswcs = 1;
      else if (equinox == 1950.0)
        syswcs = 2;
    } else if (epoch > 0.0) {
      if (epoch > 1980.0) {
        syswcs = 1;
        equinox = 2000.0;
      } else {
        syswcs = 2;
        equinox = 1950.0;
      }
    } else
      syswcs = 1;
  }
  if (syswcs == 2) {
    if (epoch == 1950.0 || epoch == 0.0)
      strcpy(cstr, "B1950");
    else
      sprintf(cstr, "B%7.2f", equinox);
    if ((estr = strstr(cstr, ".00")) != NULL) {
      estr[0] = (char)0;
      estr[1] = (char)0;
      estr[2] = (char)0;
    }
  } else if (syswcs == 3)
    strcpy(cstr, "galactic");
  else if (syswcs == 4)
    strcpy(cstr, "ecliptic");
  else if (syswcs == 1) {
    if (epoch == 2000.0 || epoch == 0.0)
      strcpy(cstr, "J2000");
    else
      sprintf(cstr, "J%7.2f", equinox);
    if ((estr = strstr(cstr, ".00")) != NULL) {
      estr[0] = (char)0;
      estr[1] = (char)0;
      estr[2] = (char)0;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<wcscstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    116b <wcscstr+0x3b>
jp     116b <wcscstr+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    124a <wcscstr+0x11a>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11de <wcscstr+0xae>
movsd  -0x18(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11b0 <wcscstr+0x80>
jp     11b0 <wcscstr+0x80>
movl   $0x1,-0xc(%rbp)
jmp    11d9 <wcscstr+0xa9>
movsd  -0x18(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11d4 <wcscstr+0xa4>
jp     11d4 <wcscstr+0xa4>
movl   $0x2,-0xc(%rbp)
jmp    11d9 <wcscstr+0xa9>
jmp    1245 <wcscstr+0x115>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1239 <wcscstr+0x109>
movsd  -0x20(%rbp),%xmm0
movsd  0xe03(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1220 <wcscstr+0xf0>
movl   $0x1,-0xc(%rbp)
movsd  0xdfa(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1234 <wcscstr+0x104>
movl   $0x2,-0xc(%rbp)
movsd  0xdd9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1240 <wcscstr+0x110>
movl   $0x1,-0xc(%rbp)
jmp    1245 <wcscstr+0x115>
jmp    124a <wcscstr+0x11a>
cmpl   $0x2,-0xc(%rbp)
jne    12f2 <wcscstr+0x1c2>
movsd  -0x20(%rbp),%xmm0
movsd  0xda7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1276 <wcscstr+0x146>
jp     1276 <wcscstr+0x146>
jmp    128e <wcscstr+0x15e>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12a3 <wcscstr+0x173>
jp     12a3 <wcscstr+0x173>
mov    -0x8(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12b8 <wcscstr+0x188>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xd6b(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd62(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     12ed <wcscstr+0x1bd>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x2(%rax)
jmp    13e7 <wcscstr+0x2b7>
cmpl   $0x3,-0xc(%rbp)
jne    1311 <wcscstr+0x1e1>
mov    -0x8(%rbp),%rdi
lea    0xd22(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13e2 <wcscstr+0x2b2>
cmpl   $0x4,-0xc(%rbp)
jne    1330 <wcscstr+0x200>
mov    -0x8(%rbp),%rdi
lea    0xd0c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    13dd <wcscstr+0x2ad>
cmpl   $0x1,-0xc(%rbp)
jne    13d8 <wcscstr+0x2a8>
movsd  -0x20(%rbp),%xmm0
movsd  0xcc9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    135c <wcscstr+0x22c>
jp     135c <wcscstr+0x22c>
jmp    1374 <wcscstr+0x244>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1389 <wcscstr+0x259>
jp     1389 <wcscstr+0x259>
mov    -0x8(%rbp),%rdi
lea    0xcbc(%rip),%rsi
call   1030 <strcpy@plt>
jmp    139e <wcscstr+0x26e>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xca8(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xc7c(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     13d3 <wcscstr+0x2a3>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x28(%rbp),%rax
movb   $0x0,0x2(%rax)
jmp    13d8 <wcscstr+0x2a8>
jmp    13dd <wcscstr+0x2ad>
jmp    13e2 <wcscstr+0x2b2>
jmp    13e7 <wcscstr+0x2b7>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscstr>:
push   %rbx
mov    %rdi,%rbx
xorpd  %xmm2,%xmm2
movapd %xmm1,%xmm3
cmpeqsd %xmm2,%xmm3
movapd %xmm3,%xmm4
andpd  %xmm0,%xmm4
andnpd %xmm1,%xmm3
orpd   %xmm4,%xmm3
test   %esi,%esi
js     1185 <wcscstr+0x55>
add    $0xffffffff,%esi
cmp    $0x3,%esi
ja     126f <wcscstr+0x13f>
lea    0xeb0(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
movapd %xmm0,%xmm2
movapd %xmm0,%xmm1
jmp    *%rcx
lea    0xeb9(%rip),%rsi
jmp    1205 <wcscstr+0xd5>
ucomisd %xmm2,%xmm0
jbe    11ad <wcscstr+0x7d>
movsd  0xe75(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    119b <wcscstr+0x6b>
jnp    11cd <wcscstr+0x9d>
movsd  0xe5d(%rip),%xmm2
ucomisd %xmm2,%xmm0
jne    1155 <wcscstr+0x25>
jnp    1216 <wcscstr+0xe6>
jmp    1155 <wcscstr+0x25>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
movapd %xmm0,%xmm1
jbe    11cd <wcscstr+0x9d>
ucomisd 0xe4d(%rip),%xmm3
jbe    120e <wcscstr+0xde>
movsd  0xe3b(%rip),%xmm1
ucomisd 0xe33(%rip),%xmm3
jne    11d9 <wcscstr+0xa9>
jnp    11f5 <wcscstr+0xc5>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    11e5 <wcscstr+0xb5>
jnp    11f5 <wcscstr+0xc5>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
movapd %xmm1,%xmm0
jmp    123c <wcscstr+0x10c>
lea    0xe4f(%rip),%rsi
jmp    124a <wcscstr+0x11a>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strcpy@plt>
movsd  0xdea(%rip),%xmm2
ucomisd 0xde2(%rip),%xmm3
jne    1222 <wcscstr+0xf2>
jnp    1243 <wcscstr+0x113>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jne    122e <wcscstr+0xfe>
jnp    1243 <wcscstr+0x113>
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
movapd %xmm2,%xmm0
call   1040 <sprintf@plt>
jmp    1252 <wcscstr+0x122>
lea    0xdde(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xddc(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
je     126f <wcscstr+0x13f>
movw   $0x0,(%rax)
movb   $0x0,0x2(%rax)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"B1950\00"
@.str.1 = [7 x i8] c"B%7.2f\00"
@.str.2 = [4 x i8] c".00\00"
@.str.3 = [9 x i8] c"galactic\00"
@.str.4 = [9 x i8] c"ecliptic\00"
@.str.5 = [6 x i8] c"J2000\00"
@.str.6 = [7 x i8] c"J%7.2f\00"
define void @wcscstr(i8* %0, i32 %1, double %2, double %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %8
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load double, double* %7
store double %13, double* %8
br label %14
14: ; preds = %12, %4
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %42
17: ; preds = %14
%18 = load double, double* %7
%19 = fcmp ogt double %18, 0.000000e+00
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load double, double* %7
%22 = fcmp oeq double %21, 2.000000e+03
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 1, i32* %6
br label %29
24: ; preds = %20
%25 = load double, double* %7
%26 = fcmp oeq double %25, 1.950000e+03
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 2, i32* %6
br label %28
28: ; preds = %27, %24
br label %29
29: ; preds = %28, %23
br label %41
30: ; preds = %17
%31 = load double, double* %8
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load double, double* %8
%35 = fcmp ogt double %34, 1.980000e+03
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 1, i32* %6
store double 2.000000e+03, double* %7
br label %38
37: ; preds = %33
store i32 2, i32* %6
store double 1.950000e+03, double* %7
br label %38
38: ; preds = %37, %36
br label %40
39: ; preds = %30
store i32 1, i32* %6
br label %40
40: ; preds = %39, %38
br label %41
41: ; preds = %40, %29
br label %42
42: ; preds = %41, %14
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, 2
br i1 %44, label %45, label %70
45: ; preds = %42
%46 = load double, double* %8
%47 = fcmp oeq double %46, 1.950000e+03
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = load double, double* %8
%50 = fcmp oeq double %49, 0.000000e+00
br i1 %50, label %51, label %54
51: ; preds = %48, %45
%52 = load i8*, i8** %5
%53 = call i32 @strcpy(i8* %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %58
54: ; preds = %48
%55 = load i8*, i8** %5
%56 = load double, double* %7
%57 = call i32 @sprintf(i8* %55, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %56)
br label %58
58: ; preds = %54, %51
%59 = load i8*, i8** %5
%60 = call i8* @strstr(i8* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i8* %60, i8** %9
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %69
62: ; preds = %58
%63 = load i8*, i8** %9
%64 = getelementptr inbounds i8, i8* %63, i64 0
store i8 0, i8* %64
%65 = load i8*, i8** %9
%66 = getelementptr inbounds i8, i8* %65, i64 1
store i8 0, i8* %66
%67 = load i8*, i8** %9
%68 = getelementptr inbounds i8, i8* %67, i64 2
store i8 0, i8* %68
br label %69
69: ; preds = %62, %58
br label %113
70: ; preds = %42
%71 = load i32, i32* %6
%72 = icmp eq i32 %71, 3
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i8*, i8** %5
%75 = call i32 @strcpy(i8* %74, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %112
76: ; preds = %70
%77 = load i32, i32* %6
%78 = icmp eq i32 %77, 4
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = load i8*, i8** %5
%81 = call i32 @strcpy(i8* %80, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %111
82: ; preds = %76
%83 = load i32, i32* %6
%84 = icmp eq i32 %83, 1
br i1 %84, label %85, label %110
85: ; preds = %82
%86 = load double, double* %8
%87 = fcmp oeq double %86, 2.000000e+03
br i1 %87, label %91, label %88
88: ; preds = %85
%89 = load double, double* %8
%90 = fcmp oeq double %89, 0.000000e+00
br i1 %90, label %91, label %94
91: ; preds = %88, %85
%92 = load i8*, i8** %5
%93 = call i32 @strcpy(i8* %92, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %98
94: ; preds = %88
%95 = load i8*, i8** %5
%96 = load double, double* %7
%97 = call i32 @sprintf(i8* %95, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %96)
br label %98
98: ; preds = %94, %91
%99 = load i8*, i8** %5
%100 = call i8* @strstr(i8* %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i8* %100, i8** %9
%101 = icmp ne i8* %100, null
br i1 %101, label %102, label %109
102: ; preds = %98
%103 = load i8*, i8** %9
%104 = getelementptr inbounds i8, i8* %103, i64 0
store i8 0, i8* %104
%105 = load i8*, i8** %9
%106 = getelementptr inbounds i8, i8* %105, i64 1
store i8 0, i8* %106
%107 = load i8*, i8** %9
%108 = getelementptr inbounds i8, i8* %107, i64 2
store i8 0, i8* %108
br label %109
109: ; preds = %102, %98
br label %110
110: ; preds = %109, %82
br label %111
111: ; preds = %110, %79
br label %112
112: ; preds = %111, %73
br label %113
113: ; preds = %112, %69
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"B1950\00"
@.str.1 = [7 x i8] c"B%7.2f\00"
@.str.2 = [4 x i8] c".00\00"
@.str.3 = [9 x i8] c"galactic\00"
@.str.4 = [9 x i8] c"ecliptic\00"
@.str.5 = [6 x i8] c"J2000\00"
@.str.6 = [7 x i8] c"J%7.2f\00"
define void @wcscstr(i8* %0, i32 %1, double %2, double %3) {
%5 = fcmp oeq double %3, 0.000000e+00
%6 = select i1 %5, double %2, double %3
%7 = icmp slt i32 %1, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = fcmp ogt double %2, 0.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = fcmp oeq double %2, 2.000000e+03
br i1 %11, label %38, label %12
12: ; preds = %10
%13 = fcmp oeq double %2, 1.950000e+03
br i1 %13, label %19, label %18
14: ; preds = %8
%15 = fcmp ogt double %6, 0.000000e+00
br i1 %15, label %16, label %38
16: ; preds = %14
%17 = fcmp ogt double %6, 1.980000e+03
br i1 %17, label %38, label %19
18: ; preds = %12, %4
switch i32 %1, label %53 [
i32 2, label %19
i32 3, label %34
i32 4, label %36
i32 1, label %38
]
19: ; preds = %12, %16, %18
%20 = phi double [ %2, %18 ], [ 1.950000e+03, %16 ], [ 1.950000e+03, %12 ]
%21 = fcmp oeq double %6, 1.950000e+03
%22 = fcmp oeq double %6, 0.000000e+00
%23 = or i1 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %28
26: ; preds = %19
%27 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %20)
br label %28
28: ; preds = %26, %24
%29 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i8* %29, null
br i1 %30, label %53, label %31
31: ; preds = %28
store i8 0, i8* %29
%32 = getelementptr inbounds i8, i8* %29, i64 1
store i8 0, i8* %32
%33 = getelementptr inbounds i8, i8* %29, i64 2
store i8 0, i8* %33
br label %53
34: ; preds = %18
%35 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %53
36: ; preds = %18
%37 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %53
38: ; preds = %16, %14, %10, %18
%39 = phi double [ %2, %18 ], [ %2, %14 ], [ 2.000000e+03, %10 ], [ 2.000000e+03, %16 ]
%40 = fcmp oeq double %6, 2.000000e+03
%41 = fcmp oeq double %6, 0.000000e+00
%42 = or i1 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %47
45: ; preds = %38
%46 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %39)
br label %47
47: ; preds = %45, %43
%48 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%49 = icmp eq i8* %48, null
br i1 %49, label %53, label %50
50: ; preds = %47
store i8 0, i8* %48
%51 = getelementptr inbounds i8, i8* %48, i64 1
store i8 0, i8* %51
%52 = getelementptr inbounds i8, i8* %48, i64 2
store i8 0, i8* %52
br label %53
53: ; preds = %18, %34, %50, %47, %36, %28, %31
ret void
}