#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*/ check_seccomp_filter();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ install_syscall_filter();
int /*<<< orphan*/ printf(char *);
int main(void) {
  if (!check_seccomp_filter()) {
    printf("exiting, seccomp filter not available\n");
    exit(-1);
  }
  if (!install_syscall_filter()) {
    printf("install_syscall_filter failed\n");
    exit(-1);
  }
  printf("seccomp filter installed\n");
  if (!install_syscall_filter()) {
    printf("install_syscall_filter failed\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <check_seccomp_filter@plt>
cmp    $0x0,%eax
jne    116a <main+0x2a>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    $0x0,%al
call   1060 <install_syscall_filter@plt>
cmp    $0x0,%eax
jne    1190 <main+0x50>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <install_syscall_filter@plt>
cmp    $0x0,%eax
jne    11c2 <main+0x82>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <check_seccomp_filter@plt>
test   %eax,%eax
je     117b <main+0x3b>
xor    %eax,%eax
call   1060 <install_syscall_filter@plt>
test   %eax,%eax
je     1172 <main+0x32>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <install_syscall_filter@plt>
test   %eax,%eax
je     1172 <main+0x32>
xor    %eax,%eax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
jmp    1182 <main+0x42>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"exiting, seccomp filter not available\0A\00"
@.str.1 = [31 x i8] c"install_syscall_filter failed\0A\00"
@.str.2 = [26 x i8] c"seccomp filter installed\0A\00"
define i32 @main() {
%1 = call i32 (...) @check_seccomp_filter()
%2 = icmp ne i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 -1)
unreachable
6: ; preds = %0
%7 = call i32 (...) @install_syscall_filter()
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %6
%13 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (...) @install_syscall_filter()
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@str = [38 x i8] c"exiting, seccomp filter not available\00"
@str.4 = [25 x i8] c"seccomp filter installed\00"
@str.5 = [30 x i8] c"install_syscall_filter failed\00"
define i32 @main() {
%1 = tail call i32 (...) @check_seccomp_filter()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 -1)
unreachable
6: ; preds = %0
%7 = tail call i32 (...) @install_syscall_filter()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%14 = tail call i32 (...) @install_syscall_filter()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %12
ret i32 0
}