#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 */
scalar_t__ ENOSYS;
int /*<<< orphan*/ SYS_rt_sigsuspend;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int syscall(int /*<<< orphan*/, int, int);
int main(void) {
  int err = syscall(SYS_rt_sigsuspend, 1, 2);
  if (err == -1 && errno == ENOSYS)
    printf("ENOSYS\n");
  printf("xyzzy\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <syscall@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    118a <main+0x5a>
mov    0x2e65(%rip),%rax
mov    (%rax),%rax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
jne    118a <main+0x5a>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <syscall@plt>
cmp    $0xffffffff,%eax
jne    1170 <main+0x40>
mov    0x2e7b(%rip),%rax
mov    (%rax),%rax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
jne    1170 <main+0x40>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SYS_rt_sigsuspend = global i32 0
@errno = global i64 0
@ENOSYS = global i64 0
@.str = [8 x i8] c"ENOSYS\0A\00"
@.str.1 = [7 x i8] c"xyzzy\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @SYS_rt_sigsuspend
%4 = call i32 @syscall(i32 %3, i32 1, i32 2)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = load i64, i64* @errno
%9 = load i64, i64* @ENOSYS
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %7, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@SYS_rt_sigsuspend = global i32 0
@errno = global i64 0
@ENOSYS = global i64 0
@str = [6 x i8] c"xyzzy\00"
@str.2 = [7 x i8] c"ENOSYS\00"
define i32 @main() {
%1 = load i32, i32* @SYS_rt_sigsuspend
%2 = tail call i32 @syscall(i32 %1, i32 1, i32 2)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @ENOSYS
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %4, %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 0)
unreachable
}