#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*/ printf(char *);
int main() {
  unsigned int allOne = -1;
  int castToInt = allOne;
  long castToLong = allOne;
  long castToLong2 = castToInt;
  unsigned long castToULong = allOne;
  unsigned long castToULong2 = castToInt;
  if (castToInt != -1 || castToLong != 4294967295L || castToLong2 != -1 ||
      castToULong != 4294967295L || castToULong2 != 18446744073709551615ul) {
    printf("UNSAFE\n");
    goto ERROR;
  }
  printf("SAFE\n");
  return (0);
ERROR:
  return (-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x28(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1188 <main+0x78>
mov    $0xffffffff,%eax
cmp    %rax,-0x18(%rbp)
jne    1188 <main+0x78>
cmpq   $0xffffffffffffffff,-0x20(%rbp)
jne    1188 <main+0x78>
mov    $0xffffffff,%eax
cmp    %rax,-0x28(%rbp)
jne    1188 <main+0x78>
cmpq   $0xffffffffffffffff,-0x30(%rbp)
je     1199 <main+0x89>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    11b1 <main+0xa1>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <main+0xa8>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"UNSAFE\0A\00"
@.str.1 = [6 x i8] c"SAFE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
store i32 -1, i32* %2
%8 = load i32, i32* %2
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
store i64 %10, i64* %4
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
store i64 %12, i64* %5
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
store i64 %14, i64* %6
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
store i64 %16, i64* %7
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, -1
br i1 %18, label %31, label %19
19: ; preds = %0
%20 = load i64, i64* %4
%21 = icmp ne i64 %20, 4294967295
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = load i64, i64* %5
%24 = icmp ne i64 %23, -1
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load i64, i64* %6
%27 = icmp ne i64 %26, 4294967295
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i64, i64* %7
%30 = icmp ne i64 %29, -1
br i1 %30, label %31, label %33
31: ; preds = %28, %25, %22, %19, %0
%32 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %35
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %36
35: ; preds = %31
store i32 -1, i32* %1
br label %36
36: ; preds = %35, %33
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@str = [5 x i8] c"SAFE\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}