#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 lgamma(double volatile);
float lgammaf(float volatile);
long double lgammal(long double volatile);
int /*<<< orphan*/ puts(char *);
int signgam;
int main(void) {
  int result = 0;
  do {
    volatile float a, b, c __attribute__((unused));
    a = 0.5;
    b = -0.5;
    signgam = 123;
    c = lgammaf(a);
    if (signgam == 123)
      puts("PASS: "
           "lgammaf"
           " (0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgammaf"
           " (0.5) setting signgam");
      result = 1;
    }
    signgam = 123;
    c = lgammaf(b);
    if (signgam == 123)
      puts("PASS: "
           "lgammaf"
           " (-0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgammaf"
           " (-0.5) setting signgam");
      result = 1;
    }
  } while (0);
  do {
    volatile double a, b, c __attribute__((unused));
    a = 0.5;
    b = -0.5;
    signgam = 123;
    c = lgamma(a);
    if (signgam == 123)
      puts("PASS: "
           "lgamma"
           " (0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgamma"
           " (0.5) setting signgam");
      result = 1;
    }
    signgam = 123;
    c = lgamma(b);
    if (signgam == 123)
      puts("PASS: "
           "lgamma"
           " (-0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgamma"
           " (-0.5) setting signgam");
      result = 1;
    }
  } while (0);
  do {
    volatile long double a, b, c __attribute__((unused));
    a = 0.5;
    b = -0.5;
    signgam = 123;
    c = lgammal(a);
    if (signgam == 123)
      puts("PASS: "
           "lgammal"
           " (0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgammal"
           " (0.5) setting signgam");
      result = 1;
    }
    signgam = 123;
    c = lgammal(b);
    if (signgam == 123)
      puts("PASS: "
           "lgammal"
           " (-0.5) setting signgam");
    else {
      puts("FAIL: "
           "lgammal"
           " (-0.5) setting signgam");
      result = 1;
    }
  } while (0);
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movss  0xea6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe95(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    0x2e71(%rip),%rax
movl   $0x7b,(%rax)
movss  -0xc(%rbp),%xmm0
call   1060 <lgammaf@plt>
movss  %xmm0,-0x14(%rbp)
mov    0x2e55(%rip),%rax
cmpl   $0x7b,(%rax)
jne    11ad <main+0x6d>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
jmp    11c0 <main+0x80>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    0x2e21(%rip),%rax
movl   $0x7b,(%rax)
movss  -0x10(%rbp),%xmm0
call   1060 <lgammaf@plt>
movss  %xmm0,-0x14(%rbp)
mov    0x2e05(%rip),%rax
cmpl   $0x7b,(%rax)
jne    11fd <main+0xbd>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
jmp    1210 <main+0xd0>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    1215 <main+0xd5>
jmp    121a <main+0xda>
movsd  0xdee(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdd9(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2dad(%rip),%rax
movl   $0x7b,(%rax)
movsd  -0x20(%rbp),%xmm0
call   1050 <lgamma@plt>
movsd  %xmm0,-0x30(%rbp)
mov    0x2d91(%rip),%rax
cmpl   $0x7b,(%rax)
jne    1271 <main+0x131>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
jmp    1284 <main+0x144>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    0x2d5d(%rip),%rax
movl   $0x7b,(%rax)
movsd  -0x28(%rbp),%xmm0
call   1050 <lgamma@plt>
movsd  %xmm0,-0x30(%rbp)
mov    0x2d41(%rip),%rax
cmpl   $0x7b,(%rax)
jne    12c1 <main+0x181>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
jmp    12d4 <main+0x194>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    12d9 <main+0x199>
jmp    12de <main+0x19e>
flds   0xd20(%rip)
fstpt  -0x40(%rbp)
flds   0xd13(%rip)
fstpt  -0x50(%rbp)
mov    0x2cf1(%rip),%rax
movl   $0x7b,(%rax)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgammal@plt>
fstpt  -0x60(%rbp)
mov    0x2cd4(%rip),%rax
cmpl   $0x7b,(%rax)
jne    132e <main+0x1ee>
lea    0xe14(%rip),%rdi
call   1030 <puts@plt>
jmp    1341 <main+0x201>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    0x2ca0(%rip),%rax
movl   $0x7b,(%rax)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <lgammal@plt>
fstpt  -0x60(%rbp)
mov    0x2c83(%rip),%rax
cmpl   $0x7b,(%rax)
jne    137f <main+0x23f>
lea    0xe0b(%rip),%rdi
call   1030 <puts@plt>
jmp    1392 <main+0x252>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    1397 <main+0x257>
mov    -0x8(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x3f000000,0x30(%rsp)
3f
movl   $0xbf000000,0x20(%rsp)
bf
mov    0x2e83(%rip),%rbp
movl   $0x7b,0x0(%rbp)
movss  0x30(%rsp),%xmm0
call   1060 <lgammaf@plt>
movss  %xmm0,0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
sete   %r14b
lea    0xe7c(%rip),%rax
lea    0xe99(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
movl   $0x7b,0x0(%rbp)
movss  0x20(%rsp),%xmm0
call   1060 <lgammaf@plt>
movss  %xmm0,0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
sete   %r12b
lea    0xe8d(%rip),%rax
lea    0xeab(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
movabs $0x3fe0000000000000,%rax
mov    %rax,0x30(%rsp)
movabs $0xbfe0000000000000,%rax
mov    %rax,0x20(%rsp)
movl   $0x7b,0x0(%rbp)
movsd  0x30(%rsp),%xmm0
call   1050 <lgamma@plt>
movsd  %xmm0,0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
sete   %r15b
lea    0xe82(%rip),%rax
lea    0xe9e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
movl   $0x7b,0x0(%rbp)
movsd  0x20(%rsp),%xmm0
call   1050 <lgamma@plt>
movsd  %xmm0,0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
sete   %bl
lea    0xe92(%rip),%rax
lea    0xeaf(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
flds   0xd9c(%rip)
fstpt  0x30(%rsp)
flds   0xd96(%rip)
fstpt  0x20(%rsp)
movl   $0x7b,0x0(%rbp)
fldt   0x30(%rsp)
fstpt  (%rsp)
call   1040 <lgammal@plt>
fstpt  0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
sete   %r13b
lea    0xe90(%rip),%rax
lea    0xead(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
movl   $0x7b,0x0(%rbp)
fldt   0x20(%rsp)
fstpt  (%rsp)
call   1040 <lgammal@plt>
fstpt  0x10(%rsp)
cmpl   $0x7b,0x0(%rbp)
lea    0xea6(%rip),%rax
lea    0xec4(%rip),%rdi
cmove  %rax,%rdi
sete   %al
and    %r13b,%al
and    %r15b,%bl
and    %al,%bl
and    %r14b,%r12b
and    %bl,%r12b
xor    $0x1,%r12b
movzbl %r12b,%ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@signgam = global i32 0
@.str = [36 x i8] c"PASS: lgammaf (0.5) setting signgam\00"
@.str.1 = [36 x i8] c"FAIL: lgammaf (0.5) setting signgam\00"
@.str.2 = [37 x i8] c"PASS: lgammaf (-0.5) setting signgam\00"
@.str.3 = [37 x i8] c"FAIL: lgammaf (-0.5) setting signgam\00"
@.str.4 = [35 x i8] c"PASS: lgamma (0.5) setting signgam\00"
@.str.5 = [35 x i8] c"FAIL: lgamma (0.5) setting signgam\00"
@.str.6 = [36 x i8] c"PASS: lgamma (-0.5) setting signgam\00"
@.str.7 = [36 x i8] c"FAIL: lgamma (-0.5) setting signgam\00"
@.str.8 = [36 x i8] c"PASS: lgammal (0.5) setting signgam\00"
@.str.9 = [36 x i8] c"FAIL: lgammal (0.5) setting signgam\00"
@.str.10 = [37 x i8] c"PASS: lgammal (-0.5) setting signgam\00"
@.str.11 = [37 x i8] c"FAIL: lgammal (-0.5) setting signgam\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca x86_fp80
%10 = alloca x86_fp80
%11 = alloca x86_fp80
store i32 0, i32* %1
store i32 0, i32* %2
br label %12
12: ; preds = %0
store volatile float 5.000000e-01, float* %3
store volatile float -5.000000e-01, float* %4
store i32 123, i32* @signgam
%13 = load volatile float, float* %3
%14 = call float @lgammaf(float %13)
store volatile float %14, float* %5
%15 = load i32, i32* @signgam
%16 = icmp eq i32 %15, 123
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %21
19: ; preds = %12
%20 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %21
21: ; preds = %19, %17
store i32 123, i32* @signgam
%22 = load volatile float, float* %4
%23 = call float @lgammaf(float %22)
store volatile float %23, float* %5
%24 = load i32, i32* @signgam
%25 = icmp eq i32 %24, 123
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %30
28: ; preds = %21
%29 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30
br label %32
32: ; preds = %31
store volatile double 5.000000e-01, double* %6
store volatile double -5.000000e-01, double* %7
store i32 123, i32* @signgam
%33 = load volatile double, double* %6
%34 = call double @lgamma(double %33)
store volatile double %34, double* %8
%35 = load i32, i32* @signgam
%36 = icmp eq i32 %35, 123
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %41
39: ; preds = %32
%40 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %2
br label %41
41: ; preds = %39, %37
store i32 123, i32* @signgam
%42 = load volatile double, double* %7
%43 = call double @lgamma(double %42)
store volatile double %43, double* %8
%44 = load i32, i32* @signgam
%45 = icmp eq i32 %44, 123
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %50
48: ; preds = %41
%49 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %2
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51
store volatile x86_fp80 0xK3FFE8000000000000000, x86_fp80* %9
store volatile x86_fp80 0xKBFFE8000000000000000, x86_fp80* %10
store i32 123, i32* @signgam
%53 = load volatile x86_fp80, x86_fp80* %9
%54 = call x86_fp80 @lgammal(x86_fp80 %53)
store volatile x86_fp80 %54, x86_fp80* %11
%55 = load i32, i32* @signgam
%56 = icmp eq i32 %55, 123
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
br label %61
59: ; preds = %52
%60 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %2
br label %61
61: ; preds = %59, %57
store i32 123, i32* @signgam
%62 = load volatile x86_fp80, x86_fp80* %10
%63 = call x86_fp80 @lgammal(x86_fp80 %62)
store volatile x86_fp80 %63, x86_fp80* %11
%64 = load i32, i32* @signgam
%65 = icmp eq i32 %64, 123
br i1 %65, label %66, label %68
66: ; preds = %61
%67 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
br label %70
68: ; preds = %61
%69 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %2
br label %70
70: ; preds = %68, %66
br label %71
71: ; preds = %70
%72 = load i32, i32* %2
ret i32 %72
}

LLVM IR (-O2):
@signgam = global i32 0
@.str = [36 x i8] c"PASS: lgammaf (0.5) setting signgam\00"
@.str.1 = [36 x i8] c"FAIL: lgammaf (0.5) setting signgam\00"
@.str.2 = [37 x i8] c"PASS: lgammaf (-0.5) setting signgam\00"
@.str.3 = [37 x i8] c"FAIL: lgammaf (-0.5) setting signgam\00"
@.str.4 = [35 x i8] c"PASS: lgamma (0.5) setting signgam\00"
@.str.5 = [35 x i8] c"FAIL: lgamma (0.5) setting signgam\00"
@.str.6 = [36 x i8] c"PASS: lgamma (-0.5) setting signgam\00"
@.str.7 = [36 x i8] c"FAIL: lgamma (-0.5) setting signgam\00"
@.str.8 = [36 x i8] c"PASS: lgammal (0.5) setting signgam\00"
@.str.9 = [36 x i8] c"FAIL: lgammal (0.5) setting signgam\00"
@.str.10 = [37 x i8] c"PASS: lgammal (-0.5) setting signgam\00"
@.str.11 = [37 x i8] c"FAIL: lgammal (-0.5) setting signgam\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca x86_fp80
%10 = bitcast float* %1 to i8*
%11 = bitcast float* %2 to i8*
%12 = bitcast float* %3 to i8*
store volatile float 5.000000e-01, float* %1
store volatile float -5.000000e-01, float* %2
store i32 123, i32* @signgam
%13 = load volatile float, float* %1
%14 = tail call float @lgammaf(float %13)
store volatile float %14, float* %3
%15 = load i32, i32* @signgam
%16 = icmp eq i32 %15, 123
%17 = select i1 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0)
%18 = tail call i32 @puts(i8* dereferenceable(1) %17)
store i32 123, i32* @signgam
%19 = load volatile float, float* %2
%20 = tail call float @lgammaf(float %19)
store volatile float %20, float* %3
%21 = load i32, i32* @signgam
%22 = icmp eq i32 %21, 123
%23 = select i1 %22, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0)
%24 = tail call i32 @puts(i8* dereferenceable(1) %23)
%25 = bitcast double* %4 to i8*
%26 = bitcast double* %5 to i8*
%27 = bitcast double* %6 to i8*
store volatile double 5.000000e-01, double* %4
store volatile double -5.000000e-01, double* %5
store i32 123, i32* @signgam
%28 = load volatile double, double* %4
%29 = tail call double @lgamma(double %28)
store volatile double %29, double* %6
%30 = load i32, i32* @signgam
%31 = icmp eq i32 %30, 123
%32 = select i1 %31, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0)
%33 = tail call i32 @puts(i8* dereferenceable(1) %32)
store i32 123, i32* @signgam
%34 = load volatile double, double* %5
%35 = tail call double @lgamma(double %34)
store volatile double %35, double* %6
%36 = load i32, i32* @signgam
%37 = icmp eq i32 %36, 123
%38 = select i1 %37, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0)
%39 = tail call i32 @puts(i8* dereferenceable(1) %38)
%40 = bitcast x86_fp80* %7 to i8*
%41 = bitcast x86_fp80* %8 to i8*
%42 = bitcast x86_fp80* %9 to i8*
store volatile x86_fp80 0xK3FFE8000000000000000, x86_fp80* %7
store volatile x86_fp80 0xKBFFE8000000000000000, x86_fp80* %8
store i32 123, i32* @signgam
%43 = load volatile x86_fp80, x86_fp80* %7
%44 = tail call x86_fp80 @lgammal(x86_fp80 %43)
store volatile x86_fp80 %44, x86_fp80* %9
%45 = load i32, i32* @signgam
%46 = icmp eq i32 %45, 123
%47 = select i1 %46, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0)
%48 = tail call i32 @puts(i8* dereferenceable(1) %47)
store i32 123, i32* @signgam
%49 = load volatile x86_fp80, x86_fp80* %8
%50 = tail call x86_fp80 @lgammal(x86_fp80 %49)
store volatile x86_fp80 %50, x86_fp80* %9
%51 = load i32, i32* @signgam
%52 = icmp eq i32 %51, 123
%53 = select i1 %52, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0)
%54 = select i1 %52, i1 %46, i1 false
%55 = select i1 %54, i1 %37, i1 false
%56 = select i1 %55, i1 %31, i1 false
%57 = select i1 %56, i1 %22, i1 false
%58 = select i1 %57, i1 %16, i1 false
%59 = xor i1 %58, true
%60 = zext i1 %59 to i32
%61 = tail call i32 @puts(i8* dereferenceable(1) %53)
ret i32 %60
}